Skip to content

Commit 0bd14a1

Browse files
committed
RP2040: optimize flash/ram occupation
Since we are not using ROM functions here, just keep everything as default as possible
1 parent f01600a commit 0bd14a1

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

targets/TARGET_RASPBERRYPI/TARGET_RP2040/TOOLCHAIN_GCC_ARM/memmap_default.ld

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@
2727
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400
2828
#endif
2929

30+
#if !defined(PICO_FLASH_SIZE_BYTES)
31+
/* This value is normally defined by the tools
32+
to 0x1000 for bare metal and 0x400 for RTOS */
33+
#define PICO_FLASH_SIZE_BYTES 2048k
34+
#endif
35+
3036
MEMORY
3137
{
32-
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2048k
38+
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = PICO_FLASH_SIZE_BYTES
3339
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
3440
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
3541
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
@@ -70,11 +76,7 @@ SECTIONS
7076
KEEP (*(.binary_info_header))
7177
__binary_info_header_end = .;
7278
KEEP (*(.reset))
73-
/* TODO revisit this now memset/memcpy/float in ROM */
74-
/* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from
75-
* FLASH ... we will include any thing excluded here in .data below by default */
7679
KEEP (*(.init))
77-
*(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*)
7880
*(.fini)
7981
/* Pull all c'tors into .text */
8082
*crtbegin.o(.ctors)
@@ -94,7 +96,6 @@ SECTIONS
9496
} > FLASH
9597

9698
.rodata : {
97-
*(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*)
9899
. = ALIGN(4);
99100
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*)))
100101
. = ALIGN(4);
@@ -136,10 +137,6 @@ SECTIONS
136137

137138
*(.time_critical*)
138139

139-
/* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */
140-
*(.text*)
141-
. = ALIGN(4);
142-
*(.rodata*)
143140
. = ALIGN(4);
144141

145142
*(.data*)

0 commit comments

Comments
 (0)