5

我正在尝试为基于 XMC1100 的开发板编写代码。我正在尝试本教程:http ://eleceng.dit.ie/frank/arm/BareMetalXMC2Go/index.html

我已经下载了 blinky.tar.gz 文件并解压缩。当我尝试“make”时,出现此错误: arm-none-eabi-ld: cannot find -lc

这是“make”的输出

arm-none-eabi-gcc -c -mcpu=cortex-m0 -mthumb -g init.c -o init.o
arm-none-eabi-gcc -c -mcpu=cortex-m0 -mthumb -g main.c -o main.o
arm-none-eabi-ld init.o main.o  -L /usr/lib/gcc/arm-none-eabi/4.8.2/armv6-m -T linker_script.ld -lc --cref -Map main.map -nostartfiles -o main.elf
arm-none-eabi-ld: cannot find -lc
make: *** [main.elf] Error 1

我正在使用 Linux Mint 17 Qiana

我错过了什么?

这是我的生成文件:

LIBSPEC=-L /usr/lib/gcc/arm-none-eabi/4.8.2/armv6-m

# Specify the compiler to use
CC=arm-none-eabi-gcc
# Specify the assembler to use
AS=arm-none-eabi-as
# Specity the linker to use
LD=arm-none-eabi-ld

CCFLAGS=-mcpu=cortex-m0 -mthumb -g

# List the object files involved in this project
OBJS=   init.o \
        main.o 

# The default 'target' (output) is main.elf and it depends on the object files being there.
# These object files are linked together to create main.elf
main.elf : $(OBJS)
    $(LD) $(OBJS) $(LIBSPEC) -T linker_script.ld -lc --cref -Map main.map -nostartfiles -o main.elf
    arm-none-eabi-objcopy -O binary main.elf main.bin
    objcopy -O ihex main.elf main.hex
    @echo "done"

# The object file main.o depends on main.c.  main.c is compiled to make main.o
main.o: main.c
    $(CC) -c $(CCFLAGS) main.c -o main.o


init.o: init.c
    $(CC) -c $(CCFLAGS) init.c -o init.o

# if someone types in 'make clean' then remove all object files and executables
# associated wit this project
clean: 
    rm $(OBJS) 
    rm main.elf
    rm main.bin 
4

2 回答 2

6

我遇到了同样的问题并sudo apt-get install libnewlib-arm-none-eabi帮助了我。

于 2016-04-13T09:26:32.150 回答
1

尝试运行构建时,我得到以下信息:

/usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: cannot find -lstdc++

我已经在 Ubuntu 上安装了这些软件包,sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi make dfu-util但似乎还需要一个(至少对于我的系统而言)。安装后libstdc++-arm-none-eabi-newlib,它能够找到正确的文件。

以下是我系统上该软件包中包含的文件:

$ apt-file show libstdc++-arm-none-eabi-newlib | grep -e "stdc++.a$"
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/armv6-m/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/armv7-ar/thumb/fpu/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/armv7-ar/thumb/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/armv7-ar/thumb/softfp/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/armv7-m/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/armv7e-m/fpu/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/armv7e-m/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/armv7e-m/softfp/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/fpu/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/mthumb/march=armv7/mfloat-abi=hard/mfpu=vfpv3-d16/mbig-endian/libstdc++.a
libstdc++-arm-none-eabi-newlib: /usr/lib/arm-none-eabi/newlib/thumb/libstdc++.a
于 2018-07-19T05:53:17.163 回答