decaday / py32f0_cmake_template

PY32F0 MCU CMake project template. Using GCC, cross-platform.Supported PY32F030,PY32F002/3,XL32,AIR001
4 stars 0 forks source link

ninja:build stopped:subcommand failed #2

Open lightrainmail opened 1 week ago

lightrainmail commented 1 week ago

====================[ 构建 | py32_cmake_template.elf | Debug ]==================== "C:\Program Files\JetBrains\CLion 2023.3.1\bin\cmake\win\x64\bin\cmake.exe" --build C:\Users\light\OneDrive\PYF002A\PY32_Cmake_test2\py32f0_cmake_template\cmake-build-debug --target py32_cmake_template.elf -j 6 [1/1] Linking C executable py32_cmake_template.elf FAILED: py32_cmake_template.elf C:\Windows\system32\cmd.exe /C "cd . && arm-none-eabi-gcc -g -Wl,-gc-sections,--print-memory-usage,-Map=C:/Users/light/OneDrive/PYF002A/PY32_Cmake_test2/py32f0_cmake_template/cmake-build-debug/py32_cmake_template.map -specs=nano.specs -specs=nosys.specs -static -lc -lm -Wl,--no-warn-rwx-segments -mcpu=cortex-m0plus -mthumb -mthumb-interwork -T C:/Users/light/OneDrive/PYF002A/PY32_Cmake_test2/py32f0_cmake_template/Drivers/LDScripts/py32f002ax5.ld CMakeFiles/py32_cmake_template.elf.dir/Drivers/CMSIS/Device/PY32F0xx/Source/system_py32f0xx.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_adc.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_adc_ex.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_comp.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_cortex.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_crc.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_dma.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_exti.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_flash.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_gpio.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_i2c.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_irda.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_iwdg.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_led.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_lptim.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_pwr.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc_ex.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rtc.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rtc_ex.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_spi.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_tim.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_tim_ex.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_uart.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_usart.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_wwdg.c.obj CMakeFiles/py32_cmake_template.elf.dir/Drivers/CMSIS/Device/PY32F0xx/Source/gcc/startup_py32f002a.s.obj CMakeFiles/py32_cmake_template.elf.dir/App/main.c.obj CMakeFiles/py32_cmake_template.elf.dir/App/py32f0xx_hal_msp.c.obj CMakeFiles/py32_cmake_template.elf.dir/App/py32f0xx_it.c.obj -o py32_cmake_template.elf && C:\Windows\system32\cmd.exe /C "cd /D C:\Users\light\OneDrive\PYF002A\PY32_Cmake_test2\py32f0_cmake_template\cmake-build-debug && arm-none-eabi-objcopy -Oihex C:/Users/light/OneDrive/PYF002A/PY32_Cmake_test2/py32f0_cmake_template/cmake-build-debug/py32_cmake_template.elf C:/Users/light/OneDrive/PYF002A/PY32_Cmake_test2/py32f0_cmake_template/cmake-build-debug/py32_cmake_template.hex && arm-none-eabi-objcopy -Obinary C:/Users/light/OneDrive/PYF002A/PY32_Cmake_test2/py32f0_cmake_template/cmake-build-debug/py32_cmake_template.elf C:/Users/light/OneDrive/PYF002A/PY32_Cmake_test2/py32f0_cmake_template/cmake-build-debug/py32_cmake_template.bin"" c:/program files/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--no-warn-rwx-segments' c:/program files/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed.

decaday commented 1 week ago

What MCU are you using? Please provide your py32f0.cmake and CMakeList.txt (if you edited it)

decaday commented 1 week ago

I seem to have found the reason, you need to upgrade your arm-gcc version. Your GCC (10.3.1) does not support --no-warn-rwx-segments. This option was released in Binutils 2.39 (2022.8). For later arm-gcc, if you do not use --no-warn-rwx-segments, a warning will appear: warning: <file> has a LOAD segment with RWX permissions

Alternatively, you can delete this line in CMakeLists.txt. image