MNRS-BM-BSP/env/CMakeLists.txt

65 lines
1.6 KiB
CMake
Raw Permalink Normal View History

2024-12-20 14:27:45 +01:00
project(env)
message(STATUS " here in bsp/env")
message(STATUS " BOARD: ${BOARD}")
2024-12-17 12:32:21 +01:00
# Enable ASM language
enable_language(ASM)
2024-12-20 14:27:45 +01:00
set(ASM_SOURCES
2024-12-17 12:32:21 +01:00
entry.S
start.S
)
2024-12-20 14:27:45 +01:00
add_library(asm_obj OBJECT ${ASM_SOURCES})
set_target_properties(asm_obj PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bare-metal-bsp/${PROJECT_NAME})
target_include_directories(asm_obj PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${BSP_BASE}/include
#include/
${BSP_BASE}/env
${BSP_BASE}/env/${BOARD}
${BSP_BASE}/drivers
)
2024-12-17 12:32:21 +01:00
2024-12-20 14:27:45 +01:00
# Export variables for hello-world to use
set(ENV_OBJECTS
$<TARGET_OBJECTS:asm_obj>
2024-12-17 12:32:21 +01:00
2024-12-20 14:27:45 +01:00
PARENT_SCOPE
)
2024-12-17 12:32:21 +01:00
2024-12-20 14:27:45 +01:00
set(BOARD_LIB_NAME ${BOARD})
message(STATUS " BOARD_LIB_NAME: ${BOARD_LIB_NAME}")
set(BOARD_LIB_SRC
${BOARD}/init.c
${BOARD}/write.c
)
add_library(${BOARD_LIB_NAME} STATIC ${BOARD_LIB_SRC})
set_target_properties(${BOARD_LIB_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bare-metal-bsp/${PROJECT_NAME})
2024-12-17 12:32:21 +01:00
2024-12-20 14:27:45 +01:00
# Set ASM compile options
#set(CMAKE_ASM_COMPILER riscv64-unknown-elf-as)
#set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -march=${RISCV_ARCH}_zicsr_zifencei -mabi=${RISCV_ABI}")
2024-12-17 12:32:21 +01:00
2024-12-20 14:27:45 +01:00
#add_subdirectory(${BOARD})
2024-12-17 12:32:21 +01:00
2024-12-20 14:27:45 +01:00
target_include_directories(${BOARD_LIB_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${BSP_BASE}/include
${BSP_BASE}/libwrap/sys
${BSP_BASE}/env
${BSP_BASE}/env/${BOARD}
${BSP_BASE}/drivers
)
2024-12-17 12:32:21 +01:00
# Include the ISS board configuration
2024-12-20 14:27:45 +01:00
#set(ISS_SOURCE_DIR "${CMAKE_SOURCE_DIR}/bare-metal-bsp/env/iss")
#set(ISS_BINARY_DIR "${CMAKE_BINARY_DIR}/iss_build")
2024-12-17 12:32:21 +01:00
2024-12-20 14:27:45 +01:00
#add_subdirectory(${ISS_SOURCE_DIR} ${ISS_BINARY_DIR})
2024-12-17 12:32:21 +01:00
# Export board library
2024-12-20 14:27:45 +01:00
#set(BOARD_LIB board_iss PARENT_SCOPE)