Fix build for N0100 and legacy N0110

This commit is contained in:
Yaya-Cout
2025-01-03 18:32:20 +01:00
parent d6831e46bf
commit 0c3506d85d
6 changed files with 18 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ ion_device_src += $(addprefix ion/src/device/bootloader/drivers/, \
board.cpp \ board.cpp \
cache.cpp \ cache.cpp \
external_flash_tramp.cpp \ external_flash_tramp.cpp \
storage.cpp \
led.cpp \ led.cpp \
power.cpp \ power.cpp \
reset.cpp \ reset.cpp \

View File

@@ -58,7 +58,7 @@ SECTIONS {
} > FLASH } > FLASH
.recovery_boot : { .recovery_boot : {
. = ORIGIN(FLASH) + USERLAND_OFFSET + 0x100; . = ORIGIN(FLASH) + USERLAND_OFFSET + 0x80;
KEEP(*(.recovery_boot)); KEEP(*(.recovery_boot));
} >FLASH } >FLASH

View File

@@ -0,0 +1,10 @@
#include <ion/storage.h>
namespace Ion {
// TODO: Check if the storage is initialized at runtime and not at compile time:
// As far as I can see, it break build for N0110 legacy internal storage and
// N0100 due to lack of storage, so it's probably wasting space.
uint32_t __attribute__((section(".static_storage"))) staticStorageArea[sizeof(Storage)/sizeof(uint32_t)] = {0};
}

View File

@@ -71,6 +71,7 @@ SECTIONS {
*(.text.__assert) *(.text.__assert)
*(.text.memcpy) *(.text.memcpy)
*(.text.memset) *(.text.memset)
*(.text.__udivmoddi4)
/* /*
*(.text.strlen) *(.text.strlen)
*(.text.strncmp) *(.text.strncmp)

View File

@@ -23,10 +23,10 @@ MEMORY {
* overwritten (for instance, vtables that live in the .rodata section). */ * overwritten (for instance, vtables that live in the .rodata section). */
/* The image is quite large too! /* The image is quite large too!
* So we put the stack to 18K so there's still space * So we put the stack to 17K so there's still space
* for our image, if not LD will throw an error. */ * for our image, if not LD will throw an error. */
STACK_SIZE = 18K; STACK_SIZE = 17K;
SECTIONS { SECTIONS {
.isr_vector_table ORIGIN(RAM_BUFFER) : { .isr_vector_table ORIGIN(RAM_BUFFER) : {

View File

@@ -6,7 +6,9 @@
namespace Ion { namespace Ion {
uint32_t __attribute__((section(".static_storage"))) staticStorageArea[sizeof(Storage)/sizeof(uint32_t)] = {0}; // Declaration for N0110 with bootloader is in ion/src/device/bootloader/drivers/storage.cpp
// to fix LD build
__attribute__((weak)) uint32_t staticStorageArea[sizeof(Storage)/sizeof(uint32_t)] = {0};
Storage * Storage::sharedStorage() { Storage * Storage::sharedStorage() {
static Storage * storage = new (staticStorageArea) Storage(); static Storage * storage = new (staticStorageArea) Storage();