@@ -362,6 +362,11 @@ async def build_circuitpython():
362362 genhdr = builddir / "genhdr"
363363 genhdr .mkdir (exist_ok = True , parents = True )
364364 version_header = genhdr / "mpversion.h"
365+ mpconfigboard_fn = board_tools .find_mpconfigboard (portdir , board )
366+ mpconfigboard = {"USB_VID" : 0x1209 , "USB_PID" : 0x000C , "USB_INTERFACE_NAME" : "CircuitPython" }
367+ if mpconfigboard_fn is not None and mpconfigboard_fn .exists ():
368+ with mpconfigboard_fn .open ("rb" ) as f :
369+ mpconfigboard .update (tomllib .load (f ))
365370 async with asyncio .TaskGroup () as tg :
366371 tg .create_task (
367372 cpbuild .run_command (
@@ -379,21 +384,16 @@ async def build_circuitpython():
379384 )
380385
381386 board_autogen_task = tg .create_task (
382- zephyr_dts_to_cp_board (zephyr_board , portdir , builddir , zephyrbuilddir )
387+ zephyr_dts_to_cp_board (zephyr_board , portdir , builddir , zephyrbuilddir , mpconfigboard )
383388 )
384389 board_info = board_autogen_task .result ()
385- mpconfigboard_fn = board_tools .find_mpconfigboard (portdir , board )
386- mpconfigboard = {"USB_VID" : 0x1209 , "USB_PID" : 0x000C , "USB_INTERFACE_NAME" : "CircuitPython" }
387390 if mpconfigboard_fn is None :
388391 mpconfigboard_fn = (
389392 portdir / "boards" / board_info ["vendor_id" ] / board / "circuitpython.toml"
390393 )
391394 logging .warning (
392395 f"Could not find board config at: boards/{ board_info ['vendor_id' ]} /{ board } "
393396 )
394- elif mpconfigboard_fn .exists ():
395- with mpconfigboard_fn .open ("rb" ) as f :
396- mpconfigboard .update (tomllib .load (f ))
397397
398398 autogen_board_info_fn = mpconfigboard_fn .parent / "autogen_board_info.toml"
399399
@@ -402,6 +402,9 @@ async def build_circuitpython():
402402 circuitpython_flags .append (f"-DCIRCUITPY_CREATOR_ID=0x{ creator_id :08x} " )
403403 circuitpython_flags .append (f"-DCIRCUITPY_CREATION_ID=0x{ creation_id :08x} " )
404404
405+ vendor = mpconfigboard .get ("VENDOR" , board_info ["vendor" ])
406+ name = mpconfigboard .get ("NAME" , board_info ["name" ])
407+
405408 enabled_modules , module_reasons = determine_enabled_modules (board_info , portdir , srcdir )
406409
407410 web_workflow_enabled = board_info .get ("wifi" , False ) or board_info .get ("hostnetwork" , False )
@@ -459,8 +462,8 @@ async def build_circuitpython():
459462 f"-DUSB_INTERFACE_NAME='\" { mpconfigboard ['USB_INTERFACE_NAME' ]} \" '"
460463 )
461464 for macro , limit , value in (
462- ("USB_PRODUCT" , 16 , board_info [ " name" ] ),
463- ("USB_MANUFACTURER" , 8 , board_info [ " vendor" ] ),
465+ ("USB_PRODUCT" , 16 , name ),
466+ ("USB_MANUFACTURER" , 8 , vendor ),
464467 ):
465468 circuitpython_flags .append (f"-D{ macro } ='\" { value } \" '" )
466469 circuitpython_flags .append (f"-D{ macro } _{ limit } ='\" { value [:limit ]} \" '" )
@@ -512,7 +515,7 @@ async def build_circuitpython():
512515 "This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info."
513516 )
514517 )
515- autogen_board_info .add ("name" , board_info [ " vendor" ] + " " + board_info [ " name" ] )
518+ autogen_board_info .add ("name" , vendor + " " + name )
516519 autogen_modules = tomlkit .table ()
517520 autogen_board_info .add ("modules" , autogen_modules )
518521 for module in sorted (
0 commit comments