-
-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy path0066-RP2040-optimize-flash-ram-occupation.patch
65 lines (57 loc) · 2.43 KB
/
0066-RP2040-optimize-flash-ram-occupation.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 371bf34f0070753420c9629fd853a7beff992cc2 Mon Sep 17 00:00:00 2001
From: Martino Facchin <m.facchin@arduino.cc>
Date: Mon, 2 Aug 2021 10:23:43 +0200
Subject: [PATCH 066/157] RP2040: optimize flash/ram occupation
Since we are not using ROM functions here, just keep everything as default as possible
---
.../TOOLCHAIN_GCC_ARM/memmap_default.ld | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TOOLCHAIN_GCC_ARM/memmap_default.ld b/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TOOLCHAIN_GCC_ARM/memmap_default.ld
index d92bd42107..ec8bac7e40 100644
--- a/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TOOLCHAIN_GCC_ARM/memmap_default.ld
+++ b/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TOOLCHAIN_GCC_ARM/memmap_default.ld
@@ -27,9 +27,15 @@
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400
#endif
+#if !defined(PICO_FLASH_SIZE_BYTES)
+ /* This value is normally defined by the tools
+ to 0x1000 for bare metal and 0x400 for RTOS */
+ #define PICO_FLASH_SIZE_BYTES 2048k
+#endif
+
MEMORY
{
- FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2048k
+ FLASH(rx) : ORIGIN = 0x10000000, LENGTH = PICO_FLASH_SIZE_BYTES
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
@@ -70,11 +76,7 @@ SECTIONS
KEEP (*(.binary_info_header))
__binary_info_header_end = .;
KEEP (*(.reset))
- /* TODO revisit this now memset/memcpy/float in ROM */
- /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from
- * FLASH ... we will include any thing excluded here in .data below by default */
KEEP (*(.init))
- *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*)
*(.fini)
/* Pull all c'tors into .text */
*crtbegin.o(.ctors)
@@ -94,7 +96,6 @@ SECTIONS
} > FLASH
.rodata : {
- *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*)
. = ALIGN(4);
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*)))
. = ALIGN(4);
@@ -136,10 +137,6 @@ SECTIONS
*(.time_critical*)
- /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */
- *(.text*)
- . = ALIGN(4);
- *(.rodata*)
. = ALIGN(4);
*(.data*)
--
2.36.0