Added FAST_RAM_INITIALIZED (#5733)
* Added FAST_RAM_INITIALIZED for those who really want it * Added the white crow of KISSFCV2F7 * Made initialized data LMAs robust * Fixed indirection when initializing fast memory
This commit is contained in:
parent
8e152f3259
commit
f18448e8dc
|
@ -265,10 +265,18 @@ void init(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_ITCM_RAM
|
#ifdef USE_ITCM_RAM
|
||||||
/* Load functions into ITCM RAM */
|
/* Load functions into ITCM RAM */
|
||||||
extern unsigned char tcm_code_start;
|
extern uint8_t tcm_code_start;
|
||||||
extern unsigned char tcm_code_end;
|
extern uint8_t tcm_code_end;
|
||||||
extern unsigned char tcm_code;
|
extern uint8_t tcm_code;
|
||||||
memcpy(&tcm_code_start, &tcm_code, (int)(&tcm_code_end - &tcm_code_start));
|
memcpy(&tcm_code_start, &tcm_code, (size_t) (&tcm_code_end - &tcm_code_start));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_FAST_RAM
|
||||||
|
/* Load FAST_RAM_INITIALIZED variable intializers into FAST RAM */
|
||||||
|
extern uint8_t _sfastram_data;
|
||||||
|
extern uint8_t _efastram_data;
|
||||||
|
extern uint8_t _sfastram_idata;
|
||||||
|
memcpy(&_sfastram_data, &_sfastram_idata, (size_t) (&_efastram_data - &_sfastram_data));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_HAL_DRIVER
|
#ifdef USE_HAL_DRIVER
|
||||||
|
|
|
@ -158,7 +158,7 @@ void pidResetITerm(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static FAST_RAM float itermAccelerator = 1.0f;
|
static FAST_RAM_INITIALIZED float itermAccelerator = 1.0f;
|
||||||
|
|
||||||
void pidSetItermAccelerator(float newItermAccelerator)
|
void pidSetItermAccelerator(float newItermAccelerator)
|
||||||
{
|
{
|
||||||
|
|
|
@ -136,7 +136,7 @@ SECTIONS
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
/* used by the startup to initialize data */
|
/* used by the startup to initialize data */
|
||||||
_sidata = .;
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||||
.data :
|
.data :
|
||||||
|
@ -182,6 +182,21 @@ SECTIONS
|
||||||
__sram2_end__ = _esram2;
|
__sram2_end__ = _esram2;
|
||||||
} >SRAM2
|
} >SRAM2
|
||||||
|
|
||||||
|
/* used during startup to initialized fastram_data */
|
||||||
|
_sfastram_idata = LOADADDR(.fastram_data);
|
||||||
|
|
||||||
|
/* Initialized FAST_RAM section for unsuspecting developers */
|
||||||
|
.fastram_data :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sfastram_data = .; /* create a global symbol at data start */
|
||||||
|
*(.fastram_data) /* .data sections */
|
||||||
|
*(.fastram_data*) /* .data* sections */
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_efastram_data = .; /* define a global symbol at data end */
|
||||||
|
} >FASTRAM AT> FLASH
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.fastram_bss (NOLOAD) :
|
.fastram_bss (NOLOAD) :
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,8 +99,10 @@
|
||||||
|
|
||||||
#ifdef USE_FAST_RAM
|
#ifdef USE_FAST_RAM
|
||||||
#define FAST_RAM __attribute__ ((section(".fastram_bss"), aligned(4)))
|
#define FAST_RAM __attribute__ ((section(".fastram_bss"), aligned(4)))
|
||||||
|
#define FAST_RAM_INITIALIZED __attribute__ ((section(".fastram_data"), aligned(4)))
|
||||||
#else
|
#else
|
||||||
#define FAST_RAM
|
#define FAST_RAM
|
||||||
|
#define FAST_RAM_INITIALIZED
|
||||||
#endif // USE_FAST_RAM
|
#endif // USE_FAST_RAM
|
||||||
|
|
||||||
#ifdef STM32F4
|
#ifdef STM32F4
|
||||||
|
|
|
@ -93,7 +93,7 @@ SECTIONS
|
||||||
} >FLASH AT >AXIM_FLASH
|
} >FLASH AT >AXIM_FLASH
|
||||||
|
|
||||||
/* used by the startup to initialize data */
|
/* used by the startup to initialize data */
|
||||||
_sidata = .;
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||||
.data :
|
.data :
|
||||||
|
@ -139,6 +139,21 @@ SECTIONS
|
||||||
__sram2_end__ = _esram2;
|
__sram2_end__ = _esram2;
|
||||||
} >SRAM2
|
} >SRAM2
|
||||||
|
|
||||||
|
/* used during startup to initialized fastram_data */
|
||||||
|
_sfastram_idata = LOADADDR(.fastram_data);
|
||||||
|
|
||||||
|
/* Initialized FAST_RAM section for unsuspecting developers */
|
||||||
|
.fastram_data :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sfastram_data = .; /* create a global symbol at data start */
|
||||||
|
*(.fastram_data) /* .data sections */
|
||||||
|
*(.fastram_data*) /* .data* sections */
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_efastram_data = .; /* define a global symbol at data end */
|
||||||
|
} >FASTRAM AT> FLASH
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.fastram_bss (NOLOAD) :
|
.fastram_bss (NOLOAD) :
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,7 +106,7 @@ SECTIONS
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
/* used by the startup to initialize data */
|
/* used by the startup to initialize data */
|
||||||
_sidata = .;
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||||
.data :
|
.data :
|
||||||
|
@ -136,6 +136,22 @@ SECTIONS
|
||||||
__bss_end__ = _ebss;
|
__bss_end__ = _ebss;
|
||||||
} >RAM
|
} >RAM
|
||||||
|
|
||||||
|
/* used during startup to initialized fastram_data */
|
||||||
|
_sfastram_idata = LOADADDR(.fastram_data);
|
||||||
|
|
||||||
|
/* Initialized FAST_RAM section for unsuspecting developers */
|
||||||
|
.fastram_data :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sfastram_data = .; /* create a global symbol at data start */
|
||||||
|
*(.fastram_data) /* .data sections */
|
||||||
|
*(.fastram_data*) /* .data* sections */
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_efastram_data = .; /* define a global symbol at data end */
|
||||||
|
} >FASTRAM AT> FLASH
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
.fastram_bss (NOLOAD) :
|
.fastram_bss (NOLOAD) :
|
||||||
{
|
{
|
||||||
__fastram_bss_start__ = .;
|
__fastram_bss_start__ = .;
|
||||||
|
|
Loading…
Reference in New Issue