Compare commits
2 Commits
private/ho
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| c8ae71cfd5 | |||
| e9d42211d0 |
@@ -1,13 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.21)
|
|
||||||
project(test_fw C)
|
|
||||||
set(TARGET test_fw)
|
|
||||||
add_executable(${TARGET} test_fw.c)
|
|
||||||
|
|
||||||
set(BOARD "iss" CACHE STRING "Target board")
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../bare-metal-bsp bsp)
|
|
||||||
target_link_libraries(${TARGET} PRIVATE bsp)
|
|
||||||
target_link_options(${TARGET} PRIVATE LINKER:-Map=${TARGET}.map)
|
|
||||||
|
|
||||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
|
||||||
COMMAND ${CMAKE_OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis
|
|
||||||
COMMENT "Creating disassembly for ${TARGET}")
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"vendor": {
|
|
||||||
"conan": {}
|
|
||||||
},
|
|
||||||
"cmakeMinimumRequired": {
|
|
||||||
"major": 3,
|
|
||||||
"minor": 24,
|
|
||||||
"patch": 0
|
|
||||||
},
|
|
||||||
"configurePresets": [
|
|
||||||
{
|
|
||||||
"name": "32imc",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../bare-metal-bsp/cmake/rv32imc.cmake"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "64imc",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../bare-metal-bsp/cmake/rv64gc.cmake"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "iss",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"BOARD": "iss"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "moonlight",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"BOARD": "moonlight"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "riscv_vp",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"BOARD": "riscv_vp",
|
|
||||||
"LINKER_SCRIPT": "/scratch/hongyu/workarea/Firmwares/bare-metal-bsp/env/riscv_vp/flash.lds"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rtl",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"BOARD": "rtl"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "debug",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Debug"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "release",
|
|
||||||
"hidden": true,
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Release"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ISS_Debug",
|
|
||||||
"inherits": ["iss", "debug", "32imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Moonlight_Debug",
|
|
||||||
"inherits": ["moonlight", "debug", "32imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "riscv_vp_Debug",
|
|
||||||
"inherits": ["riscv_vp", "debug", "32imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ISS_Debug_64",
|
|
||||||
"inherits": ["iss", "debug", "64imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Moonlight_Debug_64",
|
|
||||||
"hidden": true,
|
|
||||||
"inherits": ["moonlight", "debug", "64imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "riscv_vp_Debug_64",
|
|
||||||
"inherits": ["riscv_vp", "debug", "64imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ISS_Release",
|
|
||||||
"inherits": ["iss", "release", "32imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Moonlight_Release",
|
|
||||||
"inherits": ["moonlight", "release", "32imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "riscv_vp_Release",
|
|
||||||
"inherits": ["riscv_vp", "release", "32imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ISS_Release_64",
|
|
||||||
"inherits": ["iss", "release", "64imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Moonlight_Release_64",
|
|
||||||
"hidden": true,
|
|
||||||
"inherits": ["moonlight", "release", "64imc"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "riscv_vp_Release_64",
|
|
||||||
"hidden": true,
|
|
||||||
"inherits": ["riscv_vp", "release", "64imc"]
|
|
||||||
}
|
|
||||||
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#include "encoding.h"
|
|
||||||
#include "platform.h"
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
void handle_m_time_interrupt() {
|
|
||||||
uint64_t time = get_aclint_mtime(aclint);
|
|
||||||
time += MTIMER_NEXT_TICK_INC;
|
|
||||||
set_aclint_mtimecmp(aclint, time);
|
|
||||||
puts("m_time_irq");
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
puts("in main");
|
|
||||||
// avoid getting interrupt upon enabling MIP/MIE_MTI
|
|
||||||
set_aclint_mtimecmp(aclint, 0xffffffffffffffff);
|
|
||||||
// enable global interrupt
|
|
||||||
csr_set_bits_mstatus(MSTATUS_MIE_BIT_MASK);
|
|
||||||
|
|
||||||
puts("after enable MSTATUS_MIE/MPP");
|
|
||||||
// enable MIE
|
|
||||||
csr_set_bits_mie(MIE_MTI_BIT_MASK | MIE_MSI_BIT_MASK | MIE_MEI_BIT_MASK);
|
|
||||||
puts("after enable MIE");
|
|
||||||
|
|
||||||
uint64_t time = get_aclint_mtime(aclint);
|
|
||||||
printf("in main() get_aclint_mtime return %lu \n", (uint32_t)time);
|
|
||||||
set_aclint_mtime(aclint, 9);
|
|
||||||
time = get_aclint_mtime(aclint);
|
|
||||||
printf("in main() get_aclint_mtime after set 9, return %lu \n", (uint32_t)time);
|
|
||||||
|
|
||||||
set_aclint_mtimecmp(aclint, (time + 3));
|
|
||||||
puts("set mtimecmp");
|
|
||||||
|
|
||||||
uint64_t timecmp = get_aclint_mtimecmp(aclint);
|
|
||||||
printf("in main() get_aclint_mtimecmp return %d \n", timecmp);
|
|
||||||
|
|
||||||
puts(" finshed ");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user