Skip to content

Commit 110c82c

Browse files
committed
Move noinit to after BSS segment,
Now dynamically allocates noinit area size stores it after the bss before the heap and stack.
1 parent c9dedfd commit 110c82c

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

gcc_nrf52-mcuboot.ld

+5-9
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,21 @@
33
SEARCH_DIR(.)
44
GROUP(-lgcc -lc -lnosys)
55

6-
NOINIT_SIZE = 0x100;
7-
RAM_SIZE = 64K;
8-
96
MEMORY
107
{
118
FLASH (rx) : ORIGIN = 0x08020, LENGTH = 0x78000
12-
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = RAM_SIZE - NOINIT_SIZE
13-
NOINIT (rwx): ORIGIN = ORIGIN(RAM) + LENGTH(RAM), LENGTH = NOINIT_SIZE
9+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
1410
}
1511

1612
SECTIONS
1713
{
18-
noinit (NOLOAD):
14+
.noinit(NOLOAD):
1915
{
2016
PROVIDE(__start_noinit_data = .);
21-
KEEP(*(.noinit))
17+
*(.noinit)
2218
PROVIDE(__stop_noinit_data = .);
23-
} >NOINIT
24-
}
19+
} > RAM
20+
} INSERT AFTER .bss
2521

2622
SECTIONS
2723
{

gcc_nrf52.ld

+6-9
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,21 @@
33
SEARCH_DIR(.)
44
GROUP(-lgcc -lc -lnosys)
55

6-
NOINIT_SIZE = 0x100;
7-
RAM_SIZE = 64K;
8-
96
MEMORY
107
{
118
FLASH (rx) : ORIGIN = 0x00000, LENGTH = 0x78000
12-
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = RAM_SIZE - NOINIT_SIZE
13-
NOINIT (rwx): ORIGIN = ORIGIN(RAM) + LENGTH(RAM), LENGTH = NOINIT_SIZE
9+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
1410
}
1511

1612
SECTIONS
1713
{
18-
noinit (NOLOAD):
14+
.noinit(NOLOAD):
1915
{
2016
PROVIDE(__start_noinit_data = .);
21-
KEEP(*(.noinit))
17+
*(.noinit)
2218
PROVIDE(__stop_noinit_data = .);
23-
} >NOINIT
24-
}
19+
} > RAM
20+
} INSERT AFTER .bss
2521

2622
SECTIONS
2723
{
@@ -54,6 +50,7 @@ SECTIONS
5450
PROVIDE(__stop_log_filter_data = .);
5551
} > RAM
5652

53+
5754
} INSERT AFTER .data;
5855

5956
SECTIONS

0 commit comments

Comments
 (0)