Modified for compilation under Linux.

This commit is contained in:
skarg
2009-06-22 03:07:42 +00:00
parent 85cf09aa6b
commit 4c9bd5f842
6 changed files with 189 additions and 58 deletions
+86 -10
View File
@@ -26,12 +26,15 @@ LINT = splint
# jtag2fast = Atmel JTAG ICE mkII, running at 115200 Bd
# jtag2slow = Atmel JTAG ICE mkII, running at 19200 Bd
# avrispmkII = AVR ISP MKII
AVRDUDE_PROGRAMMERID = avrispmkII
# avr109 = bootloader
AVRDUDE_PROGRAMMERID = jtag2fast
#
# # port--serial or parallel port to which your
# # hardware programmer is attached
# # usb can just be usb
# port--serial or parallel port to which your
# hardware programmer is attached
# usb can just be usb
AVRDUDE_PORT = usb
#AVRDUDE_PORT = /dev/ttyUSB0
# Source locations
BACNET_CORE = ../../src
@@ -40,6 +43,7 @@ BACNET_DEMO = ../../demo
# local files for this project
CSRC = main.c \
fuses.c \
init.c \
stack.c \
adc.c \
@@ -136,7 +140,7 @@ OPTIMIZATION = -Os $(OPTIMIZE_FLAGS)
DEBUGGING =
endif#
## Compile options common for all C compilation units.
## BACnet options
BFLAGS = -DBACDL_MSTP
BFLAGS += -DMAX_APDU=128
BFLAGS += -DBIG_ENDIAN=0
@@ -149,12 +153,23 @@ BFLAGS += -DBACAPP_UNSIGNED
BFLAGS += -DBACAPP_ENUMERATED
BFLAGS += -DBACAPP_CHARACTER_STRING
BFLAGS += -DWRITE_PROPERTY
## Compile options for C files
CFLAGS = $(COMMON)
CFLAGS += $(DEFINES)
CFLAGS += $(DEBUGGING)
# dead code removal
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -Wall -gdwarf-2 $(BFLAGS) $(OPTIMIZATION) -fsigned-char
# General flags
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
# warnings
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
# put it all together
CFLAGS += -gdwarf-2 $(BFLAGS) $(OPTIMIZATION)
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
## Assembly specific flags
@@ -177,6 +192,60 @@ HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
HEX_FUSE_FLAGS = -j .fuse
HEX_FUSE_FLAGS += --change-section-lma .fuse=0 --no-change-warnings
AVRDUDE_FLAGS = -c $(AVRDUDE_PROGRAMMERID)
AVRDUDE_FLAGS += -p $(AVRDUDE_MCU)
AVRDUDE_FLAGS += -P $(AVRDUDE_PORT)
# Fuse high byte (0=enable,1=disable):
# 0x92 = 1 0 0 1 0 0 1 0
# ^ ^ ^ ^ ^ \+/ ^
# | | | | | | |---- BOOTRST (Enable Bootloader Reset Vector)
# | | | | | +------- BOOTSZ 1..0 (Select Boot Size)
# | | | | | +------- [00=4k, 01=2k, 10=1k, 11=512]
# | | | | +---------- EESAVE (Enable preserve EEPROM on Chip Erase)
# | | | +-------------- WDTON (watchdog timer always on)
# | | +---------------- SPIEN (Enable Serial Program and Data Downloading)
# | +------------------ JTAGEN (Enable JTAG)
# +-------------------- OCDEN (Enable OCD)
#
# Fuse low byte (0=enable,1=disable):
# 0xC7 = 1 1 0 0 0 1 1 1
# ^ ^ \+/ \--+--/
# | | | +------- CKSEL 3..0 (Select Clock Source)
# | | | +------- [1111-1000=Low Power Crystal Oscillator]
# | | | +------- [0111-0110=Full Swing Crystal Oscillator]
# | | | +------- [0101-0100=Low Frequency Crystal Oscillator]
# | | | +------- [0011=Internal 128kHz RC Oscillator]
# | | | +------- [0010=Calibrated Internal RC Oscillator]
# | | | +------- [0000=External Clock]
# | | +--------------- SUT 1..0 (Start up Time selection)
# | | +--------------- [CKSEL=0:14CK+ 00=4.1ms,01=65ms,10=0ms,11=4.1ms]
# | | +--------------- [CKSEL=1:14CK+ 00=65ms,01=0ms,10=4.1ms,11=65ms]
# | +------------------ CKOUT (clock output on CKOUT pin)
# +-------------------- CKDIV8 (divide clock by 8)
#
# Fuse extended byte (0=enable,1=disable):
# 0xFC = 1 1 1 1 1 1 0 0
# ^ ^ ^ ^ ^ \-+-/
# | | | | | +------ BODLEVEL 2..0 (brownout trigger level)
# | | | | | +------ [100=4.3V, 101=2.7V, 110=1.8V, 111=disabled]
# | | | | +----------
# | | | +--------------
# | | +----------------
# | +------------------
# +--------------------
AVRDUDE_WRITE_FUSES = -U hfuse:w:0x92:m -U lfuse:w:0xC7:m -U efuse:w:0xFC:m
AVRDUDE_READ_FUSES = -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h
AVRDUDE_WRITE_FLASH = -e -U flash:w:$(TARGET).hex
AVRDUDE_INSTALL = $(AVRDUDE_WRITE_FLASH)
AVRDUDE_INSTALL += $(AVRDUDE_READ_FUSES)
## Objects that must be built in order to link
OBJECTS = $(COBJ) $(DEMOOBJ)
@@ -219,10 +288,17 @@ size: ${TARGET_ELF}
lint:
$(LINT) $(BFLAGS) $(CSRC)
install: $(TARGET_ELF)
$(AVRDUDE) -c $(AVRDUDE_PROGRAMMERID) \
-p $(AVRDUDE_MCU) -P $(AVRDUDE_PORT) -e \
-U flash:w:$(TARGET).hex
install: $(TARGET_ELF)
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_INSTALL)
writefuses:
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FUSES)
showfuses:
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_READ_FUSES)
bootloader:
make -C bootloader all
## Clean target
.PHONY: clean