Skip to content
Snippets Groups Projects
Commit afa941e0 authored by iliya's avatar iliya
Browse files

feat: pt3 of ex2 done

parent 9cfe91a1
No related branches found
No related tags found
No related merge requests found
......@@ -22,16 +22,28 @@
#include "uart.h"
#include "macro.h"
#define BUF_SIZE 100
#define MMFAR *(unsigned *)0xE000ED34
unsigned user_stack[USER_STACK_SIZE]; // space for user stack
void *user_stating_address;
int *p_sram2 = (int*) 0x2007c000, a, *p_out_of_mem = (int*) 0x80000;
unsigned arr_addr[BUF_SIZE] = {0};
unsigned arr_err_code[BUF_SIZE] = {0};
volatile static unsigned idx_error;
void switch_to_user_mode();
void asm_test_fault();
void MemManage_Handler() {
arr_addr[idx_error] = MMFAR;
arr_err_code[idx_error] = SCB->CFSR;
idx_error++;
SCB->CFSR = 0xFFFF;
LPC_GPIO2->FIOPIN = idx_error;
}
void test_supervisor_mode() {
......@@ -56,6 +68,8 @@ void test_user_mode() {
int main(void) {
LPC_GPIO2->FIODIR = 0xFF;
LPC_GPIO2->FIOPIN = 0;
// MPU configuration here...
// Region 0 (Flash)
MPU->RNR = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment