1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Internal flash settings for F1

Conflicts:
	flight/pios/stm32f10x/pios_flash_internal.c
This commit is contained in:
Alessio Morale 2013-05-05 21:23:35 +02:00
parent da23fd6784
commit 8d57d8ff76
6 changed files with 57 additions and 6 deletions

View File

@ -2,7 +2,7 @@ MEMORY
{
BL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x03000 - 0x00080
BD_INFO (r) : ORIGIN = 0x08003000 - 0x80, LENGTH = 0x00080
FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 0x20000 - 0x03000 - 0x00400
EE_FLASH (rw) : ORIGIN = 0x0801FC00, LENGTH = 0x00400
FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 0x20000 - 0x03000 - 0x04000
EE_FLASH (rw) : ORIGIN = 0x0801C000, LENGTH = 0x04000
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x05000
}

View File

@ -12,12 +12,27 @@ MODEL_SUFFIX := _PX
OPENOCD_JTAG_CONFIG := stlink-v2.cfg
OPENOCD_CONFIG := stm32f1x.stlink.cfg
# Flash memory map for OPLM:
# Sector start size use
# 0 0x0800 0000 1k BL
# 1 0x0800 0400 1k BL
# .. ..
# 10 0x0800 2C00 1k BL
# 11 0x0800 3000 1k FW
# 12 0x0800 1000 1k FW
# .. ..
# 125 0x0801 F400 1k FW
# 126 0x0801 F800 1k EE
# 127 0x0801 FC00 1k EE
# Note: These must match the values in link_$(BOARD)_memory.ld
BL_BANK_BASE := 0x08000000 # Start of bootloader flash
BL_BANK_SIZE := 0x00003000 # Should include BD_INFO region
FW_BANK_BASE := 0x08003000 # Start of firmware flash
FW_BANK_SIZE := 0x0001CC00 # Should include FW_DESC_SIZE
EE_BANK_BASE := 0x0801FC00 # EEPROM storage area
EE_BANK_SIZE := 0x00000400 # Size of EEPROM storage area
FW_BANK_SIZE := 0x00019000 # Should include FW_DESC_SIZE
EE_BANK_BASE := 0x0801C000 # EEPROM storage area
EE_BANK_SIZE := 0x00004000 # Size of EEPROM storage area
FW_DESC_SIZE := 0x00000064

View File

@ -99,6 +99,29 @@ const struct pios_led_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (__attribute__((unused)
#endif /* PIOS_INCLUDE_LED */
#if defined(PIOS_INCLUDE_FLASH)
#include "pios_flashfs_logfs_priv.h"
#include "pios_flash_internal_priv.h"
static const struct pios_flash_internal_cfg flash_internal_cfg = {
};
static const struct flashfs_logfs_cfg flashfs_internal_cfg = {
.fs_magic = 0x99abcfef,
.total_fs_size = EE_BANK_SIZE, /* 2K bytes (2x1KB sectors) */
.arena_size = 0x00002000, /* 4 * slot size = 1K bytes = 1 sector */
.slot_size = 0x00000100, /* 256 bytes */
.start_offset = EE_BANK_BASE, /* start after the bootloader */
.sector_size = 0x00000400, /* 1K bytes */
.page_size = 0x00000400, /* 1K bytes */
};
#include "pios_flash.h"
#endif /* PIOS_INCLUDE_FLASH */
#if defined(PIOS_INCLUDE_SPI)
#include <pios_spi_priv.h>

View File

@ -56,6 +56,9 @@ else
SRC += $(OPTESTS)/$(TESTAPP).c
endif
CDEFS += -DEE_BANK_BASE=$(EE_BANK_BASE)
CDEFS += -DEE_BANK_SIZE=$(EE_BANK_SIZE)
# Optional component libraries
include $(FLIGHTLIB)/rscode/library.mk

View File

@ -105,8 +105,9 @@
/* #define PIOS_OVERO_SPI */
/* #define PIOS_INCLUDE_SDCARD */
/* #define LOG_FILENAME "startup.log" */
/* #define PIOS_INCLUDE_FLASH */
/* #define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS */
#define PIOS_INCLUDE_FLASH
#define PIOS_INCLUDE_FLASH_INTERNAL
#define PIOS_INCLUDE_FLASH_SECTOR_SETTINGS
/* #define FLASH_FREERTOS */
#define PIOS_INCLUDE_FLASH_EEPROM

View File

@ -82,6 +82,15 @@ void PIOS_Board_Init(void) {
/* Delay system */
PIOS_DELAY_Init();
#ifdef PIOS_INCLUDE_FLASH_SECTOR_SETTINGS
uintptr_t flash_id;
uintptr_t fs_id;
PIOS_Flash_Internal_Init(&flash_id, &flash_internal_cfg);
PIOS_FLASHFS_Logfs_Init(&fs_id, &flashfs_internal_cfg, &pios_internal_flash_driver, flash_id);
#elif !defined(PIOS_USE_SETTINGS_ON_SDCARD)
#error No setting storage specified. (define PIOS_USE_SETTINGS_ON_SDCARD or INCLUDE_FLASH_SECTOR_SETTINGS)
#endif
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();