“arm-none-eabi-gcc”的消息是“未实施并将始终失败”

huangapple go评论61阅读模式
英文:

arm-none-eabi-gcc "is not implemented and will always fail" messages

问题

这些编译器警告信息是由于某些函数(例如_close_r_lseek_r_read_r_write_r)没有实现引起的,因此它们将始终失败。这些函数通常是与文件操作相关的,例如关闭文件、寻址文件、读取文件和写入文件。

在两个项目中,您使用了相同的编译选项和链接选项,这使得编译过程应该是相同的。然而,在一个项目中,您遇到了这些警告,而在另一个项目中没有。

可能的原因是在两个项目中使用的设备或配置存在一些差异。您提到在一个项目中使用了-DSTM32F103xE,而在另一个项目中使用了-DSTM32F103xB,这可能是其中一个潜在的区别。您可能需要检查这些宏定义和与它们相关的文件是否存在差异。

另外,您还提到这些问题可能在最近的更新后出现。如果您在两个项目中使用相同的编译器和库版本,但其中一个项目出现问题,那么问题可能源于特定于项目的配置或源代码差异。您可能需要详细比较两个项目的源代码和配置文件,以查找差异。

最后,还可以考虑执行更详细的调试,例如使用-E选项查看生成的预处理文件,以查看是否存在差异。如果问题仍然存在,您可能需要进一步调查特定于项目的配置或源代码文件。

英文:

I have two stm32 projects (one with stm32f103rb and the other with stm32f103re). Both projects are built using cmake and make based on stm32-cmake template and also use cubeMX HAL libraries. For both projects I use this printf library and overall structure of the source code and implemented functions are similar.

When I build the projects, I get these linker messages, but only in the 103re project and not the other one (both project build completely):

usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-closer.o): in function `_close_r':
/build/arm-none-eabi-newlib/src/build-nano/arm-none-eabi/thumb/v7-m/nofp/newlib/../../../../../../newlib-4.3.0.20230120/newlib/libc/reent/closer.c:47: warning: _close is not implemented and will always fail
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-lseekr.o): in function `_lseek_r':
/build/arm-none-eabi-newlib/src/build-nano/arm-none-eabi/thumb/v7-m/nofp/newlib/../../../../../../newlib-4.3.0.20230120/newlib/libc/reent/lseekr.c:49: warning: _lseek is not implemented and will always fail
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-readr.o): in function `_read_r':
/build/arm-none-eabi-newlib/src/build-nano/arm-none-eabi/thumb/v7-m/nofp/newlib/../../../../../../newlib-4.3.0.20230120/newlib/libc/reent/readr.c:49: warning: _read is not implemented and will always fail
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-writer.o): in function `_write_r':
/build/arm-none-eabi-newlib/src/build-nano/arm-none-eabi/thumb/v7-m/nofp/newlib/../../../../../../newlib-4.3.0.20230120/newlib/libc/reent/writer.c:49: warning: _write is not implemented and will always fail

What's the reason for these messages? and why the compiler behavior is different in two project?

PS: this wasn't the case couple of weeks ago and it happens recently probably after an update or something.

❮ pacman -Q | grep arm-none-eabi
arm-none-eabi-binutils 2.39-2
arm-none-eabi-gcc 12.2.0-1
arm-none-eabi-gdb 13.1-1
arm-none-eabi-newlib 4.3.0.20230120-1

Edit 1:

build flags, in gcc-arm-none-eabi.cmake module:

set(CMAKE_C_FLAGS_INIT
    "-fdata-sections -ffunction-sections --specs=nano.specs --specs=nosys.specs -Wl,--gc-sections")

compile options in CMakeLists.txt:

target_compile_options(${EXECUTABLE} PRIVATE
    ${CPU_PARAMETERS}
    -Wall
    -Wextra
    -Wpedantic
    -Wshadow
    -Wdouble-promotion
    -Wformat=2 -Wformat-truncation
    -Wundef
    -fno-common
    -Wno-unused-parameter
    $<$<COMPILE_LANGUAGE:CXX>:
        -Wconversion
        -Wno-volatile
        -Wold-style-cast
        -Wuseless-cast
        -Wsuggest-override>
    $<$<CONFIG:Debug>:-Og -g3 -ggdb>
    $<$<CONFIG:Release>:-Og -g0>)

and linker flags in CMakeLists.txt file:

target_link_options(${EXECUTABLE} PRIVATE
    -T${MCU_LINKER_SCRIPT}
    ${CPU_PARAMETERS}
    -Wl,-Map=${CMAKE_PROJECT_NAME}.map
    -Wl,--start-group
    -lc
    -lm
    -lnosys
    -lstdc++
    -Wl,--end-group
    -Wl,--print-memory-usage)

All these options are identical in both files

Edit 2:

Output of make VERBOSE=1 for one of the source files in both projects. I checked with vimdiff and they are identical (except -DSTM32F103xE which is -DSTM32F103xB on the other project:

[  3%] Building C object CMakeFiles/ap-v0.2-22-gd2cd.dir/Core/Src/dma.c.obj
/usr/bin/arm-none-eabi-gcc -DSTM32F103xE -DUSE_HAL_DRIVER -I/home/mehdi/wrk/code/ap -isystem /home/mehdi/wrk/code/ap/Core/Inc -isystem /home/mehdi/wrk/code/ap/Drivers/STM32F1xx_HAL_Driver/Inc -isystem /home/mehdi/wrk/code/ap/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -isystem /home/mehdi/wrk/code/ap/
Drivers/CMSIS/Device/ST/STM32F1xx/Include -isystem /home/mehdi/wrk/code/ap/Drivers/CMSIS/Include -fdata-sections -ffunction-sections --specs=nano.specs --specs=nosys.specs -Wl,--gc-sections -g -mcpu=cortex-m3 -mthumb -Wall -Wextra -Wpedantic -Wshadow -Wdouble-promotion -Wformat=2 -Wformat-truncati
on -Wundef -fno-common -Wno-unused-parameter -Og -g3 -ggdb -std=gnu11 -MD -MT CMakeFiles/ap-v0.2-22-gd2cd.dir/Core/Src/dma.c.obj -MF CMakeFiles/ap-v0.2-22-gd2cd.dir/Core/Src/dma.c.obj.d -o CMakeFiles/ap-v0.2-22-gd2cd.dir/Core/Src/dma.c.obj -c /home/mehdi/wrk/code/ap/Core/Src/dma.c

link command:

[100%] Linking C executable ap-v0.2-22-gd2cd.elf
/usr/bin/cmake -E cmake_link_script CMakeFiles/ap-v0.2-22-gd2cd.dir/link.txt --verbose=1
/usr/bin/arm-none-eabi-gcc -fdata-sections -ffunction-sections --specs=nano.specs --specs=nosys.specs -Wl,--gc-sections -g -T/home/mehdi/wrk/code/ap/CubeMX/STM32F103RETx_FLASH.ld -mcpu=cortex-m3 -mthumb -Wl,-Map=ap.map -Wl,--start-group -lc -lm -lnosys -lstdc++ -Wl,--end-group -Wl,--print-memory-u
sage "CMakeFiles/ap-v0.2-22-gd2cd.dir/Core/Src/dma.c.obj" ... all other sources

search results for _write_r in .map file:

in stm32f103rb project:

/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-writer.o)
                              /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-stdio.o) (_write_r)

 .text._write_r
                0x0000000008008c8c       0x24 /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-writer.o)
                0x0000000008008c8c                _write_r

in stm32f103re project:

/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-writer.o)
                              /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-stdio.o) (_write_r)

 .text          0x0000000000000000        0x0 /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-writer.o)
 .data          0x0000000000000000        0x0 /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-writer.o)
 .bss           0x0000000000000000        0x0 /usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc_nano.a(libc_a-writer.o)
 .text._write_r

答案1

得分: 1

以下是翻译好的部分:

这个警告消息定义在newlib-cygwin/libgloss/libnosys/warning.h文件中,作为一个.gnu.warning.*节(section),你可以使用objcopy来移除它。

输入你的arm-none-eabi工具安装目录,使用以下命令:

find -name "libnosys.a" -exec arm-none-eabi-objcopy -R .gnu.warning.* {} \;
英文:

This warning message defined in newlib-cygwin/libgloss/libnosys
/warning.h , as a .gnu.warning.* section, you can remove it use objcopy.

Enter your arm-none-eabi tools install dir, use command:

find -name "libnosys.a" -exec arm-none-eabi-objcopy -R .gnu.warning.* {} \;

huangapple
  • 本文由 发表于 2023年3月3日 19:46:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75626690.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定