From 099398f1863cbbb782dcd13c003950c7edbbf0ca Mon Sep 17 00:00:00 2001 From: bugobliterator Date: Wed, 3 Jul 2024 16:46:04 +1000 Subject: [PATCH] AP_HAL_ChibiOS: add define for bootloader to find first DMA SAFE Memory --- libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index fedc7f84c0f52d..9923b564dd89ea 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -1132,6 +1132,13 @@ def write_mcu_config(self, f): f.write('#define HAL_CC_MEMORY_REGIONS %s\n' % ', '.join(cc_regions)) f.write('#define HAL_MEMORY_TOTAL_KB %u\n' % (total_memory/1024)) + if self.is_bootloader_fw() and not (ram_map[0][2] & 0x01): + # if first memory region is DMA safe then nothing to do + for (address, size, flags) in ram_map: + if flags & 0x01: + f.write('#define HAL_DMA_SAFE_MEM_START 0x%x' % address) + break + f.write('\n// CPU serial number (12 bytes)\n') udid_start = self.get_mcu_config('UDID_START') if udid_start is None: