STM32H7 ITCM testing for improved performance
Hi all,
EDIT:
Intention,
I would like to test if there is any performance gain to be had by running functions tat are called inside interrupts from ITCMRAM rather than flash on an STM32H7 MCU.
I'm working with an STM32H7 nucleo 144 board. I have some functions I would like to test running from ITCM RAM rather than FLASH but I'm having some issues. I have managed to set up my linker script to place one of my function in the ITCMRAM memory section, then using linker symbols and memcpy, copy the function from FLASH to the ITCMRAM area at the start if the main function.
I'm using Atollic TrueStudio.
I know the function works, but when I try to run it from ITCMRAM I get a hard fault caused by an attempt to execute and undefined instruction. Does anyone know what would cause this? Below is the C and disassembly that is causing the fault. This occurs with optimisation off and on. there is something going on with the copy from flash to ram but I don't understand what it could be.
Any help would be great.
Thanks
Rob
C
if (signals->I_term_reset == 1)
Disassembly in ITCM area when running from ITCM
; <UNDEFINED> instruction: 0xb890Disassembly in FLASH load address area
when running from ITCMldrb.w r5, [r0, &sharp36] ; 0x24
Disassembly when running normally from FLASH
ldrb.w r5, [r0, &sharp36] ; 0x24
EDIT: THIS IS WRONG!
I have found that after the copy, the ITCMRAM code is correct. Its not until the function stored in ITCMRAM is entered that the data becomes corrupt.
EDIT:
Using a watch point I have found that when the __HAL_UNLOCK macro is used the ITCMRAM address where the error is occurring is being modified.
#stm32h7 #stm32 #itcm