⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile

📁 WWVB receiver using AVR.
💻
字号:
# $Id: Makefile,v 1.19 2005/10/30 19:44:38 simimeie Exp $
# Makefile for the ntp-led-clock project

CC	= avr-gcc
OBJDUMP	= avr-objdump
OBJCOPY = avr-objcopy
UISP	= uisp
INCDIR	= .
# There are a few additional defines that disable certain small features,
# mainly to save space in case you are running out of flash.
# You can add them here.
# Some examples are:
# -DNOINTERNALOSC       do not program the internal oscillator. Use this if
#                       you have an external oscillator.
# -DNET_NOUSELESSCRAP   NOTCPRESET + NODPORTUNREACH
# -DNET_NOTCPRESET      do not send back TCP Resets (ignore TCP completely)
# -DNET_NODPORTUNREACH  do not send back Destination Port Unreachable for
#                       UDP packets to closed ports. Note that this also
#                       implies that traceroute won't work anymore.
# -DDCFDEBUG            makes the DCF77 decoder code print every received bit
ADDDEFS	= -DNOINTERNALOSC

# target mcu (at90s8515, atmega16, atmega8515...)
MCU	= atmega8515

# Some more settings
# Clock Frequency of the AVR. Needed for various calculations.
CPUFREQ		= 7372800UL
# Set to 1 to enable the serial debug console.
# Settings for the PC: no handshaking, 8N1, Baudrate as set below.
DEBUGCONSOLE	= 1
# desired baudrate of serial debug console (if enabled)
BAUDRATE	= 38400UL
# Set to 1 to enable the LED module
LEDMODULE	= 1
# Set to 1 to enable the Clockface module
CLOCKFACEMODULE	= 1
# Do we have external memory?
# Note that not much will work with only the internal 512 Byte...
# Note that extmemstart/end has to be given hex, but without any
# pre- or postfixes like 0x...
EXTMEMORY	= 1
EXTMEMSTART	= 0260
EXTMEMEND	= 7fff
# Support for ISA (NE2000) NICs?
ISANETWORK	= 1
# Generate Statistics about network traffic?
NETWORKSTATS	= 1
# Should the DCF77 display debug output? This will make it print every
# received bit to the debugconsole. Useful for diagnosing reception problems.
DCFDEBUG	= 0

SRCS	= timers.c ntpleduhr.c dcf77.c timeformat.c
PROG	= ntpleduhr

# compiler flags
CFLAGS	= -g -Os -Wall -mmcu=$(MCU) $(ADDDEFS)

# linker flags
LDFLAGS = -g -mmcu=$(MCU) -Wl,-Map,$(PROG).map

CFLAGS += -DCPUFREQ=$(CPUFREQ) -DF_CPU=$(CPUFREQ)
ifeq ($(DEBUGCONSOLE), 1)
	CFLAGS += -DDEBUGCONSOLE -DBAUDRATE=$(BAUDRATE)
	SRCS += debugconsole.c
endif
ifeq ($(LEDMODULE), 1)
	CFLAGS += -DLEDMODULE
	SRCS += ledmodule.c
endif
ifeq ($(CLOCKFACEMODULE), 1)
	CFLAGS += -DCLOCKFACEMODULE
	SRCS += clockface.c
endif
ifeq ($(EXTMEMORY), 1)
	CFLAGS += -DEXTMEMORY -DEXTMEMEND=0x$(EXTMEMEND)U
	LDFLAGS += -Wl,-Tdata=0x80$(EXTMEMSTART),--defsym=__heap_end=0x80$(EXTMEMEND)
endif
ifeq ($(ISANETWORK), 1)
	CFLAGS += -DISANETWORK
	SRCS += networkstack.c
endif
ifeq ($(NETWORKSTATS), 1)
	CFLAGS += -DNETWORKSTATS
endif
ifeq ($(DCFDEBUG), 1)
	CFLAGS += -DDCFDEBUG
endif

OBJS	= $(SRCS:.c=.o)

all: compile dump text eeprom

compile: $(OBJS)
	$(CC) $(LDFLAGS) -o $(PROG).elf $(OBJS)

dump: compile
	$(OBJDUMP) -h -S $(PROG).elf > $(PROG).lst

%o : %c 
	$(CC) $(CFLAGS) -I$(INCDIR) -c $< -o $@

clockrcon:
	gcc -o clockrcon -Wall -O2 clockrcon.c

# Create the flash contents
text: compile
	$(OBJCOPY) -j .text -j .data -O ihex $(PROG).elf $(PROG).hex
	$(OBJCOPY) -j .text -j .data -O srec $(PROG).elf $(PROG).srec
	$(OBJCOPY) -j .text -j .data -O binary $(PROG).elf $(PROG).bin

# Rules for building the .eeprom rom images
eeprom: compile
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $(PROG).elf $(PROG)_eeprom.hex
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $(PROG).elf $(PROG)_eeprom.srec
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $(PROG).elf $(PROG)_eeprom.bin

clean:
	rm -f $(PROG) clockrcon *~ *.elf *.rom *.bin *.eep *.o *.lst *.map *.srec *.hex

upload: uploadflash uploadeeprom

uploadflash:
	$(UISP) -v=2 -dprog=stk500 -dserial=/dev/ttyS0 -dpart=$(MCU) --segment=flash --erase --upload --verify if=$(PROG).srec

uploadeeprom:
	$(UISP) -v=2 -dprog=stk500 -dserial=/dev/ttyS0 -dpart=$(MCU) --segment=eeprom --upload --verify if=$(PROG)_eeprom.srec

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -