2025-01-06 20:19:05 +01:00
|
|
|
cmake_minimum_required(VERSION 3.21)
|
|
|
|
project(mnrs-bsp LANGUAGES ASM C)
|
|
|
|
|
|
|
|
if(NOT DEFINED BOARD)
|
|
|
|
message(FATAL_ERROR "No Board selected")
|
|
|
|
endif()
|
|
|
|
add_compile_definitions("BOARD_${BOARD}")
|
|
|
|
# check if we are building for a testbench, adjust the Base accordingly
|
|
|
|
set(BOARD_BASE ${BOARD})
|
|
|
|
|
|
|
|
option(SEMIHOSTING "Enable semihosting support" OFF)
|
|
|
|
if(SEMIHOSTING)
|
|
|
|
add_compile_definitions(SEMIHOSTING)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(startup STATIC env/start.S env/entry.S)
|
|
|
|
target_include_directories(startup PUBLIC env include)
|
|
|
|
|
2024-12-17 12:32:21 +01:00
|
|
|
add_subdirectory(libwrap)
|
2025-01-06 20:19:05 +01:00
|
|
|
|
|
|
|
add_library(bsp INTERFACE)
|
|
|
|
target_link_libraries(bsp INTERFACE startup wrap)
|
|
|
|
target_include_directories(bsp INTERFACE env/${BOARD_BASE})
|
|
|
|
target_link_options(bsp INTERFACE LINKER:--no-warn-rwx-segments -nostartfiles -T ${CMAKE_CURRENT_SOURCE_DIR}/env/${BOARD_BASE}/link.lds)
|
|
|
|
if(SEMIHOSTING)
|
|
|
|
target_include_directories(bsp INTERFACE /include)
|
|
|
|
target_sources(bsp INTERFACE env/semihosting.c env/trap.c)
|
|
|
|
endif()
|