Sysprogs forums › Forums › VisualGDB › Problem with BSP_ALIAS
- This topic has 5 replies, 2 voices, and was last updated 1 year, 7 months ago by support.
-
AuthorPosts
-
March 30, 2023 at 11:26 #34049drjonemParticipant
Hi,
I’m trying to have different builds of the same BSP in the same CMake project, one for application, one for boot. It looks like the ALIAS function should do the job, but I am having the following issues:
If I do as per documentation (simplified example):
find_bsp(ID com.sysprogs.arm.stm32
VERSION 2020.10
MCU STM32F746NG
ALIAS BOOT_BSP)find_bsp(ID com.sysprogs.arm.stm32
VERSION 2020.10
MCU STM32F746NG
ALIAS APP_BSP)bsp_compile_definitions(BSP_ALIAS BOOT_BSP
BOOT=1)
add_bsp_based_executable(NAME boot_app
BSP_ALIAS BOOT_BSP
SOURCES test.cpp)bsp_compile_definitions(BSP_ALIAS APP_BSP
BOOT=0)add_bsp_based_executable(NAME main_spp
BSP_ALIAS APP_BSP
SOURCES test2.cpp)cmake error with “Cannot specify compile definitions for target “BSP” which is not built by this project.” Implying that the BSP_ALIAS are not being processed.
If I modify to
find_bsp(ID com.sysprogs.arm.stm32
VERSION 2020.10
MCU STM32F746NG
ALIAS BOOT_BSP)find_bsp(ID com.sysprogs.arm.stm32
VERSION 2020.10
MCU STM32F746NG
ALIAS APP_BSP)bsp_compile_definitions(ALIAS BOOT_BSP
BOOT=1)
add_bsp_based_executable(NAME boot_app
BSP_ALIAS BOOT_BSP
SOURCES test.cpp)bsp_compile_definitions(ALIAS APP_BSP
BOOT=0)add_bsp_based_executable(NAME main_app
BSP_ALIAS APP_BSP
SOURCES test2.cpp)i.e. changing the BSP_ALIAS to just ALIAS in the bsp_compile_definitions, cmake is happy (same is true for bsp_include_directories) which tends to suggest an error in the docco.
However, if I build the project, I will get errors about Boot being redefined. Looking at the compiler definitions in the BSP properties, you can see that both bsp_compile_defintions have been applied to both BSP including the ALIAS, i.e. Additional Preprocessor Macros shows ALIAS;BOOT_BSP;BOOT=1;ALIAS;APP_BSP;BOOT=0
So the system is clearly not working as it should. Any advice or resolutions? I can run as two separate solutions if necessary but this looked like a nice way of grouping common options and sources.
I’m running v5.6R8 of VisualGDB (haven’t upgraded to R9 as there doesn’t seem to be a changelog for it) and CMake 3.20.3.2
Also workth noting I have used your examples above for clarity but I’m actually using an improted MCUXpressor SDK:
find_bsp(
ID com.sysprogs.imported.ksdk2x.MIMXRT1176xxxxx_CM4_MIMXRT1176XXXXX
VERSION 2.12.1
MCU MIMXRT1176DVMAA_CM7_MIMXRT1176XXXXX
ALIAS BOOT_BSP- This topic was modified 1 year, 7 months ago by drjonem.
March 30, 2023 at 11:38 #34052supportKeymasterHi,
The first code snippet you posted should work just fine. You can retest it by creating a simple STM32 project and copying it there.
If it’s not working in a more complicated McuXpresso project, the issue is likely caused by some hard-to-see difference (e.g. a space in some identifier that breaks CMake argument order). The easiest way to narrow it down would be to use the CMake debugger to step through a working STM32 setup and a broken McuXpresso setup side-by-side, until the difference becomes obvious.
March 31, 2023 at 08:13 #34057drjonemParticipantHi,
I’m still not having any luck with this. As suggested, I tried creating a very simple STM32 project – see attached CMakeLists.txt.
There seems to be a problem with cmake_parse_arguments in bsp_compile_definitions. The arguments are passed correctly; however, if the arguments are BSP_ALIAS BOOT_BSP, BSP_ALIAS is not found. If the arguments are ALIAS BOOT_BSP then somehow BSP_ALIAS is found and parse as BOOT_BSP.
I think I will revert to using two solutions but if you can find a solution to the above, I would be interested to know as it seems very odd behaviour.
Thanks,
Jon
Attachments:
You must be logged in to view attached files.April 3, 2023 at 16:10 #34062supportKeymasterThanks, we have reproduced the issue with the bsp_compile_definitions() and other similar statements. Indeed, they expected the ALIAS keyword instead of BSP_ALIAS as per documentation.
We have updated VisualGDB to handle both keywords in this build: VisualGDB-5.6.109.4853.msi
That said, we could not reproduce the issue with the flags applied to both BSPs. If it still persists with the new build, please try reproducing it on a sample STM32-based project and share the updated repro file.
April 4, 2023 at 02:08 #34063drjonemParticipantHi,
Thank you for the prompt fix!
Apologies for not updating re the flags – they were set in the BSP depending on memory destiation used and I hadn’t realised that, so that was my problem.
Thanks again,
Jon.
April 4, 2023 at 09:20 #34064supportKeymasterNo worries. Complex problems almost always have multiple causes, and simplifying the repro scenario always helps separate them.
If you encounter further issues, feel free to create another thread and we will be happy to help you.
-
AuthorPosts
- You must be logged in to reply to this topic.