This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL2-RM57L: RAM size being calculated wrong in .CMD file

Part Number: LAUNCHXL2-RM57L
Other Parts Discussed in Thread: HALCOGEN

Hello all,

I am currently debugging some prefetch aborts that are happening within my FreeRTOS project and found out that the HALCoGen generated HL_sys_link.cmd file contains erroneous RAM size calculations:

Looking at the code above generated by HALCoGen, the RAM section boundaries would be:

 

Start: origin=(0x08004500+0x00000800) = 0x08004D00

End: origin + length = 0x08004D00 + (0x0007F800 - 0x00000800) = 0x08083D00

By looking at the Hercules RM57 memory map below, we can see that the calculated upper limit of RAM (0x08083D00) is out of bounds of the RAM part of memory (from 0x08000000 through 0x0807FFFFF). Please ignore the yellow color. The highlighted areas are the memory parts that have MPU regions created for them (does not have anything to do with this particular post).

So I guess my first question is, how is the 0x0007F800 number in this case calculated? I must have something else configured wrong in order for this number to get calculated erroneously.

Second question: What is the difference between changing the stack size in CCS (Properties > ARM Linker > Basic Options) vs changing it in HALCoGen? I know in HALCoGen you can change the space that gets allocated to each stack section, but what if you change the overall stack size in CCS and it does not match the overall stack size set in HALCoGen? Or viceversa?

I appreciate any help you can provide.

Thank you,

Surialic

  • Hell Surialic,

    Than you for pointing this bug out. I will ask SW team to correct it. The correct length should be 0x80000(SRAM size) -0x4500(Stacks )-0x800(KRAM) =0x7B300. The 0x7F800 is 0x80000 (SRAM size) - 0x800 (KRAM size).

    1. --stack_size=0x800 is defined in CCS linker options (your 2nd picture)
    2. The memory section used for stack is defined in cmd file (your 1st picture). This region should be >= --stack_size defined in CCS linker options. The stack_size should be bigger than the size used for all the modes (user, SVC, IRQ, abort,...)
    3. The starting address of stack in cmd file should be consistent with the starting address defined in sys_core.asm:

    userSp .word 0x08000000+0x00001000
    svcSp .word 0x08000000+0x00001000+0x00000100
    fiqSp .word 0x08000000+0x00001000+0x00000100+0x00000100
    irqSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100
    abortSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100+0x00000100
    undefSp .word 0x08000000+0x00001000+0x00000100+0x00000100+0x00000100+0x00000100+0x00000100
  • Hi QJ Wang,

    Thanks for your reply. It was very helpful. I have also noticed that whenever I regenerate the code with HALCoGen the .sysmem SECTIONS entry (from HL_sys_link.cmd) goes away and I have to re-add it manually. I don't remember having to do that with the other board I was using. Just pointing it out in case this is a bug as well.

    Thank you,

    Surialic
  • Hello Surialic,

    Please add your code in the user code section: