[platformInfo] Hardcode recovery boot address to fix build on GCC 13+

This commit is contained in:
Yaya-Cout
2024-12-29 11:57:44 +01:00
parent 4c26e846d3
commit b6d5bda120
4 changed files with 16 additions and 9 deletions

View File

@@ -44,7 +44,7 @@ const bool UserlandHeader::hasUpsilonExtras() const {
return m_upsilonExtraMagicHeader == UpsilonExtraMagic && m_upsilonExtraMagicFooter == UpsilonExtraMagic;
}
const uint16_t UserlandHeader::getExtraVersion() const {
const uint32_t UserlandHeader::getExtraVersion() const {
return m_extraVersion;
}

View File

@@ -138,7 +138,7 @@ void __attribute__((noinline)) start() {
void __attribute__((noinline)) __attribute__((section(".recovery_boot"))) __attribute__((used)) recovery_start() {
// Here we are in the recovery boot.
Ion::Device::Board::initFPU();
bool is_recoverying = Ion::Device::BootloaderSharedData::sharedBootloaderData()->storageAddress() != 0;
if (is_recoverying) {
@@ -146,7 +146,7 @@ void __attribute__((noinline)) __attribute__((section(".recovery_boot"))) __attr
uint32_t size = Ion::Device::BootloaderSharedData::sharedBootloaderData()->storageSize();
size_t storageSize = (&_static_storage_end - &_static_storage_start);
memcpy(&_static_storage_start, (void*)address, size);
size_t dataSectionLength = (&_data_section_end_ram - &_data_section_start_ram);
@@ -160,7 +160,7 @@ void __attribute__((noinline)) __attribute__((section(".recovery_boot"))) __attr
size_t bssSectionLength = (&_bss_section_end_ram - &_bss_section_start_ram);
memset(&_bss_section_start_ram, 0, bssSectionLength);
}
if (&_init_array_start != &_init_array_end) {
abort();
}

View File

@@ -58,10 +58,8 @@ SECTIONS {
} > FLASH
.recovery_boot : {
. = ALIGN(4);
_recovery_boot_start = .;
. = ORIGIN(FLASH) + USERLAND_OFFSET + 0x100;
KEEP(*(.recovery_boot));
_recovery_boot_end = .;
} >FLASH
.text : {

View File

@@ -18,7 +18,7 @@
#endif
extern "C" {
extern char _recovery_boot_start;
extern void recovery_start();
}
namespace Ion {
extern char staticStorageArea[];
@@ -77,7 +77,16 @@ public:
m_osType(OSType),
m_upsilonMagicFooter(UpsilonMagic),
m_upsilonExtraMagicHeader(UpsilonExtraMagic),
m_recoveryAddress(((uint32_t)&_recovery_boot_start) + 1),
// FIXME: Since GCC 13, we can't longer store a pointer to a function in the
// class initialization. I don't know if it's a problem in GCC or our code,
// but it's a bit suspicious as the whole class is blank (0x00) in the
// binary with the data available nowhere else (searching for the username
// returns nothing).
// As a workaround, we fixed the address of recovery_start in flash using
// LD script (ion/src/device/bootloader/bootloader_common.ld).
// This line works on GCC 12
// m_recoveryAddress((uint32_t)recovery_start + 1),
m_recoveryAddress(0x90010080 + 1),
m_extraVersion(1),
m_upsilonExtraMagicFooter(UpsilonExtraMagic) { }