Files
DCCONSTRUCTIONS f32c7b400b feat(vesc): extend motor diagnostics, configuration and transport recovery
Add firmware and extension catalogues, configuration transactions, sample review and QML diagnostics. Preserve explicit authority, bounded retries and stop recovery in motor transport.
2026-10-29 09:09:59 +03:00

21 lines
1.1 KiB
Python

"""Declared main-flash SWD jobs. Staging never connects or halts a target."""
TARGETS=[(1,'STM32F40x',2048),(2,'NRF51822 · 128K / 16K',128),
(3,'NRF51822 · 256K / 16K',256),(4,'NRF51822 · 256K / 32K',256),
(5,'NRF52832 · 256K / 32K',256),(6,'NRF52832 · 256K / 64K',256),
(7,'NRF52832 · 512K / 64K',512),(8,'NRF52840 · 1M / 256K',1024),
(9,'STM32F30x',2048),(10,'STM32L47x',2048),(11,'STM32G43',2048),
(12,'STM32G47',2048),(13,'STM32G49',2048)]
def validate(p):
if not isinstance(p,dict) or set(p)!={'target_code','pins','address','flash_bytes'}:
raise ValueError('Exact SWD target, pins and main flash range required')
code=p['target_code']
if type(code) is not int or not 1<=code<=13 or p['pins'] not in ('default','nrf5x'):
raise ValueError('Unsupported SWD target or pin mapping')
base=0 if 2<=code<=8 else 0x08000000
cap=TARGETS[code-1][2]*1024
if (type(p['address']) is not int or type(p['flash_bytes']) is not int or p['address']<base
or p['flash_bytes']<256 or p['address']+p['flash_bytes']>base+cap):
raise ValueError('SWD image must remain inside declared main flash')