removes arguments for consumers (setting output dir and target_mem)
This commit is contained in:
@@ -33,7 +33,6 @@ endif()
|
||||
###############################################################################
|
||||
project(threadx_demo C ASM)
|
||||
option(NX_DEBUG "compile netxduo debug output in" OFF)
|
||||
option(ENABLE_THREADX_REGRESSION "Build ThreadX regression test executables" OFF)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
|
||||
|
||||
@@ -41,23 +40,16 @@ add_subdirectory(port/moonlight)
|
||||
|
||||
function(setup_target TARGET)
|
||||
set(options)
|
||||
set(oneValueArgs OUTPUT_DIR TARGET_MEM)
|
||||
set(oneValueArgs) #None for now
|
||||
set(multiValueArgs LIBRARIES SOURCES)
|
||||
cmake_parse_arguments(ST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if(ST_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "setup_target(${TARGET} ...): unknown args: ${ST_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
if(NOT ST_OUTPUT_DIR)
|
||||
set(ST_OUTPUT_DIR ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
if(NOT ST_TARGET_MEM)
|
||||
set(ST_TARGET_MEM ${TARGET_MEM})
|
||||
endif()
|
||||
|
||||
add_executable(${TARGET})
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${ST_OUTPUT_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
target_add_moonlight_platform(${TARGET})
|
||||
|
||||
@@ -76,23 +68,19 @@ function(setup_target TARGET)
|
||||
target_link_options(${TARGET} PRIVATE
|
||||
-nostartfiles
|
||||
-nostdlib
|
||||
-T ${CMAKE_SOURCE_DIR}/src/${ST_TARGET_MEM}.lds
|
||||
-T ${CMAKE_SOURCE_DIR}/src/${TARGET_MEM}.lds
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=${ST_OUTPUT_DIR}/${TARGET}.map)
|
||||
-Wl,-Map=${CMAKE_BINARY_DIR}/${TARGET}.map)
|
||||
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${OBJCOPY} -O ihex $<TARGET_FILE:${TARGET}> ${ST_OUTPUT_DIR}/${TARGET}.hex
|
||||
COMMAND ${OBJCOPY} -O binary $<TARGET_FILE:${TARGET}> ${ST_OUTPUT_DIR}/${TARGET}.bin
|
||||
COMMAND ${OBJCOPY} -O ihex $<TARGET_FILE:${TARGET}> ${CMAKE_BINARY_DIR}/${TARGET}.hex
|
||||
COMMAND ${OBJCOPY} -O binary $<TARGET_FILE:${TARGET}> ${CMAKE_BINARY_DIR}/${TARGET}.bin
|
||||
COMMAND ${SIZE} $<TARGET_FILE:${TARGET}>
|
||||
COMMAND ${OBJDUMP} -S $<TARGET_FILE:${TARGET}> > ${ST_OUTPUT_DIR}/${TARGET}.dis
|
||||
COMMAND ${OBJDUMP} -S $<TARGET_FILE:${TARGET}> > ${CMAKE_BINARY_DIR}/${TARGET}.dis
|
||||
COMMENT "Creating collateral for ${TARGET}"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
if(ENABLE_THREADX_REGRESSION)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user