provide nano libc in source
It seems complicate to compile a toolchain provided pre-compile c library.
I compile a Hello world program, it is 31KiB, my SoC just has 32KiB flash. :(
my toolchain is installed in
/opt/gcc-
my gcc version:
http://
gcc version 4.8.4 20140725 (release) [ARM/embedded-
here is my Makefile
- - - -
ARCH := arm
CROSS_COMPILE := arm-none-eabi-
CC=$(CROSS_
LD=$(CROSS_
OBJCOPY=
CFLAGS := -mthumb -mcpu=cortex-m0
CFLAGS += --specs=nano.specs
CFLAGS += -Os -flto -ffunction-sections -fdata-sections
CFLAGS += -fno-builtin
CFLAGS += --specs=nosys.specs
LDFLAGS := --gc-sections
LDFLAGS += -nostartfiles
LDFLAGS += -Map=jingwen.map
LDFLAGS += -T jingwen.lds
LIBPATH := -L /opt/gcc-
LIBPATH += -L /opt/gcc-
SRCS := arch/arm/
SRCS += arch/arm/
SRCS += arch/arm/
SRCS += usr/main.c
OBJS := arch/arm/
OBJS += arch/arm/
OBJS += arch/arm/
OBJS += usr/main.o
jingwen.bin: jingwen
$(OBJCOPY) -O binary $< $@
cp $@ ~/
jingwen: $(OBJS)
$(LD) $(LDFLAGS) -o $@ --start-group $^ --end-group $(LIBPATH) -lc -lgcc
%.o: %.S
$(CC) $< -c -o $@ $(CFLAGS)
%.o: %.s
$(AS) $< -c -o $@ $(CFLAGS)
%.o: %.c
$(CC) $< -c -o $@ $(CFLAGS)
clean:
rm -f hello jingwen jingwen.bin startup.o $(OBJS) *.map
- - - -
1. what is wrong with my makefile.
2. can arm provide the source of nano-libc, not mixing with newlib.
integrate whole newlib source into a project, the project will big and become complex.
thanks,
Du Huanpeng
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- DU HUANPENG
- Solved:
- Last query:
- Last reply: