构建失败 arm-none-eabi-gcc
Build Fail arm-none-eabi-gcc
我进了书 "Beginning STM32" - Warren Gay。
我尝试在 Cygwin 下构建源代码,但即使 makefile 中指示了所需文件的路径,所需文件也不是文件夹 libopencm3/cm3/scb.h 中的 found.The 文件 位于路径中:/home/root/STM32/stm32f103c8t6/libopencm3/include 所以正确的路径应该是 /home/root/STM32/stm32f103c8t6/libopencm3/include/libopencm3/cm3/scb.h 然后我检查了文件的存在。
所以我尝试将#include 更改为#include "file.h" 并在源文件夹中使用所需的头文件 - 这可行,但在不同的源文件中有很多情况。
是否有任何建议来修复此问题或找到摆脱此问题的方法?
非常感谢!
这是我从终端得到的。
[~/STM32/stm32f103c8t6]
$ make
make -C rtos/libwwg
make[1]: Entering directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg'
make -w -C ./src
make[2]: Entering directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg/src'
arm-none-eabi-gcc -Os -g -std=c99 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I/home/root/STM32/stm32f103c8t6/libopencm3/include -I/home/root/STM32/stm32f103c8t6//rtos/libwwg/include -I./rtos -I. -MD -Wall -Wundef -DSTM32F1 -I/home/root/STM32/stm32f103c8t6/libopencm3/include -I/home/root/STM32/stm32f103c8t6//rtos/libwwg/include -o usbcdc.o -c usbcdc.c
usbcdc.c:7:10: fatal error: libopencm3/cm3/scb.h: No such file or directory
7 | #include <libopencm3/cm3/scb.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [../../../Makefile.incl:111: usbcdc.o] Error 1
make[2]: Leaving directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg/src'
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg'
make: *** [Makefile:41: libwwg] Error 2
所以,我知道问题的根源是什么。
Cygwin 中的路径格式存在问题,或者更确切地说,在 Windows 和 Linux 路径格式之间的交互之间存在问题。我可以通过将 Makefile 中的路径从 Linux /home/folder 更改为 Windows D:\home\folder\ 格式来解决问题。
更详细的解答初学者:
修改“Makefile.incl”处的两行可能会解决问题。
在上述情况下,“Makefile.incl”应该在 ~/STM32/stm32f103c8t6 文件夹中。
以下是“Makefile.incl”
中的行
#TOP_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
TOP_DIR := C:\xyz\home\STM32\stm32f103c8t6
#OPENCM3_DIR := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/libopencm3)
OPENCM3_DIR := c:/xyz/home/STM32/stm32f103c8t6/libopencm3
路径中的'\'或'/'无关紧要
我进了书 "Beginning STM32" - Warren Gay。 我尝试在 Cygwin 下构建源代码,但即使 makefile 中指示了所需文件的路径,所需文件也不是文件夹 libopencm3/cm3/scb.h 中的 found.The 文件 位于路径中:/home/root/STM32/stm32f103c8t6/libopencm3/include 所以正确的路径应该是 /home/root/STM32/stm32f103c8t6/libopencm3/include/libopencm3/cm3/scb.h 然后我检查了文件的存在。
所以我尝试将#include 更改为#include "file.h" 并在源文件夹中使用所需的头文件 - 这可行,但在不同的源文件中有很多情况。
是否有任何建议来修复此问题或找到摆脱此问题的方法?
非常感谢!
这是我从终端得到的。
[~/STM32/stm32f103c8t6]
$ make
make -C rtos/libwwg
make[1]: Entering directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg'
make -w -C ./src
make[2]: Entering directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg/src'
arm-none-eabi-gcc -Os -g -std=c99 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I/home/root/STM32/stm32f103c8t6/libopencm3/include -I/home/root/STM32/stm32f103c8t6//rtos/libwwg/include -I./rtos -I. -MD -Wall -Wundef -DSTM32F1 -I/home/root/STM32/stm32f103c8t6/libopencm3/include -I/home/root/STM32/stm32f103c8t6//rtos/libwwg/include -o usbcdc.o -c usbcdc.c
usbcdc.c:7:10: fatal error: libopencm3/cm3/scb.h: No such file or directory
7 | #include <libopencm3/cm3/scb.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [../../../Makefile.incl:111: usbcdc.o] Error 1
make[2]: Leaving directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg/src'
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/home/root/STM32/stm32f103c8t6/rtos/libwwg'
make: *** [Makefile:41: libwwg] Error 2
所以,我知道问题的根源是什么。 Cygwin 中的路径格式存在问题,或者更确切地说,在 Windows 和 Linux 路径格式之间的交互之间存在问题。我可以通过将 Makefile 中的路径从 Linux /home/folder 更改为 Windows D:\home\folder\ 格式来解决问题。
更详细的解答初学者: 修改“Makefile.incl”处的两行可能会解决问题。 在上述情况下,“Makefile.incl”应该在 ~/STM32/stm32f103c8t6 文件夹中。
以下是“Makefile.incl”
中的行#TOP_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
TOP_DIR := C:\xyz\home\STM32\stm32f103c8t6
#OPENCM3_DIR := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/libopencm3)
OPENCM3_DIR := c:/xyz/home/STM32/stm32f103c8t6/libopencm3
路径中的'\'或'/'无关紧要