Hey guys,
I’m currently trying to get cmake to work for cross compiling an embedded project using gcc arm-none-eabi.
I found this nice toolchain and it helps me passing the required compiler tests.
However the architecture flags generated by cmake are wrong.
FreeRTOS using some asm instructions like
/* Scheduler utilities. */
#define portYIELD() \
{ \
\
/* Barriers are normally not required but do ensure the code is completely \
* within the specified behaviour for the architecture. */ \
__asm volatile ( "dsb" ::: "memory" ); \
__asm volatile ( "isb" ); \
}
This results in
Error: selected processor does not support
dsb’ in ARM mode`
Generated flags are “’-mcpu=arm7tdmi’ ‘-mfloat-abi=soft’ ‘-marm’ ‘-march=armv4t’”
The required flags are: -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
I figured out that the arch values are coming from the “architecture” settings in my presets
{
"name": "_arm_none_eabi",
"hidden": true,
"architecture": {
//"value": "-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16",
"value": "ARM",
//"value": "arm-none-eabi",
"strategy": "external"
},
"toolchainFile": "${sourceParentDir}/toolbox/cmake/toolchain/arm-none-eabi/arm-gcc-toolchain.cmake",
"cacheVariables": {
"BUILD_SHARED_LIBS": "OFF",
"CMAKE_BUILD_WITH_INSTALL_RPATH": "ON"
}
},
I tried several values of architecture, none with the expected result.
I can live with omitting the arch flag in den presets and setting it explicitly in the toolchainfile: However even after removing this value from the presets, Arch flags will still be generated by cmake.
Do you have an idea how to generate my wanted flags?
I created a minimum working example, I did pack the gcc cross compiler directly into it so it should work out of the box.
Could someone look into it?