Sunday, July 5, 2015

Phase 1: Makefile

########################################################################
#name:          Makefile
#description:   IgboEmbedded' EGWU Makefile
#date:          06/09/2015
#author:        Samuel Igwe
########################################################################

CC     = arm-linux-gnueabi-gcc
LD     = arm-linux-gnueabi-ld
OBJCPY = arm-linux-gnueabi-objcopy

AR     = arm-linux-gnueabi-ar
RM     = rm -f
MV     = mv -f


#CFLAGS = -g -c -Wall -nostdlib -mcpu=cortex-m3 -mlittle-endian -mthumb -mabi=atpcs -O0 -DDEBUG
CFLAGS = -g -c -Wall -nostdlib -mcpu=cortex-m3 -mlittle-endian -mthumb  -mabi=atpcs -DDEBUG -fno-inline\
         -fno-inline-small-functions -O0
LDFLAGS= -nostdlib -e main  -Map flash.map -L linker -T IE_lpc177x.ld --cref 
ARFLAGS= -r



all:
        make lpcopen.lib
        make egwu_core
        make egwu_app
        make clean


        
lpcopen.lib:
        $(CC)   $(CFLAGS) -DCORE_M3 -I lpcopen/include lpcopen/source/*.c
        $(AR)   $(ARFLAGS) lpcopen.lib *.o
        $(RM)   *.o



egwu_core:      
        $(CC)   $(CFLAGS)                                                -o ivt.o    core/IE_egwu_ivt.S
        $(CC)   $(CFLAGS) -DCORE_M3  -I core -I lpcopen/include -I tclib -o setup.o  core/IE_egwu_setup.c
        $(CC)   $(CFLAGS) -DCORE_M3  -I core -I lpcopen/include -I tclib -o uartio.o core/IE_egwu_uartio.c
        $(CC)   $(CFLAGS)                                       -I tclib -o tclib.o  tclib/IE_tclib.S
        


egwu_app:
        $(CC)   $(CFLAGS) -DCORE_M3  -I core -I lpcopen/include -I tclib -o main.o   app/main.c
        $(LD)   $(LDFLAGS)                                               -o app.out  ivt.o\
                                                                                     setup.o\
                                                                                     uartio.o\
                                                                                     tclib.o\
                                                                                     main.o\
                                                                                     lpcopen.lib


clean:
        $(RM)   *.o
        $(RM)   lpcopen.lib
     

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




No comments:

Post a Comment