【发布时间】:2018-01-04 15:47:10
【问题描述】:
我在尝试为我的新 STM32F7 Nucleo 板设置的项目时遇到问题。我新安装了GNU ARM Embedded toolchain、STM32CubeF7 和GNU MCU Eclipse Plugin,并在我的Windows 7 机器上设置了一个新项目。我以前在家里的 Ubuntu 笔记本电脑上做过,没有任何问题。 设置项目后,我添加了 HAL 和 CMSIS 库,并使用了来自 STM32CubeF7 的模板项目。到目前为止,编译工作正常,但是在链接时出现以下错误:
c:/program files (x86)/gnu tools arm embedded/5.4 2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: cannot find -lc_p-lc_p
据我了解,这里的问题是找不到一些名称非常奇怪的库。不幸的是,唯一的page that I found where the same error is described 是俄语,我根本不会说。
乍一看,生成的 makefile 似乎已损坏,并且一个名为 c_p 的库正在尝试链接,但它执行了两次,中间没有空格。所以这可能是 Eclipse 或 Eclipse GNU MCU 插件的问题。
我试图摆脱错误的事情:
- 更新 Eclipse
- 降级到多个旧版本的 GNU ARM Embedded 工具链
- 关闭/打开以下链接器选项:
--specs=nano.specs-nodefaultlibs-nostdlib
- 将工具链安装在没有空格的文件夹中
这是自动生成的makefile:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include system/src/subdir.mk
-include system/HAL/Src/subdir.mk
-include system/subdir.mk
-include src/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(ASM_DEPS)),)
-include $(ASM_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
SECONDARY_FLASH += \
stm32Template.hex \
SECONDARY_SIZE += \
stm32Template.siz \
# All Target
all: stm32Template.elf secondary-outputs
# Tool invocations
stm32Template.elf: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GNU ARM Cross C++ Linker'
arm-none-eabi-g++ -mcpu=cortex-m7 -mthumb -mfloat-abi=soft -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra -g3 -p -pg -T mem.ld -T libs.ld -T sections.ld -nostartfiles -L"../ldscripts" -Wl,-Map,"stm32Template.map" --specs=nano.specs -o "stm32Template.elf" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
stm32Template.hex: stm32Template.elf
@echo 'Invoking: GNU ARM Cross Create Flash Image'
arm-none-eabi-objcopy -O ihex "stm32Template.elf" "stm32Template.hex"
@echo 'Finished building: $@'
@echo ' '
stm32Template.siz: stm32Template.elf
@echo 'Invoking: GNU ARM Cross Print Size'
arm-none-eabi-size --format=berkeley "stm32Template.elf"
@echo 'Finished building: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(CC_DEPS)$(C++_DEPS)$(OBJS)$(C_UPPER_DEPS)$(CXX_DEPS)$(SECONDARY_FLASH)$(SECONDARY_SIZE)$(ASM_DEPS)$(S_UPPER_DEPS)$(C_DEPS)$(CPP_DEPS) stm32Template.elf
-@echo ' '
secondary-outputs: $(SECONDARY_FLASH) $(SECONDARY_SIZE)
.PHONY: all clean dependents
-include ../makefile.targets
有人对此有什么意见吗?
编辑: GNU MCU Eclipse Plugin 为新项目提供了一个模板,即使这样我也会遇到同样的错误。
【问题讨论】: