From 350ebf5a1f93a5a068ddb731bbfa214858841f44 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 25 Jan 2021 22:57:45 -0500 Subject: [PATCH] boards: CUAV CAN GPS flash based parameters --- boards/cuav/can-gps-v1/src/board_config.h | 2 ++ boards/cuav/can-gps-v1/src/init.c | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/boards/cuav/can-gps-v1/src/board_config.h b/boards/cuav/can-gps-v1/src/board_config.h index 4b01181eda..f19d43cdf7 100644 --- a/boards/cuav/can-gps-v1/src/board_config.h +++ b/boards/cuav/can-gps-v1/src/board_config.h @@ -73,6 +73,8 @@ #define HRT_TIMER 3 /* use timer 3 for the HRT */ #define HRT_TIMER_CHANNEL 4 /* use capture/compare channel 4 */ +#define FLASH_BASED_PARAMS + __BEGIN_DECLS #define BOARD_HAS_N_S_RGB_LED 8 /* Uses 8 SK6812 digital led chip */ #define BOARD_MAX_LEDS BOARD_HAS_N_S_RGB_LED diff --git a/boards/cuav/can-gps-v1/src/init.c b/boards/cuav/can-gps-v1/src/init.c index 0e9c7c845b..46db91809a 100644 --- a/boards/cuav/can-gps-v1/src/init.c +++ b/boards/cuav/can-gps-v1/src/init.c @@ -71,6 +71,10 @@ #include +# if defined(FLASH_BASED_PARAMS) +# include +#endif + /************************************************************************************ * Name: stm32_boardinitialize * @@ -126,9 +130,24 @@ __EXPORT int board_app_initialize(uintptr_t arg) { px4_platform_init(); - /* Configure the HW based on the manifest */ +#if defined(FLASH_BASED_PARAMS) + static sector_descriptor_t params_sector_map[] = { + {2, 16 * 1024, 0x08008000}, + {3, 16 * 1024, 0x0800C000}, + {0, 0, 0}, + }; - px4_platform_configure(); + /* Initialize the flashfs layer to use heap allocated memory */ + int result = parameter_flashfs_init(params_sector_map, NULL, 0); + + if (result != OK) { + syslog(LOG_ERR, "[boot] FAILED to init params in FLASH %d\n", result); + return -ENODEV; + } + +#endif // FLASH_BASED_PARAMS + + //px4_platform_configure(); return OK; }