seveibar/am3352-dev-board

A 324-ball TI AM3352 ARM processor with DDR3, LCD, USB, Ethernet, storage, serial, analog, clock, reset, power, and JTAG interfaces, paired with configurable JST-GH board connectors and constrained PCB routing.

Version
1.0.2
License
unset
Stars
0

scripts/materialize-checkpoint.py

"""Create a scratch geometry-only routing checkpoint, never a release build."""
import json,sys
from pathlib import Path
c=json.loads(Path('dist/index/circuit.json').read_text());data=json.loads(Path('design/routed-copper.json').read_text())
c=[x for x in c if x['type'] not in (['pcb_trace','pcb_via'] if '--keep-pours' in sys.argv else ['pcb_trace','pcb_via','pcb_copper_pour']) and not x['type'].endswith('_error')]
for key,rs in data['nets'].items():
 for i,r in enumerate(rs):c.append({'type':'pcb_trace','pcb_trace_id':f'fr_{key}_{i}','connection_name':key,'source_trace_id':data['sourceTraceIds'][key],'route':r})
if '--nominal-planes' in sys.argv:
 names={n['name']:n['source_net_id'] for n in c if n['type']=='source_net'}
 for i,(name,layer) in enumerate([('GND','inner1'),('GND','inner6'),('DDR_1V5','inner2'),('A3V3','inner2'),('VDD_CORE','inner3'),('VDD_MPU','inner4'),('V1V8','inner5'),('V3V3','bottom')]):
  pts=[(-34.6,-29.6),(34.6,-29.6),(34.6,29.6),(-34.6,29.6)]
  if name=='DDR_1V5':pts=[(-18.7,-29.6),(34.6,-29.6),(34.6,0),(-18.7,0)]
  if name=='A3V3':pts=[(-34.6,-29.6),(-19,-29.6),(-19,.3),(34.6,.3),(34.6,29.6),(-34.6,29.6)]
  c.append({'type':'pcb_copper_pour','pcb_copper_pour_id':f'pcb_copper_pour_nominal_{i}','shape':'polygon','layer':layer,'source_net_id':names[name],'points':[{'x':a,'y':b} for a,b in pts]})
Path('../../work/routing-geometry.json').write_text(json.dumps(c))