2011-11-10 17:55:56 +00:00
|
|
|
#****************************************************************************************
|
|
|
|
#| Description: Makefile for NXP LPC2000 using CodeSourcery GNU GCC compiler toolset
|
|
|
|
#| File Name: makefile
|
|
|
|
#|
|
|
|
|
#|---------------------------------------------------------------------------------------
|
|
|
|
#| C O P Y R I G H T
|
|
|
|
#|---------------------------------------------------------------------------------------
|
2012-03-04 17:51:16 +00:00
|
|
|
#| Copyright (c) 2011 by Feaser http://www.feaser.com All rights reserved
|
2011-11-10 17:55:56 +00:00
|
|
|
#|
|
|
|
|
#|---------------------------------------------------------------------------------------
|
|
|
|
#| L I C E N S E
|
|
|
|
#|---------------------------------------------------------------------------------------
|
2016-05-17 15:12:27 +00:00
|
|
|
#| This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
|
2011-11-10 17:55:56 +00:00
|
|
|
#| modify it under the terms of the GNU General Public License as published by the Free
|
|
|
|
#| Software Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
#| version.
|
|
|
|
#|
|
2016-05-17 15:12:27 +00:00
|
|
|
#| OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2011-11-10 17:55:56 +00:00
|
|
|
#| without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
#| PURPOSE. See the GNU General Public License for more details.
|
|
|
|
#|
|
2016-04-30 22:52:15 +00:00
|
|
|
#| You have received a copy of the GNU General Public License along with OpenBLT. It
|
|
|
|
#| should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
|
2011-11-10 17:55:56 +00:00
|
|
|
#|
|
|
|
|
#****************************************************************************************
|
|
|
|
SHELL = sh
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Configure project name |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
2016-10-24 13:19:17 +00:00
|
|
|
PROJ_NAME=openblt_olimex_lpc_l2294_20mhz
|
2011-11-10 17:55:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Speficy project source files |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
PROJ_FILES= \
|
2013-08-01 08:58:35 +00:00
|
|
|
blt_conf.h \
|
2011-11-10 17:55:56 +00:00
|
|
|
hooks.c \
|
|
|
|
main.c \
|
2011-12-01 22:30:33 +00:00
|
|
|
extflash.c \
|
|
|
|
extflash.h \
|
2011-11-10 17:55:56 +00:00
|
|
|
lpc2294.h \
|
|
|
|
../../../Source/boot.c \
|
|
|
|
../../../Source/boot.h \
|
|
|
|
../../../Source/com.c \
|
|
|
|
../../../Source/com.h \
|
|
|
|
../../../Source/xcp.c \
|
|
|
|
../../../Source/xcp.h \
|
|
|
|
../../../Source/backdoor.c \
|
|
|
|
../../../Source/backdoor.h \
|
|
|
|
../../../Source/cop.c \
|
|
|
|
../../../Source/cop.h \
|
|
|
|
../../../Source/assert.c \
|
|
|
|
../../../Source/assert.h \
|
2016-02-25 13:51:12 +00:00
|
|
|
../../../Source/cpu.h \
|
|
|
|
../../../Source/can.h \
|
|
|
|
../../../Source/uart.h \
|
|
|
|
../../../Source/nvm.h \
|
|
|
|
../../../Source/timer.h \
|
2011-11-10 17:55:56 +00:00
|
|
|
../../../Source/plausibility.h \
|
|
|
|
../../../Source/ARM7_LPC2000/types.h \
|
|
|
|
../../../Source/ARM7_LPC2000/cpu.c \
|
|
|
|
../../../Source/ARM7_LPC2000/can.c \
|
|
|
|
../../../Source/ARM7_LPC2000/uart.c \
|
|
|
|
../../../Source/ARM7_LPC2000/nvm.c \
|
|
|
|
../../../Source/ARM7_LPC2000/timer.c \
|
|
|
|
../../../Source/ARM7_LPC2000/GCC/flash.c \
|
|
|
|
../../../Source/ARM7_LPC2000/GCC/flash.h \
|
|
|
|
../../../Source/ARM7_LPC2000/GCC/vectors.c \
|
2016-10-17 23:08:45 +00:00
|
|
|
../../../Source/ARM7_LPC2000/GCC/cpu_comp.c \
|
2011-11-10 17:55:56 +00:00
|
|
|
../../../Source/ARM7_LPC2000/GCC/cstart.s
|
|
|
|
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Compiler binaries |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
CC = arm-none-eabi-gcc
|
|
|
|
LN = arm-none-eabi-gcc
|
|
|
|
OC = arm-none-eabi-objcopy
|
|
|
|
OD = arm-none-eabi-objdump
|
|
|
|
AS = arm-none-eabi-as
|
|
|
|
SZ = arm-none-eabi-size
|
|
|
|
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Extract file names |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
PROJ_ASRCS = $(filter %.s,$(foreach file,$(PROJ_FILES),$(notdir $(file))))
|
|
|
|
PROJ_CSRCS = $(filter %.c,$(foreach file,$(PROJ_FILES),$(notdir $(file))))
|
|
|
|
PROJ_CHDRS = $(filter %.h,$(foreach file,$(PROJ_FILES),$(notdir $(file))))
|
|
|
|
PROJ_CCMPL = $(patsubst %.c,%.cpl,$(PROJ_CSRCS))
|
|
|
|
PROJ_ACMPL = $(patsubst %.s,%.cpl,$(PROJ_ASRCS))
|
|
|
|
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Set important path variables |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
VPATH = $(foreach path,$(sort $(foreach file,$(PROJ_FILES),$(dir $(file)))) $(subst \,/,$(OBJ_PATH)),$(path) :)
|
|
|
|
OBJ_PATH = ./obj
|
|
|
|
BIN_PATH = ./bin
|
|
|
|
INC_PATH = $(patsubst %,-I%,$(sort $(foreach file,$(filter %.h,$(PROJ_FILES)),$(dir $(file)))))
|
|
|
|
INC_PATH += -I.
|
|
|
|
LIB_PATH = -L../../../Source/ARM7_LPC2000/GCC/
|
|
|
|
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Options for compiler binaries |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
AFLAGS = -ahls -mapcs-32 -mcpu=arm7tdmi-s -mfpu=softfpa
|
2011-12-01 22:30:33 +00:00
|
|
|
CFLAGS = $(INC_PATH) -O1 -Wall -fmessage-length=0 -mcpu=arm7tdmi-s -g
|
2011-11-10 17:55:56 +00:00
|
|
|
CFLAGS += -Wa,-adhlns="$(OBJ_PATH)/$(subst .o,.lst,$@)"
|
|
|
|
LFLAGS = $(LIB_PATH) -T"memory.x" -g -mcpu=arm7tdmi-s -nostartfiles
|
|
|
|
OCFLAGS = -O ihex
|
|
|
|
ODFLAGS = -x
|
|
|
|
SZFLAGS = -B -d
|
|
|
|
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Define targets |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
AOBJS = $(patsubst %.s,%.o,$(PROJ_ASRCS))
|
|
|
|
COBJS = $(patsubst %.c,%.o,$(PROJ_CSRCS))
|
|
|
|
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Make ALL |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
all : $(BIN_PATH)/$(PROJ_NAME).hex
|
|
|
|
|
|
|
|
$(BIN_PATH)/$(PROJ_NAME).hex : $(BIN_PATH)/$(PROJ_NAME).elf
|
|
|
|
@$(OC) $(OCFLAGS) $< $@
|
|
|
|
@$(OD) $(ODFLAGS) $< > $(BIN_PATH)/$(PROJ_NAME).map
|
|
|
|
@echo +++ Summary of memory consumption:
|
|
|
|
@$(SZ) $(SZFLAGS) $<
|
|
|
|
@echo +++ Build complete [$(notdir $@)]
|
|
|
|
|
|
|
|
$(BIN_PATH)/$(PROJ_NAME).elf : $(AOBJS) $(COBJS)
|
|
|
|
@echo +++ Linking [$(notdir $@)]
|
|
|
|
@$(LN) $(LFLAGS) -o $@ $(patsubst %.o,$(OBJ_PATH)/%.o,$(^F))
|
|
|
|
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Compile and assemble |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
$(AOBJS): %.o: %.s $(PROJ_CHDRS)
|
|
|
|
@echo +++ Assembling [$@]
|
|
|
|
@$(AS) $(AFLAGS) $< -o $(OBJ_PATH)/$(@F) > $(subst .o,.lst,$(OBJ_PATH)/$(@F))
|
|
|
|
|
|
|
|
$(COBJS): %.o: %.c $(PROJ_CHDRS)
|
|
|
|
@echo +++ Compiling [$@]
|
|
|
|
@$(CC) $(CFLAGS) -c -o $(OBJ_PATH)/$(@F) $<
|
|
|
|
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
#| Make CLEAN |
|
|
|
|
#|---------------------------------------------------------------------------------------|
|
|
|
|
clean :
|
|
|
|
@echo +++ Cleaning build environment
|
2014-02-06 14:37:04 +00:00
|
|
|
@cs-rm -f $(foreach file,$(AOBJS),$(OBJ_PATH)/$(file))
|
|
|
|
@cs-rm -f $(foreach file,$(COBJS),$(OBJ_PATH)/$(file))
|
|
|
|
@cs-rm -f $(patsubst %.o,%.lst,$(foreach file,$(AOBJS),$(OBJ_PATH)/$(file)))
|
|
|
|
@cs-rm -f $(patsubst %.o,%.lst,$(foreach file,$(COBJS),$(OBJ_PATH)/$(file)))
|
|
|
|
@cs-rm -f $(BIN_PATH)/$(PROJ_NAME).hex $(BIN_PATH)/$(PROJ_NAME).map $(BIN_PATH)/$(PROJ_NAME).elf
|
2011-11-10 17:55:56 +00:00
|
|
|
@echo +++ Clean complete
|
|
|
|
|
|
|
|
|