Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
f46a211a8d | |||
57fff5c09b | |||
e39264632f | |||
630f9993d6 | |||
9249f34038 | |||
b14442d722 | |||
58e2dcfaf8 | |||
a7559066f4 | |||
10eb3c88fc | |||
90720804ba | |||
4975a8273c | |||
ed4ab31837 | |||
21391f1f01 | |||
21f97e9bc3 | |||
d715d50dfb | |||
a2cd38fbd5 | |||
c7cd0843b8 | |||
83b2105c38 | |||
510695bf6e | |||
7258684a33 | |||
15cc2ece6f | |||
3e0eaba231 | |||
4bd2111c93 | |||
f99db9409f | |||
87539a8433 | |||
de4cf8f35a | |||
7d4bcea3ba | |||
339d6b0f2c | |||
36cb401420 | |||
f3dc9aea54 | |||
2f675e9bdd | |||
3114cb265a | |||
fca9f04264 | |||
fe1136c7ce |
4
.gitignore
vendored
4
.gitignore
vendored
@ -151,6 +151,4 @@ compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
*.dump
|
||||
|
||||
.vscode/c_cpp_properties.json
|
||||
semihosting_test/build/semihosting_test
|
||||
semihosting_test/build/Makefile
|
||||
build
|
@ -0,0 +1,23 @@
|
||||
if (NOT DEFINED BOARD)
|
||||
set(BOARD iss)
|
||||
endif()
|
||||
if (NOT DEFINED ISA)
|
||||
set(ISA imc)
|
||||
endif()
|
||||
if(DEFINED LINK_TARGET)
|
||||
set(LNK LINK_TARGET=${LINK_TARGET})
|
||||
endif()
|
||||
message(STATUS "Building firmware using ${BOARD} board configuration and isa ${ISA}")
|
||||
add_custom_target(fw-common ALL
|
||||
COMMAND make -C ${CMAKE_CURRENT_SOURCE_DIR}/hello-world BOARD=${BOARD} ISA=${ISA} ${LNK}
|
||||
COMMAND make -C ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/dhrystone BOARD=${BOARD} ISA=${ISA} ${LNK}
|
||||
COMMAND make -C ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/coremark BOARD=${BOARD} ISA=${ISA} ${LNK}
|
||||
USES_TERMINAL
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_custom_target(fw-common-clean
|
||||
COMMAND make -C ${CMAKE_CURRENT_SOURCE_DIR}/hello-world BOARD=${BOARD} ISA=${ISA} ${LNK} clean
|
||||
COMMAND make -C ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/dhrystone BOARD=${BOARD} ISA=${ISA} ${LNK} clean
|
||||
COMMAND make -C ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/coremark BOARD=${BOARD} ISA=${ISA} ${LNK} clean
|
||||
USES_TERMINAL
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
116
Jenkinsfile
vendored
116
Jenkinsfile
vendored
@ -2,7 +2,7 @@ void checkout_project() {
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: [
|
||||
[name: '*/main']
|
||||
[name: '*/develop']
|
||||
],
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
@ -15,6 +15,24 @@ void checkout_project() {
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
void checkout_iss_project(String repoUrl, String branch = 'develop') {
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: [
|
||||
[name: "*/${branch}"]
|
||||
],
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: false, shallow: true]
|
||||
],
|
||||
submoduleCfg: [],
|
||||
userRemoteConfigs: [
|
||||
[credentialsId: 'gitea-jenkins', url: repoUrl]
|
||||
]
|
||||
])
|
||||
}
|
||||
|
||||
void checkout_develop() {
|
||||
dir("bare-metal-bsp") {
|
||||
withCredentials([usernamePassword(credentialsId: 'gitea-jenkins', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) {
|
||||
@ -29,6 +47,17 @@ void make_hello(board) {
|
||||
sh("make -C hello-world/ clean")
|
||||
}
|
||||
|
||||
void cmake_hello(board,build_type,core_type) {
|
||||
sh("pwd")
|
||||
// sh("cd hello-world/")
|
||||
//sh("pwd")
|
||||
def flavor ="${board}_${build_type}_${core_type}"
|
||||
if (core_type=="32")
|
||||
flavor ="${board}_${build_type}"
|
||||
sh("cmake -B ${flavor} --preset=${flavor}")
|
||||
sh("cmake --build ${flavor}")
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent { docker {
|
||||
image 'ubuntu-riscv'
|
||||
@ -48,12 +77,13 @@ pipeline {
|
||||
stage('make rtl') {steps { make_hello("rtl")}}
|
||||
stage('make ehrenberg') {steps { make_hello("ehrenberg")}}
|
||||
stage('make tgc_vp') {steps { make_hello("tgc_vp")}}*/
|
||||
|
||||
stage('make hello-world') {
|
||||
matrix {
|
||||
axes {
|
||||
axis{
|
||||
name 'BOARD'
|
||||
values 'iss', 'hifive1', 'TGCP', 'ehrenberg', 'rtl', 'tgc_vp'
|
||||
values 'iss', 'moonlight', 'tgc_vp'
|
||||
}
|
||||
}
|
||||
stages {
|
||||
@ -72,10 +102,92 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('CMAKE flow for hello-world') {
|
||||
matrix {
|
||||
axes {
|
||||
axis{
|
||||
name 'BOARD'
|
||||
values 'ISS', 'Moonlight', 'TGC_VP'
|
||||
}
|
||||
axis{
|
||||
name 'BUILD_TYPE'
|
||||
values 'Debug', 'Release'
|
||||
}
|
||||
axis{
|
||||
name 'CORE_TYPE'
|
||||
values '32', '64'
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Force sequential') {
|
||||
options {
|
||||
lock("One Board at a time")
|
||||
}
|
||||
stages {
|
||||
stage("CMAKE") {
|
||||
steps {
|
||||
dir("hello-world"){
|
||||
cmake_hello("${BOARD}","${BUILD_TYPE}","${CORE_TYPE}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Checkout TGC-ISS, TGC-Compliance and TGC-GEN"){
|
||||
steps {
|
||||
sh 'rm -rf * .??* '
|
||||
checkout_iss_project("https://git.minres.com/TGFS/TGC-ISS.git", "develop")
|
||||
dir("TGC-COMPLIANCE"){
|
||||
checkout_iss_project("https://git.minres.com/TGFS/TGC-COMPLIANCE.git", "master")
|
||||
}
|
||||
dir("TGC-GEN"){
|
||||
checkout_iss_project("https://git.minres.com/TGFS/TGC-GEN.git", "develop")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stage("Generate cores and build TGC-ISS"){
|
||||
steps {
|
||||
sh 'pwd'
|
||||
sh 'conan profile detect --force'
|
||||
sh 'rm -rf build'
|
||||
/*
|
||||
sh '''
|
||||
for core in RV32GC; do
|
||||
for backend in interp; do
|
||||
TGC-GEN/scripts/generate_iss.sh -o dbt-rise-tgc/ -c $core -b ${backend} TGC-GEN/CoreDSL/${core}.core_desc
|
||||
done
|
||||
done
|
||||
for core in RV64GC; do
|
||||
for backend in interp; do
|
||||
TGC-GEN/scripts/generate_iss.sh -o dbt-rise-tgc/ -c $core -b ${backend} TGC-GEN/CoreDSL/${core}.core_desc
|
||||
done
|
||||
done
|
||||
'''
|
||||
sh 'conan profile detect --force'
|
||||
sh 'rm -rf build'
|
||||
sh 'cmake -S . -B build --preset Release -DWITH_ASMJIT=ON -DWITH_TCC=ON -DWITH_LLVM=OFF'
|
||||
sh 'cmake --build build -j'
|
||||
sh 'build/dbt-rise-tgc/tgc-sim --isa ?'
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
stage("start to check") {
|
||||
steps {
|
||||
sh 'pwd'
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
post {
|
||||
failure {
|
||||
sh("make -C hello-world/ clean")
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Submodule bare-metal-bsp updated: 540397494a...a7b4e7b715
@ -1,15 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(coremark C)
|
||||
set(TARGET coremark)
|
||||
#set(CMAKE_BUILD_TYPE Release)
|
||||
|
||||
option(HAVE_NO_INIT_FINI "Enable NO_INIT_FINI" OFF)
|
||||
|
||||
if(HAVE_NO_INIT_FINI)
|
||||
#if HAVE_NO_INIT_FINI is ON
|
||||
add_definitions(-DHAVE_NO_INIT_FINI)
|
||||
endif()
|
||||
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
|
||||
# Source files
|
||||
set(SOURCES
|
||||
@ -23,7 +15,6 @@ set(SOURCES
|
||||
cm/core_util.c
|
||||
)
|
||||
|
||||
|
||||
# Create executable
|
||||
add_executable(coremark ${SOURCES})
|
||||
target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/cm)
|
||||
@ -33,13 +24,7 @@ target_compile_definitions(${TARGET} PRIVATE PERFORMANCE_RUN=1 CLOCKS_PER_SEC=10
|
||||
set(BOARD "iss" CACHE STRING "Target board")
|
||||
add_subdirectory(../../bare-metal-bsp bsp)
|
||||
target_link_libraries(${TARGET} PRIVATE bsp)
|
||||
target_link_options(${TARGET} PRIVATE -Wl,-Map=${TARGET}.map)
|
||||
|
||||
include(CMakePrintHelpers)
|
||||
cmake_print_properties(TARGETS ${TARGET} PROPERTIES COMPILE_DEFINITIONS COMPILE_OPTIONS LINK_OPTIONS INTERFACE_LINK_OPTIONS)
|
||||
|
||||
#message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
||||
#message(STATUS "CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
|
||||
target_link_options(${TARGET} PRIVATE LINKER:-Map=${TARGET}.map)
|
||||
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis
|
||||
|
@ -9,62 +9,110 @@
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "32imc",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "64imc",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "iss",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "iss"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "moonlight",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "moonlight"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tgc_vp",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "tgc_vp"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "rtl",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "rtl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_moon",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "moonlight",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_tgc",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "tgc_vp",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64_moon",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "moonlight",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64_tgc",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "tgc_vp",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ISS_Debug",
|
||||
"inherits": ["iss", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Debug",
|
||||
"inherits": ["moonlight", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Debug",
|
||||
"inherits": ["tgc_vp", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Debug_64",
|
||||
"inherits": ["iss", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Debug_64",
|
||||
"inherits": ["moonlight", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Debug_64",
|
||||
"inherits": ["tgc_vp", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Release",
|
||||
"inherits": ["iss", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Release",
|
||||
"inherits": ["moonlight", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Release",
|
||||
"inherits": ["tgc_vp", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Release_64",
|
||||
"inherits": ["iss", "release", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Release_64",
|
||||
"inherits": ["moonlight", "release", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Release_64",
|
||||
"inherits": ["tgc_vp", "release", "64imc"]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
@ -2,14 +2,7 @@ cmake_minimum_required(VERSION 3.21)
|
||||
project(dhrystone C)
|
||||
set(TARGET dhrystone)
|
||||
|
||||
option(HAVE_NO_INIT_FINI "Enable NO_INIT_FINI" OFF)
|
||||
|
||||
if(HAVE_NO_INIT_FINI)
|
||||
#if HAVE_NO_INIT_FINI is ON
|
||||
add_definitions(-DHAVE_NO_INIT_FINI)
|
||||
endif()
|
||||
|
||||
set(ITERATIONS 50000) # 20000 for TGC
|
||||
set(ITERATIONS 50000)
|
||||
|
||||
add_executable(${TARGET} dhry_1.c dhry_2.c dhry_stubs.c)
|
||||
target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
@ -19,12 +12,7 @@ target_compile_definitions(${TARGET} PRIVATE ITERATIONS=${ITERATIONS} HZ=32768 T
|
||||
set(BOARD "iss" CACHE STRING "Target board")
|
||||
add_subdirectory(../../bare-metal-bsp bsp)
|
||||
target_link_libraries(${TARGET} PRIVATE bsp)
|
||||
target_link_options(${TARGET} PRIVATE LINKER:--wrap=scanf)
|
||||
#target_link_options(${TARGET} PRIVATE LINKER:--wrap=scanf -Wl,--no-gc-sections)
|
||||
|
||||
target_link_options(${TARGET} PRIVATE -Wl,-Map=${TARGET}.map)
|
||||
include(CMakePrintHelpers)
|
||||
cmake_print_properties(TARGETS ${TARGET} PROPERTIES COMPILE_DEFINITIONS COMPILE_OPTIONS LINK_OPTIONS INTERFACE_LINK_OPTIONS)
|
||||
target_link_options(${TARGET} PRIVATE LINKER:-Map=${TARGET}.map)
|
||||
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis
|
||||
|
@ -9,62 +9,110 @@
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "32imc",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "64imc",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "iss",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "iss"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "moonlight",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "moonlight"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tgc_vp",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "tgc_vp"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "rtl",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "rtl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_moon",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "moonlight",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_tgc",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "tgc_vp",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64_moon",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "moonlight",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64_tgc",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "tgc_vp",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ISS_Debug",
|
||||
"inherits": ["iss", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Debug",
|
||||
"inherits": ["moonlight", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Debug",
|
||||
"inherits": ["tgc_vp", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Debug_64",
|
||||
"inherits": ["iss", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Debug_64",
|
||||
"inherits": ["moonlight", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Debug_64",
|
||||
"inherits": ["tgc_vp", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Release",
|
||||
"inherits": ["iss", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Release",
|
||||
"inherits": ["moonlight", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Release",
|
||||
"inherits": ["tgc_vp", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Release_64",
|
||||
"inherits": ["iss", "release", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Release_64",
|
||||
"inherits": ["moonlight", "release", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Release_64",
|
||||
"inherits": ["tgc_vp", "release", "64imc"]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
@ -9,7 +9,7 @@ HEADERS := dhry.h
|
||||
BOARD?=iss
|
||||
LINK_TARGET=link
|
||||
RISCV_ARCH:=rv32$(ISA)
|
||||
ifeq ($(ISA),e)
|
||||
ifneq (,$(findstring e,$(ISA)))
|
||||
RISCV_ABI:=ilp32e
|
||||
else
|
||||
RISCV_ABI:=ilp32
|
||||
@ -18,7 +18,6 @@ endif
|
||||
CFLAGS := -g -O3 -DITERATIONS=$(ITERATIONS) -DHZ=32768 -DTIME -DNO_INIT -fno-inline -fno-builtin-printf -fno-common -Wno-implicit \
|
||||
-funroll-loops -fpeel-loops -fgcse-sm -fgcse-las
|
||||
LDFLAGS := -Wl,--wrap=scanf
|
||||
|
||||
TOOL_DIR=$(dir $(compiler))
|
||||
|
||||
BSP_BASE = ../../bare-metal-bsp
|
||||
|
@ -212,7 +212,7 @@ main ()
|
||||
printf ("Arr_2_Glob[8][7]: %d\n", Arr_2_Glob[8][7]);
|
||||
printf (" should be: Number_Of_Runs + 10\n");
|
||||
printf ("Ptr_Glob->\n");
|
||||
printf (" Ptr_Comp: %d\n", (int) Ptr_Glob->Ptr_Comp);
|
||||
printf (" Ptr_Comp: %d\n", (long) Ptr_Glob->Ptr_Comp);
|
||||
printf (" should be: (implementation-dependent)\n");
|
||||
printf (" Discr: %d\n", Ptr_Glob->Discr);
|
||||
printf (" should be: %d\n", 0);
|
||||
@ -223,7 +223,7 @@ main ()
|
||||
printf (" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp);
|
||||
printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n");
|
||||
printf ("Next_Ptr_Glob->\n");
|
||||
printf (" Ptr_Comp: %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
|
||||
printf (" Ptr_Comp: %d\n", (long) Next_Ptr_Glob->Ptr_Comp);
|
||||
printf (" should be: (implementation-dependent), same as above\n");
|
||||
printf (" Discr: %d\n", Next_Ptr_Glob->Discr);
|
||||
printf (" should be: %d\n", 0);
|
||||
|
@ -1,22 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(hello-world C)
|
||||
set(TARGET hello)
|
||||
option(HAVE_NO_INIT_FINI "Enable NO_INIT_FINI" OFF)
|
||||
|
||||
if(HAVE_NO_INIT_FINI)
|
||||
#if HAVE_NO_INIT_FINI is ON
|
||||
add_definitions(-DHAVE_NO_INIT_FINI)
|
||||
endif()
|
||||
|
||||
add_executable(${TARGET} hello.c)
|
||||
|
||||
|
||||
|
||||
set(BOARD "iss" CACHE STRING "Target board")
|
||||
message(" BOARD = ${BOARD}")
|
||||
add_subdirectory(../bare-metal-bsp bsp)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../bare-metal-bsp bsp)
|
||||
target_link_libraries(${TARGET} PRIVATE bsp)
|
||||
target_link_options(${TARGET} PRIVATE -Wl,-Map=${TARGET}.map)
|
||||
target_link_options(${TARGET} PRIVATE LINKER:-Map=${TARGET}.map)
|
||||
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis
|
||||
|
@ -9,62 +9,110 @@
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "32imc",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "64imc",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "iss",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "iss"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "moonlight",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "moonlight"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tgc_vp",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "tgc_vp"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "rtl",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"BOARD": "rtl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_moon",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "moonlight",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_tgc",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "tgc_vp",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64_moon",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "moonlight",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug_64_tgc",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"BOARD": "tgc_vp",
|
||||
"HAVE_NO_INIT_FINI": "ON",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
|
||||
}
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
|
||||
}
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ISS_Debug",
|
||||
"inherits": ["iss", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Debug",
|
||||
"inherits": ["moonlight", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Debug",
|
||||
"inherits": ["tgc_vp", "debug", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Debug_64",
|
||||
"inherits": ["iss", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Debug_64",
|
||||
"inherits": ["moonlight", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Debug_64",
|
||||
"inherits": ["tgc_vp", "debug", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Release",
|
||||
"inherits": ["iss", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Release",
|
||||
"inherits": ["moonlight", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Release",
|
||||
"inherits": ["tgc_vp", "release", "32imc"]
|
||||
},
|
||||
{
|
||||
"name": "ISS_Release_64",
|
||||
"inherits": ["iss", "release", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "Moonlight_Release_64",
|
||||
"inherits": ["moonlight", "release", "64imc"]
|
||||
},
|
||||
{
|
||||
"name": "TGC_VP_Release_64",
|
||||
"inherits": ["tgc_vp", "release", "64imc"]
|
||||
}
|
||||
|
||||
]
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
|
||||
TARGET = hello
|
||||
ISA?=imc
|
||||
|
||||
|
@ -3,35 +3,19 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "encoding.h"
|
||||
#include "platform.h"
|
||||
#include <string.h>
|
||||
|
||||
int factorial(int i) {
|
||||
|
||||
volatile int result = 1;
|
||||
for (int ii = 1; ii <= i; ii++) {
|
||||
result = result * ii;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
extern volatile uintptr_t tohost;
|
||||
|
||||
void write_tohost(char *string) {
|
||||
volatile uint64_t payload[4] = {64, 0, (uintptr_t)string,
|
||||
(strlen(string) + 1)};
|
||||
tohost = (uintptr_t)payload;
|
||||
}
|
||||
|
||||
int main() {
|
||||
char string[] = "hello world with write in hello";
|
||||
|
||||
write_tohost(string);
|
||||
|
||||
write(STDOUT_FILENO, string, sizeof(string));
|
||||
|
||||
int result = factorial(10);
|
||||
printf("Factorial is %d", result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user