Skip to content

Commit

Permalink
AP_HAL_ChibiOS: enable heap allocation if flash space for bootloader …
Browse files Browse the repository at this point in the history
…is > 128K
  • Loading branch information
bugobliterator committed Jul 18, 2024
1 parent b9cf515 commit 6d41070
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,12 @@ def write_mcu_config(self, f):
#endif
#define STM32_FLASH_DISABLE_ISR 0
''')
if not self.env_vars['EXT_FLASH_SIZE_MB'] and not args.signed_fw:
# get bootloader flash space, if larger than 128k we can enable Heap
flash_size = self.get_config('FLASH_USE_MAX_KB', type=int, default=0)
if flash_size == 0:
flash_size = self.get_config('FLASH_SIZE_KB', type=int)
flash_length = min(flash_size, self.get_config('FLASH_BOOTLOADER_LOAD_KB', type=int))
if not self.env_vars['EXT_FLASH_SIZE_MB'] and not args.signed_fw and flash_length < 128:
f.write('''
#ifndef CH_CFG_USE_MEMCORE
#define CH_CFG_USE_MEMCORE FALSE
Expand Down

0 comments on commit 6d41070

Please sign in to comment.