Skip to content

Commit 98d1de0

Browse files
committed
Linker script: Update gcc_nrf52.ld to reflect changes done in gcc_nrf52-mcuboot.ld.
The only change between the 2 linker scripts is the ORIGIN address of the flash memory allocated to InfiniTime. The MCUBoot one starts at 0x8000, which is the address that will be loaded by MCUBoot after the boot process. This linker script allow to run the application without MCUBoot by setting the origin address to 0x00. The APP_SIZE is the same for both linker scripts, but it could be set to a higher value in this one for development purposes.
1 parent cfc86d7 commit 98d1de0

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

gcc_nrf52.ld

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
1-
/* Linker script to configure memory regions. */
1+
/****************************************************************
2+
* Memory map configuration for using application with MCU-boot *
3+
****************************************************************/
4+
/*
5+
* Internal nRF52 flash memory:
6+
* 0x00000000: MCUBoot(28 kB)
7+
* 0x00007000: Reboot logs (4 kB)
8+
* 0x00008000: MCUBoot header (32 bytes)
9+
* 0x00008020: Application (463+ kB)
10+
* 0x0007be50: MCUBoot image trailer (432 bytes)
11+
* 0x0007c000: MCUBoot Scratch partition (4 kB)
12+
* 0x0007d000: unused (12 kB)
13+
*
14+
* SPI flash:
15+
* 0x00000000: Bootloader Assets, like Boot Graphic (256 kB)
16+
* 0x00040000: Application 2 (including MCUBoot header) (464 kB)
17+
* 0x000b4000: User files - littlefs (3376 kB)
18+
*
19+
* This linker script sets the origin of the application at 0x00
20+
* which means that the application must be linked with a start
21+
* address at 0x00 and that it'll overwrite the bootloader.
22+
* This is very practical when debugging and testing on
23+
* the hardware with a SWD probe.
24+
*/
225

326
SEARCH_DIR(.)
427
GROUP(-lgcc -lc -lnosys)
528

29+
MCUBOOT_SIZE = 0x8000;
30+
SCRATCH_SIZE = 0x1000;
31+
TLV_SIZE = 0x28; /* Metadata added by imgtool at the end of the image */
32+
SCRATCH_OFFSET = 0x7c000;
33+
MCUBOOT_APP_IMAGE_HEADER_SIZE = 0x20;
34+
MCUBOOT_APP_IMAGE_TRAILER_SIZE = 0x1b0;
35+
APP_OFFSET = 0x00;
36+
APP_SIZE = SCRATCH_OFFSET - MCUBOOT_SIZE - MCUBOOT_APP_IMAGE_HEADER_SIZE - MCUBOOT_APP_IMAGE_TRAILER_SIZE - TLV_SIZE;
37+
638
MEMORY
739
{
8-
FLASH (rx) : ORIGIN = 0x00000, LENGTH = 0x78000
40+
/* MCUBOOT (r) : ORIGIN = 0x0, LENGTH = MCUBOOT_SIZE */
41+
FLASH (rx) : ORIGIN = APP_OFFSET, LENGTH = APP_SIZE
42+
/* SCRATCH (r) : ORIGIN = SCRATCH_OFFSET, LENGTH = SCRATCH_SIZE */
43+
SPARE_SPACE (r) : ORIGIN = SCRATCH_OFFSET + SCRATCH_SIZE, LENGTH = 12K
944
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
1045
}
1146

0 commit comments

Comments
 (0)