updates CMakeLists and Presets for all examples

This commit is contained in:
Eyck-Alexander Jentzsch 2025-05-23 09:31:31 +02:00
parent 7d4bcea3ba
commit de4cf8f35a
6 changed files with 168 additions and 88 deletions

View File

@ -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

View File

@ -10,61 +10,100 @@
},
"configurePresets": [
{
"name": "debug",
"name": "ISS_Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "debug_moon",
"name": "Moonlight_Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "moonlight",
"HAVE_NO_INIT_FINI": "ON",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "debug_tgc",
"name": "TGC_Debug",
"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",
"name": "ISS_Debug_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "debug_64_moon",
"name": "Moonlight_Debug_64",
"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",
"name": "TGC_Debug_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "tgc_vp",
"HAVE_NO_INIT_FINI": "ON",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"name": "ISS_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "Moonlight_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "moonlight",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "TGC_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "tgc_vp",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "ISS_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "Moonlight_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "moonlight",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "TGC_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "tgc_vp",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
}
]
}

View File

@ -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

View File

@ -10,61 +10,100 @@
},
"configurePresets": [
{
"name": "debug",
"name": "ISS_Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "debug_moon",
"name": "Moonlight_Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "moonlight",
"HAVE_NO_INIT_FINI": "ON",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "debug_tgc",
"name": "TGC_Debug",
"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",
"name": "ISS_Debug_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "debug_64_moon",
"name": "Moonlight_Debug_64",
"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",
"name": "TGC_Debug_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "tgc_vp",
"HAVE_NO_INIT_FINI": "ON",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"name": "ISS_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "Moonlight_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "moonlight",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "TGC_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "tgc_vp",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "ISS_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "Moonlight_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "moonlight",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "TGC_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "tgc_vp",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
}
]
}

View File

@ -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

View File

@ -10,61 +10,100 @@
},
"configurePresets": [
{
"name": "debug",
"name": "ISS_Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "debug_moon",
"name": "Moonlight_Debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "moonlight",
"HAVE_NO_INIT_FINI": "ON",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "debug_tgc",
"name": "TGC_Debug",
"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",
"name": "ISS_Debug_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "debug_64_moon",
"name": "Moonlight_Debug_64",
"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",
"name": "TGC_Debug_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "tgc_vp",
"HAVE_NO_INIT_FINI": "ON",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"name": "ISS_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "Moonlight_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "moonlight",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "TGC_Release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "tgc_vp",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv32imc.cmake"
}
},
{
"name": "ISS_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "iss",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "Moonlight_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "moonlight",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
},
{
"name": "TGC_Release_64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BOARD": "tgc_vp",
"CMAKE_TOOLCHAIN_FILE": "../../bare-metal-bsp/cmake/rv64gc.cmake"
}
}
]
}