mirror of https://github.com/ArduPilot/ardupilot
HAL_ChibiOS: support uncompressed bootloader on f103-periph
this allows update with very low memory
This commit is contained in:
parent
29856d4ff3
commit
e276031faa
|
@ -233,7 +233,7 @@ bool Util::flash_bootloader()
|
|||
|
||||
EXPECT_DELAY_MS(11000);
|
||||
|
||||
uint8_t *fw = AP_ROMFS::find_decompress(fw_name, fw_size);
|
||||
const uint8_t *fw = AP_ROMFS::find_decompress(fw_name, fw_size);
|
||||
if (!fw) {
|
||||
hal.console->printf("failed to find %s\n", fw_name);
|
||||
return false;
|
||||
|
@ -245,14 +245,14 @@ bool Util::flash_bootloader()
|
|||
const uint32_t addr = hal.flash->getpageaddr(0);
|
||||
if (!memcmp(fw, (const void*)addr, fw_size)) {
|
||||
hal.console->printf("Bootloader up-to-date\n");
|
||||
free(fw);
|
||||
AP_ROMFS::free(fw);
|
||||
return true;
|
||||
}
|
||||
|
||||
hal.console->printf("Erasing\n");
|
||||
if (!hal.flash->erasepage(0)) {
|
||||
hal.console->printf("Erase failed\n");
|
||||
free(fw);
|
||||
AP_ROMFS::free(fw);
|
||||
return false;
|
||||
}
|
||||
hal.console->printf("Flashing %s @%08x\n", fw_name, (unsigned int)addr);
|
||||
|
@ -267,12 +267,12 @@ bool Util::flash_bootloader()
|
|||
continue;
|
||||
}
|
||||
hal.console->printf("Flash OK\n");
|
||||
free(fw);
|
||||
AP_ROMFS::free(fw);
|
||||
return true;
|
||||
}
|
||||
|
||||
hal.console->printf("Flash failed after %u attempts\n", max_attempts);
|
||||
free(fw);
|
||||
AP_ROMFS::free(fw);
|
||||
return false;
|
||||
}
|
||||
#endif // !HAL_NO_FLASH_SUPPORT && !HAL_NO_ROMFS_SUPPORT
|
||||
|
|
|
@ -146,3 +146,7 @@ env APP_DESCRIPTOR MissionPlanner
|
|||
RAM_RESERVE_START 256
|
||||
|
||||
# define CH_DBG_ENABLE_STACK_CHECK TRUE
|
||||
|
||||
# keep ROMFS uncompressed as we don't have enough RAM
|
||||
# to uncompress the bootloader at runtime
|
||||
env ROMFS_UNCOMPRESSED True
|
||||
|
|
|
@ -673,6 +673,8 @@ def write_mcu_config(f):
|
|||
#define HAL_USE_I2C FALSE
|
||||
#define HAL_USE_PWM FALSE
|
||||
''')
|
||||
if env_vars.get('ROMFS_UNCOMPRESSED', False):
|
||||
f.write('#define HAL_ROMFS_UNCOMPRESSED\n')
|
||||
|
||||
def write_ldscript(fname):
|
||||
'''write ldscript.ld for this board'''
|
||||
|
|
Loading…
Reference in New Issue