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.

TM4C129EKCPDT: size of binary image

Part Number: TM4C129EKCPDT

Hello,

I am new to CCS. I am trying to find a way to create a global symbol in the link command file to represent the highest allocated flash memory address (which will equal to the image size  - 1) so that I can reference this value in my code. Such as:

extern DWORD __IMAGE_SIZE;
#pragma DATA_SECTION(Header, ".imgheader")
const IMG_HEADER Header = {
        (DWORD)&__IMAGE_SIZE,

        __DATE__,
        __TIME__,
};

This is my link command file:

--retain=g_pfnVectors
--retain=Header

MEMORY
{
    FLASH (RX) : origin = 0x00000000, length = 0x00008000
    SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}

SECTIONS
{
    .intvecs:   > 0x00000000
    .imgheader:    > 0x00000200
    .text   :   > FLASH
    .const  :   > FLASH
    .cinit  :   > FLASH
    .pinit  :   > FLASH
    .init_array : > FLASH
    .dummy : > FLASH
        {
            __IMAGE_SIZE = .;
        }

    .vtable :   > 0x20000000
    .data   :   > SRAM
    .bss    :   > SRAM
    .sysmem :   > SRAM
    .stack  :   > SRAM
}

__STACK_TOP = __stack + 512;

I was trying to get the pointer value if .dummy section was last allocated and this value will be the size of binary image (the binary image is generated by post compilation command). But this method does not work since nothing is allocated for .dummy section, the value of __IMAGE_SIZE is 0.

My question is, what is the proper method to get the binary size at link time?