我正在尝试在树莓派上编写一个简单的裸机程序,但是当我尝试使用strcmp
时,出现以下错误:
arm-none-eabi-ld -o main.elf -T ./src/memmap vectors.o led.o main.o uart.o general.o
main.o: In function `main':
main.c:(.text.startup+0x80): undefined reference to `strcmp'
这是我的制作文件:
ARMGNU = arm-none-eabi
ARMGNU ?= arm-none-eabi
AOPS = --warn --fatal-warnings -mcpu=arm1176jzf-s -march=armv6
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mhard-float
LIBRARIES= -I ./include -I ./src
all : kernel.img
rm -f *.bin
rm -f *.o
rm -f *.elf
rm -f *.list
rm -f *.hex
vectors.o : ./src/vectors.s
$(ARMGNU)-as $(AOPS) $(LIBRARIES) -mfpu=vfp ./src/vectors.s -o vectors.o
main.o : ./src/main.c
$(ARMGNU)-gcc $(COPS) $(LIBRARIES) -c ./src/main.c -o main.o
led.o : ./src/led.c
$(ARMGNU)-gcc $(COPS) $(LIBRARIES) -c ./src/led.c -o led.o
uart.o : ./src/uart.c
$(ARMGNU)-gcc $(COPS) $(LIBRARIES) -c ./src/uart.c -o uart.o
general.o : ./src/general.c
$(ARMGNU)-gcc $(COPS) $(LIBRARIES) -c ./src/general.c -o general.o
kernel.img : ./src/memmap vectors.o main.o led.o uart.o general.o
$(ARMGNU)-ld -o main.elf -T ./src/memmap vectors.o led.o main.o uart.o general.o
$(ARMGNU)-objdump -D main.elf > main.list
$(ARMGNU)-objcopy main.elf kernel.img -O binary
clean:
rm -r *.img