You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.2 KiB
29 lines
1.2 KiB
function(addPeripheral alias)
|
|
if(EXISTS ${CSL_SOURCES}/imp_${alias}.c) # Checks if the desired peripheral is implemented for the desired CSL.
|
|
message("Chip has usart >>imp_${alias}.c was found<<")
|
|
if(EXISTS ${PERIFERALS_DIR}/${alias}.c) # Cheks if generic funtions are awailable. this is useful for standars as SPI i2c etc...
|
|
message("${alias}.c generic functions library extits")
|
|
add_library(${alias}_submodule ${alias}.c ${CSL_SOURCES}/imp_${alias}.c)
|
|
else()
|
|
add_library(${alias}_submodule ${CSL_SOURCES}/imp_${alias}.c)
|
|
endif()
|
|
|
|
target_compile_options(${alias}_submodule PRIVATE ${C_FLAGS})
|
|
target_compile_definitions(${alias}_submodule PRIVATE ${C_DEFS})
|
|
target_include_directories(${alias}_submodule PUBLIC ${PERIFERALS_DIR} ${CSL_INCLUDES})
|
|
add_library(sub::${alias} ALIAS ${alias}_submodule)
|
|
|
|
else() # optional block
|
|
message("${BoldRed}Chip has no usart periferal >>imp_usart.c was not found<<")
|
|
message("${BoldRed}Compilation Aborted")
|
|
endif()
|
|
endfunction()
|
|
|
|
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")
|