Saturday, November 28, 2015

Phase 2: Makefile

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

CC     = arm-none-eabi-gcc
LD     = arm-none-eabi-ld
OBJCPY = arm-none-eabi-objcopy

AR     = arm-none-eabi-ar
RM     = rm -f
MV     = mv -f


CFLAGS = -g -c -Wall -nostdlib -mcpu=cortex-m3 -mlittle-endian -mthumb  -mabi=atpcs -DDEBUG \
         -O2 -DEXT_CLK 
         #-O2 -DEXT_CLK -DDIVADDVAL=1 -DMULVAL=2
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) -DCORE_M3  -I core -I lpcopen/include -I tclib -o monitor.o core/IE_egwu_monitor.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 main.out ivt.o\
                                                                                     setup.o\
                                                                                     uartio.o\
                                                                                     monitor.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