nlhans / qt-baremetal

Bare metal programming in QT Creator & QBS for ARM Cortex devices
GNU General Public License v3.0
42 stars 16 forks source link

Does not work with Qt Creator 4.x #4

Open n6hpa opened 7 years ago

n6hpa commented 7 years ago

Hi There,

I am trying to get this running with Qt Creator 4.3. I was able to get this working with older versions of Qt Creator, but with 4.3 I get the following linker error:

helloworld-stm32f4-Debug/qtc_stm32f4_b337530f-debug/Hello-World-.qtc-stm32f4-b337530f.b023bda8/.obj/e64ca3ddddfee403/stm32f4xx_tim.c.o /Users/n6hpa/dev/build-helloworld-stm32f4-Debug/qtc_stm32f4_b337530f-debug/Hello-World-.qtc-stm32f4-b337530f.b023bda8/.obj/e64ca3ddddfee403/stm32f4xx_usart.c.o /Users/n6hpa/dev/build-helloworld-stm32f4-Debug/qtc_stm32f4_b337530f-debug/Hello-World-.qtc-stm32f4-b337530f.b023bda8/.obj/e64ca3ddddfee403/stm32f4xx_wwdg.c.o /Users/n6hpa/gcc-arm-none-eabi-5_4-2016q3/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: unrecognised emulation mode: thumb Supported emulations: armelf collect2: error: ld returned 1 exit status

Any idea what is causing this? Google has failed me so far...

nlhans commented 7 years ago

I could not reproduce this at first because I was using older versions on Ubuntu LTS. Recently I've upgraded and I was able to reproduce.

It turns out later versions of QBS is escaping linker commands al the time. This meant that information about chip architectures was not given correctly. The fix is to use driverFlags instead. cpp.driverFlags: [ "-mcpu=cortex-m4", "-mfloat-abi=hard", "-mfpu=fpv4-sp-d16", "-mthumb" ]

You can place this in the Qbs file nearby the linkerFlags definition. Then remove these definitions from the linkerFlags as they are redundant. I'm still investigating if I can streamline more of the QBS by this, because I believe driverFlags is given to any compiler command.