Commits

Dennis Muhlestein  committed 9e3a495

Changed Makefile format.

Only set the default variables if they are not already set.
Allows for slightly simple firmware projects You can set the variables
before including the fx2.mk instead of after.

  • Participants
  • Parent commits b761745

Comments (0)

Files changed (8)

File examples/bulkloop/Makefile

 BASENAME = bulkloop
 SOURCES=bulkloop.c
 A51_SOURCES=dscr.a51
+PID=0x1004
 
+include $(FX2LIBDIR)lib/fx2.mk
 
-include $(FX2LIBDIR)/lib/fx2.mk
-
-PID=0x1004
 
 test: test.cpp
 	g++ -o test test.cpp -lusb-1.0

File examples/i2c/Makefile

 FX2LIBDIR=../..
 BASENAME = i2c
 SOURCES=i2c.c
-
-include $(FX2LIBDIR)/lib/fx2.mk	
-
 DSCR_AREA=
 INT2JT=
+include $(FX2LIBDIR)/lib/fx2.mk	
+
+

File examples/lights/Makefile

 FX2LIBDIR=../..
 BASENAME = lights
 SOURCES=lights.c
-
-include $(FX2LIBDIR)/lib/fx2.mk
-
 DSCR_AREA=
 INT2JT=
+include $(FX2LIBDIR)/lib/fx2.mk
+
+

File examples/reset/Makefile

 FX2LIBDIR=../..
 BASENAME = reset
 SOURCES=reset.c fx2_c0.c
-
-include $(FX2LIBDIR)/lib/fx2.mk
-
 DSCR_AREA=
 INT2JT=
+include $(FX2LIBDIR)/lib/fx2.mk
+
+

File examples/serial/Makefile

 FX2LIBDIR=../..
 BASENAME = serial
 SOURCES=serial.c
-
-
-include $(FX2LIBDIR)/lib/fx2.mk
-
 DSCR_AREA=
 INT2JT=
+include $(FX2LIBDIR)/lib/fx2.mk
+
 

File examples/timers/Makefile

 FX2LIBDIR=../..
 BASENAME = timers
 SOURCES=timers.c
-
-include $(FX2LIBDIR)/lib/fx2.mk
-
 DSCR_AREA=
 INT2JT=
+include $(FX2LIBDIR)/lib/fx2.mk
+
+
 
 
 # change location of fx2libdir if needed
-FX2LIBDIR = ..
 SOURCES=fw.c device.c
 A51_SOURCES=dscr.a51
 BASENAME=firmware
 
 
-include $(FX2LIBDIR)/lib/fx2.mk
+include ../lib/fx2.mk
 
 #       generated prior to compiling. You must provide the target definition
 #       for any DEPS you define.
 # BASENAME: name of your firmware file, i.e., myfirmware, but not myfirmware.c
-# FX2LIBDIR: top directory of fx2lib.  Contains lib and include dirs
 #
 # Leave these alone or redefine as necessary to customize firmware.
 # (Redefine after including this makefile)
 #
 #
 
-VID=0x04b4
-PID=0x8613
+VID?=0x04b4
+PID?=0x8613
 
-DSCR_AREA=-Wl"-b DSCR_AREA=0x3e00"
-INT2JT=-Wl"-b INT2JT=0x3f00"
-CODE_SIZE=--code-size 0x3c00
-XRAM_SIZE=--xram-size 0x0200
-XRAM_LOC=--xram-loc 0x3c00
-BUILDDIR=build
+DSCR_AREA?=-Wl"-b DSCR_AREA=0x3e00"
+INT2JT?=-Wl"-b INT2JT=0x3f00"
+CODE_SIZE?=--code-size 0x3c00
+XRAM_SIZE?=--xram-size 0x0200
+XRAM_LOC?=--xram-loc 0x3c00
+BUILDDIR?=build
 
+FX2LIBDIR?=$(dir $(lastword $(MAKEFILE_LIST)))../
 
 RELS=$(addprefix $(BUILDDIR)/, $(addsuffix .rel, $(notdir $(basename $(SOURCES) $(A51_SOURCES)))))
 # these are pretty good settings for most firmwares.