Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move all symbol definitions to the end of the linker script.

  • Loading branch information...
commit ea5e0f005aee02f87124cbe40f2f0b855d97c89e 1 parent 84bafc9
David Anderson authored
Showing with 39 additions and 38 deletions.
  1. +39 −38 nxos/systems/appkernel.lds
View
77 nxos/systems/appkernel.lds
@@ -40,9 +40,6 @@ RAM_SIZE = 64k;
SAMBA_RESERVED_SIZE = 8k;
SECTIONS {
- SAM_ONLY __boot_from_samba__ = 1;
- ROM_ONLY __boot_from_samba__ = 0;
-
/*
* Interrupt vectors. These are loaded to the bottom of memory at
* boot time.
@@ -52,11 +49,6 @@ SECTIONS {
} > vector_ram
ROM_ONLY AT> rom
- __vectors_ram_start__ = ADDR(.vectors);
- __vectors_ram_end__ = (ADDR(.vectors) + SIZEOF(.vectors));
- __vectors_load_start__ = LOADADDR(.vectors);
- __vectors_load_end__ = (LOADADDR(.vectors) + SIZEOF(.vectors));
-
/*
* This section contains code that is relocated to RAM before
@@ -73,11 +65,6 @@ SECTIONS {
} > ram
ROM_ONLY AT> rom
- __ramtext_ram_start__ = ADDR(.ram_text);
- __ramtext_ram_end__ = ADDR(.ram_text) + SIZEOF(.ram_text);
- __ramtext_load_start__ = LOADADDR(.ram_text);
- __ramtext_load_end__ = __ramtext_load_start__ + SIZEOF(.ram_text) ;
-
/*
* Read/Write initialized data. Runs from RAM, gets copied there
@@ -89,11 +76,6 @@ SECTIONS {
} > ram
ROM_ONLY AT> rom
- __data_ram_start__ = ADDR(.data);
- __data_ram_end__ = ADDR(.data) + SIZEOF(.data);
- __data_load_start__ = LOADADDR(.data);
- __data_load_end__ = __data_load_start__ + SIZEOF(.data) ;
-
/*
* The main kernel executable code, as well as all the read-only
@@ -108,11 +90,6 @@ SECTIONS {
ROM_ONLY > rom
SAM_ONLY > ram
- ROM_ONLY __rom_userspace_start__ = ADDR(.text) + SIZEOF(.text);
- SAM_ONLY __rom_userspace_start__ = 0;
-
- __text_start__ = ADDR(.text);
- __text_end__ = ADDR(.text) + SIZEOF(.text);
/*
* The BSS section is zero-initialized data. The section does not
@@ -126,9 +103,6 @@ SECTIONS {
__bss_end__ = . ;
} > ram
- __bss_start__ = ADDR(.bss);
- __bss_end__ = (ADDR(.bss) + SIZEOF(.bss));
-
/*
* The various kernel stacks.
@@ -151,24 +125,12 @@ SECTIONS {
__supervisor_stack_top__ = . ;
} > ram
- __stack_start__ = ADDR(.stack);
- __stack_end__ = (ADDR(.stack) + SIZEOF(.stack));
-
- SAM_ONLY __kernel_ram_load_size__ = SIZEOF(.vectors) + SIZEOF(.ram_text) +
- SAM_ONLY SIZEOF(.text) + SIZEOF(.data);
/* SAMBA stage 0.5 */
SAM_ONLY .samba_boot ADDR(.bss) : {
SAM_ONLY KEEP(base/samba_init.o(.samba_init));
SAM_ONLY }
- /*
- * Variables defined to inform the kernel of how much RAM remains
- * behind the loaded kernel.
- */
- /* TODO: fix these values. */
- __userspace_start__ = __stack_end__;
- __userspace_end__ = (RAM_BASE + RAM_SIZE);
/*
* The magic metadata struct is tacked onto the start of the kernel binary.
@@ -204,4 +166,43 @@ SECTIONS {
/DISCARD/ : {
* (*);
}
+
+ /*
+ * Symbol definitions for the use of the kernel code.
+ */
+ SAM_ONLY __boot_from_samba__ = 1;
+ ROM_ONLY __boot_from_samba__ = 0;
+
+ __vectors_ram_start__ = ADDR(.vectors);
+ __vectors_ram_end__ = (ADDR(.vectors) + SIZEOF(.vectors));
+ __vectors_load_start__ = LOADADDR(.vectors);
+ __vectors_load_end__ = (LOADADDR(.vectors) + SIZEOF(.vectors));
+
+ __ramtext_ram_start__ = ADDR(.ram_text);
+ __ramtext_ram_end__ = ADDR(.ram_text) + SIZEOF(.ram_text);
+ __ramtext_load_start__ = LOADADDR(.ram_text);
+ __ramtext_load_end__ = __ramtext_load_start__ + SIZEOF(.ram_text) ;
+
+ __data_ram_start__ = ADDR(.data);
+ __data_ram_end__ = ADDR(.data) + SIZEOF(.data);
+ __data_load_start__ = LOADADDR(.data);
+ __data_load_end__ = __data_load_start__ + SIZEOF(.data) ;
+
+ ROM_ONLY __rom_userspace_start__ = ADDR(.text) + SIZEOF(.text);
+ SAM_ONLY __rom_userspace_start__ = 0;
+
+ __text_start__ = ADDR(.text);
+ __text_end__ = ADDR(.text) + SIZEOF(.text);
+
+ __bss_start__ = ADDR(.bss);
+ __bss_end__ = (ADDR(.bss) + SIZEOF(.bss));
+
+ __stack_start__ = ADDR(.stack);
+ __stack_end__ = (ADDR(.stack) + SIZEOF(.stack));
+
+ SAM_ONLY __kernel_ram_load_size__ = SIZEOF(.vectors) + SIZEOF(.ram_text) +
+ SAM_ONLY SIZEOF(.text) + SIZEOF(.data);
+
+ __userspace_start__ = __stack_end__;
+ __userspace_end__ = (RAM_BASE + RAM_SIZE);
}
Please sign in to comment.
Something went wrong with that request. Please try again.