when i use the ITCM of stm32h743,in linkscript,i add new section as:
_sitcm_addr = LOADADDR(.ItcmRam); _svtor_addr = LOADADDR(.isr_vector); _vtor_size = 0x400; /*SIZEOF (.isr_vector)*/ .ItcmRam : { . = _vtor_size; /*reserved for vector table*/ . = ALIGN(4); _sitcm = .; /* create a global symbol at ITCM start */ *(.ItcmRam); /* ram_itcm */ . = ALIGN(4); _eitcm = .; /* define a global symbol at ITCM end */ } >ITCMRAM AT> FLASH
where ITCMRAM in memory
MEMORY{DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128KRAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512KRAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288KRAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64KITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64KFLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K}
in startup file ,i copy .ItcmRam section content in flash to itcm ram after .bss section,like this
CopyItcmInit: ldr r3, =_sitcm_addr ldr r3, [r3, r1] str r3, [r0, r1] adds r1, r1, #4LoopCopyItcmInit: ldr r0, =_sitcm ldr r3, =_eitcm adds r2, r0, r1 cmp r2, r3 bcc CopyItcmInit
in source file ,i make some function in ItcmRam section like
void TestItcm(void) __attribute__((section(".ItcmRam")));
in main(){
TestBF();
TestItcm();
TestAF()
}
it works right that can go into the function TestItcm,but then can not get back to main to run the next TestAf function
in the TestItcm function ,it works correctly untill return , and not retrun to main instead of into "HardFault_Handler".
IS there some method to use stm32h7x's itcm ram with GCC? thanks!