@@ -2,7 +2,7 @@ ENTRY(ram64_start)
2
2
3
3
PHDRS
4
4
{
5
- program PT_LOAD FILEHDR PHDRS ;
5
+ ram PT_LOAD FILEHDR PHDRS ;
6
6
}
7
7
8
8
/* Loaders like to put stuff in low memory (< 1M), so we don't use it. */
@@ -13,16 +13,26 @@ stack_size = 64K;
13
13
14
14
SECTIONS
15
15
{
16
- /* Mapping in the program headers makes it easier to mmap the whole file. */
16
+ /* Mapping the program headers into RAM makes the file smaller . */
17
17
. = ram_min;
18
18
. += SIZEOF_HEADERS ;
19
19
20
- .rodata : { *(.rodata .rodata.*) } :program
21
- .text : { *(.text .text.*) } :program
22
- .data : { *(.data .data.*) } :program
23
- .bss : { *(.bss .bss.*) } :program
20
+ /* These sections are mapped into RAM from the file. Omitting :ram from
21
+ later sections avoids emitting empty sections in the final binary. */
22
+ data_start = .;
23
+ .rodata : { *(.rodata .rodata.*) } :ram
24
+ .text : { *(.text .text.*) }
25
+ .data : { *(.data .data.*) }
26
+ data_size = . - data_start;
24
27
25
- firmware_ram_size = . - ram_min;
28
+ /* The BSS section isn't mapped from any file data. It is simply zeroed
29
+ in RAM. So our file size should be computed from here. */
30
+ file_size = . - ram_min;
31
+ .bss : {
32
+ bss_start = .;
33
+ *(.bss .bss.*)
34
+ bss_size = . - bss_start;
35
+ }
26
36
27
37
ASSERT ((. <= ram_max - stack_size), "firmware size too big for RAM region")
28
38
0 commit comments