日期:2014-05-16 浏览次数:20748 次
CC = arm-linux-gcc LD = arm-linux-ld OBJDUMP = arm-linux-objdump OBJCOPY = arm-linux-objcopy LDFAGS := -T myld.lds LDFAGS += -lc -lm -lgcc_s -Bstatic CFLAGS := -g -c -O2 -nostdlib CFLAGS += -o objs=main.o app.o ucos_ii.bin:$(objs) $(LD) -o core.elf $(objs) $(LDFAGS) -Map core.map $(OBJCOPY) -O binary -S core.elf core.bin $(OBJDUMP) -D -m arm core.elf > core.dis main.o:main.c $(CC) $(CFLAGS) $@ $< app.o:app.c $(CC) $(CFLAGS) $@ $< clean: -rm -f *.o -rm -f *.elf -rm -f *.bin -rm -f *.map
ENTRY(_start) SECTIONS { . = 0x20000040; .text : { *(.text ) } . = ALIGN(4); .rodata : { *(.rodata) } . = ALIGN(4); .data : { *(.data) } . = ALIGN(4); .bss : { *(.bss) } }
#include "app.h" int main(void) { app(); return 0; }
static void *memcpy(void *dest, void *src, int count) { char *tmp = dest; char *s = src; while (count--) *tmp++ = *s++; return dest; } int app(void) { char a[4]; char str="1234"; memcpy(a,str,4); return 0; }
int app(void);
#include <string.h> int app(void) { char a[4]; char str="1234"; memcpy(a,str,4); return 0; }