Skip to content

Commit

Permalink
rp2_common/pico_standard_link: linker script fixes (#1539)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mvds00 authored Jan 12, 2024
1 parent 73dce4e commit 4d19007
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/rp2_common/pico_standard_link/memmap_blocked_ram.ld
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,15 @@ SECTIONS
__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)
Expand Down Expand Up @@ -173,11 +178,6 @@ SECTIONS
/* __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__ = .;
Expand Down
12 changes: 6 additions & 6 deletions src/rp2_common/pico_standard_link/memmap_copy_to_ram.ld
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,15 @@ SECTIONS
. = 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)
Expand Down Expand Up @@ -175,11 +180,6 @@ SECTIONS
/* __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__ = .;
Expand Down
12 changes: 6 additions & 6 deletions src/rp2_common/pico_standard_link/memmap_default.ld
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,15 @@ SECTIONS
__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)
Expand Down Expand Up @@ -173,11 +178,6 @@ SECTIONS
/* __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__ = .;
Expand Down

0 comments on commit 4d19007

Please sign in to comment.