From 9e834d26f81c47cb6c40cb66e448c4ee26039af9 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 3 Feb 2021 05:28:42 -0800 Subject: [PATCH] holybro_can-gps-v1:Add Flash Based Parameters --- boards/holybro/can-gps-v1/src/board_config.h | 2 ++ boards/holybro/can-gps-v1/src/init.c | 23 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/boards/holybro/can-gps-v1/src/board_config.h b/boards/holybro/can-gps-v1/src/board_config.h index 033be518ef..78339042c7 100644 --- a/boards/holybro/can-gps-v1/src/board_config.h +++ b/boards/holybro/can-gps-v1/src/board_config.h @@ -98,6 +98,8 @@ #define HW_INFO_INIT_VER 6 #define HW_INFO_INIT_REV 7 +#define FLASH_BASED_PARAMS + /* CAN Silence * * Silent mode control diff --git a/boards/holybro/can-gps-v1/src/init.c b/boards/holybro/can-gps-v1/src/init.c index da508a2aaf..a22d839cd4 100644 --- a/boards/holybro/can-gps-v1/src/init.c +++ b/boards/holybro/can-gps-v1/src/init.c @@ -74,6 +74,9 @@ #include #include #include +# if defined(FLASH_BASED_PARAMS) +# include +#endif /* * Ideally we'd be able to get these from arm_internal.h, @@ -158,6 +161,23 @@ __EXPORT int board_app_initialize(uintptr_t arg) stm32_spiinitialize(); +#if defined(FLASH_BASED_PARAMS) + static sector_descriptor_t params_sector_map[] = { + {2, 16 * 1024, 0x08008000}, + {0, 0, 0}, + }; + + /* 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 + + #if defined(SERIAL_HAVE_RXDMA) /* set up the serial DMA polling */ static struct hrt_call serial_dma_call; @@ -183,8 +203,5 @@ __EXPORT int board_app_initialize(uintptr_t arg) led_on(LED_GREEN); // Indicate Power. led_off(LED_BLUE); - /* Configure the HW based on the manifest */ - - px4_platform_configure(); return OK; }