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.

RM48 RAM Usage and loading Requirements

Other Parts Discussed in Thread: HALCOGEN

Hello,

We are running sample code on the HDK Board and we are considering whether we need an external SRAM or not.  The sample code we have includes configured Halcogen drivers and unit tests without any OS.  We noticed that in debug mode, the .out image is 670KB with the respective memory map.

MEMORY CONFIGURATION

name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
VECTORS 00000000 00000020 00000020 00000000 X
FLASH0 00000020 0017ffe0 000186a2 0016793e R X
FLASH1 00180000 00180000 00000000 00180000 R X
STACKS 08000000 00001e00 00000000 00001e00 RW
RAM 08001e00 0003e200 00000dd8 0003d428 RW


SEGMENT ALLOCATION MAP

run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
00000000 00000000 000186c8 000186c8 r-x
00000000 00000000 00000020 00000020 r-x .intvecs
00000020 00000020 00017844 00017844 r-x .text
00017868 00017868 00000c66 00000c66 r-- .const
000184d0 000184d0 000001f8 000001f8 r-- .cinit
08001e00 08001e00 00000ddc 00000000 rw-
08001e00 08001e00 00000a1c 00000000 rw- .bss
08002820 08002820 000003bc 00000000 rw- .data

Our release build is 609KB with the following memory map:

MEMORY CONFIGURATION

name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
VECTORS 00000000 00000020 00000020 00000000 X
FLASH0 00000020 0017ffe0 0000f55a 00170a86 R X
FLASH1 00180000 00180000 00000000 00180000 R X
STACKS 08000000 00001e00 00000000 00001e00 RW
RAM 08001e00 0003e200 00000dd8 0003d428 RW


SEGMENT ALLOCATION MAP

run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
00000000 00000000 0000f580 0000f580 r-x
00000000 00000000 00000020 00000020 r-x .intvecs
00000020 00000020 0000e6fc 0000e6fc r-x .text
0000e720 0000e720 00000c66 00000c66 r-- .const
0000f388 0000f388 000001f8 000001f8 r-- .cinit
08001e00 08001e00 00000ddc 00000000 rw-
08001e00 08001e00 00000a1c 00000000 rw- .bss
08002820 08002820 000003bc 00000000 rw- .data

How much of the program is actually loaded in RAM?  Is all of it loaded at boot?

Also, in regards to the debug image, would it load all of the debug symbols when debugging?  Is there a difference using XDS560 JTAG or XDS100v2?

Thanks.

  • Hello Ubaid,

    The linker follows your directive as defined in the linker command file. Given the above section allocation in the .map file, you have assigned .bss, .data and another (unnamed) section to the RAM (address 0x08000000 onwards). The "init" description of the segment allocation map shows how much of each section is loaded into the corresponding memory when you load the program. The actual executable code is part of the .text section and is loaded into flash memory, as per your linker command file directive.

    The debug image does keep all the debug symbols so that you can locate a variable in memory by its name. This symbol information is removed when making a "release" build.

    There is no difference in the way variables are accessed using either XDS560 or XDS100v2. It is a question of access/refresh speed.

    Regards,
    Sunil
  • Thanks Sunil,

    When you mention "linker command file ", are you referring to the linker command line found in the makefile? or sys_link.cmd that is auto-generated via HalcoGen?

    In sys_link.cmd, the following section configuration exists (which I assume is what you are referring to by "linker command file"):

    SECTIONS
    {
    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    This indciates only bss, data, and sysmem are loaded into ram, otherwise everything else goes to Flash.  I do not see any size information for bss, data, or sysmem in the segmentation allocation map.  Am I misunderstanding something?

    Based on your description of "init", the debug image loads a total of  97KB into BOTH RAM and Flash, and the release image loads a total of 61KB into BOTH RAM and Flash.  Is this correct?

    I am assuming I do not include the first row under the segment allocation map.  That first row for "init" column is the summation of all segments, correct?

    Thanks

    Ubaid