Merge pull request #2466 from AlienWiiBF/FlashUpdate
EEPROM configuration space updates
This commit is contained in:
commit
c5dc03862e
|
@ -26,41 +26,12 @@
|
|||
extern uint8_t __config_start; // configured via linker script when building binaries.
|
||||
extern uint8_t __config_end;
|
||||
|
||||
#if !defined(FLASH_PAGE_SIZE)
|
||||
// F1
|
||||
# if defined(STM32F10X_MD)
|
||||
# define FLASH_PAGE_SIZE (0x400)
|
||||
# elif defined(STM32F10X_HD)
|
||||
# define FLASH_PAGE_SIZE (0x800)
|
||||
// F3
|
||||
# elif defined(STM32F303xC)
|
||||
# define FLASH_PAGE_SIZE (0x800)
|
||||
// F4
|
||||
# elif defined(STM32F40_41xxx)
|
||||
# define FLASH_PAGE_SIZE ((uint32_t)0x20000)
|
||||
# elif defined (STM32F411xE)
|
||||
# define FLASH_PAGE_SIZE ((uint32_t)0x20000)
|
||||
# elif defined(STM32F427_437xx)
|
||||
# define FLASH_PAGE_SIZE ((uint32_t)0x20000) // 128K sectors
|
||||
# elif defined (STM32F446xx)
|
||||
# define FLASH_PAGE_SIZE ((uint32_t)0x20000)
|
||||
// F7
|
||||
#elif defined(STM32F722xx)
|
||||
# define FLASH_PAGE_SIZE ((uint32_t)0x20000)
|
||||
# elif defined(STM32F745xx)
|
||||
# define FLASH_PAGE_SIZE ((uint32_t)0x40000)
|
||||
# elif defined(STM32F746xx)
|
||||
# define FLASH_PAGE_SIZE ((uint32_t)0x40000)
|
||||
# elif defined(UNIT_TEST)
|
||||
# define FLASH_PAGE_SIZE (0x400)
|
||||
# else
|
||||
# error "Flash page size not defined for target."
|
||||
# endif
|
||||
#endif
|
||||
uint32_t FlashPageSize;
|
||||
|
||||
void config_streamer_init(config_streamer_t *c)
|
||||
{
|
||||
memset(c, 0, sizeof(*c));
|
||||
FlashPageSize = (uint32_t)&__config_end - (uint32_t)&__config_start;
|
||||
}
|
||||
|
||||
void config_streamer_start(config_streamer_t *c, uintptr_t base, int size)
|
||||
|
@ -93,7 +64,7 @@ void config_streamer_start(config_streamer_t *c, uintptr_t base, int size)
|
|||
c->err = 0;
|
||||
}
|
||||
|
||||
#if defined(STM32F7)
|
||||
#if defined(STM32F745xx) || defined(STM32F746xx)
|
||||
/*
|
||||
Sector 0 0x08000000 - 0x08007FFF 32 Kbytes
|
||||
Sector 1 0x08008000 - 0x0800FFFF 32 Kbytes
|
||||
|
@ -130,6 +101,43 @@ static uint32_t getFLASHSectorForEEPROM(void)
|
|||
}
|
||||
}
|
||||
|
||||
#elif defined(STM32F722xx)
|
||||
/*
|
||||
Sector 0 0x08000000 - 0x08003FFF 16 Kbytes
|
||||
Sector 1 0x08004000 - 0x08007FFF 16 Kbytes
|
||||
Sector 2 0x08008000 - 0x0800BFFF 16 Kbytes
|
||||
Sector 3 0x0800C000 - 0x0800FFFF 16 Kbytes
|
||||
Sector 4 0x08010000 - 0x0801FFFF 64 Kbytes
|
||||
Sector 5 0x08020000 - 0x0803FFFF 128 Kbytes
|
||||
Sector 6 0x08040000 - 0x0805FFFF 128 Kbytes
|
||||
Sector 7 0x08060000 - 0x0807FFFF 128 Kbytes
|
||||
*/
|
||||
|
||||
static uint32_t getFLASHSectorForEEPROM(void)
|
||||
{
|
||||
if ((uint32_t)&__config_start <= 0x08003FFF)
|
||||
return FLASH_SECTOR_0;
|
||||
if ((uint32_t)&__config_start <= 0x08007FFF)
|
||||
return FLASH_SECTOR_1;
|
||||
if ((uint32_t)&__config_start <= 0x0800BFFF)
|
||||
return FLASH_SECTOR_2;
|
||||
if ((uint32_t)&__config_start <= 0x0800FFFF)
|
||||
return FLASH_SECTOR_3;
|
||||
if ((uint32_t)&__config_start <= 0x0801FFFF)
|
||||
return FLASH_SECTOR_4;
|
||||
if ((uint32_t)&__config_start <= 0x0803FFFF)
|
||||
return FLASH_SECTOR_5;
|
||||
if ((uint32_t)&__config_start <= 0x0805FFFF)
|
||||
return FLASH_SECTOR_6;
|
||||
if ((uint32_t)&__config_start <= 0x0807FFFF)
|
||||
return FLASH_SECTOR_7;
|
||||
|
||||
// Not good
|
||||
while (1) {
|
||||
failureMode(FAILURE_FLASH_WRITE_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(STM32F4)
|
||||
/*
|
||||
Sector 0 0x08000000 - 0x08003FFF 16 Kbytes
|
||||
|
@ -186,7 +194,7 @@ static int write_word(config_streamer_t *c, uint32_t value)
|
|||
return c->err;
|
||||
}
|
||||
#if defined(STM32F7)
|
||||
if (c->address % FLASH_PAGE_SIZE == 0) {
|
||||
if (c->address % FlashPageSize == 0) {
|
||||
FLASH_EraseInitTypeDef EraseInitStruct = {
|
||||
.TypeErase = FLASH_TYPEERASE_SECTORS,
|
||||
.VoltageRange = FLASH_VOLTAGE_RANGE_3, // 2.7-3.6V
|
||||
|
@ -204,7 +212,7 @@ static int write_word(config_streamer_t *c, uint32_t value)
|
|||
return -2;
|
||||
}
|
||||
#else
|
||||
if (c->address % FLASH_PAGE_SIZE == 0) {
|
||||
if (c->address % FlashPageSize == 0) {
|
||||
#if defined(STM32F4)
|
||||
const FLASH_Status status = FLASH_EraseSector(getFLASHSectorForEEPROM(), VoltageRange_3); //0x08080000 to 0x080A0000
|
||||
#else
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#define HW_PIN PC13
|
||||
#define BRUSHED_ESC_AUTODETECT
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "AlienFlight F4"
|
||||
|
||||
#define LED0 PC12
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
#define TARGET_BOARD_IDENTIFIER "ANY7"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x080C0000)
|
||||
|
||||
#define USBD_PRODUCT_STRING "AnyFCF7"
|
||||
|
||||
#define USE_DSHOT
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#define TARGET_VALIDATECONFIG
|
||||
#define TARGET_PREINIT
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "BlueJayF4"
|
||||
|
||||
#define USE_HARDWARE_REVISION_DETECTION
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
#define TARGET_BOARD_IDENTIFIER "COLI"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "Colibri"
|
||||
#ifdef OPBL
|
||||
#define USBD_SERIALNUMBER_STRING "0x8020000"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#pragma once
|
||||
#define TARGET_BOARD_IDENTIFIER "ELL0"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS 0x08080000 //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
#define TARGET_XTAL_MHZ 25
|
||||
|
||||
#define USBD_PRODUCT_STRING "Elle0"
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#pragma once
|
||||
#define TARGET_BOARD_IDENTIFIER "F4BY"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "Swift-Flyer F4BY"
|
||||
|
||||
#define LED0 PE3 // Blue LED
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "FDF4"
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "FishDroneF4"
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "FYF4"
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "FuryF4"
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
#define TARGET_BOARD_IDENTIFIER "FYF7"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x080C0000)
|
||||
|
||||
#define USBD_PRODUCT_STRING "FuryF7"
|
||||
|
||||
#define USE_DSHOT
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#pragma once
|
||||
#define TARGET_BOARD_IDENTIFIER "KTV1"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS 0x08080000 //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "KakuteF4-V1"
|
||||
|
||||
#define LED0 PB5
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "KIWI"
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "KIWIF4"
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#pragma once
|
||||
#define TARGET_BOARD_IDENTIFIER "NERO"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08060000)
|
||||
|
||||
#define USBD_PRODUCT_STRING "NERO"
|
||||
|
||||
#define HW_PIN PB2
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
#define TARGET_BOARD_IDENTIFIER "NUC7"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x080C0000)
|
||||
|
||||
#define USBD_PRODUCT_STRING "NucleoF7"
|
||||
|
||||
//#define USE_DSHOT
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#define TARGET_BOARD_IDENTIFIER "OBF4"
|
||||
#endif
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "OmnibusF4"
|
||||
#ifdef OPBL
|
||||
#define USBD_SERIALNUMBER_STRING "0x8020000"
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#if defined(AIRBOTF4)
|
||||
#define TARGET_BOARD_IDENTIFIER "AIR4"
|
||||
#define USBD_PRODUCT_STRING "AirbotF4"
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#pragma once
|
||||
#define TARGET_BOARD_IDENTIFIER "REVN"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08060000) //0x08060000 to 0x08080000 (FLASH_Sector_7)
|
||||
|
||||
#define USBD_PRODUCT_STRING "Revo Nano"
|
||||
#ifdef OPBL
|
||||
#define USBD_SERIALNUMBER_STRING "0x8010000"
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#pragma once
|
||||
#define TARGET_BOARD_IDENTIFIER "SPK2"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS 0x08080000 //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "Sparky 2.0"
|
||||
#ifdef OPBL
|
||||
#define USBD_SERIALNUMBER_STRING "0x8020000"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "VRRA"
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "VRRACE"
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#pragma once
|
||||
#define TARGET_BOARD_IDENTIFIER "YPF4"
|
||||
|
||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||
|
||||
#define USBD_PRODUCT_STRING "YupiF4"
|
||||
|
||||
#define LED0 PB6
|
||||
|
|
|
@ -13,16 +13,18 @@
|
|||
ENTRY(Reset_Handler)
|
||||
|
||||
/*
|
||||
0x08000000 to 0x08100000 1024K full flash,
|
||||
0x08000000 to 0x080DFFFF 896K firmware,
|
||||
0x080E0000 to 0x08100000 128K config, // FLASH_Sector_11
|
||||
0x08000000 to 0x080FFFFF 1024K full flash,
|
||||
0x08000000 to 0x08003FFF 16K isr vector, startup code,
|
||||
0x08004000 to 0x08007FFF 16K config, // FLASH_Sector_1
|
||||
0x08008000 to 0x080FFFFF 992K firmware,
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 896K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x080E0000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08004000, LENGTH = 16K
|
||||
FLASH1 (rx) : ORIGIN = 0x08008000, LENGTH = 992K
|
||||
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
|
@ -32,4 +34,4 @@ MEMORY
|
|||
|
||||
REGION_ALIAS("STACKRAM", CCM)
|
||||
|
||||
INCLUDE "stm32_flash.ld"
|
||||
INCLUDE "stm32_flash_split.ld"
|
|
@ -13,17 +13,19 @@
|
|||
ENTRY(Reset_Handler)
|
||||
|
||||
/*
|
||||
0x08000000 to 0x08100000 1024K full flash,
|
||||
0x08000000 to 0x08004000 16K OPBL,
|
||||
0x08004000 to 0x080DFFFF 880K firmware,
|
||||
0x080E0000 to 0x08100000 128K config, // FLASH_Sector_11
|
||||
0x08000000 to 0x080FFFFF 1024K full flash,
|
||||
0x08000000 to 0x08003FFF 16K OPBL,
|
||||
0x08004000 to 0x08007FFF 16K isr vector, startup code,
|
||||
0x08008000 to 0x0800BFFF 16K config, // FLASH_Sector_2
|
||||
0x0800C000 to 0x080FFFFF 976K firmware,
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 880K
|
||||
FLASH_CONFIG (r): ORIGIN = 0x080E0000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 16K
|
||||
FLASH_CONFIG (r): ORIGIN = 0x08008000, LENGTH = 16K
|
||||
FLASH1 (rx) : ORIGIN = 0x0800C000, LENGTH = 976K
|
||||
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
|
@ -32,4 +34,4 @@ MEMORY
|
|||
|
||||
REGION_ALIAS("STACKRAM", CCM)
|
||||
|
||||
INCLUDE "stm32_flash.ld"
|
||||
INCLUDE "stm32_flash_split.ld"
|
||||
|
|
|
@ -13,16 +13,18 @@
|
|||
ENTRY(Reset_Handler)
|
||||
|
||||
/*
|
||||
0x08000000 to 0x08080000 512K full flash,
|
||||
0x08000000 to 0x0805FFFF 384K firmware,
|
||||
0x08060000 to 0x08080000 128K config,
|
||||
0x08000000 to 0x0807FFFF 512K full flash,
|
||||
0x08000000 to 0x08003FFF 16K isr vector, startup code,
|
||||
0x08004000 to 0x08007FFF 16K config, // FLASH_Sector_1
|
||||
0x08008000 to 0x0807FFFF 480K firmware,
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 384K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08060000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08004000, LENGTH = 16K
|
||||
FLASH1 (rx) : ORIGIN = 0x08008000, LENGTH = 480K
|
||||
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
|
||||
|
@ -30,4 +32,4 @@ MEMORY
|
|||
|
||||
REGION_ALIAS("STACKRAM", RAM)
|
||||
|
||||
INCLUDE "stm32_flash.ld"
|
||||
INCLUDE "stm32_flash_split.ld"
|
||||
|
|
|
@ -13,17 +13,19 @@
|
|||
ENTRY(Reset_Handler)
|
||||
|
||||
/*
|
||||
0x08000000 to 0x08080000 512K full flash,
|
||||
0x08000000 to 0x08004000 16K OPBL,
|
||||
0x08004000 to 0x0805FFFF 368K firmware,
|
||||
0x08060000 to 0x08080000 128K config,
|
||||
0x08000000 to 0x0807FFFF 512K full flash,
|
||||
0x08000000 to 0x08003FFF 16K OPBL,
|
||||
0x08004000 to 0x08007FFF 16K isr vector, startup code,
|
||||
0x08008000 to 0x0800BFFF 16K config, // FLASH_Sector_2
|
||||
0x0800C000 to 0x0807FFFF 464K firmware,
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 368K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08060000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 16K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08008000, LENGTH = 16K
|
||||
FLASH1 (rx) : ORIGIN = 0x0800C000, LENGTH = 464K
|
||||
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
CCM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
|
@ -32,4 +34,4 @@ MEMORY
|
|||
|
||||
REGION_ALIAS("STACKRAM", CCM)
|
||||
|
||||
INCLUDE "stm32_flash.ld"
|
||||
INCLUDE "stm32_flash_split.ld"
|
||||
|
|
|
@ -13,16 +13,18 @@
|
|||
ENTRY(Reset_Handler)
|
||||
|
||||
/*
|
||||
0x08000000 to 0x08080000 512K full flash,
|
||||
0x08000000 to 0x0805FFFF 384K firmware,
|
||||
0x08060000 to 0x08080000 128K config,
|
||||
0x08000000 to 0x0807FFFF 512K full flash,
|
||||
0x08000000 to 0x08003FFF 16K isr vector, startup code,
|
||||
0x08004000 to 0x08007FFF 16K config, // FLASH_Sector_1
|
||||
0x08008000 to 0x0807FFFF 480K firmware,
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 384K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08060000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08004000, LENGTH = 16K
|
||||
FLASH1 (rx) : ORIGIN = 0x08008000, LENGTH = 480K
|
||||
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||
MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
|
||||
|
@ -30,4 +32,4 @@ MEMORY
|
|||
|
||||
REGION_ALIAS("STACKRAM", RAM)
|
||||
|
||||
INCLUDE "stm32_flash.ld"
|
||||
INCLUDE "stm32_flash_split.ld"
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
|
||||
/* Internal Memory Map*/
|
||||
MEMORY
|
||||
{
|
||||
rom (rx) : ORIGIN = 0x08000000, LENGTH = 0x00100000
|
||||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000
|
||||
ram1 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x00010000
|
||||
}
|
||||
|
||||
_eram = 0x20000000 + 0x00020000;
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
PROVIDE (isr_vector_table_base = .);
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_fram e*))
|
||||
} > rom
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > rom
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > rom
|
||||
__exidx_end = .;
|
||||
__etext = .;
|
||||
|
||||
/* _sidata is used in coide startup code */
|
||||
_sidata = __etext;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
|
||||
/* _sdata is used in coide startup code */
|
||||
_sdata = __data_start__;
|
||||
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
/* _edata is used in coide startup code */
|
||||
_edata = __data_end__;
|
||||
} > ram
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
_sbss = __bss_start__;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
_ebss = __bss_end__;
|
||||
} > ram
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
_end = __end__;
|
||||
end = __end__;
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > ram
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.co_stack (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.co_stack .co_stack.*)
|
||||
} > ram
|
||||
|
||||
/* Set stack top to end of ram , and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(ram ) + LENGTH(ram );
|
||||
__StackLimit = __StackTop - SIZEOF(.co_stack);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* Check if data + heap + stack exceeds ram limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region ram overflowed with stack")
|
||||
}
|
|
@ -12,11 +12,19 @@
|
|||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/*
|
||||
0x08000000 to 0x0807FFFF 512K full flash,
|
||||
0x08000000 to 0x08003FFF 16K isr vector, startup code,
|
||||
0x08004000 to 0x08007FFF 16K config, // FLASH_Sector_1
|
||||
0x08008000 to 0x0807FFFF 480K firmware,
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 384K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08060000, LENGTH = 128K
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08004000, LENGTH = 16K
|
||||
FLASH1 (rx) : ORIGIN = 0x08008000, LENGTH = 480K
|
||||
|
||||
TCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||
RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 192K
|
||||
|
@ -26,4 +34,4 @@ MEMORY
|
|||
/* note TCM could be used for stack */
|
||||
REGION_ALIAS("STACKRAM", TCM)
|
||||
|
||||
INCLUDE "stm32_flash.ld"
|
||||
INCLUDE "stm32_flash_split.ld"
|
||||
|
|
|
@ -12,11 +12,19 @@
|
|||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/*
|
||||
0x08000000 to 0x080FFFFF 1024K full flash,
|
||||
0x08000000 to 0x08007FFF 32K isr vector, startup code,
|
||||
0x08008000 to 0x0800FFFF 32K config, // FLASH_Sector_1
|
||||
0x08010000 to 0x080FFFFF 960K firmware,
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 768K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x080C0000, LENGTH = 256K
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08008000, LENGTH = 32K
|
||||
FLASH1 (rx) : ORIGIN = 0x08010000, LENGTH = 960K
|
||||
|
||||
TCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||
RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 256K
|
||||
|
@ -25,4 +33,4 @@ MEMORY
|
|||
/* note CCM could be used for stack */
|
||||
REGION_ALIAS("STACKRAM", TCM)
|
||||
|
||||
INCLUDE "stm32_flash.ld"
|
||||
INCLUDE "stm32_flash_split.ld"
|
||||
|
|
|
@ -12,11 +12,19 @@
|
|||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/*
|
||||
0x08000000 to 0x080FFFFF 1024K full flash,
|
||||
0x08000000 to 0x08007FFF 32K isr vector, startup code,
|
||||
0x08008000 to 0x0800FFFF 32K config, // FLASH_Sector_1
|
||||
0x08010000 to 0x080FFFFF 960K firmware,
|
||||
*/
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 768K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x080C0000, LENGTH = 256K
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
|
||||
FLASH_CONFIG (r) : ORIGIN = 0x08008000, LENGTH = 32K
|
||||
FLASH1 (rx) : ORIGIN = 0x08010000, LENGTH = 960K
|
||||
|
||||
TCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||
RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 256K
|
||||
|
@ -25,4 +33,4 @@ MEMORY
|
|||
/* note CCM could be used for stack */
|
||||
REGION_ALIAS("STACKRAM", TCM)
|
||||
|
||||
INCLUDE "stm32_flash.ld"
|
||||
INCLUDE "stm32_flash_split.ld"
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
*****************************************************************************
|
||||
**
|
||||
** File : stm32_flash_split.ld
|
||||
**
|
||||
** Abstract : Common linker script for STM32 devices.
|
||||
**
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = ORIGIN(STACKRAM) + LENGTH(STACKRAM); /* end of RAM */
|
||||
|
||||
/* Base address where the config is stored. */
|
||||
__config_start = ORIGIN(FLASH_CONFIG);
|
||||
__config_end = ORIGIN(FLASH_CONFIG) + LENGTH(FLASH_CONFIG);
|
||||
|
||||
/* Generate a link error if heap and stack don't fit into RAM */
|
||||
_Min_Heap_Size = 0; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x800; /* required amount of stack */
|
||||
|
||||
/* Define output sections */
|
||||
SECTIONS
|
||||
{
|
||||
/* The startup code goes first into FLASH */
|
||||
.isr_vector :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE (isr_vector_table_base = .);
|
||||
KEEP(*(.isr_vector)) /* Startup code */
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
/* The program code and other data goes into FLASH */
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.text) /* .text sections (code) */
|
||||
*(.text*) /* .text* sections (code) */
|
||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||
*(.glue_7) /* glue arm to thumb code */
|
||||
*(.glue_7t) /* glue thumb to arm code */
|
||||
*(.eh_frame)
|
||||
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .; /* define a global symbols at end of code */
|
||||
} >FLASH1
|
||||
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||
.ARM : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >FLASH
|
||||
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array*))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
} >FLASH
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array*))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
} >FLASH
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(.fini_array*))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} >FLASH
|
||||
.pg_registry :
|
||||
{
|
||||
PROVIDE_HIDDEN (__pg_registry_start = .);
|
||||
KEEP (*(.pg_registry))
|
||||
KEEP (*(SORT(.pg_registry.*)))
|
||||
PROVIDE_HIDDEN (__pg_registry_end = .);
|
||||
} >FLASH
|
||||
.pg_resetdata :
|
||||
{
|
||||
PROVIDE_HIDDEN (__pg_resetdata_start = .);
|
||||
KEEP (*(.pg_resetdata))
|
||||
PROVIDE_HIDDEN (__pg_resetdata_end = .);
|
||||
} >FLASH
|
||||
|
||||
/* used by the startup to initialize data */
|
||||
_sidata = .;
|
||||
|
||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sdata = .; /* create a global symbol at data start */
|
||||
*(.data) /* .data sections */
|
||||
*(.data*) /* .data* sections */
|
||||
|
||||
. = ALIGN(4);
|
||||
_edata = .; /* define a global symbol at data end */
|
||||
} >RAM AT> FLASH
|
||||
|
||||
/* Uninitialized data section */
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
/* This is used by the startup in order to initialize the .bss secion */
|
||||
_sbss = .; /* define a global symbol at bss start */
|
||||
__bss_start__ = _sbss;
|
||||
*(.bss)
|
||||
*(SORT_BY_ALIGNMENT(.bss*))
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
_ebss = .; /* define a global symbol at bss end */
|
||||
__bss_end__ = _ebss;
|
||||
} >RAM
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||
_heap_stack_end = ORIGIN(STACKRAM)+LENGTH(STACKRAM) - 8; /* 8 bytes to allow for alignment */
|
||||
_heap_stack_begin = _heap_stack_end - _Min_Stack_Size - _Min_Heap_Size;
|
||||
. = _heap_stack_begin;
|
||||
._user_heap_stack :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE ( end = . );
|
||||
PROVIDE ( _end = . );
|
||||
. = . + _Min_Heap_Size;
|
||||
. = . + _Min_Stack_Size;
|
||||
. = ALIGN(4);
|
||||
} >STACKRAM = 0xa5
|
||||
|
||||
/* MEMORY_bank1 section, code must be located here explicitly */
|
||||
/* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
|
||||
.memory_b1_text :
|
||||
{
|
||||
*(.mb1text) /* .mb1text sections (code) */
|
||||
*(.mb1text*) /* .mb1text* sections (code) */
|
||||
*(.mb1rodata) /* read-only data (constants) */
|
||||
*(.mb1rodata*)
|
||||
} >MEMORY_B1
|
||||
|
||||
/* Remove information from the standard libraries */
|
||||
/DISCARD/ :
|
||||
{
|
||||
libc.a ( * )
|
||||
libm.a ( * )
|
||||
libgcc.a ( * )
|
||||
}
|
||||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
}
|
Loading…
Reference in New Issue