i want to run this c code "world.c" on Raspberry:
Code: Select all
#include <stdio.h>
int main(void)
{
printf("Hello world!\n");
return 0;
}
Code: Select all
world.o: In function `main':
hello_world/world.c:34: undefined reference to `puts'
Code: Select all
#include <stdio.h>
int main(void)
{
printf("Hello world!\n");
return 0;
}
Code: Select all
world.o: In function `main':
hello_world/world.c:34: undefined reference to `puts'
Code: Select all
ARMGNU ?= arm-none-eabi
INCLUDEPATH ?= "./h"
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mcpu=arm1176jzf-s -I $(INCLUDEPATH)
gcc : kernel.img
OBJS = build/startup.o
OBJS += build/uart.o
OBJS += build/main.o
OBJS += lib/libc.a
OBJS += lib/libgcc.a
clean :
rm -f build/*.o
rm -f *.bin
rm -f *.hex
rm -f *.elf
rm -f *.list
rm -f *.img
rm -f build/*.bc
build/%.o : userApp/%.s
$(ARMGNU)-gcc $(COPS) -D__ASSEMBLY__ -c -o $@ $<
build/%.o : userApp/%.c
$(ARMGNU)-gcc $(COPS) -c -o $@ $<
kernel.img : raspberrypi.ld $(OBJS)
$(ARMGNU)-ld $(OBJS) -T raspberrypi.ld -o ucos_bcm2835.elf
$(ARMGNU)-objdump -D ucos_bcm2835.elf > ucos_bcm2835.list
$(ARMGNU)-objcopy ucos_bcm2835.elf -O ihex ucos_bcm2835.hex
$(ARMGNU)-objcopy ucos_bcm2835.elf -O binary ucos_bcm2835.bin
$(ARMGNU)-objcopy ucos_bcm2835.elf -O binary kernel.img