rp2_common/pico_standard_link: linker script fixes (#1539)
The resulting elf binaries contained an unusual section that leads to an error
when objcopy attempts to update a section (e.g. when using the picowota
combined build mechanism).
This seemed to be due to the order of sections, where two RAM-only sections
were split by a RAM/FLASH section. By moving the RAM-only sections together,
this issue disappeared.
diff --git a/src/rp2_common/pico_standard_link/memmap_blocked_ram.ld b/src/rp2_common/pico_standard_link/memmap_blocked_ram.ld
index e9142d2..52384e1 100644
--- a/src/rp2_common/pico_standard_link/memmap_blocked_ram.ld
+++ b/src/rp2_common/pico_standard_link/memmap_blocked_ram.ld
@@ -117,10 +117,15 @@
__binary_info_end = .;
. = ALIGN(4);
- .ram_vector_table (NOLOAD): {
+ .ram_vector_table (NOLOAD): {
*(.ram_vector_table)
} > RAM
+ .uninitialized_data (NOLOAD): {
+ . = ALIGN(4);
+ *(.uninitialized_data*)
+ } > RAM
+
.data : {
__data_start__ = .;
*(vtable)
@@ -173,11 +178,6 @@
/* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */
__etext = LOADADDR(.data);
- .uninitialized_data (NOLOAD): {
- . = ALIGN(4);
- *(.uninitialized_data*)
- } > RAM
-
/* Start and end symbols must be word-aligned */
.scratch_x : {
__scratch_x_start__ = .;
diff --git a/src/rp2_common/pico_standard_link/memmap_copy_to_ram.ld b/src/rp2_common/pico_standard_link/memmap_copy_to_ram.ld
index ea81cec..1d7e514 100644
--- a/src/rp2_common/pico_standard_link/memmap_copy_to_ram.ld
+++ b/src/rp2_common/pico_standard_link/memmap_copy_to_ram.ld
@@ -96,10 +96,15 @@
. = ALIGN(4);
/* Vector table goes first in RAM, to avoid large alignment hole */
- .ram_vector_table (NOLOAD): {
+ .ram_vector_table (NOLOAD): {
*(.ram_vector_table)
} > RAM
+ .uninitialized_data (NOLOAD): {
+ . = ALIGN(4);
+ *(.uninitialized_data*)
+ } > RAM
+
.text : {
__ram_text_start__ = .;
*(.init)
@@ -175,11 +180,6 @@
/* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */
__etext = LOADADDR(.data);
- .uninitialized_data (NOLOAD): {
- . = ALIGN(4);
- *(.uninitialized_data*)
- } > RAM
-
/* Start and end symbols must be word-aligned */
.scratch_x : {
__scratch_x_start__ = .;
diff --git a/src/rp2_common/pico_standard_link/memmap_default.ld b/src/rp2_common/pico_standard_link/memmap_default.ld
index e85b327..b4dadfc 100644
--- a/src/rp2_common/pico_standard_link/memmap_default.ld
+++ b/src/rp2_common/pico_standard_link/memmap_default.ld
@@ -117,10 +117,15 @@
__binary_info_end = .;
. = ALIGN(4);
- .ram_vector_table (NOLOAD): {
+ .ram_vector_table (NOLOAD): {
*(.ram_vector_table)
} > RAM
+ .uninitialized_data (NOLOAD): {
+ . = ALIGN(4);
+ *(.uninitialized_data*)
+ } > RAM
+
.data : {
__data_start__ = .;
*(vtable)
@@ -173,11 +178,6 @@
/* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */
__etext = LOADADDR(.data);
- .uninitialized_data (NOLOAD): {
- . = ALIGN(4);
- *(.uninitialized_data*)
- } > RAM
-
/* Start and end symbols must be word-aligned */
.scratch_x : {
__scratch_x_start__ = .;