0
votes

I am having a problem with a project that I'm trying to set up for my new STM32F7 Nucleo Board. I freshly installed the GNU ARM Embedded toolchain, STM32CubeF7 and the GNU MCU Eclipse Plugin, with which I set up a new Project on my Windows 7 machine at work. I have previously done that at home on my Ubuntu Laptop without issues. After I set up the project, I added the HAL and the CMSIS libraries and used a template project from STM32CubeF7. So far the compilation works fine, but when linking I get the following error:

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

To my understanding the issue here is that some library with a very strange name can not be found. Unfortunately the only page that I found where the same error is described is in Russian, which I don't speak at all.

At first glance, to me it looks like the generated makefile is corrupted, and a library called c_p is trying to be linked, but it is done twice without a space in between. So it could be an issue with Eclipse or the Eclipse GNU MCU Plugin.

Things that I tried to get rid of the error:

  • Update Eclipse
  • Downgrade to several old versions of the GNU ARM Embedded toolchain
  • Turn off/on the following linker options:
    • --specs=nano.specs
    • -nodefaultlibs
    • -nostdlib
  • Install the toolchain in a folder without any spaces

Here's the automatically generated 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

Does anybody have any inputs with this for me?

EDIT: GNU MCU Eclipse Plugin provides a template for new projects, even with this I get the same error.

2

2 Answers

0
votes

You make one very important mistake. You try to use DIY Eclipse configuration to import projects created for the particular environment.

Install OpenSTM32. Generate your project using SW4STM32 toolchain setting.

Import the project. Compile, link and debug

If you find the installed toolchain obsolete, you will be able to replace it.

0
votes

After a while I figured out how to work around this problem, yet unfortunately I have not yet found out what exactly causes it. I searched my GNU ARM Embedded toolchain install folder and did not find any library name containing c_p. I figured the cause to this problem must be lying wherever the default libraries of the linker are defined, which is why I assume the problem lies within the toolchain itself.

However, I chose to disable the use of default libraries (-nodefaultlibs flag) and linked them myself. I linked the following libraries:

-lg -lstdc++ -lgcc -lm -lrdimon -lc

If someone can help me find the actual root of this problem that would be greatly appreciated. However, since it solved my problem, I am going to close this issue.