From a0e7dd7c9c8ad11ac3402307ca5bd588b12d7510 Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Sat, 26 Jan 2019 22:25:59 +0300 Subject: [PATCH] Added ITCM-RAM loading --- src/main/startup/startup_stm32f722xx.s | 2 ++ src/main/target/system_stm32f7xx.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/main/startup/startup_stm32f722xx.s b/src/main/startup/startup_stm32f722xx.s index 69d6b475ec..884d06f520 100644 --- a/src/main/startup/startup_stm32f722xx.s +++ b/src/main/startup/startup_stm32f722xx.s @@ -134,6 +134,8 @@ LoopMarkHeapStack: cmp r2, r3 bcc MarkHeapStack + bl CopyFastCode + /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ diff --git a/src/main/target/system_stm32f7xx.c b/src/main/target/system_stm32f7xx.c index e0b094bd4b..0fa02176e8 100644 --- a/src/main/target/system_stm32f7xx.c +++ b/src/main/target/system_stm32f7xx.c @@ -240,6 +240,17 @@ * @{ */ +void CopyFastCode(void) +{ +#ifdef USE_ITCM_RAM + /* Load functions into ITCM RAM */ + extern uint8_t tcm_code_start; + extern uint8_t tcm_code_end; + extern uint8_t tcm_code; + memcpy(&tcm_code_start, &tcm_code, (size_t) (&tcm_code_end - &tcm_code_start)); +#endif +} + /** * @brief Setup the microcontroller system * Initialize the Embedded Flash Interface, the PLL and update the