mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[bootloader] Small fixes
This commit is contained in:
@@ -46,4 +46,3 @@ bootloader_images = $(addprefix bootloader/, \
|
|||||||
bootloader_src += $(ion_src) $(simple_kandinsky_src) $(liba_src) $(libaxx_src) $(bootloader_images)
|
bootloader_src += $(ion_src) $(simple_kandinsky_src) $(liba_src) $(libaxx_src) $(bootloader_images)
|
||||||
|
|
||||||
$(eval $(call depends_on_image,bootloader/interface/static/interface.cpp,$(bootloader_images)))
|
$(eval $(call depends_on_image,bootloader/interface/static/interface.cpp,$(bootloader_images)))
|
||||||
$(eval $(call depends_on_image,bootloader/interface/src/menu.cpp,$(bootloader_images)))
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ void Boot::setMode(BootMode mode) {
|
|||||||
void Boot::busError() {
|
void Boot::busError() {
|
||||||
Ion::Device::Flash::ClearInternalFlashErrors();
|
Ion::Device::Flash::ClearInternalFlashErrors();
|
||||||
asm("mov r12, lr");
|
asm("mov r12, lr");
|
||||||
if (config()->isBooting()) {
|
if (config()->isBooting()) { // Bus error is normal if we are booting, it's triggered when we lock OPTCR
|
||||||
asm("mov lr, r12");
|
asm("mov lr, r12");
|
||||||
asm("bx lr");
|
asm("bx lr");
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ void Boot::bootSlot(Bootloader::Slot s) {
|
|||||||
void Boot::bootSelectedSlot() {
|
void Boot::bootSelectedSlot() {
|
||||||
lockInternal();
|
lockInternal();
|
||||||
config()->setBooting(true);
|
config()->setBooting(true);
|
||||||
Ion::Device::Flash::EnableInternalSessionLock();
|
Ion::Device::Flash::LockInternalFlashForSession();
|
||||||
config()->slot()->boot();
|
config()->slot()->boot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,8 +133,8 @@ __attribute__((noreturn)) void Boot::boot() {
|
|||||||
Boot::config()->setBooting(false);
|
Boot::config()->setBooting(false);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
HomeMenu menu = HomeMenu();
|
HomeMenu menu = HomeMenu();
|
||||||
menu.open(true);
|
menu.open(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Achievement unlocked: How Did We Get Here?
|
// Achievement unlocked: How Did We Get Here?
|
||||||
@@ -181,7 +181,7 @@ void Boot::lockInternal() {
|
|||||||
Ion::Device::Flash::EnableInternalProtection();
|
Ion::Device::Flash::EnableInternalProtection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Boot::enableFlashIntr() {
|
void Boot::EnableInternalFlashInterrupt() {
|
||||||
Ion::Device::Flash::EnableInternalFlashInterrupt();
|
Ion::Device::Flash::EnableInternalFlashInterrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
namespace Bootloader {
|
namespace Bootloader {
|
||||||
|
|
||||||
class BootConfig {
|
class BootConfig {
|
||||||
public:
|
public:
|
||||||
BootConfig() : m_slot(nullptr), m_booting(false) {};
|
BootConfig() : m_slot(nullptr), m_booting(false) {};
|
||||||
|
|
||||||
void setSlot(Slot * slot) { m_slot = slot; }
|
void setSlot(Slot * slot) { m_slot = slot; }
|
||||||
@@ -16,19 +16,19 @@ class BootConfig {
|
|||||||
|
|
||||||
void setBooting(bool booting) { m_booting = booting; }
|
void setBooting(bool booting) { m_booting = booting; }
|
||||||
bool isBooting() const { return m_booting; }
|
bool isBooting() const { return m_booting; }
|
||||||
private:
|
private:
|
||||||
Bootloader::Slot * m_slot;
|
Bootloader::Slot * m_slot;
|
||||||
bool m_booting;
|
bool m_booting;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BootMode: uint8_t {
|
enum BootMode: uint8_t {
|
||||||
SlotA = 0,
|
SlotA = 0,
|
||||||
SlotB = 1,
|
SlotB = 1,
|
||||||
// These modes exists so that you can launch the bootloader from a running slot
|
// These modes exists so that you can launch the bootloader from a running slot
|
||||||
// They mean "Launch bootloader then go back to slot X"
|
// They mean "Launch bootloader then go back to slot X"
|
||||||
SlotABootloader = 2,
|
SlotABootloader = 2,
|
||||||
SlotBBootloader = 3,
|
SlotBBootloader = 3,
|
||||||
Unknown
|
Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
class Boot {
|
class Boot {
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
static void bootloader();
|
static void bootloader();
|
||||||
static void lockInternal();
|
static void lockInternal();
|
||||||
static void enableFlashIntr();
|
static void EnableInternalFlashInterrupt();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
#include <bootloader/interface/static/messages.h>
|
#include <bootloader/interface/static/messages.h>
|
||||||
|
|
||||||
Bootloader::AboutMenu::AboutMenu() : Menu(KDColorBlack, KDColorWhite, Messages::aboutMenuTitle, Messages::bootloaderVersion) {
|
Bootloader::AboutMenu::AboutMenu() : Menu(KDColorBlack, KDColorWhite, Messages::aboutMenuTitle, Messages::bootloaderVersion) {
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::AboutMenu::setup() {
|
void Bootloader::AboutMenu::setup() {
|
||||||
m_default_columns[0] = Column(Messages::aboutMessage1, k_small_font, 0, true);
|
m_defaultColumns[0] = Column(Messages::aboutMessage1, k_small_font, 0, true);
|
||||||
m_default_columns[1] = Column(Messages::aboutMessage2, k_small_font, 0, true);
|
m_defaultColumns[1] = Column(Messages::aboutMessage2, k_small_font, 0, true);
|
||||||
m_default_columns[2] = Column(Messages::aboutMessage3, k_small_font, 0, true);
|
m_defaultColumns[2] = Column(Messages::aboutMessage3, k_small_font, 0, true);
|
||||||
m_default_columns[3] = Column(Messages::aboutMessage4, k_small_font, 0, true);
|
m_defaultColumns[3] = Column(Messages::aboutMessage4, k_small_font, 0, true);
|
||||||
m_default_columns[4] = Column(Messages::aboutMessage5, k_small_font, 0, true);
|
m_defaultColumns[4] = Column(Messages::aboutMessage5, k_small_font, 0, true);
|
||||||
|
|
||||||
m_columns[0] = ColumnBinder(&m_default_columns[0]);
|
m_columns[0] = ColumnBinder(&m_defaultColumns[0]);
|
||||||
m_columns[1] = ColumnBinder(&m_default_columns[1]);
|
m_columns[1] = ColumnBinder(&m_defaultColumns[1]);
|
||||||
m_columns[2] = ColumnBinder(&m_default_columns[2]);
|
m_columns[2] = ColumnBinder(&m_defaultColumns[2]);
|
||||||
m_columns[3] = ColumnBinder(&m_default_columns[3]);
|
m_columns[3] = ColumnBinder(&m_defaultColumns[3]);
|
||||||
m_columns[4] = ColumnBinder(&m_default_columns[4]);
|
m_columns[4] = ColumnBinder(&m_defaultColumns[4]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
#include "crash.h"
|
#include "crash.h"
|
||||||
|
|
||||||
Bootloader::CrashMenu::CrashMenu(const char * err) : Menu(KDColorBlack, KDColorWhite, Bootloader::Messages::bootloaderCrashTitle, Bootloader::Messages::mainTitle), m_error(err) {
|
Bootloader::CrashMenu::CrashMenu(const char * err) : Menu(KDColorBlack, KDColorWhite, Bootloader::Messages::bootloaderCrashTitle, Bootloader::Messages::mainTitle), m_error(err) {
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::CrashMenu::setup() {
|
void Bootloader::CrashMenu::setup() {
|
||||||
m_default_columns[0] = Column(m_error, k_large_font, 0, true);
|
m_defaultColumns[0] = Column(m_error, k_large_font, 0, true);
|
||||||
m_default_columns[1] = Column(Bootloader::Messages::bootloaderCrashMessage1, k_small_font, 0, true);
|
m_defaultColumns[1] = Column(Bootloader::Messages::bootloaderCrashMessage1, k_small_font, 0, true);
|
||||||
m_default_columns[2] = Column(Bootloader::Messages::bootloaderCrashMessage2, k_small_font, 0, true);
|
m_defaultColumns[2] = Column(Bootloader::Messages::bootloaderCrashMessage2, k_small_font, 0, true);
|
||||||
|
|
||||||
m_columns[0] = ColumnBinder(&m_default_columns[0]);
|
m_columns[0] = ColumnBinder(&m_defaultColumns[0]);
|
||||||
m_columns[1] = ColumnBinder(&m_default_columns[1]);
|
m_columns[1] = ColumnBinder(&m_defaultColumns[1]);
|
||||||
m_columns[2] = ColumnBinder(&m_default_columns[2]);
|
m_columns[2] = ColumnBinder(&m_defaultColumns[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::CrashMenu::postOpen() {
|
void Bootloader::CrashMenu::postOpen() {
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ Bootloader::DfuMenu::DfuMenu(const char * text, const USBData * data) : Menu(KDC
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::DfuMenu::setup() {
|
void Bootloader::DfuMenu::setup() {
|
||||||
m_default_columns[0] = Column(m_submenuText, k_small_font, 0, true);
|
m_defaultColumns[0] = Column(m_submenuText, k_small_font, 0, true);
|
||||||
|
|
||||||
m_columns[0] = ColumnBinder(&m_default_columns[0]);
|
m_columns[0] = ColumnBinder(&m_defaultColumns[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::DfuMenu::postOpen() {
|
void Bootloader::DfuMenu::postOpen() {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Bootloader::InstallerMenu * Bootloader::HomeMenu::installerMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bootloader::HomeMenu::HomeMenu() : Menu(KDColorBlack, KDColorWhite, Messages::homeTitle, Messages::mainTitle) {
|
Bootloader::HomeMenu::HomeMenu() : Menu(KDColorBlack, KDColorWhite, Messages::homeTitle, Messages::mainTitle) {
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool slotA_submenu() {
|
bool slotA_submenu() {
|
||||||
@@ -70,11 +70,11 @@ const char * Bootloader::HomeMenu::getSlotOsText(Slot slot) {
|
|||||||
const char * Bootloader::HomeMenu::getSlotText(Slot slot) {
|
const char * Bootloader::HomeMenu::getSlotText(Slot slot) {
|
||||||
if(Slot::isFullyValid(slot)) {
|
if(Slot::isFullyValid(slot)) {
|
||||||
if (slot.address() == Slot::A().address()) {
|
if (slot.address() == Slot::A().address()) {
|
||||||
return Messages::homeSlotASubmenu;
|
return Messages::homeSlotASubmenu;
|
||||||
} else if (slot.address() == Slot::Khi().address()) {
|
} else if (slot.address() == Slot::Khi().address()) {
|
||||||
return Messages::homeSlotKhiSubmenu;
|
return Messages::homeSlotKhiSubmenu;
|
||||||
} else if (slot.address() == Slot::B().address()) {
|
} else if (slot.address() == Slot::B().address()) {
|
||||||
return Messages::homeSlotBSubmenu;
|
return Messages::homeSlotBSubmenu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Messages::invalidSlot;
|
return Messages::invalidSlot;
|
||||||
@@ -93,17 +93,15 @@ void Bootloader::HomeMenu::setup() {
|
|||||||
Slot Khi = Slot::Khi();
|
Slot Khi = Slot::Khi();
|
||||||
Slot B = Slot::B();
|
Slot B = Slot::B();
|
||||||
|
|
||||||
m_slot_columns[0] = SlotColumn(getSlotText(A), getKernelText(A), getSlotOsText(A), getVersionText(A), Ion::Keyboard::Key::One, k_small_font, 10, false, &slotA_submenu);
|
m_slotColumns[0] = SlotColumn(getSlotText(A), getKernelText(A), getSlotOsText(A), getVersionText(A), Ion::Keyboard::Key::One, k_small_font, 10, false, &slotA_submenu);
|
||||||
m_slot_columns[1] = SlotColumn(getSlotText(Khi), getKernelText(Khi), getSlotOsText(Khi), getVersionText(Khi), Ion::Keyboard::Key::Two, k_small_font, 10, false, &slotKhi_submenu);
|
m_slotColumns[1] = SlotColumn(getSlotText(Khi), getKernelText(Khi), getSlotOsText(Khi), getVersionText(Khi), Ion::Keyboard::Key::Two, k_small_font, 10, false, &slotKhi_submenu);
|
||||||
m_slot_columns[2] = SlotColumn(getSlotText(B), getKernelText(B), getSlotOsText(B), getVersionText(B), Ion::Keyboard::Key::Three, k_small_font, 10, false, &slotB_submenu);
|
m_slotColumns[2] = SlotColumn(getSlotText(B), getKernelText(B), getSlotOsText(B), getVersionText(B), Ion::Keyboard::Key::Three, k_small_font, 10, false, &slotB_submenu);
|
||||||
m_default_columns[0] = Column(Messages::homeInstallerSubmenu, Ion::Keyboard::Key::Four, k_small_font, 10, false, &installer_submenu);
|
m_defaultColumns[0] = Column(Messages::homeInstallerSubmenu, Ion::Keyboard::Key::Four, k_small_font, 10, false, &installer_submenu);
|
||||||
m_default_columns[1] = Column(Messages::homeAboutSubmenu, Ion::Keyboard::Key::Five, k_small_font, 10, false, &about_submenu);
|
m_defaultColumns[1] = Column(Messages::homeAboutSubmenu, Ion::Keyboard::Key::Five, k_small_font, 10, false, &about_submenu);
|
||||||
|
|
||||||
|
|
||||||
m_columns[0] = ColumnBinder(&m_slot_columns[0]);
|
|
||||||
m_columns[1] = ColumnBinder(&m_slot_columns[1]);
|
|
||||||
m_columns[2] = ColumnBinder(&m_slot_columns[2]);
|
|
||||||
m_columns[3] = ColumnBinder(&m_default_columns[0]);
|
|
||||||
m_columns[4] = ColumnBinder(&m_default_columns[1]);
|
|
||||||
|
|
||||||
|
m_columns[0] = ColumnBinder(&m_slotColumns[0]);
|
||||||
|
m_columns[1] = ColumnBinder(&m_slotColumns[1]);
|
||||||
|
m_columns[2] = ColumnBinder(&m_slotColumns[2]);
|
||||||
|
m_columns[3] = ColumnBinder(&m_defaultColumns[0]);
|
||||||
|
m_columns[4] = ColumnBinder(&m_defaultColumns[1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ namespace Bootloader {
|
|||||||
const char * getSlotText(Slot slot);
|
const char * getSlotText(Slot slot);
|
||||||
const char * getKernelText(Slot slot);
|
const char * getKernelText(Slot slot);
|
||||||
const char * getVersionText(Slot slot);
|
const char * getVersionText(Slot slot);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,37 +5,37 @@
|
|||||||
#include <bootloader/interface/menus/dfu.h>
|
#include <bootloader/interface/menus/dfu.h>
|
||||||
|
|
||||||
Bootloader::DfuMenu * Bootloader::InstallerMenu::SlotsDFU() {
|
Bootloader::DfuMenu * Bootloader::InstallerMenu::SlotsDFU() {
|
||||||
USBData data = USBData::DEFAULT();
|
USBData data = USBData::DEFAULT();
|
||||||
static DfuMenu * slotsDfu = new DfuMenu(Messages::dfuSlotsUpdate, &data);
|
static DfuMenu * slotsDfu = new DfuMenu(Messages::dfuSlotsUpdate, &data);
|
||||||
return slotsDfu;
|
return slotsDfu;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bootloader::DfuMenu * Bootloader::InstallerMenu::BootloaderDFU() {
|
Bootloader::DfuMenu * Bootloader::InstallerMenu::BootloaderDFU() {
|
||||||
USBData data = USBData::BOOTLOADER_UPDATE();
|
USBData data = USBData::BOOTLOADER_UPDATE();
|
||||||
static DfuMenu * bootloaderDfu = new DfuMenu(Messages::dfuBootloaderUpdate, &data);
|
static DfuMenu * bootloaderDfu = new DfuMenu(Messages::dfuBootloaderUpdate, &data);
|
||||||
return bootloaderDfu;
|
return bootloaderDfu;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bootloader::InstallerMenu::InstallerMenu() : Menu(KDColorBlack, KDColorWhite, Messages::installerTitle, Messages::mainTitle) {
|
Bootloader::InstallerMenu::InstallerMenu() : Menu(KDColorBlack, KDColorWhite, Messages::installerTitle, Messages::mainTitle) {
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool slotsSubmenu() {
|
bool slotsSubmenu() {
|
||||||
Bootloader::InstallerMenu::SlotsDFU()->open();
|
Bootloader::InstallerMenu::SlotsDFU()->open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bootloaderSubmenu() {
|
bool bootloaderSubmenu() {
|
||||||
Bootloader::InstallerMenu::BootloaderDFU()->open();
|
Bootloader::InstallerMenu::BootloaderDFU()->open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::InstallerMenu::setup() {
|
void Bootloader::InstallerMenu::setup() {
|
||||||
m_default_columns[0] = Column(Messages::installerText1, k_large_font, 0, true);
|
m_defaultColumns[0] = Column(Messages::installerText1, k_large_font, 0, true);
|
||||||
m_default_columns[1] = Column(Messages::installerSlotsSubmenu, Ion::Keyboard::Key::One, k_small_font, 30, false, &slotsSubmenu);
|
m_defaultColumns[1] = Column(Messages::installerSlotsSubmenu, Ion::Keyboard::Key::One, k_small_font, 30, false, &slotsSubmenu);
|
||||||
m_default_columns[2] = Column(Messages::installerBootloaderSubmenu, Ion::Keyboard::Key::Two, k_small_font, 30, false, &bootloaderSubmenu);
|
m_defaultColumns[2] = Column(Messages::installerBootloaderSubmenu, Ion::Keyboard::Key::Two, k_small_font, 30, false, &bootloaderSubmenu);
|
||||||
|
|
||||||
m_columns[0] = ColumnBinder(&m_default_columns[0]);
|
m_columns[0] = ColumnBinder(&m_defaultColumns[0]);
|
||||||
m_columns[1] = ColumnBinder(&m_default_columns[1]);
|
m_columns[1] = ColumnBinder(&m_defaultColumns[1]);
|
||||||
m_columns[2] = ColumnBinder(&m_default_columns[2]);
|
m_columns[2] = ColumnBinder(&m_defaultColumns[2]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ Bootloader::SlotRecoveryMenu::SlotRecoveryMenu(USBData * usb) : Menu(KDColorBlac
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::SlotRecoveryMenu::setup() {
|
void Bootloader::SlotRecoveryMenu::setup() {
|
||||||
m_default_columns[0] = Column(Messages::recoveryMessage1, k_small_font, 0, true);
|
m_defaultColumns[0] = Column(Messages::recoveryMessage1, k_small_font, 0, true);
|
||||||
m_default_columns[1] = Column(Messages::recoveryMessage2, k_small_font, 0, true);
|
m_defaultColumns[1] = Column(Messages::recoveryMessage2, k_small_font, 0, true);
|
||||||
m_default_columns[2] = Column(Messages::recoveryMessage3, k_small_font, 0, true);
|
m_defaultColumns[2] = Column(Messages::recoveryMessage3, k_small_font, 0, true);
|
||||||
m_default_columns[3] = Column(Messages::recoveryMessage4, k_small_font, 0, true);
|
m_defaultColumns[3] = Column(Messages::recoveryMessage4, k_small_font, 0, true);
|
||||||
m_default_columns[4] = Column(Messages::recoveryMessage5, k_small_font, 0, true);
|
m_defaultColumns[4] = Column(Messages::recoveryMessage5, k_small_font, 0, true);
|
||||||
|
|
||||||
m_columns[0] = ColumnBinder(&m_default_columns[0]);
|
m_columns[0] = ColumnBinder(&m_defaultColumns[0]);
|
||||||
m_columns[1] = ColumnBinder(&m_default_columns[1]);
|
m_columns[1] = ColumnBinder(&m_defaultColumns[1]);
|
||||||
m_columns[2] = ColumnBinder(&m_default_columns[2]);
|
m_columns[2] = ColumnBinder(&m_defaultColumns[2]);
|
||||||
m_columns[3] = ColumnBinder(&m_default_columns[3]);
|
m_columns[3] = ColumnBinder(&m_defaultColumns[3]);
|
||||||
m_columns[4] = ColumnBinder(&m_default_columns[4]);
|
m_columns[4] = ColumnBinder(&m_defaultColumns[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::SlotRecoveryMenu::postOpen() {
|
void Bootloader::SlotRecoveryMenu::postOpen() {
|
||||||
|
|||||||
@@ -19,17 +19,17 @@ bool backoff() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bootloader::WarningMenu::setup() {
|
void Bootloader::WarningMenu::setup() {
|
||||||
m_default_columns[0] = Column(Messages::epsilonWarningMessage1, k_small_font, 0, true);
|
m_defaultColumns[0] = Column(Messages::epsilonWarningMessage1, k_small_font, 0, true);
|
||||||
m_default_columns[1] = Column(Messages::epsilonWarningMessage2, k_small_font, 0, true);
|
m_defaultColumns[1] = Column(Messages::epsilonWarningMessage2, k_small_font, 0, true);
|
||||||
m_default_columns[2] = Column(Messages::epsilonWarningMessage3, k_small_font, 0, true);
|
m_defaultColumns[2] = Column(Messages::epsilonWarningMessage3, k_small_font, 0, true);
|
||||||
m_default_columns[3] = Column(Messages::epsilonWarningMessage4, k_small_font, 0, true);
|
m_defaultColumns[3] = Column(Messages::epsilonWarningMessage4, k_small_font, 0, true);
|
||||||
m_default_columns[4] = Column(Messages::epsilonWarningMessage5, Ion::Keyboard::Key::EXE, k_small_font, 0, true, &proceed);
|
m_defaultColumns[4] = Column(Messages::epsilonWarningMessage5, Ion::Keyboard::Key::EXE, k_small_font, 0, true, &proceed);
|
||||||
m_default_columns[5] = Column(Messages::epsilonWarningMessage6, Ion::Keyboard::Key::Back, k_small_font, 0, true, &backoff);
|
m_defaultColumns[5] = Column(Messages::epsilonWarningMessage6, Ion::Keyboard::Key::Back, k_small_font, 0, true, &backoff);
|
||||||
|
|
||||||
m_columns[0] = ColumnBinder(&m_default_columns[0]);
|
m_columns[0] = ColumnBinder(&m_defaultColumns[0]);
|
||||||
m_columns[1] = ColumnBinder(&m_default_columns[1]);
|
m_columns[1] = ColumnBinder(&m_defaultColumns[1]);
|
||||||
m_columns[2] = ColumnBinder(&m_default_columns[2]);
|
m_columns[2] = ColumnBinder(&m_defaultColumns[2]);
|
||||||
m_columns[3] = ColumnBinder(&m_default_columns[3]);
|
m_columns[3] = ColumnBinder(&m_defaultColumns[3]);
|
||||||
m_columns[4] = ColumnBinder(&m_default_columns[4]);
|
m_columns[4] = ColumnBinder(&m_defaultColumns[4]);
|
||||||
m_columns[5] = ColumnBinder(&m_default_columns[5]);
|
m_columns[5] = ColumnBinder(&m_defaultColumns[5]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Bootloader {
|
|||||||
Menu(KDColor forground, KDColor background, const char * title) : Menu(forground, background, title, nullptr) {};
|
Menu(KDColor forground, KDColor background, const char * title) : Menu(forground, background, title, nullptr) {};
|
||||||
Menu(KDColor forground, KDColor background, const char * title, const char * bottom) : Menu(forground, background, title, bottom, false) {};
|
Menu(KDColor forground, KDColor background, const char * title, const char * bottom) : Menu(forground, background, title, bottom, false) {};
|
||||||
Menu(KDColor forground, KDColor background, const char * title, const char * bottom, bool centerY) : Menu(forground, background, title, bottom, centerY, k_columns_margin) {};
|
Menu(KDColor forground, KDColor background, const char * title, const char * bottom, bool centerY) : Menu(forground, background, title, bottom, centerY, k_columns_margin) {};
|
||||||
Menu(KDColor forground, KDColor background, const char * title, const char * bottom, bool centerY, int margin) : m_columns(), m_default_columns(), m_slot_columns(), m_background(background), m_title(title), m_foreground(forground), m_bottom(bottom), m_centerY(centerY), m_forced_exit(false), m_margin(margin) {
|
Menu(KDColor forground, KDColor background, const char * title, const char * bottom, bool centerY, int margin) : m_columns(), m_defaultColumns(), m_slotColumns(), m_background(background), m_title(title), m_foreground(forground), m_bottom(bottom), m_centerY(centerY), m_forced_exit(false), m_margin(margin) {
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
static const int k_columns_margin = 5;
|
static const int k_columns_margin = 5;
|
||||||
@@ -110,8 +110,8 @@ namespace Bootloader {
|
|||||||
protected:
|
protected:
|
||||||
ColumnBinder m_columns[k_max_columns];
|
ColumnBinder m_columns[k_max_columns];
|
||||||
// Columns Storage
|
// Columns Storage
|
||||||
Column m_default_columns[k_max_columns];
|
Column m_defaultColumns[k_max_columns];
|
||||||
SlotColumn m_slot_columns[k_max_columns];
|
SlotColumn m_slotColumns[k_max_columns];
|
||||||
KDColor m_background;
|
KDColor m_background;
|
||||||
KDColor m_foreground;
|
KDColor m_foreground;
|
||||||
const char * m_title;
|
const char * m_title;
|
||||||
|
|||||||
@@ -39,12 +39,15 @@ void Interface::drawImage(KDContext * ctx, const Image * image, int offset) {
|
|||||||
|
|
||||||
void Interface::drawFlasher() {
|
void Interface::drawFlasher() {
|
||||||
KDContext * ctx = KDIonContext::sharedContext();
|
KDContext * ctx = KDIonContext::sharedContext();
|
||||||
|
|
||||||
ctx->fillRect(KDRect(0, 0, 320, 240), KDColorWhite);
|
ctx->fillRect(KDRect(0, 0, 320, 240), KDColorWhite);
|
||||||
drawImage(ctx, ImageStore::Computer, 25);
|
drawImage(ctx, ImageStore::Computer, 25);
|
||||||
|
|
||||||
KDSize fontSize = KDFont::LargeFont->glyphSize();
|
KDSize fontSize = KDFont::LargeFont->glyphSize();
|
||||||
int initPos = (320 - fontSize.width() * strlen(Messages::mainTitle)) / 2;
|
int initPos = (320 - fontSize.width() * strlen(Messages::mainTitle)) / 2;
|
||||||
ctx->drawString(Messages::mainTitle, KDPoint(initPos, ImageStore::Computer->height() + fontSize.height() + 10), KDFont::LargeFont, KDColorBlack, KDColorWhite);
|
ctx->drawString(Messages::mainTitle, KDPoint(initPos, ImageStore::Computer->height() + 25 + 10), KDFont::LargeFont, KDColorBlack, KDColorWhite);
|
||||||
int y = ImageStore::Computer->height() + (KDFont::LargeFont->glyphSize().height() + 10) + (KDFont::SmallFont->glyphSize().height() + 10);
|
|
||||||
|
int y = ImageStore::Computer->height() + 25 + 10 + (KDFont::SmallFont->glyphSize().height() + 10);
|
||||||
initPos = (320 - KDFont::SmallFont->glyphSize().width() * strlen(Messages::dfuSlotsUpdate)) / 2;
|
initPos = (320 - KDFont::SmallFont->glyphSize().width() * strlen(Messages::dfuSlotsUpdate)) / 2;
|
||||||
ctx->drawString(Messages::dfuSlotsUpdate, KDPoint(initPos, y), KDFont::SmallFont, KDColorBlack, KDColorWhite);
|
ctx->drawString(Messages::dfuSlotsUpdate, KDPoint(initPos, y), KDFont::SmallFont, KDColorBlack, KDColorWhite);
|
||||||
}
|
}
|
||||||
@@ -56,9 +59,10 @@ void Interface::drawLoading() {
|
|||||||
Ion::Timing::msleep(250);
|
Ion::Timing::msleep(250);
|
||||||
KDSize fontSize = KDFont::LargeFont->glyphSize();
|
KDSize fontSize = KDFont::LargeFont->glyphSize();
|
||||||
int initPos = (320 - fontSize.width() * strlen(Messages::mainTitle)) / 2;
|
int initPos = (320 - fontSize.width() * strlen(Messages::mainTitle)) / 2;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < strlen(Messages::mainTitle); i++) {
|
for (uint8_t i = 0; i < strlen(Messages::mainTitle); i++) {
|
||||||
char tmp[2] = {Messages::mainTitle[i], '\0'};
|
char tmp[2] = {Messages::mainTitle[i], '\0'};
|
||||||
ctx->drawString(tmp, KDPoint(initPos + i * (fontSize.width()), ImageStore::Computer->height() + fontSize.height() + 10), KDFont::LargeFont, KDColorBlack, KDColorWhite);
|
ctx->drawString(tmp, KDPoint(initPos + i * (fontSize.width()), ImageStore::Computer->height() + 25 + 10), KDFont::LargeFont, KDColorBlack, KDColorWhite);
|
||||||
Ion::Timing::msleep(50);
|
Ion::Timing::msleep(50);
|
||||||
}
|
}
|
||||||
Ion::Timing::msleep(500);
|
Ion::Timing::msleep(500);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
HANDY_TARGETS += test.external_flash.write test.external_flash.read bootloader
|
HANDY_TARGETS += test.external_flash.write test.external_flash.read bootloader
|
||||||
|
|
||||||
$(BUILD_DIR)/test.external_flash.%.$(EXE): LDSCRIPT = ion/test/device/n0110/external_flash_tests.ld
|
$(BUILD_DIR)/test.external_flash.%.$(EXE): LDSCRIPT = ion/test/device/n0110/external_flash_tests.ld
|
||||||
test_external_flash_src = $(ion_src) $(liba_src) $(libaxx_src) $(default_kandinsky_src) $(poincare_src) $(ion_device_dfu_relogated_src) $(runner_src)
|
test_external_flash_src = $(ion_src) $(liba_src) $(libaxx_src) $(default_kandinsky_src) $(poincare_src) $(ion_device_dfu_relegated_src) $(runner_src)
|
||||||
$(BUILD_DIR)/test.external_flash.read.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_external_flash_read_symbols.o $(call object_for,$(test_external_flash_src) $(test_ion_external_flash_read_src))
|
$(BUILD_DIR)/test.external_flash.read.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_external_flash_read_symbols.o $(call object_for,$(test_external_flash_src) $(test_ion_external_flash_read_src))
|
||||||
$(BUILD_DIR)/test.external_flash.write.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_external_flash_write_symbols.o $(call object_for,$(test_external_flash_src) $(test_ion_external_flash_write_src))
|
$(BUILD_DIR)/test.external_flash.write.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_external_flash_write_symbols.o $(call object_for,$(test_external_flash_src) $(test_ion_external_flash_write_src))
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include <ion/storage.h>
|
#include <ion/storage.h>
|
||||||
#include <ion/timing.h>
|
#include <ion/timing.h>
|
||||||
#include <ion/usb.h>
|
#include <ion/usb.h>
|
||||||
#include <ion/flash.h>
|
|
||||||
#include <ion/unicode/utf8_decoder.h>
|
#include <ion/unicode/utf8_decoder.h>
|
||||||
#include <ion/unicode/utf8_helper.h>
|
#include <ion/unicode/utf8_helper.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
#ifndef ION_DEVICE_SHARED_FLASH_H
|
|
||||||
#define ION_DEVICE_SHARED_FLASH_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
namespace Ion {
|
|
||||||
namespace Device {
|
|
||||||
namespace Flash {
|
|
||||||
|
|
||||||
int TotalNumberOfSectors();
|
|
||||||
int SectorAtAddress(uint32_t address);
|
|
||||||
|
|
||||||
void MassErase();
|
|
||||||
void EraseSector(int i);
|
|
||||||
void WriteMemory(uint8_t * destination, uint8_t * source, size_t length);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -62,7 +62,7 @@ void SetInternalSectorProtection(int i, bool protect) {
|
|||||||
InternalFlash::SetSectorProtection(i, protect);
|
InternalFlash::SetSectorProtection(i, protect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnableInternalSessionLock() {
|
void LockInternalFlashForSession() {
|
||||||
InternalFlash::EnableSessionLock();
|
InternalFlash::EnableSessionLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef ION_DEVICE_SHARED_FLASH_H
|
#ifndef ION_DEVICE_SHARED_FLASH_DRIVER_H
|
||||||
#define ION_DEVICE_SHARED_FLASH_H
|
#define ION_DEVICE_SHARED_FLASH_DRIVER_H
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -18,7 +18,7 @@ void WriteMemory(uint8_t * destination, uint8_t * source, size_t length);
|
|||||||
void DisableInternalProtection();
|
void DisableInternalProtection();
|
||||||
void EnableInternalProtection();
|
void EnableInternalProtection();
|
||||||
void SetInternalSectorProtection(int i, bool protect);
|
void SetInternalSectorProtection(int i, bool protect);
|
||||||
void EnableInternalSessionLock(); // Will cause BUSERR when enabled
|
void LockInternalFlashForSession(); // Will cause BUSERR when enabled
|
||||||
void EnableInternalFlashInterrupt();
|
void EnableInternalFlashInterrupt();
|
||||||
void ClearInternalFlashErrors();
|
void ClearInternalFlashErrors();
|
||||||
void LockSlotA();
|
void LockSlotA();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ static inline void wait() {
|
|||||||
static void open() {
|
static void open() {
|
||||||
// Unlock the Flash configuration register if needed
|
// Unlock the Flash configuration register if needed
|
||||||
if (FLASH.CR()->getLOCK()) {
|
if (FLASH.CR()->getLOCK()) {
|
||||||
|
// https://www.numworks.com/resources/engineering/hardware/electrical/parts/stm32f730-arm-mcu-reference-manual-1b6e1356.pdf#page=82
|
||||||
FLASH.KEYR()->set(0x45670123);
|
FLASH.KEYR()->set(0x45670123);
|
||||||
FLASH.KEYR()->set(0xCDEF89AB);
|
FLASH.KEYR()->set(0xCDEF89AB);
|
||||||
}
|
}
|
||||||
@@ -33,6 +34,7 @@ static void open() {
|
|||||||
|
|
||||||
static void open_protection() {
|
static void open_protection() {
|
||||||
if (FLASH.OPTCR()->getLOCK()) {
|
if (FLASH.OPTCR()->getLOCK()) {
|
||||||
|
// https://www.numworks.com/resources/engineering/hardware/electrical/parts/stm32f730-arm-mcu-reference-manual-1b6e1356.pdf#page=82
|
||||||
FLASH.OPTKEYR()->set(0x08192A3B);
|
FLASH.OPTKEYR()->set(0x08192A3B);
|
||||||
FLASH.OPTKEYR()->set(0x4C5D6E7F);
|
FLASH.OPTKEYR()->set(0x4C5D6E7F);
|
||||||
}
|
}
|
||||||
@@ -347,8 +349,12 @@ void SetSectorProtection(int i, bool protect) {
|
|||||||
void EnableSessionLock() {
|
void EnableSessionLock() {
|
||||||
if (FLASH.OPTCR()->getLOCK()) {
|
if (FLASH.OPTCR()->getLOCK()) {
|
||||||
// writing bullshit to the lock register to lock it until next core reset
|
// writing bullshit to the lock register to lock it until next core reset
|
||||||
|
// https://www.numworks.com/resources/engineering/hardware/electrical/parts/stm32f730-arm-mcu-reference-manual-1b6e1356.pdf#page=82
|
||||||
|
// > "In the event of an unsuccessful unlock operation, this bit remains set until the next reset."
|
||||||
FLASH.OPTKEYR()->set(0x00000000);
|
FLASH.OPTKEYR()->set(0x00000000);
|
||||||
FLASH.OPTKEYR()->set(0xFFFFFFFF);
|
FLASH.OPTKEYR()->set(0xFFFFFFFF);
|
||||||
|
|
||||||
|
// Now, a bus fault error is triggered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user