Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RP2040: fix OTA and binary size computation #950

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions mbed-os-to-arduino
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,6 @@ generate_flags () {
sed -i 's/LENGTH = 0x200000/LENGTH = CM4_BINARY_END - CM4_BINARY_START/g' "$ARDUINOVARIANT"/linker_script.ld
sed -i 's/LENGTH = 0x1c0000/LENGTH = CM4_BINARY_START - 0x8040000/g' "$ARDUINOVARIANT"/linker_script.ld
fi
if [[ $ARDUINOVARIANT == *NANO_RP2040* ]]; then
set +e
HAS_2NDSTAGE_SECTION=`grep second_stage_ota "$ARDUINOVARIANT"/linker_script.ld`
set -e
if [ x"$HAS_2NDSTAGE_SECTION" == x ]; then
echo "Adding second stage bootloader section to Nano RP2040 Connect"
SECOND_STAGE_SECTION=".second_stage_ota : {\n \
KEEP (*(.second_stage_ota))\n \
} > FLASH"
sed -i "s?.flash_begin?${SECOND_STAGE_SECTION}\n .flash_begin?g" $ARDUINOVARIANT/linker_script.ld
fi
fi
done
echo " done."
}
Expand Down
12 changes: 0 additions & 12 deletions mbed-os-to-arduino-macos
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,6 @@ generate_flags () {
gsed -i 's/LENGTH = 0x200000/LENGTH = CM4_BINARY_END - CM4_BINARY_START/g' "$ARDUINOVARIANT"/linker_script.ld
gsed -i 's/LENGTH = 0x1c0000/LENGTH = CM4_BINARY_START - 0x8040000/g' "$ARDUINOVARIANT"/linker_script.ld
fi
if [[ $ARDUINOVARIANT == *NANO_RP2040* ]]; then
set +e
HAS_2NDSTAGE_SECTION=`grep second_stage_ota "$ARDUINOVARIANT"/linker_script.ld`
set -e
if [ x"$HAS_2NDSTAGE_SECTION" == x ]; then
echo "Adding second stage bootloader section to Nano RP2040 Connect"
SECOND_STAGE_SECTION=".second_stage_ota : {\n \
KEEP (*(.second_stage_ota))\n \
} > FLASH"
gsed -i "s?.flash_begin?${SECOND_STAGE_SECTION}\n .flash_begin?g" $ARDUINOVARIANT/linker_script.ld
fi
fi
done
echo " done."
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 9819fef4bdb417e3ff9aee08266264b6ec23e075 Mon Sep 17 00:00:00 2001
From: pennam <m.pennasilico@arduino.cc>
Date: Wed, 11 Sep 2024 12:24:01 +0200
Subject: [PATCH 235/236] RP2040: add second_stage_ota section to linker script

- This was previously done inside mbed-os-to-arduino script
---
.../TARGET_RP2040/TOOLCHAIN_GCC_ARM/memmap_default.ld | 4 ++++
1 file changed, 4 insertions(+)

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 ec8bac7e40..8295f3269d 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
@@ -54,6 +54,10 @@ SECTIONS
__flash_binary_start = .;
} > FLASH

+ .second_stage_ota : {
+ KEEP (*(.second_stage_ota))
+ } > FLASH
+
.boot2 : {
__boot2_start__ = .;
KEEP (*(.boot2))
--
2.45.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 35b0d95199cb5b9cda593ce4b4029c4306906ccd Mon Sep 17 00:00:00 2001
From: pennam <m.pennasilico@arduino.cc>
Date: Wed, 11 Sep 2024 12:27:03 +0200
Subject: [PATCH 236/236] RP2040: add simbols to linker script to compute
.uninitialized_data section size

---
.../TARGET_RP2040/TOOLCHAIN_GCC_ARM/memmap_default.ld | 2 ++
1 file changed, 2 insertions(+)

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 8295f3269d..b748bab5fa 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
@@ -183,7 +183,9 @@ SECTIONS

.uninitialized_data (COPY): {
. = ALIGN(4);
+ __uninitialized_data_start__ = .;
*(.uninitialized_data*)
+ __uninitialized_data_end__ = .;
} > RAM

/* Start and end symbols must be word-aligned */
--
2.45.2

2 changes: 1 addition & 1 deletion variants/NANO_RP2040_CONNECT/conf/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"target_overrides": {
"*": {
"target.printf_lib": "std",
"target.macros_add": [ "MBEDTLS_ENTROPY_NV_SEED" ],
"target.macros_add": [ "MBEDTLS_ENTROPY_NV_SEED", "UNINITIALIZED_DATA_SECTION=1" ],
"platform.stdio-buffered-serial": false,
"platform.stdio-baud-rate": 115200,
"platform.default-serial-baud-rate": 115200,
Expand Down
Loading