cancel
Showing results for 
Search instead for 
Did you mean: 

How can Gcc work with itcm of stm32h7x

iidio.1
Associate

when i use the ITCM of stm32h743 with arm gcc ,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 = 128K

RAM_D1 (xrw)     : ORIGIN = 0x24000000, LENGTH = 512K

RAM_D2 (xrw)     : ORIGIN = 0x30000000, LENGTH = 288K

RAM_D3 (xrw)     : ORIGIN = 0x38000000, LENGTH = 64K

ITCMRAM (xrw)     : ORIGIN = 0x00000000, LENGTH = 64K

FLASH (rx)     : ORIGIN = 0x8000000, LENGTH = 2048K

}

in startup file ,i copy .ItcmRam section content from 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, #4

LoopCopyItcmInit:

 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"),__long_call__));

in main(){

TestBF();

TestItcm();

TestAF()

}

it works right that can go into the function TestItcm,but no code to run

00000400:  movs   r0, r0

00000402:  movs   r0, r0

00000404:  movs   r0, r0

00000406:  movs   r0, r0

00000408:  movs   r0, r0

0000040a:  movs   r0, r0

0000040c:  movs   r0, r0

0000040e:  movs   r0, r0

00000410:  movs   r0, r0

00000412:  movs   r0, r0

 74      }

in map flie ,i can see

.ItcmRam       0x0000000000000000     0x420 load address 0x00000000080088ac

               0x0000000000000400               . = _vtor_size

 *fill*        0x0000000000000000     0x400

               0x0000000000000400               . = ALIGN (0x4)

               0x0000000000000400               _sitcm = .

 *(.ItcmRam)

 .ItcmRam      0x0000000000000400      0x20 ./Src/main.o

               0x0000000000000400               TestItcm

               0x0000000000000420               . = ALIGN (0x4)

               0x0000000000000420               _eitcm = .

.rel.dyn       0x0000000000000420       0x0 load address 0x0000000008008ccc

 .rel.iplt     0x0000000000000420       0x0 /usr/lib/gcc/arm-none-eabi/10.2.0/thumb/v7e-m+dp/hard/crtbegin.o

pc is jumped to itcm at 0x400,but no code in flash address of 0x00000000080088ac

debug like this

080088a9:  movs   r0, r2

080088ab:  movs   r0, r0

080088ad:  movs   r0, r0

080088af:  movs   r0, r0

080088b1:  movs   r0, r0

080088b3:  movs   r0, r0

080088b5:  movs   r0, r0

080088b7:  movs   r0, r0

080088b9:  movs   r0, r0

080088bb:  movs   r0, r0

080088bd:  movs   r0, r0

080088bf:  movs   r0, r0

IS there some method to use stm32h7x's itcm ram with GCC? thanks!

0 REPLIES 0