######################################################################################### # GAYE Abdoulaye Walsimou, # Copyright(C) 2009 GAYE Abdoulaye Walsimou, All rights reserved. # # This program is free software; you can distribute it and/or modify it # under the terms of the GNU General Public License # (Version 2 or later) published by the Free Software Foundation. # # This program is distributed in the hope it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. ######################################################################################### # # \file Makefile # \brief Makefile of PIC18/SDCC port # \author GAYE Abdoulaye Walsimou, # \date February 2009 ######################################################################################### CC=sdcc AS=gpasm LD=gplink #Device selection ifeq ($(DEVICE),) DEVICE:=18f452 else DEVICE:=$(DEVICE) endif #SDCC pic16 libraries ifeq ($(PIC16_LIB_PATH),) PIC16_LIB_PATH:=/usr/local/share/sdcc/lib/pic16 else PIC16_LIB_PATH:=$(PIC16_LIB_PATH) endif #type of pic used ARCH=pic16 #set MAINFILE ifeq ($(MAINFILE),) MAINFILE:=main.c else MAINFILE:=$(MAINFILE) endif MAINFILE_ASM:=$(MAINFILE:.c=.asm) MAINFILE_OBJ:=$(MAINFILE:.c=.o) # Setup paths to source code SOURCE_PATH=../../Source PORT_PATH=$(SOURCE_PATH)/portable/SDCC/PIC18 DEMO_PATH=$(PWD) COMMON_DEMO_PATH=../Common # # Source files # SOURCE_FILES= tasks.c list.c queue.c SOURCE_OBJ=$(SOURCE_FILES:.c=.o) PORT_FILES= port.c PORT_OBJ=$(PORT_FILES:.c=.o) COMMON_DEMO_FILES= integer.c COMMON_DEMO_OBJ=$(COMMON_DEMO_FILES:.c=.o) VPATH=$(SOURCE_PATH):$(PORT_PATH):$(DEMO_PATH):$(COMMON_DEMO_PATH)/Minimal # Setup Compilers and linker FLAGS SDCC_CFLAGS= -m$(ARCH) -p$(DEVICE) -I. -I$(SOURCE_PATH)/include -I$(COMMON_DEMO_PATH)/include \ -DSDCC_PIC18 --debug --mplab-comp --pstack-model=large --model-large GPASM_CFLAGS= -g LDFLAGS= -s $(DEVICE).lkr --map -I$(PIC16_LIB_PATH) LIBS= libdev$(DEVICE).lib libio$(DEVICE).lib crt0iz.o libc18f.lib libsdcc.lib libm18f.lib All: $(SOURCE_OBJ) $(PORT_OBJ) $(COMMON_DEMO_OBJ) $(CC) -S $(MAINFILE) -o $(MAINFILE_ASM) $(SDCC_CFLAGS) $(AS) -c $(MAINFILE_ASM) -o $(MAINFILE_OBJ) $(GPASM_CFLAGS) $(LD) -c -o freertos.hex $^ $(MAINFILE_OBJ) $(LIBS) $(LDFLAGS) $(SOURCE_OBJ) $(PORT_OBJ) $(COMMON_DEMO_OBJ): %.o: %.asm $(AS) -c $< -o $@ $(GPASM_CFLAGS) %.asm: %.c $(CC) -S $< -o $@ $(SDCC_CFLAGS) clean: rm -rf *.o *.asm *.cod *.lst *.hex *.adb *.lib *.calltree *.p *.map *.cof *.coff cleanAll: clean