0hmX/am3352-ethernet-rgb-b28-987

TI AM3352 ARM Cortex-A8 processor BGA with integrated DDR, LCD, USB, Ethernet, GPMC, MMC, serial, audio, and ADC interfaces.

Version
0.0.3
License
unset
Stars
0

scripts/preserve-frozen-dist.mjs

import { readFileSync, writeFileSync } from 'node:fs';
import { createHash } from 'node:crypto';
import { isDeepStrictEqual } from 'node:util';

const frozen = readFileSync('routed/circuit.json');
const expected = 'b28dfd129ee7c55fa90828619aad918acff85bd7007e618f20461c5ae2f776b1';
if (createHash('sha256').update(frozen).digest('hex') !== expected) {
  throw new Error('Frozen board hash mismatch');
}
const built = JSON.parse(readFileSync('dist/routed/circuit.json', 'utf8'));
if (!isDeepStrictEqual(built, JSON.parse(frozen.toString('utf8')))) {
  throw new Error('Built board records differ from the frozen board');
}
writeFileSync('dist/routed/circuit.json', frozen);
console.log(`Preserved all ${built.length} frozen records and exact ${expected} bytes in dist/routed/circuit.json`);