驱动内存映射修改为缺页模拟方式
This commit is contained in:
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -71,8 +71,8 @@
|
|||||||
// "miDebuggerPath": "/home/zhangzheng/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/aarch64-none-elf-gdb",
|
// "miDebuggerPath": "/home/zhangzheng/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/aarch64-none-elf-gdb",
|
||||||
// "miDebuggerPath": "/home/mkrtos-smart/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gdb",
|
// "miDebuggerPath": "/home/mkrtos-smart/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gdb",
|
||||||
// "miDebuggerPath": "/home/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gdb",
|
// "miDebuggerPath": "/home/toolchains/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gdb",
|
||||||
// "miDebuggerPath": "/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb",
|
"miDebuggerPath": "/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb",
|
||||||
"miDebuggerPath": "/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb",
|
// "miDebuggerPath": "/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb",
|
||||||
"miDebuggerServerAddress": "127.0.0.1:33333",
|
"miDebuggerServerAddress": "127.0.0.1:33333",
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
"setupCommands": [
|
"setupCommands": [
|
||||||
|
|||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -193,7 +193,7 @@
|
|||||||
"mman.h": "c"
|
"mman.h": "c"
|
||||||
},
|
},
|
||||||
"cortex-debug.showRTOS": false,
|
"cortex-debug.showRTOS": false,
|
||||||
"cortex-debug.variableUseNaturalFormat": true,
|
"cortex-debug.variableUseNaturalFormat": false,
|
||||||
"C_Cpp.default.systemIncludePath": [""],
|
"C_Cpp.default.systemIncludePath": [""],
|
||||||
"C_Cpp.default.forcedInclude": ["${workspaceFolder}/build/autoconf.h"]
|
"C_Cpp.default.forcedInclude": ["${workspaceFolder}/build/autoconf.h"]
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,8 @@ execute_process(
|
|||||||
)
|
)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND cd ${CMAKE_SOURCE_DIR}/mkrtos_user/server/fs/appfs/src/build.sh && sh build.sh
|
COMMAND cd ${CMAKE_SOURCE_DIR}/mkrtos_user/server/fs/appfs/src
|
||||||
|
COMMAND sh build.sh
|
||||||
COMMAND_ECHO STDOUT
|
COMMAND_ECHO STDOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
extern char cpio_start[];
|
extern char cpio_start[];
|
||||||
extern char cpio_end[];
|
extern char cpio_end[];
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
jump2kernel((addr_t)cpio_start, (addr_t)cpio_end);
|
jump2kernel((addr_t)cpio_start, (addr_t)cpio_end);
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -4,6 +4,14 @@
|
|||||||
compatible = "at32f43x,pin";
|
compatible = "at32f43x,pin";
|
||||||
regs = <
|
regs = <
|
||||||
0x40020000 0x2000 /*GPIO*/
|
0x40020000 0x2000 /*GPIO*/
|
||||||
|
// 0x4002 1C00 - 0x4002 1FFF GPIO 端口 H
|
||||||
|
// 0x4002 1800 - 0x4002 1BFF GPIO 端口 G
|
||||||
|
// 0x4002 1400 - 0x4002 17FF GPIO 端口 F
|
||||||
|
// 0x4002 1000 - 0x4002 13FF GPIO 端口 E
|
||||||
|
// 0x4002 0C00 - 0x4002 0FFF GPIO 端口 D
|
||||||
|
// 0x4002 0800 - 0x4002 0BFF GPIO 端口 C
|
||||||
|
// 0x4002 0400 - 0x4002 07FF GPIO 端口 B
|
||||||
|
// 0x4002 0000 - 0x4002 03FF GPIO 端口 A
|
||||||
0x40013800 0x400 /*EXINT & SCFG*/
|
0x40013800 0x400 /*EXINT & SCFG*/
|
||||||
0x40013C00 0x400 /*EXINT & SCFG*/
|
0x40013C00 0x400 /*EXINT & SCFG*/
|
||||||
0x40023800 0x400 /*CRM*/
|
0x40023800 0x400 /*CRM*/
|
||||||
|
|||||||
@@ -87,33 +87,60 @@ void MemManage_Handler(void)
|
|||||||
bool_t is_knl = is_run_knl();
|
bool_t is_knl = is_run_knl();
|
||||||
addr_t fault_addr = (addr_t)(SCB->MMFAR);
|
addr_t fault_addr = (addr_t)(SCB->MMFAR);
|
||||||
addr_t bus_addr = (addr_t)(SCB->BFAR);
|
addr_t bus_addr = (addr_t)(SCB->BFAR);
|
||||||
|
SCB->MMFAR = 0;
|
||||||
|
SCB->BFAR = 0;
|
||||||
task_t *cur_task = thread_get_current_task();
|
task_t *cur_task = thread_get_current_task();
|
||||||
|
bool_t reset_r9 = FALSE;
|
||||||
|
|
||||||
if ((SCB->CFSR & 0x1) || (SCB->CFSR & 0x2))
|
if (((SCB->CFSR & 0x1) || (SCB->CFSR & 0x2)) && (SCB->CFSR & (1 << 7)))
|
||||||
{
|
{
|
||||||
|
if (SCB->CFSR & 0x1)
|
||||||
|
{
|
||||||
|
SCB->CFSR |= 0x1;
|
||||||
|
}
|
||||||
|
if (SCB->CFSR & 0x2)
|
||||||
|
{
|
||||||
|
SCB->CFSR |= 0x2;
|
||||||
|
}
|
||||||
// printk("instr || data 0x%x access is error.\n", fault_addr);
|
// printk("instr || data 0x%x access is error.\n", fault_addr);
|
||||||
if (task_vma_page_fault(&(thread_get_current_task()->mm_space.mem_vma),
|
if (task_vma_page_fault(&(thread_get_current_task()->mm_space.mem_vma),
|
||||||
ALIGN_DOWN(fault_addr, PAGE_SIZE), NULL) < 0)
|
fault_addr, NULL) < 0)
|
||||||
{
|
{
|
||||||
printk("task:0x%x, mem_addr:0x%lx bus_addr:0x%lx semgement fault.\n",
|
printk("[semgement fault] task:0x%x, mem_addr:0x%lx bus_addr:0x%lx .\n",
|
||||||
thread_get_current_task(), fault_addr, bus_addr);
|
thread_get_current_task(), fault_addr, bus_addr);
|
||||||
task_knl_kill(thread_get_current(), is_knl);
|
goto end;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((SCB->CFSR & 8))
|
if ((SCB->CFSR & 8))
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 8;
|
||||||
printk("push stack is error.\n");
|
printk("push stack is error.\n");
|
||||||
}
|
}
|
||||||
if (SCB->CFSR & 16)
|
if (SCB->CFSR & 16)
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 16;
|
||||||
printk("pop stack is error.\n");
|
printk("pop stack is error.\n");
|
||||||
}
|
}
|
||||||
if (SCB->CFSR & 32)
|
if (SCB->CFSR & 32)
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 32;
|
||||||
printk("Floating point lazy stack error.\n");
|
printk("Floating point lazy stack error.\n");
|
||||||
}
|
}
|
||||||
task_knl_kill(thread_get_current(), is_knl);
|
end:
|
||||||
|
reset_r9 = task_knl_kill(thread_get_current(), is_knl);
|
||||||
|
if (reset_r9)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"mov r9, %0\n\t"
|
||||||
|
: /* 无输出操作数 */
|
||||||
|
: "r"(thread_get_current_task()->mm_space.mm_block) // 输入操作数,将value的值传递给R0寄存器
|
||||||
|
: // 告诉编译器R9寄存器将被修改
|
||||||
|
);
|
||||||
|
} while (0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,33 +40,60 @@ void MemManage_Handler(void)
|
|||||||
bool_t is_knl = is_run_knl();
|
bool_t is_knl = is_run_knl();
|
||||||
addr_t fault_addr = (addr_t)(SCB->MMFAR);
|
addr_t fault_addr = (addr_t)(SCB->MMFAR);
|
||||||
addr_t bus_addr = (addr_t)(SCB->BFAR);
|
addr_t bus_addr = (addr_t)(SCB->BFAR);
|
||||||
|
SCB->MMFAR = 0;
|
||||||
|
SCB->BFAR = 0;
|
||||||
task_t *cur_task = thread_get_current_task();
|
task_t *cur_task = thread_get_current_task();
|
||||||
|
bool_t reset_r9 = FALSE;
|
||||||
|
|
||||||
if ((SCB->CFSR & 0x1) || (SCB->CFSR & 0x2))
|
if (((SCB->CFSR & 0x1) || (SCB->CFSR & 0x2)) && (SCB->CFSR & (1 << 7)))
|
||||||
{
|
{
|
||||||
|
if (SCB->CFSR & 0x1)
|
||||||
|
{
|
||||||
|
SCB->CFSR |= 0x1;
|
||||||
|
}
|
||||||
|
if (SCB->CFSR & 0x2)
|
||||||
|
{
|
||||||
|
SCB->CFSR |= 0x2;
|
||||||
|
}
|
||||||
// printk("instr || data 0x%x access is error.\n", fault_addr);
|
// printk("instr || data 0x%x access is error.\n", fault_addr);
|
||||||
if (task_vma_page_fault(&(thread_get_current_task()->mm_space.mem_vma),
|
if (task_vma_page_fault(&(thread_get_current_task()->mm_space.mem_vma),
|
||||||
ALIGN_DOWN(fault_addr, PAGE_SIZE), NULL) < 0)
|
fault_addr, NULL) < 0)
|
||||||
{
|
{
|
||||||
printk("task:0x%x, mem_addr:0x%lx bus_addr:0x%lx semgement fault.\n",
|
printk("[semgement fault] task:0x%x, mem_addr:0x%lx bus_addr:0x%lx .\n",
|
||||||
thread_get_current_task(), fault_addr, bus_addr);
|
thread_get_current_task(), fault_addr, bus_addr);
|
||||||
task_knl_kill(thread_get_current(), is_knl);
|
goto end;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((SCB->CFSR & 8))
|
if ((SCB->CFSR & 8))
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 8;
|
||||||
printk("push stack is error.\n");
|
printk("push stack is error.\n");
|
||||||
}
|
}
|
||||||
if (SCB->CFSR & 16)
|
if (SCB->CFSR & 16)
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 16;
|
||||||
printk("pop stack is error.\n");
|
printk("pop stack is error.\n");
|
||||||
}
|
}
|
||||||
if (SCB->CFSR & 32)
|
if (SCB->CFSR & 32)
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 32;
|
||||||
printk("Floating point lazy stack error.\n");
|
printk("Floating point lazy stack error.\n");
|
||||||
}
|
}
|
||||||
task_knl_kill(thread_get_current(), is_knl);
|
end:
|
||||||
|
reset_r9 = task_knl_kill(thread_get_current(), is_knl);
|
||||||
|
if (reset_r9)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"mov r9, %0\n\t"
|
||||||
|
: /* 无输出操作数 */
|
||||||
|
: "r"(thread_get_current_task()->mm_space.mm_block) // 输入操作数,将value的值传递给R0寄存器
|
||||||
|
: // 告诉编译器R9寄存器将被修改
|
||||||
|
);
|
||||||
|
} while (0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -82,14 +82,24 @@ void MemManage_Handler(void)
|
|||||||
bool_t is_knl = is_run_knl();
|
bool_t is_knl = is_run_knl();
|
||||||
addr_t fault_addr = (addr_t)(SCB->MMFAR);
|
addr_t fault_addr = (addr_t)(SCB->MMFAR);
|
||||||
addr_t bus_addr = (addr_t)(SCB->BFAR);
|
addr_t bus_addr = (addr_t)(SCB->BFAR);
|
||||||
|
SCB->MMFAR = 0;
|
||||||
|
SCB->BFAR = 0;
|
||||||
task_t *cur_task = thread_get_current_task();
|
task_t *cur_task = thread_get_current_task();
|
||||||
bool_t reset_r9 = FALSE;
|
bool_t reset_r9 = FALSE;
|
||||||
|
|
||||||
if ((SCB->CFSR & 0x1) || (SCB->CFSR & 0x2))
|
if (((SCB->CFSR & 0x1) || (SCB->CFSR & 0x2)) && (SCB->CFSR & (1 << 7)))
|
||||||
{
|
{
|
||||||
|
if (SCB->CFSR & 0x1)
|
||||||
|
{
|
||||||
|
SCB->CFSR |= 0x1;
|
||||||
|
}
|
||||||
|
if (SCB->CFSR & 0x2)
|
||||||
|
{
|
||||||
|
SCB->CFSR |= 0x2;
|
||||||
|
}
|
||||||
// printk("instr || data 0x%x access is error.\n", fault_addr);
|
// printk("instr || data 0x%x access is error.\n", fault_addr);
|
||||||
if (task_vma_page_fault(&(thread_get_current_task()->mm_space.mem_vma),
|
if (task_vma_page_fault(&(thread_get_current_task()->mm_space.mem_vma),
|
||||||
ALIGN_DOWN(fault_addr, PAGE_SIZE), NULL) < 0)
|
fault_addr, NULL) < 0)
|
||||||
{
|
{
|
||||||
printk("[semgement fault] task:0x%x, mem_addr:0x%lx bus_addr:0x%lx .\n",
|
printk("[semgement fault] task:0x%x, mem_addr:0x%lx bus_addr:0x%lx .\n",
|
||||||
thread_get_current_task(), fault_addr, bus_addr);
|
thread_get_current_task(), fault_addr, bus_addr);
|
||||||
@@ -99,14 +109,17 @@ void MemManage_Handler(void)
|
|||||||
}
|
}
|
||||||
if ((SCB->CFSR & 8))
|
if ((SCB->CFSR & 8))
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 8;
|
||||||
printk("push stack is error.\n");
|
printk("push stack is error.\n");
|
||||||
}
|
}
|
||||||
if (SCB->CFSR & 16)
|
if (SCB->CFSR & 16)
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 16;
|
||||||
printk("pop stack is error.\n");
|
printk("pop stack is error.\n");
|
||||||
}
|
}
|
||||||
if (SCB->CFSR & 32)
|
if (SCB->CFSR & 32)
|
||||||
{
|
{
|
||||||
|
SCB->CFSR |= 32;
|
||||||
printk("Floating point lazy stack error.\n");
|
printk("Floating point lazy stack error.\n");
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
@@ -119,7 +132,7 @@ end:
|
|||||||
"mov r9, %0\n\t"
|
"mov r9, %0\n\t"
|
||||||
: /* 无输出操作数 */
|
: /* 无输出操作数 */
|
||||||
: "r"(thread_get_current_task()->mm_space.mm_block) // 输入操作数,将value的值传递给R0寄存器
|
: "r"(thread_get_current_task()->mm_space.mm_block) // 输入操作数,将value的值传递给R0寄存器
|
||||||
: // 告诉编译器R9寄存器将被修改
|
: // 告诉编译器R9寄存器将被修改
|
||||||
);
|
);
|
||||||
} while (0);
|
} while (0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,7 +214,8 @@ static inline pf_t *thread_get_pf(thread_t *th)
|
|||||||
static inline thread_t *thread_get_current(void)
|
static inline thread_t *thread_get_current(void)
|
||||||
{
|
{
|
||||||
umword_t sp = arch_get_sp();
|
umword_t sp = arch_get_sp();
|
||||||
thread_t *th = (thread_t *)(ALIGN_DOWN(sp, CONFIG_THREAD_BLOCK_SIZE));
|
// thread_t *th = (thread_t *)(ALIGN_DOWN(sp, CONFIG_THREAD_BLOCK_SIZE));
|
||||||
|
thread_t *th = (thread_t *)((sp / CONFIG_THREAD_BLOCK_SIZE) * CONFIG_THREAD_BLOCK_SIZE);
|
||||||
|
|
||||||
return th;
|
return th;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export TOOLCHAIN=/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/bin/
|
# export TOOLCHAIN=/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/bin/
|
||||||
export TOOLCHAIN_LIB=/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
|
# export TOOLCHAIN_LIB=/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
|
||||||
|
|
||||||
# linux build
|
# linux build
|
||||||
# export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/
|
# export TOOLCHAIN=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/bin/
|
||||||
# export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu
|
# export TOOLCHAIN_LIB=/home/zhangzheng/gcc-arm-none-eabi-5_4-2016q3/lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu
|
||||||
|
|
||||||
# mac compile
|
# mac compile
|
||||||
# export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
|
export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
|
||||||
# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m+fp/softfp
|
export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m+fp/softfp
|
||||||
|
|
||||||
# windows compile
|
# windows compile
|
||||||
# export TOOLCHAIN=/d/GNUArmEmbeddedToolchain/102021.10/bin/
|
# export TOOLCHAIN=/d/GNUArmEmbeddedToolchain/102021.10/bin/
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export TOOLCHAIN=/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/bin/
|
# export TOOLCHAIN=/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/bin/
|
||||||
export TOOLCHAIN_LIB=/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
|
# export TOOLCHAIN_LIB=/home/zhangzheng/toolchain/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
|
||||||
|
|
||||||
# export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
|
export TOOLCHAIN=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/bin/
|
||||||
# export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
|
export TOOLCHAIN_LIB=/Users/zhangzheng/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
|
||||||
|
|
||||||
# export TOOLCHAIN=/d/GNUArmEmbeddedToolchain/102021.10/bin/
|
# export TOOLCHAIN=/d/GNUArmEmbeddedToolchain/102021.10/bin/
|
||||||
# export TOOLCHAIN_LIB=/d/GNUArmEmbeddedToolchain/102021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
|
# export TOOLCHAIN_LIB=/d/GNUArmEmbeddedToolchain/102021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v7-m/nofp
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ")
|
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 ")
|
||||||
|
|
||||||
#appfs lib
|
#appfs lib
|
||||||
file(GLOB appfs_src src/appfs.c src/appfs_open.c)
|
file(GLOB appfs_src src/appfs.c src/appfs_open.c)
|
||||||
|
|||||||
@@ -14,21 +14,21 @@ static int drv_iomem_init(void)
|
|||||||
{
|
{
|
||||||
addr_t addr;
|
addr_t addr;
|
||||||
msg_tag_t tag;
|
msg_tag_t tag;
|
||||||
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, 0, 0),
|
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, VMA_ADDR_PAGE_FAULT_SIM, 0),
|
||||||
XMC_MEM_BASE - PERIPH_BASE, PERIPH_BASE, &addr);
|
XMC_MEM_BASE - PERIPH_BASE, PERIPH_BASE, &addr);
|
||||||
if (msg_tag_get_val(tag) < 0)
|
if (msg_tag_get_val(tag) < 0)
|
||||||
{
|
{
|
||||||
printf("periph mem alloc failed..\n");
|
printf("periph mem alloc failed..\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, 0, 0),
|
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, VMA_ADDR_PAGE_FAULT_SIM, 0),
|
||||||
0x4000000, XMC_MEM_BASE, &addr);
|
0x4000000, XMC_MEM_BASE, &addr);
|
||||||
if (msg_tag_get_val(tag) < 0)
|
if (msg_tag_get_val(tag) < 0)
|
||||||
{
|
{
|
||||||
printf("periph mem alloc failed..\n");
|
printf("periph mem alloc failed..\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, 0, 0),
|
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, VMA_ADDR_PAGE_FAULT_SIM, 0),
|
||||||
0x10000, XMC_REG_BASE, &addr);
|
0x10000, XMC_REG_BASE, &addr);
|
||||||
if (msg_tag_get_val(tag) < 0)
|
if (msg_tag_get_val(tag) < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ static int display_test(void)
|
|||||||
printf("display addr:0x%x\n", info.display_addr);
|
printf("display addr:0x%x\n", info.display_addr);
|
||||||
msg_tag_t tag;
|
msg_tag_t tag;
|
||||||
addr_t addr;
|
addr_t addr;
|
||||||
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, 0, 0),
|
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, VMA_ADDR_PAGE_FAULT_SIM, 0),
|
||||||
512, info.display_addr, &addr);
|
512, info.display_addr, &addr);
|
||||||
if (msg_tag_get_val(tag) < 0)
|
if (msg_tag_get_val(tag) < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ add_custom_target(
|
|||||||
COMMAND
|
COMMAND
|
||||||
cp nes.elf ${CMAKE_SOURCE_DIR}/build/output/nes.elf
|
cp nes.elf ${CMAKE_SOURCE_DIR}/build/output/nes.elf
|
||||||
COMMAND
|
COMMAND
|
||||||
cp ${CMAKE_CURRENT_SOURCE_DIR}/nes_rom/sm.nes ${CMAKE_SOURCE_DIR}/build/output/cpio/
|
cp ${CMAKE_CURRENT_SOURCE_DIR}/nes_rom/*.nes ${CMAKE_SOURCE_DIR}/build/output/cpio/
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(nes_dump nes.elf)
|
add_dependencies(nes_dump nes.elf)
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ again:
|
|||||||
}
|
}
|
||||||
msg_tag_t tag;
|
msg_tag_t tag;
|
||||||
addr_t addr;
|
addr_t addr;
|
||||||
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, 0, 0),
|
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, VMA_ADDR_PAGE_FAULT_SIM, 0),
|
||||||
512, info.display_addr, &addr);
|
512, info.display_addr, &addr);
|
||||||
if (msg_tag_get_val(tag) < 0)
|
if (msg_tag_get_val(tag) < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ int dev_regs_map(mk_dev_t *dev, void *fdt)
|
|||||||
reg[1] = fdt32_to_cpu((fdt32_t)reg_raw[i + 1]);
|
reg[1] = fdt32_to_cpu((fdt32_t)reg_raw[i + 1]);
|
||||||
|
|
||||||
printf("reg:0x%x size:0x%x\n", reg[0], reg[1]);
|
printf("reg:0x%x size:0x%x\n", reg[0], reg[1]);
|
||||||
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, 0, 0),
|
tag = u_vmam_alloc(VMA_PROT, vma_addr_create(VPAGE_PROT_RWX, VMA_ADDR_PAGE_FAULT_SIM, 0),
|
||||||
reg[1], reg[0], &vaddr);
|
reg[1], reg[0], &vaddr);
|
||||||
if (msg_tag_get_val(tag) < 0)
|
if (msg_tag_get_val(tag) < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user