diff --git a/boards/omnibus/f4sd/nuttx-config/scripts/ld.script b/boards/omnibus/f4sd/nuttx-config/scripts/ld.script index 30076eba5c..fce016b828 100644 --- a/boards/omnibus/f4sd/nuttx-config/scripts/ld.script +++ b/boards/omnibus/f4sd/nuttx-config/scripts/ld.script @@ -44,12 +44,13 @@ * where the code expects to begin execution by jumping to the entry point in * the 0x0800:0000 address range. * - * The first 0x4000 of flash is reserved for the bootloader. + * The first 16 KiB of flash is reserved for the bootloader. + * Paramater storage will use the next 16KiB Sector. */ MEMORY { - flash (rx) : ORIGIN = 0x08004000, LENGTH = 1008K + flash (rx) : ORIGIN = 0x08008000, LENGTH = 992K sram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K ccsram (rwx) : ORIGIN = 0x10000000, LENGTH = 64K } diff --git a/boards/omnibus/f4sd/src/board_config.h b/boards/omnibus/f4sd/src/board_config.h index 677375d853..9c2000a24a 100644 --- a/boards/omnibus/f4sd/src/board_config.h +++ b/boards/omnibus/f4sd/src/board_config.h @@ -61,6 +61,8 @@ #define BOARD_OVERLOAD_LED LED_BLUE +#define FLASH_BASED_PARAMS + /* * ADC channels * diff --git a/boards/omnibus/f4sd/src/init.c b/boards/omnibus/f4sd/src/init.c index 3955940707..ec9b87d87b 100644 --- a/boards/omnibus/f4sd/src/init.c +++ b/boards/omnibus/f4sd/src/init.c @@ -78,6 +78,10 @@ #include +# if defined(FLASH_BASED_PARAMS) +# include +#endif + /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ @@ -373,5 +377,23 @@ __EXPORT int board_app_initialize(uintptr_t arg) SPI_SELECT(spi3, PX4_SPIDEV_BARO, false); up_udelay(20); +#if defined(FLASH_BASED_PARAMS) + static sector_descriptor_t params_sector_map[] = { + {1, 16 * 1024, 0x08004000}, + {0, 0, 0}, + }; + + /* Initialize the flashfs layer to use heap allocated memory */ + result = parameter_flashfs_init(params_sector_map, NULL, 0); + + if (result != OK) { + message("[boot] FAILED to init params in FLASH %d\n", result); + led_on(LED_AMBER); + return -ENODEV; + } + +#endif + + return OK; }