I have a working and a not-working configuration for my project (linker settings) First lets see what it mean in the mapfile:
================================================================================ Removing Unused input sections from the image. Removing startup.o(RESET), (272 bytes). 1 unused section(s) (total 272 bytes) removed from the image. ================================================================================
================================================================================ Memory Map of the image Image Entry point : 0x00000000 Load Region LR_1 (Base: 0x00000000, Size: 0x00000a9c, Max: 0xffffffff, ABSOLUTE) Execution Region ER_RO (Base: 0x00000000, Size: 0x00000a94, Max: 0xffffffff, ABSOLUTE) Base Addr Size Type Attr Idx E Section Name Object 0x00000000 0x00000008 Code RO 78 * !!!main __main.o(c_t__un.l) 0x00000008 0x00000038 Code RO 120 !!!scatter __scatter.o(c_t__un.l) 0x00000040 0x00000028 Code RO 122 !!handler_copy __scatter_copy.o(c_t__un.l) 0x00000068 0x0000002c Code RO 124 !!handler_zi __scatter_zi.o(c_t__un.l) 0x00000094 0x00000004 Ven RO 100 .emb_text lib_init.o(c_t__un.l) 0x00000098 0x00000010 Code RO 100 .emb_text lib_init.o(c_t__un.l) 0x000000a8 0x00000020 Code RO 4 .text startup.o 0x000000c8 0x00000048 Code RO 10 .text retarget.o 0x00000110 0x0000010c Code RO 35 .text lpcx.o 0x0000021c 0x00000074 Code RO 55 .text serial.o 0x00000290 0x00000004 Code RO 69 .text use_no_semi.o(c_t__un.l)
================================================================================ Memory Map of the image Image Entry point : 0x00000110 Load Region LR_IROM1 (Base: 0x00000000, Size: 0x00000bac, Max: 0x00080000, ABSOLUTE) Execution Region ER_IROM1 (Base: 0x00000000, Size: 0x00000ba4, Max: 0xffffffff, ABSOLUTE) Base Addr Size Type Attr Idx E Section Name Object 0x00000000 0x00000110 Code RO 3 RESET startup.o 0x00000110 0x00000008 Code RO 78 * !!!main __main.o(c_t__un.l) 0x00000118 0x00000038 Code RO 120 !!!scatter __scatter.o(c_t__un.l) 0x00000150 0x00000028 Code RO 122 !!handler_copy __scatter_copy.o(c_t__un.l) 0x00000178 0x0000002c Code RO 124 !!handler_zi __scatter_zi.o(c_t__un.l) 0x000001a4 0x00000004 Ven RO 100 .emb_text lib_init.o(c_t__un.l) 0x000001a8 0x00000010 Code RO 100 .emb_text lib_init.o(c_t__un.l) 0x000001b8 0x00000020 Code RO 4 .text startup.o 0x000001d8 0x00000048 Code RO 10 .text retarget.o 0x00000220 0x0000010c Code RO 35 .text lpcx.o 0x0000032c 0x00000074 Code RO 55 .text serial.o 0x000003a0 0x00000004 Code RO 69 .text use_no_semi.o(c_t__un.l)
We recommend to use a scatter file. When you specify a scatter file then you need for the RESET section a first directive. This directive avoids that the segment is marked as unused.
LR_IROM1 0x00000000 0x00040000 { ; load region ER_IROM1 0x00000000 { ; load address = execution address *.o (RESET, +First) * (+RO) } RW_IRAM1 0x40000000 0x00004000 { ; RW data * (+RW +ZI) } }