Thursday, August 8, 2013

Makefile

CC     = arm-linux-gnueabi-gcc
LD     = arm-linux-gnueabi-ld
OBJCPY = arm-linux-gnueabi-objcopy
APP    = usb
#APP   = core

#CFLAGS = -g -c -Wall -nostdlib -mcpu=cortex-m3 -mlittle-endian -mthumb  -I core/include -I tclib \
#         -mabi=atpcs -O0 -DDEBUG
CFLAGS = -g -c -Wall -nostdlib -mcpu=cortex-m3 -mlittle-endian -mthumb  -I core/include -I tclib \
         -mabi=atpcs -DDEBUG 
LDFLAGS= -nostdlib -e main  -Map flash.map -L linker -T IE_stm32.ld --cref 

all:
        make stm32_core
        make app
        make clean
        

stm32_core:
        $(CC) -o reset.o     $(CFLAGS)  core/src/IE_stm32_ivt.S
        $(CC) -o tclibS.o    $(CFLAGS)  tclib/IE_tclib.S
        $(CC) -o tclibC.o    $(CFLAGS)  tclib/IE_tclib.c
        $(CC) -o usbdev.o    $(CFLAGS)  core/src/IE_stm32_usb.c
        $(CC) -o core.o      $(CFLAGS)  core/src/IE_stm32.c



app:
        $(CC) -o $(APP)_test.o          $(CFLAGS)  apps/$(APP)/$(APP)_test.c 
        $(LD) -o $(APP)_test.out        $(LDFLAGS) reset.o   \
                                                   core.o    \
                                                   tclibS.o  \
                                                   tclibC.o  \
                                                   usbdev.o  \
                                                   $(APP)_test.o

clean:
        rm -f reset.o
        rm -f core.o
        rm -f tclibS.o
        rm -f tclibC.o
        rm -f usbdev.o
        rm -f $(APP)_test.o
     

binimage: 
        $(OBJCPY) -O binary flash.out flash.bin



No comments:

Post a Comment