同样的软件用gcc-arm-none-eabi-7-2018-q2,出现Conflicting CPU architectures错误,用Arm GNU Toolchain arm-none-eabi 11.2 2022.02 版本没有问题。

怀疑是GNU版本对CPU架构的定义不一样;CPU类型是 Cortex-M4。

d:/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: error: d:/gcc-arm-none-eabi-7-2018-q2-update-win32/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-setjmp.o): Conflicting CPU architectures 13/0

为什么不用新版本,而用老版本的原因在于,新版本11.2 2022.02用-os,编译出来是483k flash;老版本7-2018-q2用-o2,只有400k flash,空间大大减少。
新的EIDE,发现看不到总成的makefile文件了,而老的有,好定位问题一些。

附上builder.params文件内容。
{
"name": "vesc-vscode",
"target": "Debug",
"toolchain": "GCC",
"showRepathOnLog": true,
"threadNum": 10,
"rootDir": "z:\vesc-vscode",
"dumpPath": ".eide\log",
"outDir": "build\Debug",
"ram": 20480,
"rom": 65536,
"incDirs": [
".eide/deps",
"vesc_firmware",
"vesc_firmware/qmlui",
"vesc_firmware/nrf",
"vesc_firmware/mcconf",
"vesc_firmware/lzo",
"vesc_firmware/lora",
"vesc_firmware/lispBM",
"vesc_firmware/lispBM/lispBM/src",
"vesc_firmware/lispBM/lispBM/src/extensions",
"vesc_firmware/lispBM/lispBM/platform/chibios/src",
"vesc_firmware/lispBM/lispBM/platform/chibios/include",
"vesc_firmware/lispBM/lispBM/include",
"vesc_firmware/lispBM/lispBM/include/extensions",
"vesc_firmware/libcanard",
"vesc_firmware/libcanard/dsdl/uavcan/protocol",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/param",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/file",
"vesc_firmware/libcanard/dsdl/uavcan/equipment/esc",
"vesc_firmware/imu",
"vesc_firmware/imu/Fusion",
"vesc_firmware/imu/BMI160_driver",
"vesc_firmware/hwconf",
"vesc_firmware/hwconf/luna",
"vesc_firmware/encoder",
"vesc_firmware/ChibiOS_3.0.5/os/various",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src",
"vesc_firmware/ChibiOS_3.0.5/os/rt/ports/ARMCMx",
"vesc_firmware/ChibiOS_3.0.5/os/rt/ports/ARMCMx/compilers/GCC",
"vesc_firmware/ChibiOS_3.0.5/os/rt/include",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/STM32F4xx",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/USARTv1",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/TIMv1",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/SPIv1",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/OTGv1",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/I2Cv1",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/GPIOv2",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/common/ARMCMx",
"vesc_firmware/ChibiOS_3.0.5/os/hal/osal/rt",
"vesc_firmware/ChibiOS_3.0.5/os/hal/include",
"vesc_firmware/ChibiOS_3.0.5/os/common/ports/ARMCMx/compilers/GCC",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/inc",
"vesc_firmware/blackmagic",
"vesc_firmware/blackmagic/target",
"vesc_firmware/applications",
"vesc_firmware/appconf"
],
"libDirs": [],
"defines": [],
"sourceList": [
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/misc.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_adc.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_dma.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_exti.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_flash.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_iwdg.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_rcc.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_syscfg.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_tim.c",
"vesc_firmware/ChibiOS_3.0.5/ext/stdperiph_stm32f4/src/stm32f4xx_wwdg.c",
"vesc_firmware/ChibiOS_3.0.5/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s",
"vesc_firmware/ChibiOS_3.0.5/os/common/ports/ARMCMx/compilers/GCC/crt1.c",
"vesc_firmware/ChibiOS_3.0.5/os/common/ports/ARMCMx/compilers/GCC/vectors.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/osal/rt/osal.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/GPIOv2/pal_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/I2Cv1/i2c_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/SPIv1/spi_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/TIMv1/icu_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/TIMv1/st_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/LLD/can_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/STM32F4xx/hal_lld.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/STM32/STM32F4xx/stm32_dma.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/ports/common/ARMCMx/nvic.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/can.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/hal.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/hal_mmcsd.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/hal_queues.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/i2c.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/icu.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/pal.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/serial.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/serial_usb.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/spi.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/st.c",
"vesc_firmware/ChibiOS_3.0.5/os/hal/src/usb.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/ports/ARMCMx/chcore.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/ports/ARMCMx/chcore_v7m.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.s",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chcond.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chdebug.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chdynamic.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chevents.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chheap.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chmboxes.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chmemcore.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chmempools.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chmsg.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chmtx.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chqueues.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chregistry.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chschd.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chsem.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chsys.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chthreads.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chtm.c",
"vesc_firmware/ChibiOS_3.0.5/os/rt/src/chvt.c",
"vesc_firmware/ChibiOS_3.0.5/os/various/syscalls.c",
"vesc_firmware/applications/app.c",
"vesc_firmware/applications/app_adc.c",
"vesc_firmware/applications/app_balance.c",
"vesc_firmware/applications/app_custom.c",
"vesc_firmware/applications/app_nunchuk.c",
"vesc_firmware/applications/app_pas.c",
"vesc_firmware/applications/app_ppm.c",
"vesc_firmware/applications/app_sten.c",
"vesc_firmware/applications/app_uartcomm.c",
"vesc_firmware/blackmagic/bm_if.c",
"vesc_firmware/blackmagic/exception.c",
"vesc_firmware/blackmagic/platform.c",
"vesc_firmware/blackmagic/swdptap.c",
"vesc_firmware/blackmagic/target/adiv5.c",
"vesc_firmware/blackmagic/target/adiv5_swdp.c",
"vesc_firmware/blackmagic/target/cortexm.c",
"vesc_firmware/blackmagic/target/nrf51.c",
"vesc_firmware/blackmagic/target/stm32f1.c",
"vesc_firmware/blackmagic/target/stm32f4.c",
"vesc_firmware/blackmagic/target/stm32h7.c",
"vesc_firmware/blackmagic/target/stm32l0.c",
"vesc_firmware/blackmagic/target/stm32l4.c",
"vesc_firmware/blackmagic/target/swdptap_generic.c",
"vesc_firmware/blackmagic/target/target.c",
"vesc_firmware/blackmagic/timing.c",
"vesc_firmware/bms.c",
"vesc_firmware/board.c",
"vesc_firmware/buffer.c",
"vesc_firmware/comm_can.c",
"vesc_firmware/comm_usb.c",
"vesc_firmware/comm_usb_serial.c",
"vesc_firmware/commands.c",
"vesc_firmware/conf_general.c",
"vesc_firmware/confgenerator.c",
"vesc_firmware/crc.c",
"vesc_firmware/digital_filter.c",
"vesc_firmware/eeprom.c",
"vesc_firmware/encoder/enc_abi.c",
"vesc_firmware/encoder/enc_ad2s1205.c",
"vesc_firmware/encoder/enc_as504x.c",
"vesc_firmware/encoder/enc_mt6816.c",
"vesc_firmware/encoder/enc_sincos.c",
"vesc_firmware/encoder/enc_ts5700n8501.c",
"vesc_firmware/encoder/encoder.c",
"vesc_firmware/encoder/encoder_cfg.c",
"vesc_firmware/events.c",
"vesc_firmware/flash_helper.c",
"vesc_firmware/foc_math.c",
"vesc_firmware/gpdrive.c",
"vesc_firmware/hwconf/drv8301.c",
"vesc_firmware/hwconf/drv8305.c",
"vesc_firmware/hwconf/drv8320s.c",
"vesc_firmware/hwconf/drv8323s.c",
"vesc_firmware/hwconf/hw.c",
"vesc_firmware/hwconf/luna/luna_display_serial.c",
"vesc_firmware/hwconf/si8900.c",
"vesc_firmware/i2c_bb.c",
"vesc_firmware/imu/BMI160_driver/bmi160.c",
"vesc_firmware/imu/Fusion/FusionAhrs.c",
"vesc_firmware/imu/Fusion/FusionBias.c",
"vesc_firmware/imu/Fusion/FusionCompass.c",
"vesc_firmware/imu/ahrs.c",
"vesc_firmware/imu/bmi160_wrapper.c",
"vesc_firmware/imu/icm20948.c",
"vesc_firmware/imu/imu.c",
"vesc_firmware/imu/lsm6ds3.c",
"vesc_firmware/imu/mpu9150.c",
"vesc_firmware/irq_handlers.c",
"vesc_firmware/ledpwm.c",
"vesc_firmware/libcanard/canard.c",
"vesc_firmware/libcanard/canard_driver.c",
"vesc_firmware/libcanard/dsdl/uavcan/equipment/esc/esc_RPMCommand.c",
"vesc_firmware/libcanard/dsdl/uavcan/equipment/esc/esc_RawCommand.c",
"vesc_firmware/libcanard/dsdl/uavcan/equipment/esc/esc_Status.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/file/file_BeginFirmwareUpdate.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/file/file_Read.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/param/param_Empty.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/param/param_ExecuteOpcode.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/param/param_GetSet.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/param/param_NumericValue.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/param/param_Value.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/protocol_GetNodeInfo.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/protocol_HardwareVersion.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/protocol_NodeStatus.c",
"vesc_firmware/libcanard/dsdl/uavcan/protocol/protocol_SoftwareVersion.c",
"vesc_firmware/lispBM/lispBM/platform/chibios/src/platform_mutex.c",
"vesc_firmware/lispBM/lispBM/src/env.c",
"vesc_firmware/lispBM/lispBM/src/eval_cps.c",
"vesc_firmware/lispBM/lispBM/src/extensions.c",
"vesc_firmware/lispBM/lispBM/src/extensions/array_extensions.c",
"vesc_firmware/lispBM/lispBM/src/fundamental.c",
"vesc_firmware/lispBM/lispBM/src/heap.c",
"vesc_firmware/lispBM/lispBM/src/lbm_c_interop.c",
"vesc_firmware/lispBM/lispBM/src/lbm_memory.c",
"vesc_firmware/lispBM/lispBM/src/lbm_variables.c",
"vesc_firmware/lispBM/lispBM/src/lispbm.c",
"vesc_firmware/lispBM/lispBM/src/print.c",
"vesc_firmware/lispBM/lispBM/src/qq_expand.c",
"vesc_firmware/lispBM/lispBM/src/stack.c",
"vesc_firmware/lispBM/lispBM/src/streams.c",
"vesc_firmware/lispBM/lispBM/src/symrepr.c",
"vesc_firmware/lispBM/lispBM/src/tokpar.c",
"vesc_firmware/lispBM/lispif.c",
"vesc_firmware/lispBM/lispif_vesc_dynamic_loader.c",
"vesc_firmware/lispBM/lispif_vesc_extensions.c",
"vesc_firmware/lora/SX1278.c",
"vesc_firmware/lora/SX1278_hw.c",
"vesc_firmware/lora/lora.c",
"vesc_firmware/lzo/minilzo.c",
"vesc_firmware/main.c",
"vesc_firmware/mc_interface.c",
"vesc_firmware/mcpwm.c",
"vesc_firmware/mcpwm_foc.c",
"vesc_firmware/mempools.c",
"vesc_firmware/nrf/nrf_driver.c",
"vesc_firmware/nrf/rf.c",
"vesc_firmware/nrf/rfhelp.c",
"vesc_firmware/nrf/spi_sw.c",
"vesc_firmware/packet.c",
"vesc_firmware/qmlui/qmlui.c",
"vesc_firmware/servo_dec.c",
"vesc_firmware/servo_simple.c",
"vesc_firmware/shutdown.c",
"vesc_firmware/spi_bb.c",
"vesc_firmware/terminal.c",
"vesc_firmware/timeout.c",
"vesc_firmware/timer.c",
"vesc_firmware/utils_math.c",
"vesc_firmware/utils_sys.c",
"vesc_firmware/virtual_motor.c",
"vesc_firmware/worker.c"
],
"sourceParams": {},
"sourceParamsMtime": 1652335403430.9788,
"options": {
"version": 4,
"beforeBuildTasks": [],
"afterBuildTasks": [],
"global": {
"$float-abi-type": "softfp",
"output-debug-info": "enable",
"toolPrefix": "arm-none-eabi-",
"microcontroller-cpu": "cortex-m4-sp",
"microcontroller-fpu": "cortex-m4-sp",
"microcontroller-float": "cortex-m4-sp",
"target": "cortex-m4-sp"
},
"c/cpp-compiler": {
"language-c": "c99",
"language-cpp": "c++11",
"optimization": "level-debug",
"warnings": "all-warnings",
"one-elf-section-per-function": true,
"one-elf-section-per-data": true,
"C_FLAGS": "-D_GNU_SOURCE -DBOARD_OTG_NOVBUSSENS -DUSE_LISPBM -DUSE_STDPERIPH_DRIVER -DHW_SOURCE=\\"hw_60_core.c\\" -DHW_HEADER=\\"hw_60.h\\" -Ivesc_firmware/ChibiOS_3.0.5/os/ext/CMSIS/ST -Ivesc_firmware/ChibiOS_3.0.5/os/ext/CMSIS/include -Ivesc_firmware/hwconf/trampa/vesc6 -Ivesc_firmware/libcanard/dsdl -Ivesc_firmware/lispBM/lispBM/platform/chibios/include"
},
"asm-compiler": {},
"linker": {
"output-format": "elf",
"remove-unused-input-sections": true,
"LD_FLAGS": "-Wdouble-promotion -specs=nosys.specs -ffunction-sections -fdata-sections -fno-common -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles",
"LIB_FLAGS": "-lm",
"link-scatter": [
"\"z:/vesc-vscode/vesc_firmware/ld_eeprom_emu.ld\""
]
}
},
"sha": {
"c/cpp-defines": "d751713988987e9331980363e24189ce",
"beforeBuildTasks": "d751713988987e9331980363e24189ce",
"afterBuildTasks": "d751713988987e9331980363e24189ce",
"global": "6262ba7c67c1a4efe83d701cb4be1577",
"c/cpp-compiler": "f768560d4dd4824f33dc359545516a90",
"asm-compiler": "99914b932bd37a50b983c5e7c90ae93b",
"linker": "764324550c77717f95a5a803346be8ba"
}
}

    上面关于flash大小的描述不准确;修改优化项后要点击保存,参数才有效;直接退出参数,虽然改了,但是builder.params没有修改过来。

    修改为-os,保存,查看 builder.params文件修改过来了,编译后flash稍大一点417K。

    另外新老版本gnu 对inline的定义要求不一样,老板inline函数可以定义在.h文件中; 新版 gnu 要求定义到源文件中,也就是c语言文件中。所以如果源文件一直是老版本编译的,现在用新版本,比较麻烦。

      dsppower

      eide 默认用的 arm-none-eabi-gcc-8.3.0 这个是一个比较稳定的版本,编出的产物大小也合适,建议去用这个版本编译

      百度了一下 Conflicting CPU architectures 13/0,网上也有很多这种问题,讲的就是旧的编译器不能兼容新的编译器参数

      eide 默认有一些链接参数:--specs=nosys.specs --specs=nano.specs -Wl,--gc-sections,这些参数是在 8.3.0 上没问题的,如果你用更老的版本,你得自己去填写合适参数

      dsppower

      修改优化项后要点击保存,参数才有效;直接退出参数,虽然改了,但是builder.params没有修改过来。

      这个就跟修改文件一样,改完要 点保存 或者 ctrl+s 保存,目前由于这个 WebView 页面交互的问题,你改了不保存直接点退出是没有任何提示的

      arm-none-eabi-gcc-8.3.0 用-os (size)编译出来是407k,大小还不错,版本越高编译出来越大。
      但是连接的时候,.h文件中inline函数出现没有找到参考的错误,这是gcc版本的问题,还需要研究一下解决办法。
      c:/users/lenovo/.eide/tools/gcc_arm/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld.exe: ./build/Debug/vesc_firmware/applications/app_nunchuk.o: in function output_thread':
      z:\vesc-vscode/./vesc_firmware/applications/app_nunchuk.c:433: undefined reference to
      utils_step_towards'

      但是这个问题,如果用-Ofast选项就成功链接,但是flash大小到了485k。

      还发现有一个需要优化的地方:如果出现编译错误,如下图,再一次编译,要等好一会儿。

        dsppower

        如果你要把函数体放在 .h 文件里,建议你试试 __STATIC_FORCEINLINE 而不是 inline

        仅指定 inline,编译器会根据情况决定是否内联,难以预料预期结果


        如果出现编译错误,如下图,再一次编译,要等好一会儿

        这个 要等好一会儿 是指 点编译后,终端里的内容被清空直到构建的第一条 log 被打印出来 这段时期吗?

        多谢版主!
        照这个改动,已经通过,大小也合适,目前这是改动最小的办法。
        因为这个文件是github版本库clone下来的,刷新一次,就覆盖还原了,除非合到版本;目前看这个是最小而有效的解决办法。

        出现编译错误后,这个地方显示一直旋转,也就是占用状态;您的描述和实际情况一致,就是这段时期。

          dsppower

          构建后有 刷新源文件引用 任务,会更新视图,就会产生等待中状态,但编译成功也是有的这个过程的

          这个现象在编译成功后有吗?

          计算机中途崩溃了,重新打开项目,发现C/C++编译项清空了,恢复环境花了不少时间,可能是我没有及时存的原因造成。
          现在恢复正常了,即使编译连接出现错误,也能很快的能重新编译;问题很难重现,因为计算机重启了。

          a month later
          Write a Reply...