summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-05-25 17:27:05 +0700
committerhathach <[email protected]>2023-05-25 17:27:05 +0700
commit5fea010406747a94f3a65a89e65e7956ff811b3c (patch)
treee35e339aced41fce07fa425d865951215d611a3b
parent26d05d7fc922f3715799f6049556232d5ed5c8e3 (diff)
add family_support_configure_common()
-rw-r--r--hw/bsp/family_support.cmake16
-rw-r--r--hw/bsp/imxrt/family.cmake20
-rw-r--r--hw/bsp/lpc18/family.cmake16
-rw-r--r--hw/bsp/lpc55/family.cmake16
-rw-r--r--hw/bsp/mcx/family.cmake22
-rw-r--r--hw/bsp/nrf/family.cmake23
6 files changed, 42 insertions, 71 deletions
diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake
index d2d675332..760f2fbbc 100644
--- a/hw/bsp/family_support.cmake
+++ b/hw/bsp/family_support.cmake
@@ -136,6 +136,22 @@ function(family_add_default_example_warnings TARGET)
endfunction()
+function(family_support_configure_common TARGET)
+ # set output name to .elf
+ set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${TARGET}.elf)
+
+ # run size after build
+ add_custom_command(TARGET ${TARGET} POST_BUILD
+ COMMAND ${TOOLCHAIN_SIZE} $<TARGET_FILE:${TARGET}>
+ )
+
+ # Generate map file
+ target_link_options(${TARGET} PUBLIC
+ # link map
+ "LINKER:-Map=$<TARGET_FILE:${TARGET}>.map"
+ )
+endfunction()
+
# add_custom_command(TARGET ${TARGET} POST_BUILD
# COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${TARGET}> ${TARGET}.hex
# COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${TARGET}> ${TARGET}.bin
diff --git a/hw/bsp/imxrt/family.cmake b/hw/bsp/imxrt/family.cmake
index ade744aa5..0e55b825d 100644
--- a/hw/bsp/imxrt/family.cmake
+++ b/hw/bsp/imxrt/family.cmake
@@ -63,7 +63,6 @@ if (NOT TARGET ${BOARD_TARGET})
)
target_link_options(${BOARD_TARGET} PUBLIC
"LINKER:--script=${LD_FILE_gcc}"
- "LINKER:-Map=$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map"
# nanolib
--specs=nosys.specs
--specs=nano.specs
@@ -79,17 +78,8 @@ endif () # BOARD_TARGET
#------------------------------------
# Functions
#------------------------------------
-function(family_configure_target TARGET)
- # set output name to .elf
- set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${TARGET}.elf)
-
- # run size after build
- add_custom_command(TARGET ${TARGET} POST_BUILD
- COMMAND ${TOOLCHAIN_SIZE} $<TARGET_FILE:${TARGET}>
- )
-
- # TOP is path to root directory
- set(TOP "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../..")
+function(family_configure_example TARGET)
+ family_support_configure_common(${TARGET})
#---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h
@@ -162,13 +152,13 @@ function(family_add_freertos TARGET)
endfunction()
function(family_configure_device_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_host_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_dual_usb_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
diff --git a/hw/bsp/lpc18/family.cmake b/hw/bsp/lpc18/family.cmake
index 059408fe9..29fa73d34 100644
--- a/hw/bsp/lpc18/family.cmake
+++ b/hw/bsp/lpc18/family.cmake
@@ -65,14 +65,8 @@ endif () # BOARD_TARGET
#------------------------------------
# Functions
#------------------------------------
-function(family_configure_target TARGET)
- # set output name to .elf
- set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${TARGET}.elf)
-
- # run size after build
- add_custom_command(TARGET ${TARGET} POST_BUILD
- COMMAND ${TOOLCHAIN_SIZE} $<TARGET_FILE:${TARGET}>
- )
+function(family_configure_example TARGET)
+ family_support_configure_common(${TARGET})
#---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h
@@ -143,13 +137,13 @@ function(family_add_freertos TARGET)
endfunction()
function(family_configure_device_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_host_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_dual_usb_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
diff --git a/hw/bsp/lpc55/family.cmake b/hw/bsp/lpc55/family.cmake
index 3aeda5b2d..363b7a9cd 100644
--- a/hw/bsp/lpc55/family.cmake
+++ b/hw/bsp/lpc55/family.cmake
@@ -63,8 +63,6 @@ if (NOT TARGET ${BOARD_TARGET})
target_link_options(${BOARD_TARGET} PUBLIC
# linker file
"LINKER:--script=${SDK_DIR}/devices/${MCU_VARIANT}/gcc/${MCU_CORE}_flash.ld"
- # link map
- "LINKER:-Map=$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map"
# nanolib
--specs=nosys.specs
--specs=nano.specs
@@ -77,12 +75,8 @@ endif () # BOARD_TARGET
#------------------------------------
# Functions
#------------------------------------
-function(family_configure_target TARGET)
- # set output name to .elf
- set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${TARGET}.elf)
-
- # TOP is path to root directory
- set(TOP "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../..")
+function(family_configure_example TARGET)
+ family_support_configure_common(${TARGET})
#---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h
@@ -153,13 +147,13 @@ function(family_add_freertos TARGET)
endfunction()
function(family_configure_device_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_host_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_dual_usb_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
diff --git a/hw/bsp/mcx/family.cmake b/hw/bsp/mcx/family.cmake
index e4bc11be5..bc0dfe875 100644
--- a/hw/bsp/mcx/family.cmake
+++ b/hw/bsp/mcx/family.cmake
@@ -54,11 +54,10 @@ if (NOT TARGET ${BOARD_TARGET})
target_sources(${BOARD_TARGET} PUBLIC
${SDK_DIR}/devices/${MCU_VARIANT}/gcc/startup_${MCU_CORE}.S
)
+ cmake_print_variables(CMAKE_CURRENT_BINARY_DIR)
target_link_options(${BOARD_TARGET} PUBLIC
# linker file
"LINKER:--script=${SDK_DIR}/devices/${MCU_VARIANT}/gcc/${MCU_CORE}_flash.ld"
- # link map
- "LINKER:-Map=$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map"
# nanolib
--specs=nosys.specs
--specs=nano.specs
@@ -71,17 +70,8 @@ endif () # BOARD_TARGET
#------------------------------------
# Functions
#------------------------------------
-function(family_configure_target TARGET)
- # set output name to .elf
- set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${TARGET}.elf)
-
- # run size after build
- add_custom_command(TARGET ${TARGET} POST_BUILD
- COMMAND ${TOOLCHAIN_SIZE} $<TARGET_FILE:${TARGET}>
- )
-
- # TOP is path to root directory
- set(TOP "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../..")
+function(family_configure_example TARGET)
+ family_support_configure_common(${TARGET})
#---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h
@@ -167,13 +157,13 @@ function(family_add_freertos TARGET)
endfunction()
function(family_configure_device_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_host_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_dual_usb_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
diff --git a/hw/bsp/nrf/family.cmake b/hw/bsp/nrf/family.cmake
index 1156a171b..9d958fee2 100644
--- a/hw/bsp/nrf/family.cmake
+++ b/hw/bsp/nrf/family.cmake
@@ -65,8 +65,6 @@ if (NOT TARGET ${BOARD_TARGET})
# linker file
"LINKER:--script=${LD_FILE_gcc}"
-L${NRFX_DIR}/mdk
- # link map
- "LINKER:-Map=$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map"
# nanolib
--specs=nosys.specs
--specs=nano.specs
@@ -79,19 +77,8 @@ endif () # BOARD_TARGET
#------------------------------------
# Functions
#------------------------------------
-function(family_configure_target TARGET)
- #family_add_default_example_warnings(${TARGET})
-
- # set output name to .elf
- set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${TARGET}.elf)
-
- # run size after build
- add_custom_command(TARGET ${TARGET} POST_BUILD
- COMMAND ${TOOLCHAIN_SIZE} $<TARGET_FILE:${TARGET}>
- )
-
- # TOP is path to root directory
- set(TOP "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../..")
+function(family_configure_example TARGET)
+ family_support_configure_common(${TARGET})
#---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h
@@ -161,13 +148,13 @@ function(family_add_freertos TARGET)
endfunction()
function(family_configure_device_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_host_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()
function(family_configure_dual_usb_example TARGET)
- family_configure_target(${TARGET})
+ family_configure_example(${TARGET})
endfunction()