📄 makefile
字号:
# *******************************************************************************************************
# Makefile for Atmel AT91SAM7X256 - flash execution
#
#
# Description of Compiler Flags (CFLAGS)
# -mcpu=arm7tdmi identifies the target ARM microprocessor
# -I./ search current working directory for include files
# -c do not invoke the linker
# -fno-common compiler gives each global variable space in .data segment
# -O0 set lowest otimization level (best for debugging)
# -g include debugging information in output file
# -fomit-frame-pointer don't store frame pointer for functions that don't need it
# -Wcast-align emit warning if casting pointer causes alignment problems
#
# -MD emits a one-line file such as main.d file with dependency line like this:
# main.o: main.c at91sam7x256.h board.h
# note: use -MD once to get your dependency lines set up - then remove.
#
#
# Description of Assembler Flags (ASFLAGS)
# -mapcs-32 select apcs-32 ARM procedure calling convention
# -g include debugging information in output file
#
#
# Description of Linker flags (LFLAGS)
# -omain.out set the output filename to "main.out"
# -Tdemo_sam7ex256_dma.cmd identifies the linker script file
# -Map main.map create a map file with the name "main.map"
# --cref add cross reference table to the map file
#
#
# Description of ObjCopy flags (CPFLAGS)
# --output-target=binary convert main.out to a binary file (main.bin)
#
#
# Description of ObjDump flags (ODFLAGS)
# -x display header information, symbol table etc.
# --syms display the symbol table
#
#
# James P Lynch June 22, 2008
# *******************************************************************************************************
NAME = demo_sam7ex256_dma
# variables
CC = arm-elf-gcc
AS = arm-elf-as
LD = arm-elf-ld -v
CP = arm-elf-objcopy
OD = arm-elf-objdump
CFLAGS = -mcpu=arm7tdmi -I./ -c -fno-common -O0 -g -fomit-frame-pointer -Wcast-align
ASFLAGS = -mapcs-32 -g
LFLAGS = -omain.out -Tdemo_sam7ex256_dma.cmd -Map main.map --cref
CPFLAGS = --output-target=binary
ODFLAGS = -x --syms
OBJECTS = crt.o \
main.o \
lowlevelinit.o \
usart0_setup.o \
usart0_isr.o \
isrsupport.o
# ALL - make target called by Eclipse (Project -> Build Project)
all: main.out
@ echo "...create binary file"
$(CP) $(CPFLAGS) main.out main.bin
@ echo "...create dump file"
$(OD) $(ODFLAGS) main.out > main.dmp
main.out: $(OBJECTS)
@ echo "...linking"
$(LD) $(LFLAGS) -omain.out $(OBJECTS) libgcc.a
# list of dependencies for each C and ASM file in the project
# Note: Implicit Rules will deduce from the source file extension which to run: C compiler or ARM assembler
crt.o: crt.s
main.o: main.c at91sam7x256.h board.h
lowlevelinit.o: lowlevelinit.c at91sam7x256.h Board.h
usart0_setup.o: usart0_setup.c at91sam7x256.h board.h
usart0_isr.o: usart0_isr.c at91sam7x256.h board.h
isrsupport.o: isrsupport.c
# CLEAN - make target called by Eclipse (Project -> Clean ...)
clean:
-rm $(OBJECTS) main.out main.bin main.map main.dmp
# **********************************************************************************************
# FLASH PROGRAMMING
#
# Alternate make target for flash programming only
#
# You must create a special Eclipse make target (program) to run this part of the makefile
# (Project -> Create Make Target... then set the Target Name and Make Target to "program")
#
# OpenOCD is run in "batch" mode with a special configuration file and a script file containing
# the flash commands. When flash programming completes, OpenOCD terminates.
#
# Note that the script file of flash commands (script.ocd) is part of the project
#
# Programmers: Martin Thomas, Joseph M Dupre, James P Lynch
# **********************************************************************************************
# specify output filename here (must be *.bin file)
TARGET = main.bin
# specify the directory where openocd executable reside
OPENOCD_DIR = 'c:/Program Files/openocd-r717/bin/'
# specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debuggers)
#OPENOCD = $(OPENOCD_DIR)openocd-pp.exe
OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe
# specify OpenOCD configuration file (in your project folder)
OPENOCD_CFG = openocd_program.cfg
# program the AT91SAM7S256 internal flash memory
program: $(TARGET)
@echo "Flash Programming with OpenOCD..." # display a message on the console
$(OPENOCD) -s $(OPENOCD_DIR) -f $(OPENOCD_CFG) # program the onchip FLASH here
@echo "Flash Programming Finished." # display a message on the console
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -