@@ -22,48 +22,47 @@ set(FAMILY_MCUS KINETIS_KL CACHE INTERNAL "")
2222#------------------------------------
2323# only need to be built ONCE for all examples
2424function (add_board_target BOARD_TARGET)
25- if (NOT TARGET ${BOARD_TARGET} )
26- add_library (${BOARD_TARGET} STATIC
27- ${SDK_DIR} /drivers/gpio/fsl_gpio.c
28- ${SDK_DIR} /drivers/lpsci/fsl_lpsci.c
29- ${SDK_DIR} /drivers/uart/fsl_uart.c
30- ${SDK_DIR} /devices/${MCU_VARIANT} /drivers/fsl_clock.c
31- ${SDK_DIR} /devices/${MCU_VARIANT} /system_${MCU_VARIANT} .c
32- )
33- target_compile_definitions (${BOARD_TARGET} PUBLIC
34- )
35- target_include_directories (${BOARD_TARGET} PUBLIC
36- ${CMSIS_DIR} /CMSIS/Core/Include
37- ${SDK_DIR} /devices/${MCU_VARIANT}
38- ${SDK_DIR} /devices/${MCU_VARIANT} /drivers
39- ${SDK_DIR} /drivers/common
40- ${SDK_DIR} /drivers/gpio
41- ${SDK_DIR} /drivers/lpsci
42- ${SDK_DIR} /drivers/port
43- ${SDK_DIR} /drivers/smc
44- ${SDK_DIR} /drivers/uart
45- )
25+ if (TARGET ${BOARD_TARGET} )
26+ return ()
27+ endif ()
4628
47- update_board(${BOARD_TARGET} )
29+ add_library (${BOARD_TARGET} STATIC
30+ ${SDK_DIR} /drivers/gpio/fsl_gpio.c
31+ ${SDK_DIR} /drivers/lpsci/fsl_lpsci.c
32+ ${SDK_DIR} /drivers/uart/fsl_uart.c
33+ ${SDK_DIR} /devices/${MCU_VARIANT} /drivers/fsl_clock.c
34+ ${SDK_DIR} /devices/${MCU_VARIANT} /system_${MCU_VARIANT} .c
35+ )
36+ target_compile_definitions (${BOARD_TARGET} PUBLIC
37+ )
38+ target_include_directories (${BOARD_TARGET} PUBLIC
39+ ${CMSIS_DIR} /CMSIS/Core/Include
40+ ${SDK_DIR} /devices/${MCU_VARIANT}
41+ ${SDK_DIR} /devices/${MCU_VARIANT} /drivers
42+ ${SDK_DIR} /drivers/common
43+ ${SDK_DIR} /drivers/gpio
44+ ${SDK_DIR} /drivers/lpsci
45+ ${SDK_DIR} /drivers/port
46+ ${SDK_DIR} /drivers/smc
47+ ${SDK_DIR} /drivers/uart
48+ )
49+ update_board(${BOARD_TARGET} )
4850
49- # LD_FILE and STARTUP_FILE can be defined in board.cmake
51+ # LD_FILE and STARTUP_FILE can be defined in board.cmake
52+ target_sources (${BOARD_TARGET} PUBLIC
53+ ${STARTUP_FILE_${CMAKE_C_COMPILER_ID} }
54+ )
5055
51- target_sources (${BOARD_TARGET} PUBLIC
52- ${STARTUP_FILE_${CMAKE_C_COMPILER_ID} }
56+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" )
57+ target_link_options (${BOARD_TARGET} PUBLIC
58+ "LINKER:--script=${LD_FILE_GNU} "
59+ # nanolib
60+ --specs=nosys.specs --specs=nano.specs
61+ )
62+ elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR" )
63+ target_link_options (${BOARD_TARGET} PUBLIC
64+ "LINKER:--config=${LD_FILE_IAR} "
5365 )
54-
55- if (CMAKE_C_COMPILER_ID STREQUAL "GNU" )
56- target_link_options (${BOARD_TARGET} PUBLIC
57- "LINKER:--script=${LD_FILE_GNU} "
58- # nanolib
59- --specs=nosys.specs
60- --specs=nano.specs
61- )
62- elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR" )
63- target_link_options (${BOARD_TARGET} PUBLIC
64- "LINKER:--config=${LD_FILE_IAR} "
65- )
66- endif ()
6766 endif ()
6867endfunction ()
6968
0 commit comments