ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

AP_HAL: hwdef: scripts: enforce use of board_types.txt - nix numeric IDs

Open peterbarker opened this issue 5 months ago • 2 comments

    f.write('#define APJ_BOARD_ID %s\n' % self.get_numeric_board_id())
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbarker/rc/ardupilot/libraries/AP_HAL_ChibiOS/hwdef/scripts/../../../../libraries/AP_HAL/hwdef/scripts/hwdef.py", line 82, in get_numeric_board_id
    raise ValueError("Numeric board ID found.  Your APJ_BOARD_ID must not use a number.  Change the number to be the name of the board used in Tools/AP_Bootloader/board_types.txt")  # noqa:E501
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Numeric board ID found.  Your APJ_BOARD_ID must not use a number.  Change the number to be the name of the board used in Tools/AP_Bootloader/board_types.txt
Failed to process hwdef.dat ret=1
(complete log in /home/pbarker/rc/ardupilot/build/config.log)
pbarker@crun:~/rc/ardupilot(pr/no-numeric-board-ids)$ 

peterbarker avatar Jun 14 '25 00:06 peterbarker

This is a no-compiler-output change PR.

Except for CubeRedSecondary-IO, in which scripting has been removed.

peterbarker avatar Jun 14 '25 10:06 peterbarker

I like this

andyp1per avatar Jun 17 '25 09:06 andyp1per

Output from size_compare_branches.py is as expected:

pbarker@threads:~$ ~/rc/ardupilot/Tools/scripts/filter_size_compare_branches_csv.py --hide-binary-identical /tmp/some.csv  
----------------------------  -----  ----------  ------  ----  -----  -----  ---
Board                         blimp  bootloader  copter  heli  plane  rover  sub
ARK_FPV                       8      *           8       8     8      8      8
ATOMRCF405NAVI-Deluxe         16     *           8       8     8      8      8
AnyleafH7                     8      *           16      16    16     8      8
BROTHERHOBBYF405v3            16     *           16      16    16     16     16
CubeOrange                    8      *           8       8     8      8      8
CubeOrange-ODID               8      *           0       0     8      0      8
CubeOrange-SimOnHardWare                         8
CubeOrange-bdshot             8      *           8       8     8      8      8
CubeOrange-joey               0      *           0       0     0      0      0
CubeOrangePlus                -8     *           -8      -8    0      -8     0
CubeOrangePlus-ODID           -8     *           0       -8    -8     0      -8
CubeOrangePlus-SimOnHardWare                     0
CubeOrangePlus-bdshot         0      *           0       0     0      0      0
Pixhawk6C                     24     *           16      24    24     24     16
Pixhawk6C-bdshot              16     *           16      16    16     16     16
----------------------------  -----  ----------  ------  ----  -----  -----  ---
pbarker@threads:~$ 

... noting that we don't put the board ID anywhere in the IOMCU firmwares, they were unchanged. Other changes here are just the hwdef.dat changes.

peterbarker avatar Jun 20 '25 01:06 peterbarker

I have verified that CI will fail PRs that don't use numeric IDs by killing the changes to the BrotherHobbies boards: image

peterbarker avatar Jun 20 '25 02:06 peterbarker

Made the changes requested at DevCall - did away with the mapping from weird string to board ID for Pixhawk6C, and just modified the board type. I created a PR in the PX4-Bootloader repository to make the same change.

peterbarker avatar Jun 24 '25 05:06 peterbarker

I've again confirmed there's no change to the build products for the IOMCUs.

peterbarker avatar Jun 24 '25 06:06 peterbarker

configure-all still passes everything when I rebase this on master. Merging as agreed at DevCall.

peterbarker avatar Jun 24 '25 06:06 peterbarker