-
Notifications
You must be signed in to change notification settings - Fork 0
/
elf2uf2.diff
23 lines (22 loc) · 1.51 KB
/
elf2uf2.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/tools/elf2uf2/main.cpp b/tools/elf2uf2/main.cpp
index 77e67c7..d5d4493 100644
--- a/tools/elf2uf2/main.cpp
+++ b/tools/elf2uf2/main.cpp
@@ -81,6 +81,7 @@ const address_ranges rp2040_address_ranges_flash {
const address_ranges rp2040_address_ranges_ram {
address_range(MAIN_RAM_START, MAIN_RAM_END, address_range::type::CONTENTS),
+ address_range(MAIN_RAM_BANKED_START, MAIN_RAM_BANKED_END, address_range::type::CONTENTS),
address_range(XIP_SRAM_START, XIP_SRAM_END, address_range::type::CONTENTS),
address_range(ROM_START, ROM_END, address_range::type::IGNORE) // for now we ignore the bootrom if present
};
@@ -269,7 +270,9 @@ int elf2uf2(FILE *in, FILE *out) {
uint32_t expected_ep_main_ram = UINT32_MAX;
uint32_t expected_ep_xip_sram = UINT32_MAX;
for(auto& page_entry : pages) {
- if ( ((page_entry.first >= MAIN_RAM_START) && (page_entry.first < MAIN_RAM_END)) && (page_entry.first < expected_ep_main_ram) ) {
+ if ( (((page_entry.first >= MAIN_RAM_START) && (page_entry.first < (MAIN_RAM_END - 0x2000)))
+ ||((page_entry.first >= MAIN_RAM_BANKED_START) && (page_entry.first < (MAIN_RAM_BANKED_END))))
+ && (page_entry.first < expected_ep_main_ram) ) {
expected_ep_main_ram = page_entry.first | 0x1;
} else if ( ((page_entry.first >= XIP_SRAM_START) && (page_entry.first < XIP_SRAM_END)) && (page_entry.first < expected_ep_xip_sram) ) {
expected_ep_xip_sram = page_entry.first | 0x1;