diff --git a/CMakeLists.txt b/CMakeLists.txt index f0fcd06..eabe543 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,9 @@ target_link_libraries(c PUBLIC gcc) set(THREADX_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/threadx) add_subdirectory(third-party/threadx) target_link_libraries(threadx PUBLIC c) +#Adds threadx_smp +add_subdirectory(port/threadx_smp) +target_link_libraries(threadx_smp PUBLIC c) # Adds netxduo set(NETXDUO_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/threadx) set(NXD_ENABLE_FILE_SERVERS OFF) @@ -30,12 +33,12 @@ endif() ############################################################################### project(threadx_demo C ASM) option(NX_DEBUG "compile netxduo debug output in" OFF) -set(TARGET_MEM "ram" CACHE STRING "memory map to use" ) +set(TARGET_MEM "ram" CACHE STRING "memory map to use") set(CMAKE_EXECUTABLE_SUFFIX_C ".elf") function(setup_target TARGET) set(options) - set(oneValueArgs) # none for now + set(oneValueArgs) # none for now set(multiValueArgs LIBRARIES SOURCES) cmake_parse_arguments(ST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(ST_UNPARSED_ARGUMENTS) @@ -43,13 +46,13 @@ function(setup_target TARGET) endif() add_executable(${TARGET}) - target_sources(${TARGET} PRIVATE - port/picolibc/port.c - port/moonlight/bootup.c - port/moonlight/board.c - port/moonlight/trap_non_vectored.c - port/moonlight/exception.c - port/moonlight/vector_table.c + target_sources(${TARGET} PRIVATE + port/picolibc/port.c + port/moonlight/bootup.c + port/moonlight/board.c + port/moonlight/trap_non_vectored.c + port/moonlight/exception.c + port/moonlight/vector_table.c ) if("netxduo" IN_LIST ST_LIBRARIES) target_sources(${TARGET} PRIVATE port/moonlight/mnrs_network_driver.c) @@ -67,7 +70,7 @@ function(setup_target TARGET) -ffunction-sections ) if(NX_DEBUG) - target_compile_definitions(${TARGET} PRIVATE NX_DEBUG NX_DEBUG_PACKET) + target_compile_definitions(${TARGET} PRIVATE NX_DEBUG NX_DEBUG_PACKET) endif() target_link_directories(${TARGET} PRIVATE src) # needed for linker script includes target_link_options(${TARGET} PRIVATE @@ -80,19 +83,16 @@ function(setup_target TARGET) if(ST_LIBRARIES) target_link_libraries(${TARGET} PRIVATE ${ST_LIBRARIES}) endif() - target_link_libraries(${TARGET} PRIVATE threadx) add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND ${OBJCOPY} -O ihex $ ${CMAKE_BINARY_DIR}/${TARGET}.hex + COMMAND ${OBJCOPY} -O ihex $ ${CMAKE_BINARY_DIR}/${TARGET}.hex COMMAND ${OBJCOPY} -O binary $ ${CMAKE_BINARY_DIR}/${TARGET}.bin COMMAND ${SIZE} $ - COMMAND ${OBJDUMP} -S $ > ${TARGET}.dis + COMMAND ${OBJDUMP} -S $ > ${TARGET}.dis COMMENT "Creating collateral for ${TARGET}" ) endfunction() -setup_target(thread_demo SOURCES src/thread_demo/main.c) -setup_target(tcp_demo - LIBRARIES netxduo - SOURCES src/tcp_demo/main.c -) +setup_target(thread_demo LIBRARIES threadx SOURCES src/thread_demo/main.c) +setup_target(tcp_demo LIBRARIES threadx netxduo SOURCES src/tcp_demo/main.c) +setup_target(smp_demo LIBRARIES threadx_smp SOURCES src/thread_demo/main.c)