riscv: linker: correct _image_rom_size symbol info

This makes the _image_rom_size provide correct actual ROM image size.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
This commit is contained in:
Dino Li 2021-08-17 16:08:22 +08:00 committed by Christopher Friedt
commit 7c2dfc1558

View file

@ -188,8 +188,6 @@ SECTIONS
#include <linker/cplusplus-rom.ld>
_image_rodata_end = .;
MPU_ALIGN(_image_rodata_end - _image_rom_start);
_image_rom_end = .;
_image_rom_size = _image_rom_end - _image_rom_start;
GROUP_END(ROMABLE_REGION)
GROUP_START(RAMABLE_REGION)
@ -343,4 +341,14 @@ GROUP_END(DTCM)
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. */
_image_rom_end = LOADADDR(.last_section);
_image_rom_size = _image_rom_end - _image_rom_start;
}