Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bootloader flashing code if we're not embedding the bootloader #23536

Merged

Conversation

peterbarker
Copy link
Contributor

@peterbarker peterbarker commented Apr 18, 2023

We explicitly exempt the bootloader on some boards.

Board                         AP_Periph  blimp  bootloader  copter  heli   iofirmware  plane  rover  sub
ARKV6X                                   -1984  *           -1976   -1984              -1984  -1976  -1984
CarbonixF405                  -568                                                                   
CarbonixL496                  -568                                                                   
CubeBlack-periph              -32816                                                                 
CubeOrange-SimOnHardWare                                    -1984                                    
CubeOrangePlus-SimOnHardWare                                -2880                                    
CubePilot-CANMod              -568                                                                   
G4-ESC                        -568                                                                   
HerePro                       -592                                                                   
MatekH743-periph              -18320                                                                 
MatekL431-HWTelem             -568                                                                   
MatekL431-Proximity           -568                                                                   
MatekL431-bdshot              -568                                                                   
MazzyStarDrone                           -792   *           -792    -792               -792   -792   -792
Nucleo-L476                   -568                                                                   
Nucleo-L496                   -568                                                                   
PH4-mini-bdshot                          -2000  *           -2000   -2000              -2000  -2000  -2000
PixFlamingo                              -624   *           -624    -624               -624   -624   -624
PixSurveyA1                              -568   *           -568    -568               -560   -560   -560
Pixhawk1-1M-bdshot                       -560               -560    -568               -560   -560   -568
Sierra-F405                   -568                                                                   
Sierra-F412                   -568                                                                   
Sierra-F9P                    -568                                                                   
f303-PWM                      -568                                                                   
f303-TempSensor               -568                                                                   
fmuv2                                    -568               -560    -568               -568   -568   -568
fmuv3-bdshot                             -568               -560    -568               -568   -568   -568
luminousbee4                             -624               -624    -624               -624   -624   -624
mRoControlZeroClassic                    -2000  *           -2000   -2000              -2000  -2000  -2000
mRoControlZeroH7                         -2000  *           -2000   -2000              -2000  -2000  -2000
omnibusf4pro-one                         -584   *           -584    -584               -584   -584   -584
revo-mini-bdshot                         -584   *           -584    -584               -584   -584   -584
revo-mini-i2c                            -584   *           -584    -584               -584   -584   -584
revo-mini-i2c-bdshot                     -584   *           -584    -584               -584   -584   -584
skyviper-f412-rev1                                          -584                                     
skyviper-journey                                            -584                                     
skyviper-v2450                                              -584                                     

All unchanged outputs have been pruned

HerePro is a heavy periph, thus its size change.

@peterbarker
Copy link
Contributor Author

Tested on Pixhawk1-1M-bdshot - bootloader flashing fails with appropriate CMD_ACK

@@ -205,4 +205,8 @@ define AP_LTM_TELEM_ENABLED 0
// no buttons on SkyViper:
define HAL_BUTTON_ENABLED 0

// we don't embed the bootloader and there's no other way to flash the
// bootloader, so:
define AP_BOOTLOADER_FLASHING_ENABLED 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

@@ -125,6 +125,7 @@ define HAL_NO_FLASH_SUPPORT TRUE
define HAL_NO_UARTDRIVER TRUE
define DISABLE_SERIAL_ESC_COMM TRUE
define HAL_LOGGING_ENABLED 0
BOOTLOADER_EMBED 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, actually, the bootloader does exist in the tree, so it would try to embed it but then fail elsewhere because stm32 flash was disabled...

@@ -122,6 +122,7 @@ define __FPU_PRESENT 0

define HAL_USE_RTC FALSE
define HAL_NO_FLASH_SUPPORT TRUE
BOOTLOADER_EMBED 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be needed

@tridge tridge removed the DevCallEU label Apr 19, 2023
@peterbarker peterbarker force-pushed the wip/bootloader-flashing-enabled branch from 4fc28d2 to 40c91bd Compare April 19, 2023 11:21
@peterbarker peterbarker force-pushed the wip/bootloader-flashing-enabled branch 8 times, most recently from 0cf97b1 to 2df6cb0 Compare April 21, 2023 00:25
@peterbarker
Copy link
Contributor Author

peterbarker commented Apr 21, 2023

CubeBlack-periph loses 32kB because we embed the IOMCU firmware then remove the entire ROMFS library (as there are no references as no AP_IOMCU and no bootloader flashing). The bootloader doesn't get embedded as it isn't in-tree.

.... we embed the io firmware because we inherit ROMFS_FILES from fmuv3 which includes it

@peterbarker
Copy link
Contributor Author

The ~600 bytes ones are missing flash-bootloader and get-persistent-params (we don't need to get persistent-params unless we are saving persistent params to storage which we only do when flashing the bootloader, it returns a string...);

@peterbarker
Copy link
Contributor Author

peterbarker commented Apr 22, 2023

The 2kB savings come from when tcal methods can also be elided because they're no longer being called at all:
image

(e.g. PH4-mini-bdshot)

(PH4-mini-bdshot is missing its bootloader in Tools/bootloaders, so is now not compiling in the bootloader flashing code)

@peterbarker
Copy link
Contributor Author

MatekH743-periph is such a large diff because it is also losing the OSD files which would otherwise be embedded in the firmware:
image

MatekH743 inherits its romfs list from the main MatekH743 firnware.

libraries/AP_PiccoloCAN/AP_PiccoloCAN.cpp Outdated Show resolved Hide resolved
@peterbarker peterbarker force-pushed the wip/bootloader-flashing-enabled branch from 19eff00 to 22558d7 Compare April 26, 2023 05:15
@peterbarker peterbarker merged commit 926c7d6 into ArduPilot:master Apr 26, 2023
@peterbarker peterbarker deleted the wip/bootloader-flashing-enabled branch April 26, 2023 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants