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

Enforce bootloader present or specified as not present in ChibiOS builds #24573

Merged
merged 2 commits into from Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/ARKV6X/hwdef.dat
Expand Up @@ -321,3 +321,6 @@ ROMFS io_firmware.bin Tools/IO_Firmware/iofirmware_lowpolh.bin
# note that if firmware is build with --secure-bl then DFU is
# disabled
ENABLE_DFU_BOOT 1

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/CubeBlack-periph/hwdef.dat
Expand Up @@ -60,3 +60,6 @@ MAIN_STACK 0x2000
PROCESS_STACK 0x6000

define HAL_CAN_DRIVER_DEFAULT 1

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
Expand Up @@ -6,4 +6,7 @@ include ../include/SimOnHW.inc
# short board name override (23 chars)
define CHIBIOS_SHORT_BOARD_NAME "CubeOrangeSimOnHardWare"

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0

AUTOBUILD_TARGETS Copter
Expand Up @@ -6,4 +6,7 @@ include ../include/SimOnHW.inc
# short board name override (23 chars)
define CHIBIOS_SHORT_BOARD_NAME "CubeOrange+SimOnHW"

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0

AUTOBUILD_TARGETS Copter
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/H757I_EVAL/hwdef.dat
Expand Up @@ -84,3 +84,6 @@ PB2 QUADSPI_CLK QUADSPI1
define CAN_APP_NODE_NAME "org.cubepilot.H757"

EXT_FLASH_SIZE_MB 32

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/H757I_EVAL_intf/hwdef.dat
Expand Up @@ -84,3 +84,6 @@ PB2 QUADSPI_CLK QUADSPI1
define CAN_APP_NODE_NAME "org.cubepilot.H757"

# EXT_FLASH_SIZE_MB 32

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/HerePro/hwdef.dat
Expand Up @@ -216,3 +216,6 @@ define AP_RC_CHANNEL_ENABLED 1

define AP_RELAY_ENABLED 1
define AP_SERVORELAYEVENTS_ENABLED 1

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/MatekH743-periph/hwdef.dat
Expand Up @@ -62,3 +62,6 @@ define HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT 0

# setup for MSP
define HAL_MSP_ENABLED 1

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
2 changes: 2 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/MatekL431-HWTelem/hwdef.dat
Expand Up @@ -9,3 +9,5 @@ define HAL_DISABLE_ADC_DRIVER TRUE
define HAL_PERIPH_ENABLE_HWESC
define HAL_PERIPH_HWESC_SERIAL_PORT 2

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
2 changes: 2 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/Nucleo-L476/hwdef.dat
Expand Up @@ -109,3 +109,5 @@ define HAL_I2C_INTERNAL_MASK 0
define HAL_PERIPH_ENABLE_BARO
define HAL_PERIPH_ENABLE_AIRSPEED

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/Nucleo-L496/hwdef.dat
Expand Up @@ -115,3 +115,6 @@ BARO MS56XX SPI:ms5611
BARO BMP388 I2C:0:0x76

# define HAL_SPI_CHECK_CLOCK_FREQ

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/NucleoH755/hwdef.dat
Expand Up @@ -142,3 +142,6 @@ IMU Invensensev2 SPI:icm20948 ROTATION_YAW_270

# compass as part of ICM20948 on newer cubes
COMPASS AK09916:probe_ICM20948 0 ROTATION_ROLL_180_YAW_90

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/Pixhawk1-1M-bdshot/hwdef.dat
Expand Up @@ -38,3 +38,6 @@ define HAL_PROBE_EXTERNAL_I2C_COMPASSES
FLASH_SIZE_KB 1024
include ../include/minimize_features.inc
undef STORAGE_FLASH_PAGE

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/RADIX2HD/hwdef.dat
Expand Up @@ -173,3 +173,6 @@ DMA_PRIORITY SPI1*
DMA_NOSHARE SPI1* TIM1* TIM2* TIM3* TIM4*
NODMA I2C*
define STM32_I2C_USE_DMA FALSE

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
2 changes: 2 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/Sierra-F405/hwdef.dat
Expand Up @@ -131,3 +131,5 @@ define HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT 0

define DEFAULT_NTF_LED_TYPES 455

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
2 changes: 2 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef.dat
Expand Up @@ -134,3 +134,5 @@ PC7 M9SB INPUT

define DEFAULT_NTF_LED_TYPES 455

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/Sierra-F9P/hwdef.dat
Expand Up @@ -152,3 +152,6 @@ define HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT 0
#Sensors Enable & ESP Enable
PB0 VDD_3V3_SENSORS_EN OUTPUT HIGH
PC2 ESP_PWR_EN OUTPUT LOW

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/fmuv2/hwdef.dat
Expand Up @@ -19,3 +19,6 @@ include ../include/minimal.inc

# produce this error if we are on a 2M board and using 1M firmware
define BOARD_CHECK_F427_USE_2M "2M flash - use fmuv3 firmware"

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/kha_eth/hwdef.dat
Expand Up @@ -154,4 +154,7 @@ define HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT 0

DMA_NOSHARE USART1* USART2* CAN1*

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0

AUTOBUILD_TARGETS None
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/luminousbee4/hwdef.dat
Expand Up @@ -189,3 +189,6 @@ BARO MS56XX SPI:ms5611_int
define DMA_RESERVE_SIZE 32768

# .env DEFAULT_PARAMETERS 'Tools/Frame_params/LuminousBee4_outdoor.param'

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
2 changes: 2 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/omnibusf4pro-one/hwdef.dat
Expand Up @@ -5,3 +5,5 @@ define HAL_COMPASS_MAX_SENSORS 1
define GPS_MAX_RECEIVERS 1
define GPS_MAX_INSTANCES 1

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/revo-mini-bdshot/hwdef.dat
Expand Up @@ -8,3 +8,6 @@ PB0 TIM3_CH3 TIM3 PWM(1) GPIO(50)
PB1 TIM3_CH4 TIM3 PWM(2) GPIO(51) BIDIR
PA3 TIM2_CH4 TIM2 PWM(3) GPIO(52) BIDIR
PA2 TIM2_CH3 TIM2 PWM(4) GPIO(53)

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/revo-mini-i2c-bdshot/hwdef.dat
Expand Up @@ -9,5 +9,8 @@ PB1 TIM3_CH4 TIM3 PWM(2) GPIO(51) BIDIR
PA3 TIM2_CH4 TIM2 PWM(3) GPIO(52) BIDIR
PA2 TIM2_CH3 TIM2 PWM(4) GPIO(53)

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0

# save some flash
include ../include/save_some_flash.inc
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/revo-mini-i2c/hwdef.dat
Expand Up @@ -150,3 +150,6 @@ SPIDEV dataflash SPI3 DEVID1 FLASH_CS MODE3 32*MHZ 32*MHZ
define HAL_LOGGING_DATAFLASH_ENABLED 1

define HAL_GYROFFT_ENABLED 0

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0
32 changes: 25 additions & 7 deletions libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py
Expand Up @@ -2386,9 +2386,16 @@ def embed_bootloader(self, f):
# or, you know, not...
return

if self.is_bootloader_fw():
return

if self.is_io_fw():
return

bp = self.bootloader_path()
if not os.path.exists(bp):
return
self.error("Bootloader (%s) does not exist and AP_BOOTLOADER_FLASHING_ENABLED" %
(bp,))

bp = os.path.realpath(bp)

Expand Down Expand Up @@ -3014,9 +3021,12 @@ def add_apperiph_defaults(self, f):

self.add_firmware_defaults_from_file(f, "defaults_periph.h", "AP_Periph")

def is_bootloader_fw(self):
return args.bootloader

def add_bootloader_defaults(self, f):
'''add default defines for peripherals'''
if not args.bootloader:
if not self.is_bootloader_fw():
return

self.add_firmware_defaults_from_file(f, "defaults_bootloader.h", "bootloader")
Expand All @@ -3036,9 +3046,12 @@ def add_firmware_defaults_from_file(self, f, filename, description):
// end %s defaults
''' % (description, content, description))

def is_io_fw(self):
return self.env_vars.get('IOMCU_FW', 0) != 0

def add_iomcu_firmware_defaults(self, f):
'''add default defines IO firmwares'''
if self.env_vars.get('IOMCU_FW', 0) == 0:
if not self.is_io_fw():
# not IOMCU firmware
return

Expand All @@ -3047,16 +3060,21 @@ def add_iomcu_firmware_defaults(self, f):
def is_periph_fw(self):
return self.env_vars.get('AP_PERIPH', 0) != 0

def add_normal_firmware_defaults(self, f):
'''add default defines to builds with are not bootloader, periph or IOMCU'''
def is_normal_fw(self):
if self.env_vars.get('IOMCU_FW', 0) != 0:
# IOMCU firmware
return
return False
if self.is_periph_fw():
# Periph firmware
return
return False
if args.bootloader:
# guess
return False
return True

def add_normal_firmware_defaults(self, f):
'''add default defines to builds with are not bootloader, periph or IOMCU'''
if not self.is_normal_fw():
return

self.add_firmware_defaults_from_file(f, "defaults_normal.h", "normal")
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412-rev1/hwdef.dat
Expand Up @@ -129,4 +129,7 @@ define HAL_BARO_20789_I2C_ADDR_PRESS 0x63
define HAL_WITH_ESC_TELEM 0
define AP_FETTEC_ONEWIRE_ENABLED 0

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0

AUTOBUILD_TARGETS Copter
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/skyviper-journey/hwdef.dat
Expand Up @@ -132,4 +132,7 @@ define AP_PARAM_MAX_EMBEDDED_PARAM 8192
define HAL_WITH_ESC_TELEM 0
define AP_FETTEC_ONEWIRE_ENABLED 0

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0

AUTOBUILD_TARGETS Copter
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/skyviper-v2450/hwdef.dat
Expand Up @@ -214,4 +214,7 @@ define AP_MAVLINK_BATTERY2_ENABLED 0
# SkyViper doesn't use the Plane landing library:
define HAL_LANDING_DEEPSTALL_ENABLED 0

# bootloader embedding / bootloader flashing not available
define AP_BOOTLOADER_FLASHING_ENABLED 0

AUTOBUILD_TARGETS Copter