MNRS-BM-BSP/env/CMakeLists.txt

65 lines
1.6 KiB
CMake

project(env)
message(STATUS " here in bsp/env")
message(STATUS " BOARD: ${BOARD}")
# Enable ASM language
enable_language(ASM)
set(ASM_SOURCES
entry.S
start.S
)
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
)
# Export variables for hello-world to use
set(ENV_OBJECTS
$<TARGET_OBJECTS:asm_obj>
PARENT_SCOPE
)
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})
# 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}")
#add_subdirectory(${BOARD})
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
)
# Include the ISS board configuration
#set(ISS_SOURCE_DIR "${CMAKE_SOURCE_DIR}/bare-metal-bsp/env/iss")
#set(ISS_BINARY_DIR "${CMAKE_BINARY_DIR}/iss_build")
#add_subdirectory(${ISS_SOURCE_DIR} ${ISS_BINARY_DIR})
# Export board library
#set(BOARD_LIB board_iss PARENT_SCOPE)