@@ -364,6 +364,11 @@ async def build_circuitpython():
364364 genhdr = builddir / "genhdr"
365365 genhdr .mkdir (exist_ok = True , parents = True )
366366 version_header = genhdr / "mpversion.h"
367+ mpconfigboard_fn = board_tools .find_mpconfigboard (portdir , board )
368+ mpconfigboard = {"USB_VID" : 0x1209 , "USB_PID" : 0x000C , "USB_INTERFACE_NAME" : "CircuitPython" }
369+ if mpconfigboard_fn is not None and mpconfigboard_fn .exists ():
370+ with mpconfigboard_fn .open ("rb" ) as f :
371+ mpconfigboard .update (tomllib .load (f ))
367372 async with asyncio .TaskGroup () as tg :
368373 tg .create_task (
369374 cpbuild .run_command (
@@ -381,21 +386,16 @@ async def build_circuitpython():
381386 )
382387
383388 board_autogen_task = tg .create_task (
384- zephyr_dts_to_cp_board (zephyr_board , portdir , builddir , zephyrbuilddir )
389+ zephyr_dts_to_cp_board (zephyr_board , portdir , builddir , zephyrbuilddir , mpconfigboard )
385390 )
386391 board_info = board_autogen_task .result ()
387- mpconfigboard_fn = board_tools .find_mpconfigboard (portdir , board )
388- mpconfigboard = {"USB_VID" : 0x1209 , "USB_PID" : 0x000C , "USB_INTERFACE_NAME" : "CircuitPython" }
389392 if mpconfigboard_fn is None :
390393 mpconfigboard_fn = (
391394 portdir / "boards" / board_info ["vendor_id" ] / board / "circuitpython.toml"
392395 )
393396 logging .warning (
394397 f"Could not find board config at: boards/{ board_info ['vendor_id' ]} /{ board } "
395398 )
396- elif mpconfigboard_fn .exists ():
397- with mpconfigboard_fn .open ("rb" ) as f :
398- mpconfigboard .update (tomllib .load (f ))
399399
400400 autogen_board_info_fn = mpconfigboard_fn .parent / "autogen_board_info.toml"
401401
@@ -404,6 +404,9 @@ async def build_circuitpython():
404404 circuitpython_flags .append (f"-DCIRCUITPY_CREATOR_ID=0x{ creator_id :08x} " )
405405 circuitpython_flags .append (f"-DCIRCUITPY_CREATION_ID=0x{ creation_id :08x} " )
406406
407+ vendor = mpconfigboard .get ("VENDOR" , board_info ["vendor" ])
408+ name = mpconfigboard .get ("NAME" , board_info ["name" ])
409+
407410 enabled_modules , module_reasons = determine_enabled_modules (board_info , portdir , srcdir )
408411 for m in mpconfigboard .get ("DISABLED_MODULES" , []):
409412 enabled_modules .discard (m )
@@ -463,8 +466,8 @@ async def build_circuitpython():
463466 f"-DUSB_INTERFACE_NAME='\" { mpconfigboard ['USB_INTERFACE_NAME' ]} \" '"
464467 )
465468 for macro , limit , value in (
466- ("USB_PRODUCT" , 16 , board_info [ " name" ] ),
467- ("USB_MANUFACTURER" , 8 , board_info [ " vendor" ] ),
469+ ("USB_PRODUCT" , 16 , name ),
470+ ("USB_MANUFACTURER" , 8 , vendor ),
468471 ):
469472 circuitpython_flags .append (f"-D{ macro } ='\" { value } \" '" )
470473 circuitpython_flags .append (f"-D{ macro } _{ limit } ='\" { value [:limit ]} \" '" )
@@ -516,7 +519,7 @@ async def build_circuitpython():
516519 "This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info."
517520 )
518521 )
519- autogen_board_info .add ("name" , board_info [ " vendor" ] + " " + board_info [ " name" ] )
522+ autogen_board_info .add ("name" , vendor + " " + name )
520523 autogen_modules = tomlkit .table ()
521524 autogen_board_info .add ("modules" , autogen_modules )
522525 for module in sorted (
0 commit comments