[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

@@ -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) { }