📄 makefile
字号:
#++
# Makefile - SDCC Makefile (for GNU Make) for MP3 Player
#
# Copyright (C) 2005 by Spare Time Gizmos. All rights reserved.
#
# This file is part of the Spare Time Gizmos' MP3 Player firmware.
#
# This firmware is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that 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
#
#DESCRIPTION:
# This Makefile will build the MP3 player firmware image using the SDCC
# and ASX8051 tool chain. Note that the result of compiling, assembling
# and linking is the file PLAYER.IHX (Intel HEX), but the file that actually
# gets programmed into the flash is FLASH.HEX. The difference is that the
# latter has been run thru the romcksum program to add a checksum for the
# power on self test.
#
#TARGETS:
# make all - rebuild flash.hex
# make install - download target using Flash Magic in batch mode
# make clean - delete all generated files EXCEPT flash.hex
# make depend - regenerate source file dependencies
#
# REVISION HISTORY:
# dd-mmm-yy who description
# 19-Oct-05 RLA New file.
#--
# Tool paths - you can change these as necessary...
CC = sdcc # SDCC compiler, v2.5.0
ASM = asx8051 # SDCC assembler
LINK = aslink # SDCC linker
FM = fm # ESA Flash Magic utility
# General build options...
VERSION = 37 # version number of this firmware
LCD = -DLCD # define to build the LCD version
#VFD = -DVFD # define to build the VFD version
ROMSIZE = 32768 # size (in bytes) of the firmware image
#DEBUG= -DDEBUG # define to build the debug version
FASTSDI = 1 # 1 to use the 8051 UART to send data to the STA013
# Compiler and assembler options...
CCFLAGS = $(DEBUG) $(LCD) $(VFD) -DVERSION=$(VERSION) -DROMSIZE=$(ROMSIZE)
CFLAGS = $(CCFLAGS) -V --model-small --opt-code-speed
AFLAGS = -plosgff
# Files - C source, assembly source, and object files...
CSOURCES= player sta013 timer fat id3 post buffer switches cfcard \
display printf_large
ASOURCES= debug ide mp3drq i2c
OBJECTS = player.rel sta013.rel timer.rel fat.rel id3.rel \
post.rel buffer.rel switches.rel cfcard.rel display.rel \
debug.rel ide.rel mp3drq.rel i2c.rel printf_large.rel
# The default target builds everything, naturally...
all: flash.hex
# Make the flash image from the linker's .IHX file...
flash.hex: player.ihx
romcksum -e -1 -s$(ROMSIZE) player.ihx flash.hex
rm -f player.ihx
# Link the .REL files to make PLAYER.IHX ....
player.ihx: player.lnk $(OBJECTS)
$(LINK) -n -f player
# This rule re-creates the FASTSDI.INC file. Unfortunately ASX8051 doesn't
# support any kind of command line option to define a value, so this is the
# only way we can get the FASTSDI setting into the assembler. Note that
# MP3DRQ.ASM is the only file that actually uses this value!
fastsdi.inc:
echo FAST_SDI=$(FASTSDI) >>fastsdi.inc
# Compile a C file...
%.rel: %.c
$(CC) -c $(CFLAGS) $<
# Assemble an ASM file. Note that this rule is only used for assembly
# source files (i.e. ones for which there is no C file) - SDCC automatically
# assembles the ASM files it generates...
%.rel: %.asm
$(ASM) $(AFLAGS) $<
# Run Flash Magic and download flash.hex to the target ...
install:
$(FM) @player.fms
# Remove all generated files from the directory. DO NOT, DO NOT, DO NOT
# be tempted to do a "rm *.asm" !!!!!
clean:
rm -f *.lst *.rel *.sym *.cdb \#* *~ *.rst player.
rm -f *.ihx temp.lnk *.map *.mem *.lib fastsdi.inc
for i in $(CSOURCES); do \
rm -f $${i}.asm; \
done
# This clever little hack generates Makefile.dep, which contains all the
# dependencies for the source files, from the C sources. There's no need
# to keep the dependencies up to date by hand any more! Note that this only
# works for C files - the dependencies for the assembly sources are hard
# wired; these files only depend on PLAYER.INC anyway...
depend:
rm -f Makefile.dep
for i in $(CSOURCES); do \
$(CC) -M $(CCFLAGS) $$i.c >$${i}.dep; \
cat $${i}.dep >>Makefile.dep; \
rm $${i}.dep; \
done
for i in $(ASOURCES); do \
echo $${i}.rel: $${i}.asm player.inc fastsdi.inc >>Makefile.dep; \
done
# And these are the source file dependencies generated...
include Makefile.dep
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -