Skip to content

Commit

Permalink
aerofc: Use ram_flash dataman backend
Browse files Browse the repository at this point in the history
  • Loading branch information
zehortigoza authored and LorenzMeier committed Mar 10, 2017
1 parent e2aae04 commit 07921c9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ROMFS/px4fmu_common/init.d/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ then
set DATAMAN_OPT ""
if ver hwcmp AEROFC_V1
then
set DATAMAN_OPT -r
set DATAMAN_OPT -i
fi
# waypoint storage
# REBOOTWORK this needs to start in parallel
Expand Down
25 changes: 18 additions & 7 deletions src/drivers/boards/aerofc-v1/aerofc_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
#include <drivers/drv_hrt.h>
#include <drivers/drv_led.h>

#include <dataman/dataman.h>

#include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <systemlib/err.h>
Expand Down Expand Up @@ -335,28 +337,32 @@ __EXPORT int board_app_initialize(uintptr_t arg)
led_off(LED_AMBER);
led_off(LED_BLUE);

#if defined(FLASH_BASED_PARAMS)
/*
* Bootloader(sector 0):
* start: 0x08000000, len: 16K, end: 0x08003E80
*
* FlashFS(sector 1 and 2):
* start: 0x08004000, len: 32K, end: 0x0800C000
* start: 0x08004000, len: 32K, end: 0x0800BFFF
*
* Firmware(sector 3 to 11):
* start: 0x0800C000, len: 976K, end: 0x080FA480
* start: 0x0800C000, len: 976K, end: 0x080FFFFF
*
* First 1MB memory bank complete.
* Second 1MB memory bank is reserved for future use.
* Dataman(sector 23):
* start: 0x081E0000, len: 128K, end: 0x08200000
*
* First 1MB memory bank complete assigned.
* Second 1MB memory bank is mostly empty.
*/
static sector_descriptor_t sector_map[] = {

#if defined(FLASH_BASED_PARAMS)
static sector_descriptor_t params_sector_map[] = {
{1, 16 * 1024, 0x08004000},
{2, 16 * 1024, 0x08008000},
{0, 0, 0},
};

/* Initialize the flashfs layer to use heap allocated memory */
result = parameter_flashfs_init(sector_map, NULL, 0);
result = parameter_flashfs_init(params_sector_map, NULL, 0);

if (result != OK) {
message("[boot] FAILED to init params in FLASH %d\n", result);
Expand All @@ -366,6 +372,11 @@ __EXPORT int board_app_initialize(uintptr_t arg)

#endif

#if defined(FLASH_BASED_DATAMAN)
static dm_sector_descriptor_t dm_sector_map = {23, 128 * 1024, 0x081E0000};
dm_flash_sector_description_set(&dm_sector_map);
#endif

return OK;
}

Expand Down
1 change: 1 addition & 0 deletions src/drivers/boards/aerofc-v1/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
#define BOARD_NAME "AEROFC_V1"

#define FLASH_BASED_PARAMS
#define FLASH_BASED_DATAMAN

/*
* The following defined is a workaround and replaces CONFIG_ARCH_BOARD_AEROFC_V1
Expand Down

0 comments on commit 07921c9

Please sign in to comment.