You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To keep it simple, I patched the blinky example so that it:
use a custom linker file (see examples/custom-linker-script)
fetch HAL and CMSIS
Steps to reproduce
cp examples/custom-linker-script/F407VG.ld examples/blinky/
patch -p1 << EOF
diff --git a/examples/blinky/CMakeLists.txt b/examples/blinky/CMakeLists.txt
index 51191d3..28c7436 100644
--- a/examples/blinky/CMakeLists.txt
+++ b/examples/blinky/CMakeLists.txt
@@ -3,7 +3,8 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake
project(stm32-blinky C ASM)
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
-
+stm32_fetch_cmsis(F4 F1 L0)
+stm32_fetch_hal(F4 F1 L0)
# Configure here which STM32 target(s) to build
option(BLINKY_F4_EXAMPLE "Compile F4 example" ON)
option(BLINKY_F1_EXAMPLE "Compile F1 example" OFF)
@@ -49,6 +50,7 @@ if(BLINKY_F4_EXAMPLE)
CMSIS::STM32::F407VG
STM32::NoSys
)
+ stm32_add_linker_script(stm32-blinky-f4 PRIVATE F407VG.ld)
stm32_print_size_of_target(stm32-blinky-f4)
endif()
EOF
cmake -S examples/blinky -B build -G Ninja
cmake --build build -v
Expected behavior
linker should display an error
Screenshots
/usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/bin/ld:/home/fnadeau/git/stm32-cmake/build/F407VG.ld:9: warning: redeclaration of memory region `FLASH'
/usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/bin/ld:/home/fnadeau/git/stm32-cmake/build/F407VG.ld:10: warning: redeclaration of memory region `RAM'
/usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/bin/ld:/home/fnadeau/git/stm32-cmake/build/F407VG.ld:11: warning: redeclaration of memory region `CCMRAM'
/usr/lib/gcc/arm-none-eabi/11.1.0/../../../../arm-none-eabi/bin/ld: warning: /home/fnadeau/git/stm32-cmake/build/F407VG.ld contains output sections; did you forget -T?
Additional context
How can we used CMSIS with custom linker file. Custom linker file is usually required whenever you have a bootloader. (start address is not 0x8000000)
The text was updated successfully, but these errors were encountered:
Thank you for reporting this issue.
This is linked to #237 and I agree it would be better to find a way to warn the user at cmake generation stage and way before link stage.
However, please have a look at readme
CMSIS creates the following targets:
CMSIS::STM32:: (e.g. CMSIS::STM32::F4) - common includes, compiler flags and defines for family
CMSIS::STM32:: (e.g. CMSIS::STM32::F407xx) - common startup source for device type, depends on CMSIS::STM32::
CMSIS::STM32:: (e.g. CMSIS::STM32::F407VG) - linker script for device, depends on CMSIS::STM32::
you should use CMSIS::STM32::F407xx and this will fix the issue.
Describe the bug
Use of stm32_add_linker_script() when CMSIS is used generate an invalid linker command
Sources to reproduce
from master (e9c22b9)
To keep it simple, I patched the blinky example so that it:
Steps to reproduce
Expected behavior
linker should display an error
Screenshots
Linker command that seems to be the issue:
We can see that there is two linker file in it:
The first is the copy we made from examples/custom-linker-script and the second is the one generated by stm32-cmake.
Environment (please complete the following information):
Additional context
How can we used CMSIS with custom linker file. Custom linker file is usually required whenever you have a bootloader. (start address is not 0x8000000)
The text was updated successfully, but these errors were encountered: