mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[bootloader] MPU config
This commit is contained in:
@@ -5,7 +5,5 @@
|
||||
.thumb
|
||||
.global jump_to_firmware
|
||||
jump_to_firmware:
|
||||
dsb 0xF
|
||||
isb 0xF
|
||||
msr msp, r0
|
||||
bx r1
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <ion.h>
|
||||
#include <bootloader/slot.h>
|
||||
#include <assert.h>
|
||||
#include <ion/src/device/shared/drivers/board.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
@@ -23,10 +24,6 @@ void ion_main(int argc, const char * const argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->drawString(Bootloader::s_slotA->version(), KDPoint(0, 20));
|
||||
|
||||
*/
|
||||
Ion::Device::Board::bootloaderMPU();
|
||||
Bootloader::s_slotA->boot();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,28 @@ namespace Board {
|
||||
|
||||
using namespace Regs;
|
||||
|
||||
void bootloaderMPU() {
|
||||
// 1. Disable the MPU
|
||||
// 1.1 Memory barrier
|
||||
Cache::dmb();
|
||||
|
||||
// 1.3 Disable the MPU and clear the control register
|
||||
MPU.CTRL()->setENABLE(false);
|
||||
|
||||
MPU.RNR()->setREGION(7);
|
||||
MPU.RBAR()->setADDR(0x90000000);
|
||||
MPU.RASR()->setXN(false);
|
||||
MPU.RASR()->setENABLE(true);
|
||||
|
||||
// 2.3 Enable MPU
|
||||
MPU.CTRL()->setENABLE(true);
|
||||
|
||||
// 3. Data/instruction synchronisation barriers to ensure that the new MPU configuration is used by subsequent instructions.
|
||||
Cache::disable();
|
||||
Cache::dsb();
|
||||
Cache::isb();
|
||||
}
|
||||
|
||||
void initMPU() {
|
||||
// 1. Disable the MPU
|
||||
// 1.1 Memory barrier
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Board {
|
||||
|
||||
void init();
|
||||
|
||||
void bootloaderMPU();
|
||||
void initFPU();
|
||||
void initClocks();
|
||||
void shutdownClocks(bool keepLEDAwake = false);
|
||||
|
||||
Reference in New Issue
Block a user