From 3b230c4ec0f22733fe6a91adc3b77ede0a3bdec8 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 24 Aug 2022 17:18:50 +1000 Subject: [PATCH] hwdef: enable flash-from-SD on Pixhawk6X --- .../hwdef/Pixhawk6X/hwdef-bl.dat | 29 +++++++++++++++++++ .../AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef.dat | 3 ++ 2 files changed, 32 insertions(+) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef-bl.dat index a5441cf790..8ca7a6488f 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef-bl.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef-bl.dat @@ -74,3 +74,32 @@ define HAL_STORAGE_SIZE 16384 # enable DFU by default ENABLE_DFU_BOOT 1 + +# support flashing from SD card: +# power enable pins +PC13 VDD_3V3_SD_CARD_EN OUTPUT HIGH + +# FATFS support: +define CH_CFG_USE_MEMCORE 1 +define CH_CFG_USE_HEAP 1 +define CH_CFG_USE_SEMAPHORES 0 +define CH_CFG_USE_MUTEXES 1 +define CH_CFG_USE_DYNAMIC 1 +define CH_CFG_USE_WAITEXIT 1 +define CH_CFG_USE_REGISTRY 1 + +# microSD support +PD6 SDMMC2_CK SDMMC2 +PD7 SDMMC2_CMD SDMMC2 +PB14 SDMMC2_D0 SDMMC2 +PB15 SDMMC2_D1 SDMMC2 +PG11 SDMMC2_D2 SDMMC2 +PB4 SDMMC2_D3 SDMMC2 +define FATFS_HAL_DEVICE SDCD2 + +DMA_PRIORITY SDMMC* USART6* ADC* UART* USART* SPI* TIM* + +# enable FAT filesystem support (needs a microSD defined via SDMMC) +define HAL_OS_FATFS_IO 1 + +define AP_BOOTLOADER_FLASH_FROM_SD_ENABLED 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef.dat index d0399f2075..5fbccffb4a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef.dat @@ -369,3 +369,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 + +# build ABIN for flash-from-bootloader support: +env BUILD_ABIN True