【缘由】
在使用STM32CubeMX生成的TouchGFX的MDK工程报错,编译报错,报错信息为ARM-V8架构不兼容。经查找后,发现是由于Lib库引用的路径不对引起的。
【基本情况】
1、我使用stm32cubeMX生成的基于NUCLEO-H755开发板,使用stm32cubeMx生成基于MDK的工程,再使用TouchGFX designer生成工程,编译后在链接时报错,信息如下:
Tag_FP_arch = Use of the ARM v8-A FP ISA was permitted, but only citing registers D0-D15, S0-S31 (=8) TouchGFX_ST7789_CM4\TouchGFX_ST7789_CM4.axf: Error: L6366E: textprovider.o attributes are not compatible with the provided attributes . Object textprovider.o contains Build Attributes that are incompatible with the provided attributes. Tag_FP_arch = Use of the ARM v8-A FP ISA was permitted, but only citing registers D0-D15, S0-S31 (=8) TouchGFX_ST7789_CM4\TouchGFX_ST7789_CM4.axf: Error: L6366E: typedtext.o attributes are not compatible with the provided attributes . Object typedtext.o contains Build Attributes that are incompatible with the provided attributes. Tag_FP_arch = Use of the ARM v8-A FP ISA was permitted, but only citing registers D0-D15, S0-S31 (=8) TouchGFX_ST7789_CM4\TouchGFX_ST7789_CM4.axf: Error: L6366E: unicode.o attributes are not compatible with the provided attributes .
【问题查找】
经查找资料,从错误信息来看,所有错误都指向同一个问题:目标文件(.o)的浮点架构(FP_arch)属性与当前工程配置不兼容。这些目标文件编译时使用了 ARM v8-A 浮点指令集(仅允许 D0-D15/S0-S31 寄存器),但当前工程的 FPU 配置与之不符。
而我的TouchGFX所使用的是Cortex-M4内核,显然TouchGFX给我的Lib库是Cortex-M7内核的。而我所需要的是Cortex_M4内核的链接文件。
【解决方法】
1、打开MDK的工程文件:
2、使用vscode打开这个文件,在3367行找到lib文件的引用路径:
果然是指向了cortex_m7内存的链接库。
3、经查找/cm4/middlewares/st/touchgfx/lib/core目前下,给出了好几种内核的链接文件:
4、把目录修改为cortex_m4f
再重新编译就顺利链接通过了。