|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
cmake_minimum_required(VERSION 3.15)
|
|
|
|
|
|
|
|
|
|
include(config/cmakeProjectConfig.cmake)
|
|
|
|
|
|
|
|
|
@ -6,11 +6,17 @@ set(CSL_DIR ${CMAKE_SOURCE_DIR}/csl/${CSL_USED})
|
|
|
|
|
set(CSL_SOURCES ${CMAKE_SOURCE_DIR}/csl/${CSL_USED}/Src)
|
|
|
|
|
|
|
|
|
|
if(EXISTS ${CSL_DIR}) # Cheking if the directory exists
|
|
|
|
|
message("${BoldGreen}Compiling for ${CSL_USED} ${ColourReset}")
|
|
|
|
|
set(COMPILER_DEFS config/compiler.cmake)
|
|
|
|
|
message("${Green}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Compiling for ${CSL_USED}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
set(COMPILER_DEFS ${CMAKE_SOURCE_DIR}/config/compiler.cmake)
|
|
|
|
|
set(PROJECT_DEFS ${CSL_DIR}/config.cmake)
|
|
|
|
|
else()
|
|
|
|
|
message( FATAL_ERROR "${BoldRed}Please Select a valid CSL, CMake will exit.${ColourReset}" )
|
|
|
|
|
message("${Red}")
|
|
|
|
|
message( FATAL_ERROR "\nPlease Select a valid CSL, CMake will exit\n")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
include(${COMPILER_DEFS})
|
|
|
|
@ -38,43 +44,77 @@ add_subdirectory(csl)
|
|
|
|
|
add_subdirectory(drivers)
|
|
|
|
|
add_subdirectory(periferals)
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
#Sartupt uCode Definition
|
|
|
|
|
####################################################################################################
|
|
|
|
|
list(APPEND STARTUP_UCODE sub::startup)
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
#Peripehral definitions
|
|
|
|
|
####################################################################################################
|
|
|
|
|
set(PERIPHERALS_LIST deviceSetup delay usart timer spi i2c pin)
|
|
|
|
|
|
|
|
|
|
set(NEW_ELEMENT null)
|
|
|
|
|
|
|
|
|
|
addPeripheral("deviceSetup") # TODO: this point needs to be discussed. How should it work and what should it do?
|
|
|
|
|
addPeripheral("timer")
|
|
|
|
|
addPeripheral("usart")
|
|
|
|
|
addPeripheral("spi")
|
|
|
|
|
addPeripheral("i2c")
|
|
|
|
|
addPeripheral("delay")
|
|
|
|
|
addPeripheral("pin")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message("${BoldYellow}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Cheking Periferals")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
|
|
|
|
|
foreach(X IN LISTS PERIPHERALS_LIST)
|
|
|
|
|
addPeripheral("${X}" "NEW_ELEMENT")
|
|
|
|
|
list(APPEND PERIPHERAL_LIBS ${NEW_ELEMENT})
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
#Driver definitions
|
|
|
|
|
####################################################################################################
|
|
|
|
|
set(DRIVERS_LIST max7219)
|
|
|
|
|
|
|
|
|
|
message("${BoldYellow}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Cheking Drivers")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
|
|
|
|
|
message("${BoldBlue}Project Info ${ColourReset}")
|
|
|
|
|
message("${Blue} |--> Exec Name \t: ${EXECUTABLE} ${ColourReset}")
|
|
|
|
|
message("${Blue} |--> Compiler Def\t: ${COMPILER_DEFS} ${ColourReset}")
|
|
|
|
|
message("${Blue} |--> Project Def\t: ${PROJECT_DEFS} ${ColourReset}")
|
|
|
|
|
message("${Blue} |--> Interfaces Dir\t: ${INTERFACES_DIR} ${ColourReset}")
|
|
|
|
|
message("${Blue} |--> Libs used\t\t: ${EXTRA_LIBS} ${ColourReset}")
|
|
|
|
|
foreach(X IN LISTS DRIVERS_LIST)
|
|
|
|
|
list(APPEND DRIVER_LIBS sub::${X})
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
####################################################################################################
|
|
|
|
|
#Library definitions
|
|
|
|
|
#Overview
|
|
|
|
|
####################################################################################################
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::startup)
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::delay)
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::usart)
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::timer)
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::deviceSetup)
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::max7219)
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::spi)
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::i2c)
|
|
|
|
|
list(APPEND EXTRA_LIBS sub::pin)
|
|
|
|
|
message("${BoldBlue}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Project Info")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message(" |--> Executable's Name\t\t\t : ${EXECUTABLE}")
|
|
|
|
|
message(" |--> Compiler Definition file\t\t : ${COMPILER_DEFS}")
|
|
|
|
|
message(" |--> Project's cmake configuration\t : ${PROJECT_DEFS}")
|
|
|
|
|
message(" |--> Chip Support Layer Dir.\t\t : ${CSL_DIR}")
|
|
|
|
|
message(" |--> Driver Dir\t\t\t : ${DRIVERS_DIR}")
|
|
|
|
|
message(" |--> Periferal Definition Dir\t\t : ${PERIFERALS_DIR}")
|
|
|
|
|
message(" |--> Periferal Implementation Dir\t : ${CSL_SOURCES}")
|
|
|
|
|
|
|
|
|
|
message(" |--> Startup uCode Submodule:")
|
|
|
|
|
message(" |->${STARTUP_UCODE}")
|
|
|
|
|
|
|
|
|
|
message(" |--> Periferals Submodules:")
|
|
|
|
|
foreach(X IN LISTS PERIPHERAL_LIBS)
|
|
|
|
|
message(" |->${X}")
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
message(" |--> Driver Submodules:")
|
|
|
|
|
foreach(X IN LISTS DRIVER_LIBS)
|
|
|
|
|
message(" |->${X}")
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
|
|
|
|
|
####################################################################################################
|
|
|
|
|
#EXECUTABLE
|
|
|
|
@ -87,17 +127,27 @@ target_include_directories(${EXECUTABLE} PUBLIC ${MAIN_INCLUDES})
|
|
|
|
|
####################################################################################################
|
|
|
|
|
#LINKING EXECUTEABLE
|
|
|
|
|
####################################################################################################
|
|
|
|
|
message("${Cyan}")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("Linker & Compiler Info")
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
|
|
|
|
|
if(IS_NO_SYS)
|
|
|
|
|
message("${Cyan}Using specifier Linker script ${ColourReset}")
|
|
|
|
|
message("${Cyan} |--> ${LINKER} ${ColourReset}")
|
|
|
|
|
|
|
|
|
|
target_link_libraries(${EXECUTABLE} ${EXTRA_LIBS})
|
|
|
|
|
target_link_libraries(${EXECUTABLE} ${STARTUP_UCODE} ${PERIPHERAL_LIBS} ${DRIVER_LIBS})
|
|
|
|
|
target_link_options(${EXECUTABLE} PRIVATE ${LINKER_FLAGS})
|
|
|
|
|
else ()
|
|
|
|
|
message("${Cyan}Using systems linker ${ColourReset}")
|
|
|
|
|
target_link_libraries(${EXECUTABLE} ${EXTRA_LIBS})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
message(" |--> LINKER: ${LINKER}")
|
|
|
|
|
message(" |--> CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
|
|
|
|
|
message(" |--> CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
|
|
|
|
|
message(" |--> CMAKE_ASM_COMPILER: ${CMAKE_ASM_COMPILER}")
|
|
|
|
|
message(" |--> CMAKE_OBJCOPY: ${CMAKE_OBJCOPY}")
|
|
|
|
|
message(" |--> CMAKE_SIZE: ${CMAKE_SIZE}")
|
|
|
|
|
message(" |--> CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") #AS we provide our own linker nad not using the one from the curren OS (system)
|
|
|
|
|
message("+-------------------------------+")
|
|
|
|
|
message("${ColourReset}")
|
|
|
|
|
####################################################################################################
|
|
|
|
|
#CUSTOM COMMANDS
|
|
|
|
|
####################################################################################################
|
|
|
|
|