summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-04-24 11:24:27 +0700
committerhathach <[email protected]>2024-04-24 11:26:22 +0700
commit36e07093b8a62f6b899451562f232638b2b80415 (patch)
tree1c78f6c9770e7b18efd496a9f9f163924b87c75e
parent60f39f7b1e32a1a081f6e850eafebbce4068ecf1 (diff)
fix samd linker with clang: cannot self-check defined symbol with lld e.g `STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x1000` --> STACK_SIZE = 0
-rw-r--r--hw/bsp/fomu/fomu.ld2
-rw-r--r--hw/bsp/samd11/boards/cynthion_d11/samd11d14am_flash.ld2
-rw-r--r--hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld2
-rw-r--r--hw/bsp/samd21/boards/atsamd21_xpro/samd21j18a_flash.ld2
-rw-r--r--hw/bsp/samd21/boards/circuitplayground_express/circuitplayground_express.ld2
-rw-r--r--hw/bsp/samd21/boards/curiosity_nano/samd21g17a_flash.ld2
-rw-r--r--hw/bsp/samd21/boards/cynthion_d21/samd21g18a_flash.ld2
-rw-r--r--hw/bsp/samd21/boards/feather_m0_express/feather_m0_express.ld2
-rw-r--r--hw/bsp/samd21/boards/itsybitsy_m0/itsybitsy_m0.ld2
-rw-r--r--hw/bsp/samd21/boards/metro_m0_express/metro_m0_express.ld2
-rw-r--r--hw/bsp/samd21/boards/qtpy/qtpy.ld2
-rw-r--r--hw/bsp/samd21/boards/seeeduino_xiao/seeeduino_xiao.ld2
-rw-r--r--hw/bsp/samd21/boards/sparkfun_samd21_mini_usb/sparkfun_samd21_mini_usb.ld2
-rw-r--r--hw/bsp/samd21/boards/trinket_m0/trinket_m0.ld2
-rw-r--r--hw/bsp/samd21/family.cmake93
-rw-r--r--hw/bsp/samd51/boards/feather_m4_express/feather_m4_express.ld2
-rw-r--r--hw/bsp/samd51/boards/itsybitsy_m4/itsybitsy_m4.ld2
-rw-r--r--hw/bsp/samd51/boards/metro_m4_express/metro_m4_express.ld2
-rw-r--r--hw/bsp/samd51/boards/pybadge/pybadge.ld2
-rw-r--r--hw/bsp/samd51/boards/pyportal/pyportal.ld2
-rw-r--r--hw/bsp/samd51/family.cmake90
-rw-r--r--hw/bsp/same5x/boards/d5035_01/same51j19a_flash.ld2
-rw-r--r--hw/bsp/same5x/boards/same54_xplained/same54p20a_flash.ld2
-rw-r--r--hw/bsp/same5x/boards/same54_xplained/same54p20a_sram.ld2
-rw-r--r--hw/bsp/samg55xplained/samg55j19_flash.ld2
-rw-r--r--hw/bsp/saml2x/boards/atsaml21_xpro/saml21j18b_flash.ld2
-rw-r--r--hw/bsp/saml2x/boards/saml22_feather/saml22_feather.ld2
-rw-r--r--hw/bsp/saml2x/boards/sensorwatch_m0/sensorwatch_m0.ld2
28 files changed, 120 insertions, 115 deletions
diff --git a/hw/bsp/fomu/fomu.ld b/hw/bsp/fomu/fomu.ld
index 13278d2ad..0b0cf2612 100644
--- a/hw/bsp/fomu/fomu.ld
+++ b/hw/bsp/fomu/fomu.ld
@@ -11,7 +11,7 @@ MEMORY {
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/samd11/boards/cynthion_d11/samd11d14am_flash.ld b/hw/bsp/samd11/boards/cynthion_d11/samd11d14am_flash.ld
index f175e6504..57e7f8904 100644
--- a/hw/bsp/samd11/boards/cynthion_d11/samd11d14am_flash.ld
+++ b/hw/bsp/samd11/boards/cynthion_d11/samd11d14am_flash.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x400;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld b/hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld
index 9e12acec8..75d880f62 100644
--- a/hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld
+++ b/hw/bsp/samd11/boards/samd11_xplained/samd11d14am_flash.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x400;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/samd21/boards/atsamd21_xpro/samd21j18a_flash.ld b/hw/bsp/samd21/boards/atsamd21_xpro/samd21j18a_flash.ld
index e2f93416d..d9b086f9c 100644
--- a/hw/bsp/samd21/boards/atsamd21_xpro/samd21j18a_flash.ld
+++ b/hw/bsp/samd21/boards/atsamd21_xpro/samd21j18a_flash.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/samd21/boards/circuitplayground_express/circuitplayground_express.ld b/hw/bsp/samd21/boards/circuitplayground_express/circuitplayground_express.ld
index f0c93340c..ce7aff80b 100644
--- a/hw/bsp/samd21/boards/circuitplayground_express/circuitplayground_express.ld
+++ b/hw/bsp/samd21/boards/circuitplayground_express/circuitplayground_express.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd21/boards/curiosity_nano/samd21g17a_flash.ld b/hw/bsp/samd21/boards/curiosity_nano/samd21g17a_flash.ld
index 153f0cbb9..e03a4ce60 100644
--- a/hw/bsp/samd21/boards/curiosity_nano/samd21g17a_flash.ld
+++ b/hw/bsp/samd21/boards/curiosity_nano/samd21g17a_flash.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x1000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x1000;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/samd21/boards/cynthion_d21/samd21g18a_flash.ld b/hw/bsp/samd21/boards/cynthion_d21/samd21g18a_flash.ld
index ecb6b8523..95d71b9e3 100644
--- a/hw/bsp/samd21/boards/cynthion_d21/samd21g18a_flash.ld
+++ b/hw/bsp/samd21/boards/cynthion_d21/samd21g18a_flash.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/samd21/boards/feather_m0_express/feather_m0_express.ld b/hw/bsp/samd21/boards/feather_m0_express/feather_m0_express.ld
index f0c93340c..ce7aff80b 100644
--- a/hw/bsp/samd21/boards/feather_m0_express/feather_m0_express.ld
+++ b/hw/bsp/samd21/boards/feather_m0_express/feather_m0_express.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd21/boards/itsybitsy_m0/itsybitsy_m0.ld b/hw/bsp/samd21/boards/itsybitsy_m0/itsybitsy_m0.ld
index f0c93340c..ce7aff80b 100644
--- a/hw/bsp/samd21/boards/itsybitsy_m0/itsybitsy_m0.ld
+++ b/hw/bsp/samd21/boards/itsybitsy_m0/itsybitsy_m0.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd21/boards/metro_m0_express/metro_m0_express.ld b/hw/bsp/samd21/boards/metro_m0_express/metro_m0_express.ld
index f0c93340c..ce7aff80b 100644
--- a/hw/bsp/samd21/boards/metro_m0_express/metro_m0_express.ld
+++ b/hw/bsp/samd21/boards/metro_m0_express/metro_m0_express.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd21/boards/qtpy/qtpy.ld b/hw/bsp/samd21/boards/qtpy/qtpy.ld
index f0c93340c..ce7aff80b 100644
--- a/hw/bsp/samd21/boards/qtpy/qtpy.ld
+++ b/hw/bsp/samd21/boards/qtpy/qtpy.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd21/boards/seeeduino_xiao/seeeduino_xiao.ld b/hw/bsp/samd21/boards/seeeduino_xiao/seeeduino_xiao.ld
index cf11c4c35..0d0c4e6c4 100644
--- a/hw/bsp/samd21/boards/seeeduino_xiao/seeeduino_xiao.ld
+++ b/hw/bsp/samd21/boards/seeeduino_xiao/seeeduino_xiao.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd21/boards/sparkfun_samd21_mini_usb/sparkfun_samd21_mini_usb.ld b/hw/bsp/samd21/boards/sparkfun_samd21_mini_usb/sparkfun_samd21_mini_usb.ld
index f5d2ad151..0754a8e9c 100644
--- a/hw/bsp/samd21/boards/sparkfun_samd21_mini_usb/sparkfun_samd21_mini_usb.ld
+++ b/hw/bsp/samd21/boards/sparkfun_samd21_mini_usb/sparkfun_samd21_mini_usb.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd21/boards/trinket_m0/trinket_m0.ld b/hw/bsp/samd21/boards/trinket_m0/trinket_m0.ld
index f0c93340c..ce7aff80b 100644
--- a/hw/bsp/samd21/boards/trinket_m0/trinket_m0.ld
+++ b/hw/bsp/samd21/boards/trinket_m0/trinket_m0.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd21/family.cmake b/hw/bsp/samd21/family.cmake
index 616c8ae45..540a0ee33 100644
--- a/hw/bsp/samd21/family.cmake
+++ b/hw/bsp/samd21/family.cmake
@@ -17,55 +17,57 @@ set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -c \"transport select swd\" -f ta
#------------------------------------
# only need to be built ONCE for all examples
function(add_board_target BOARD_TARGET)
- if (NOT TARGET ${BOARD_TARGET})
- set(LD_FILE_Clang ${LD_FILE_GNU})
- if (NOT DEFINED LD_FILE_${CMAKE_C_COMPILER_ID})
- message(FATAL_ERROR "LD_FILE_${CMAKE_C_COMPILER_ID} not defined")
- endif ()
+ if (TARGET ${BOARD_TARGET})
+ return()
+ endif ()
- if (NOT DEFINED STARTUP_FILE_${CMAKE_C_COMPILER_ID})
- set(STARTUP_FILE_GNU ${SDK_DIR}/gcc/gcc/startup_samd21.c)
- set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
- endif ()
+ set(LD_FILE_Clang ${LD_FILE_GNU})
+ if (NOT DEFINED LD_FILE_${CMAKE_C_COMPILER_ID})
+ message(FATAL_ERROR "LD_FILE_${CMAKE_C_COMPILER_ID} not defined")
+ endif ()
- add_library(${BOARD_TARGET} STATIC
- ${SDK_DIR}/gcc/system_samd21.c
- ${SDK_DIR}/hpl/gclk/hpl_gclk.c
- ${SDK_DIR}/hpl/pm/hpl_pm.c
- ${SDK_DIR}/hpl/sysctrl/hpl_sysctrl.c
- ${SDK_DIR}/hal/src/hal_atomic.c
- ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
- )
- target_include_directories(${BOARD_TARGET} PUBLIC
- ${SDK_DIR}
- ${SDK_DIR}/config
- ${SDK_DIR}/include
- ${SDK_DIR}/hal/include
- ${SDK_DIR}/hal/utils/include
- ${SDK_DIR}/hpl/pm
- ${SDK_DIR}/hpl/port
- ${SDK_DIR}/hri
- ${SDK_DIR}/CMSIS/Include
- )
- target_compile_definitions(${BOARD_TARGET} PUBLIC CONF_DFLL_OVERWRITE_CALIBRATION=0)
+ if (NOT DEFINED STARTUP_FILE_GNU)
+ set(STARTUP_FILE_GNU ${SDK_DIR}/gcc/gcc/startup_samd21.c)
+ endif ()
+ set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
- update_board(${BOARD_TARGET})
+ add_library(${BOARD_TARGET} STATIC
+ ${SDK_DIR}/gcc/system_samd21.c
+ ${SDK_DIR}/hpl/gclk/hpl_gclk.c
+ ${SDK_DIR}/hpl/pm/hpl_pm.c
+ ${SDK_DIR}/hpl/sysctrl/hpl_sysctrl.c
+ ${SDK_DIR}/hal/src/hal_atomic.c
+ ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
+ )
+ target_include_directories(${BOARD_TARGET} PUBLIC
+ ${SDK_DIR}
+ ${SDK_DIR}/config
+ ${SDK_DIR}/include
+ ${SDK_DIR}/hal/include
+ ${SDK_DIR}/hal/utils/include
+ ${SDK_DIR}/hpl/pm
+ ${SDK_DIR}/hpl/port
+ ${SDK_DIR}/hri
+ ${SDK_DIR}/CMSIS/Include
+ )
+ target_compile_definitions(${BOARD_TARGET} PUBLIC CONF_DFLL_OVERWRITE_CALIBRATION=0)
+
+ update_board(${BOARD_TARGET})
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- target_link_options(${BOARD_TARGET} PUBLIC
- "LINKER:--script=${LD_FILE_GNU}"
- -nostartfiles
- --specs=nosys.specs --specs=nano.specs
- )
- elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
- target_link_options(${BOARD_TARGET} PUBLIC
- "LINKER:--script=${LD_FILE_Clang}"
- )
- elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
- target_link_options(${BOARD_TARGET} PUBLIC
- "LINKER:--config=${LD_FILE_IAR}"
- )
- endif ()
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--script=${LD_FILE_GNU}"
+ -nostartfiles
+ --specs=nosys.specs --specs=nano.specs
+ )
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--script=${LD_FILE_Clang}"
+ )
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--config=${LD_FILE_IAR}"
+ )
endif ()
endfunction()
@@ -104,6 +106,7 @@ function(family_configure_example TARGET RTOS)
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
# Flashing
+ family_add_bin_hex(${TARGET})
family_flash_jlink(${TARGET})
#family_flash_openocd(${TARGET} ${OPENOCD_OPTION})
endfunction()
diff --git a/hw/bsp/samd51/boards/feather_m4_express/feather_m4_express.ld b/hw/bsp/samd51/boards/feather_m4_express/feather_m4_express.ld
index f1a021d75..1408c3018 100644
--- a/hw/bsp/samd51/boards/feather_m4_express/feather_m4_express.ld
+++ b/hw/bsp/samd51/boards/feather_m4_express/feather_m4_express.ld
@@ -42,7 +42,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd51/boards/itsybitsy_m4/itsybitsy_m4.ld b/hw/bsp/samd51/boards/itsybitsy_m4/itsybitsy_m4.ld
index f1a021d75..1408c3018 100644
--- a/hw/bsp/samd51/boards/itsybitsy_m4/itsybitsy_m4.ld
+++ b/hw/bsp/samd51/boards/itsybitsy_m4/itsybitsy_m4.ld
@@ -42,7 +42,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd51/boards/metro_m4_express/metro_m4_express.ld b/hw/bsp/samd51/boards/metro_m4_express/metro_m4_express.ld
index f1a021d75..1408c3018 100644
--- a/hw/bsp/samd51/boards/metro_m4_express/metro_m4_express.ld
+++ b/hw/bsp/samd51/boards/metro_m4_express/metro_m4_express.ld
@@ -42,7 +42,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd51/boards/pybadge/pybadge.ld b/hw/bsp/samd51/boards/pybadge/pybadge.ld
index f1a021d75..1408c3018 100644
--- a/hw/bsp/samd51/boards/pybadge/pybadge.ld
+++ b/hw/bsp/samd51/boards/pybadge/pybadge.ld
@@ -42,7 +42,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd51/boards/pyportal/pyportal.ld b/hw/bsp/samd51/boards/pyportal/pyportal.ld
index f1a021d75..1408c3018 100644
--- a/hw/bsp/samd51/boards/pyportal/pyportal.ld
+++ b/hw/bsp/samd51/boards/pyportal/pyportal.ld
@@ -42,7 +42,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0xC000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/samd51/family.cmake b/hw/bsp/samd51/family.cmake
index 8d88cf947..3ddd2e290 100644
--- a/hw/bsp/samd51/family.cmake
+++ b/hw/bsp/samd51/family.cmake
@@ -18,54 +18,56 @@ set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -c \"transport select swd\" -c \"
#------------------------------------
# only need to be built ONCE for all examples
function(add_board_target BOARD_TARGET)
- if (NOT TARGET ${BOARD_TARGET})
- set(LD_FILE_Clang ${LD_FILE_GNU})
- if (NOT DEFINED LD_FILE_${CMAKE_C_COMPILER_ID})
- message(FATAL_ERROR "LD_FILE_${CMAKE_C_COMPILER_ID} not defined")
- endif ()
+ if (TARGET ${BOARD_TARGET})
+ return()
+ endif ()
- if (NOT DEFINED STARTUP_FILE_${CMAKE_C_COMPILER_ID})
- set(STARTUP_FILE_GNU ${SDK_DIR}/gcc/gcc/startup_samd51.c)
- set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
- endif ()
+ set(LD_FILE_Clang ${LD_FILE_GNU})
+ if (NOT DEFINED LD_FILE_${CMAKE_C_COMPILER_ID})
+ message(FATAL_ERROR "LD_FILE_${CMAKE_C_COMPILER_ID} not defined")
+ endif ()
- add_library(${BOARD_TARGET} STATIC
- ${SDK_DIR}/gcc/system_samd51.c
- ${SDK_DIR}/hpl/gclk/hpl_gclk.c
- ${SDK_DIR}/hpl/mclk/hpl_mclk.c
- ${SDK_DIR}/hpl/osc32kctrl/hpl_osc32kctrl.c
- ${SDK_DIR}/hpl/oscctrl/hpl_oscctrl.c
- ${SDK_DIR}/hal/src/hal_atomic.c
- ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
- )
- target_include_directories(${BOARD_TARGET} PUBLIC
- ${SDK_DIR}/
- ${SDK_DIR}/config
- ${SDK_DIR}/include
- ${SDK_DIR}/hal/include
- ${SDK_DIR}/hal/utils/include
- ${SDK_DIR}/hpl/port
- ${SDK_DIR}/hri
- ${CMSIS_5}/CMSIS/Core/Include
- )
+ if (NOT DEFINED STARTUP_FILE_GNU)
+ set(STARTUP_FILE_GNU ${SDK_DIR}/gcc/gcc/startup_samd51.c)
+ endif ()
+ set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
- update_board(${BOARD_TARGET})
+ add_library(${BOARD_TARGET} STATIC
+ ${SDK_DIR}/gcc/system_samd51.c
+ ${SDK_DIR}/hpl/gclk/hpl_gclk.c
+ ${SDK_DIR}/hpl/mclk/hpl_mclk.c
+ ${SDK_DIR}/hpl/osc32kctrl/hpl_osc32kctrl.c
+ ${SDK_DIR}/hpl/oscctrl/hpl_oscctrl.c
+ ${SDK_DIR}/hal/src/hal_atomic.c
+ ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
+ )
+ target_include_directories(${BOARD_TARGET} PUBLIC
+ ${SDK_DIR}/
+ ${SDK_DIR}/config
+ ${SDK_DIR}/include
+ ${SDK_DIR}/hal/include
+ ${SDK_DIR}/hal/utils/include
+ ${SDK_DIR}/hpl/port
+ ${SDK_DIR}/hri
+ ${CMSIS_5}/CMSIS/Core/Include
+ )
+
+ update_board(${BOARD_TARGET})
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- target_link_options(${BOARD_TARGET} PUBLIC
- "LINKER:--script=${LD_FILE_GNU}"
- -nostartfiles
- --specs=nosys.specs --specs=nano.specs
- )
- elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
- target_link_options(${BOARD_TARGET} PUBLIC
- "LINKER:--script=${LD_FILE_Clang}"
- )
- elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
- target_link_options(${BOARD_TARGET} PUBLIC
- "LINKER:--config=${LD_FILE_IAR}"
- )
- endif ()
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--script=${LD_FILE_GNU}"
+ -nostartfiles
+ --specs=nosys.specs --specs=nano.specs
+ )
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--script=${LD_FILE_Clang}"
+ )
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--config=${LD_FILE_IAR}"
+ )
endif ()
endfunction()
diff --git a/hw/bsp/same5x/boards/d5035_01/same51j19a_flash.ld b/hw/bsp/same5x/boards/d5035_01/same51j19a_flash.ld
index a8dd44336..486043f22 100644
--- a/hw/bsp/same5x/boards/d5035_01/same51j19a_flash.ld
+++ b/hw/bsp/same5x/boards/d5035_01/same51j19a_flash.ld
@@ -42,7 +42,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x1000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x1000;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/same5x/boards/same54_xplained/same54p20a_flash.ld b/hw/bsp/same5x/boards/same54_xplained/same54p20a_flash.ld
index 1f427a066..7a7f1be46 100644
--- a/hw/bsp/same5x/boards/same54_xplained/same54p20a_flash.ld
+++ b/hw/bsp/same5x/boards/same54_xplained/same54p20a_flash.ld
@@ -42,7 +42,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x10000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x10000;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/same5x/boards/same54_xplained/same54p20a_sram.ld b/hw/bsp/same5x/boards/same54_xplained/same54p20a_sram.ld
index e6e33ec48..c768f9c9a 100644
--- a/hw/bsp/same5x/boards/same54_xplained/same54p20a_sram.ld
+++ b/hw/bsp/same5x/boards/same54_xplained/same54p20a_sram.ld
@@ -41,7 +41,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x10000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x10000;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/samg55xplained/samg55j19_flash.ld b/hw/bsp/samg55xplained/samg55j19_flash.ld
index 21c0b5bcd..a222b919b 100644
--- a/hw/bsp/samg55xplained/samg55j19_flash.ld
+++ b/hw/bsp/samg55xplained/samg55j19_flash.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : DEFINED(__heap_size__) ? __heap_size__ : 0x0200;
diff --git a/hw/bsp/saml2x/boards/atsaml21_xpro/saml21j18b_flash.ld b/hw/bsp/saml2x/boards/atsaml21_xpro/saml21j18b_flash.ld
index 7f6b7fa99..48cacd526 100644
--- a/hw/bsp/saml2x/boards/atsaml21_xpro/saml21j18b_flash.ld
+++ b/hw/bsp/saml2x/boards/atsaml21_xpro/saml21j18b_flash.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
/* Section Definitions */
SECTIONS
diff --git a/hw/bsp/saml2x/boards/saml22_feather/saml22_feather.ld b/hw/bsp/saml2x/boards/saml22_feather/saml22_feather.ld
index 156c3e7e4..372107ff8 100644
--- a/hw/bsp/saml2x/boards/saml22_feather/saml22_feather.ld
+++ b/hw/bsp/saml2x/boards/saml22_feather/saml22_feather.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)
diff --git a/hw/bsp/saml2x/boards/sensorwatch_m0/sensorwatch_m0.ld b/hw/bsp/saml2x/boards/sensorwatch_m0/sensorwatch_m0.ld
index 156c3e7e4..372107ff8 100644
--- a/hw/bsp/saml2x/boards/sensorwatch_m0/sensorwatch_m0.ld
+++ b/hw/bsp/saml2x/boards/sensorwatch_m0/sensorwatch_m0.ld
@@ -40,7 +40,7 @@ MEMORY
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
-STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
+STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
ENTRY(Reset_Handler)