Подправил параметры запуска линовщика и компилятора в мэйке:
CODE
# ***************************************************************
# * Makefile for Atmel AT91SAM7S256 - flash execution *
# * *
# * *
# * James P Lynch September 3, 2006 *
# ***************************************************************
#NAME = umgps
include mt_defs.mk
VALIDTARGETS_ARM7 = \
AT91SAM7S321 AT91SAM7S64 AT91SAM7S128 AT91SAM7S256 AT91SAM7S512 \
AT91SAM7SE32 AT91SAM7SE256 AT91SAM7SE512 \
AT91SAM7X128 AT91SAM7X256 AT91SAM7X512 \
AT91SAM7A3
VALIDTARGETS_ARM9 = AT91RM9200 AT91SAM9260 AT91SAM9261 AT91SAM9263
VALIDTARGETS = $(VALIDTARGETS_ARM7) $(VALIDTARGETS_ARM9)
#-------------------------------------------------------------------------------
# Check parameters
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Check target
#-------------------------------------------------------------------------------
ifndef TARGET
$(warning Warning: No target selected, using default target AT91SAM7S64.)
TARGET = AT91SAM7S256
endif
ifndef SUBTARGET
$(warning Warning: No target selected, using default target AT91SAM7S64.)
SUBTARGET = UMGPS
endif
ifeq (,$(filter $(TARGET), $(VALIDTARGETS)))
$(error Error: $(TARGET): Unknown target.)
endif
ifeq (,$(filter $(TARGET), $(VALIDTARGETS_ARM9)))
MCPU = arm7tdmi
else
#todo: check this (must read - no AT91 ARM9 here for tests)
MCPU = arm9
endif
#-------------------------------------------------------------------------------
# Check board
#-------------------------------------------------------------------------------
ifndef BOARD
$(warning Warning: No board selected, using default board AT91SAM7SEK.)
BOARD = AT91SAM7SEK
endif
#-------------------------------------------------------------------------------
# Check class
#-------------------------------------------------------------------------------
#ifndef CLASS
#$(warning Warning: No class selected, using default enumeration class.)
#CLASS = ENUM
#endif
#-------------------------------------------------------------------------------
# Check remap
#-------------------------------------------------------------------------------
ifndef REMAP
REMAP = NO
else
ifneq ($(REMAP),YES)
REMAP = NO
endif
endif
#-------------------------------------------------------------------------------
# Check debug
#-------------------------------------------------------------------------------
ifndef DEBUG
DEBUG = NO
else
ifneq ($(DEBUG),YES)
DEBUG = NO
endif
endif
#-------------------------------------------------------------------------------
# Check leds
#-------------------------------------------------------------------------------
ifndef LEDS
LEDS = YES
else
ifneq ($(LEDS),NO)
LEDS = YES
endif
endif
#-------------------------------------------------------------------------------
# Check traces
#-------------------------------------------------------------------------------
ifndef TRACES
TRACES = YES
else
ifneq ($(TRACES),NO)
TRACES = YES
endif
endif
#-------------------------------------------------------------------------------
# Check power
#-------------------------------------------------------------------------------
ifndef POWER
POWER = AUTO
else
ifneq ($(POWER),BUS)
POWER = AUTO
endif
endif
#-------------------------------------------------------------------------------
# Check mode
#-------------------------------------------------------------------------------
ifndef MODE
MODE = NO
endif
#-------------------------------------------------------------------------------
# Summary
#-------------------------------------------------------------------------------
#$(warning Target:$(TARGET)/$(MCPU) Board:$(BOARD))
#$(warning Class:$(CLASS) Mode:$(MODE) Power:$(POWER))
#$(warning Remap:$(REMAP))
#$(warning Debug:$(DEBUG) LEDs:$(LEDS) Traces:$(TRACES))
ifeq ($(TARGET),AT91SAM7A3)
ifndef REVISION
$(warning Revision: REV_B)
else
$(warning Revision: $(REVISION))
endif
endif
GCCLIB = C:\Program\ /Files\yagarto\arm-none-eabi\lib
GCCLIB2 = C:\Program\ /Files\yagarto\lib\gcc\arm-none-eabi\4.5.0
GCCINC = C:\Program\ /Files\yagarto\arm-none-eabi\include
GCCINC2 = C:\Program\ /Files\yagarto\lib\gcc\arm-none-eabi\4.5.0
CC = arm-none-eabi-gcc
LD = arm-none-eabi-ld -v
AR = arm-none-eabi-ar
AS = arm-none-eabi-as -v
CP = arm-none-eabi-objcopy
OD = arm-none-eabi-objdump
#CFLAGS1 = -I./ -I$(GCCINC) -I$(GCCLIB) -c -fno-common -mthumb-interwork -O2 -g
#CFLAGS = -I./ -I$(GCCINC) -I$(GCCLIB) -c -fno-common -mthumb -mthumb-interwork -O2 -g
#CFLAGS1 = -I./ -I$(GCCINC) -I$(GCCINC2) -c -fno-common -O2
CFLAGS = -I./ -I$(GCCINC) -I$(GCCINC2) -L$(GCCLIB) -L$(GCCLIB2) -c -mcpu=arm7tdmi -O2 $(OPTIMIZATION) -D$(TARGET) -D$(SUBTARGET) -D$(BOARD) -gdwarf-2
CFLAGS += -mthumb-interwork
CFLAGS += -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst)
ifeq ($(LEDS),NO)
CFLAGS := $(CFLAGS) -DNOLEDS
endif
ifeq ($(TRACES),NO)
CFLAGS := $(CFLAGS) -DNOTRACES
endif
#ifeq ($(POWER),BUS)
#CFLAGS := $(CFLAGS) -DUSB_BUS_POWERED
#endif
#ifneq ($(MODE),NO)
#CFLAGS := $(CFLAGS) -D$(MODE)
#endif
#CFLAGS = -I./ -c -fno-common -O0 -g
#AFLAGS = -ahlns -mapcs-32 -D$(TARGET) -o Cstartup.o
AFLAGS = -ahlns -gdwarf-2 -x assembler-with-cpp -D$(TARGET) -D$(SUBTARGET) -I$(GCCINC1) -I$(GCCINC2) -L$(GCCLIB) -L$(GCCLIB2)
#LFLAGS = -Map umgps.map -Tdemo_at91sam7_blink_flash.cmd
LFLAGS = -L$(GCCLIB) -L$(GCCLIB2) -nostartfiles
LFLAGS += -Map=umgps.map -TAT91SAM7S256-ROM.ld -I$(GCCINC1) -I$(GCCINC2) --cref --gc-sections --entry=__ENTRY
CPFLAGS = -O binary
ODFLAGS = -x --syms
OBJECTS = Cstartup.o umgps.o timerisr.o timersetup.o blinker.o
OBJECTS += isrsupport.o device.o standard.o udp.o um_bot_driver.o
OBJECTS += um_sbc_methods.o board.o at91stdio.o syscalls.o um_mb_methods.o CRC.o
OBJECTS += um_spi.o um_CC1000.o um_sys_controller.o
# make target called by Eclipse (Project -> Clean ...)
clean:
-rm $(OBJECTS) Cstartup.lst umgps.lst umgps.out umgps.elf umgps.bin umgps.hex umgps.map umgps.dmp
#make target called by Eclipse (Project -> Build Project)
all: umgps.elf
@ echo "...copying"
$(CP) $(CPFLAGS) umgps.elf umgps.bin
$(OD) $(ODFLAGS) umgps.elf > umgps.dmp
umgps.elf: $(OBJECTS) AT91SAM7S256-ROM.ld
@ echo "..linking"
$(LD) $(LFLAGS) -o umgps.elf $(OBJECTS)
# $(LD) $(LFLAGS) -o umgps.out $(OBJECTS) $(GCCLIB2)libgcc.a
# $(LD) $(LFLAGS) -o umgps.out $(OBJECTS) -nostartfiles
Cstartup.o: Cstartup.S
@ echo ".assembling $@..."
$(CC) -c $(AFLAGS) $< -o $@
#$(CC) $(CFLAGS) -Wa -ahlns Cstartup.s -o Cstartup.o
umgps.o: um_main.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) um_main.c -o umgps.o
timerisr.o: timerisr.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) timerisr.c
#Cstartup_SAM7.o: Cstartup_SAM7.c
# @ echo ".compiling $@..."
# $(CC) $(CFLAGS) Cstartup_SAM7.c
timersetup.o: timersetup.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) timersetup.c
isrsupport.o: isrsupport.c
@ echo ".compiling $@..."
# $(CC) $(CFLAGS1) isrsupport.c
$(CC) $(CFLAGS) isrsupport.c
blinker.o: blinker.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) blinker.c
board.o: board.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) board.c
device.o: device.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) device.c
standard.o: standard.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) standard.c
udp.o: udp.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) udp.c
um_bot_driver.o: um_bot_driver.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) um_bot_driver.c
um_sbc_methods.o: um_sbc_methods.c
@ echo ".compiling"
$(CC) $(CFLAGS) um_sbc_methods.c
at91stdio.o: at91stdio.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) at91stdio.c
syscalls.o: syscalls.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) syscalls.c
um_mb_methods.o: um_mb_methods.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) um_mb_methods.c
CRC.o: CRC.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) CRC.c
um_spi.o: um_spi.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) um_spi.c
um_CC1000.o: um_CC1000.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) um_CC1000.c
um_sys_controller.o: um_sys_controller.c
@ echo ".compiling $@..."
$(CC) $(CFLAGS) um_sys_controller.c
# ********************************************************************************
**************
# FLASH PROGRAMMING (using OpenOCD and Amontec JTAGKey)
#
# 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 make file below creates the script file of flash commands "on the fly"
#
# Programmers: Martin Thomas, Joseph M Dupre, James P Lynch
# ********************************************************************************
**************
# specify output filename here (must be *.bin file)
OCD_TARGET = umgps.bin
# specify the directory where openocd executable resides (openocd-ftd2xx.exe or openocd-pp.exe)
OPENOCD_DIR = 'c:\Program Files\openocd-2006re93\bin\'
# specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debugger)
#OPENOCD = $(OPENOCD_DIR)openocd-pp.exe
OPENOCD = openocd-pp
#OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe
# specify OpenOCD configuration file (pick the one for your device)
#OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-wiggler-flash-program.cfg
OPENOCD_CFG = at91sam7s256-wiggler-flash-program.cfg
#OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-jtagkey-flash-program.cfg
#OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-armusbocd-flash-program.cfg
# specify the name and folder of the flash programming script file
OPENOCD_SCRIPT = script.ocd
# program the AT91SAM7S256 internal flash memory
program: $(OCD_TARGET)
@echo "Preparing OpenOCD script..."
@cmd /c 'echo wait_halt > $(OPENOCD_SCRIPT)'
@cmd /c 'echo armv4_5 core_state arm >> $(OPENOCD_SCRIPT)'
@cmd /c 'echo flash write 0 $(OCD_TARGET) 0x0 >> $(OPENOCD_SCRIPT)'
@cmd /c 'echo mww 0xfffffd08 0xa5000401 >> $(OPENOCD_SCRIPT)'
@cmd /c 'echo reset >> $(OPENOCD_SCRIPT)'
@cmd /c 'echo shutdown >> $(OPENOCD_SCRIPT)'
@echo "Flash Programming with OpenOCD..."
$(OPENOCD) -f $(OPENOCD_CFG)
@echo "Flash Programming Finished."
Отладка запустилась !
Но работает не нормально.
Жму Ф5 несколько раз и вот что выдет консоль:
Warn : stepi ignored. GDB will now fetch the register state from the target.
Error: address + size wrapped(0xfffffffe, 0x00000004)
Error: address + size wrapped(0xfffffffe, 0x00000004)
Error: address + size wrapped(0xfffffffe, 0x00000004)
Error: address + size wrapped(0xfffffffe, 0x00000004)
Warn : memory read caused data abort (address: 0x20000052, size: 0x1, count: 0x2)
Warn : memory read caused data abort (address: 0x20000052, size: 0x1, count: 0x2)
Warn : memory read caused data abort (address: 0x20000052, size: 0x1, count: 0x2)
Warn : memory read caused data abort (address: 0x20000052, size: 0x1, count: 0x2)
Warn : memory read caused data abort (address: 0x20000052, size: 0x1, count: 0x2)
Warn : memory read caused data abort (address: 0x20000052, size: 0x1, count: 0x2)
И потом зависает.