arch: arm: Add symbol for flash used

Add symbol which contains the number of bytes contained
in the image.

Using '_image_rom_end' will not work, as there are
symbols loaded after its value.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
This commit is contained in:
Håkon Øye Amundsen 2018-11-29 12:12:19 +00:00 committed by Carles Cufí
commit d85efe0b10
2 changed files with 12 additions and 0 deletions

View file

@ -518,4 +518,13 @@ SECTIONS
KEEP(*(.gnu.attributes))
}
/* Must be last in romable region */
SECTION_PROLOGUE(.last_section,(NOLOAD),)
{
} GROUP_LINK_IN(ROMABLE_REGION)
/* To provide the image size as a const expression,
* calculate this value here. */
_flash_used = LOADADDR(.last_section) - _image_rom_start;
}

View file

@ -233,6 +233,9 @@ extern char _image_rom_start[];
extern char _image_rom_end[];
extern char _image_rom_size[];
/* Includes all ROMable data, i.e. the size of the output image file. */
extern char _flash_used[];
/* datas, bss, noinit */
extern char _image_ram_start[];
extern char _image_ram_end[];