Hi
I am using an LPC2148 and am trying to program the flash. I am using the Amontec JTAGKey as well. The following is my makefile, script file and config file…am i doing something wrong here? It connects to the device when i type in "openocd -f “FLASH lpc2xxx_jtagkey.cfg” but I can’t download the scriptfile as the source as i get the error:
“flash.c :499 handle_flash_write_command(): couldn’t stat() main.bin : No such file or diectory”
makefile
##############################################################################################
Start of default section
Create ROM-image (final)
RUN_MODE=ROM_RUN
Create RAM-Image (debugging)
#RUN_MODE=RAM_RUN
TRGT = arm-elf-
CC = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
BIN = $(CP) -O binary
MCU = arm7tdmi
SUBMDL = lpc2106
List all default C defines here, like -D_DEBUG=1
DDEFS =
List all default ASM defines here, like -D_DEBUG=1
DADEFS =
List all default directories to look for include files here
DINCDIR =
List the default directory to look for the libraries here
DLIBDIR =
List all default libraries here
DLIBS =
End of default section
##############################################################################################
##############################################################################################
Start of user section
Define project name here
PROJECT = lpc_uart
Define linker script file here
LDSCRIPT= lpc2106-RAM.ld
List all user C define here, like -D_DEBUG=1
UDEFS = -D$(RUN_MODE)
Define ASM defines here
UADEFS = -D$(RUN_MODE)
List C source files here
SRC = main.c uart.c
List ASM source files here
ASRC = crt0.S
List all user directories here
UINCDIR =
List the user directory to look for the libraries here
ULIBDIR =
List all user libraries here
ULIBS =
Define optimisation level here
OPT = -O0
End of user defines
##############################################################################################
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
OBJS = $(ASRC:.S=.o) $(SRC:.c=.o)
LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)
ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.S=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,–cref,–no-warn-mismatch $(LIBDIR)
Generate dependency information
CPFLAGS += -MD -MP -MF .dep/$(@F).d
makefile rules
all: $(OBJS) $(PROJECT).elf $(PROJECT).bin
program: $(TARGET).bin
@echo
@echo “Programming with OPENOCD”
C:\Program Files\openocd-2006re88\openocd -f “FLASH lpc2xxx_jtagkey.cfg”
%o : %c
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
%o : %S
$(AS) -c $(ASFLAGS) $< -o $@
%elf: $(OBJS)
$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
%bin: %elf
$(BIN) $< $@
clean:
-rm -f $(OBJS)
-rm -f $(PROJECT).elf
-rm -f $(PROJECT).map
-rm -f $(PROJECT).bin
-rm -f $(SRC:.c=.c.bak)
-rm -f $(SRC:.c=.lst)
-rm -f $(ASRC:.S=.S.bak)
-rm -f $(ASRC:.S=.lst)
-rm -f .dep/*
Include the dependency files, should be the last of the makefile
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
*** EOF ***
lpc2148.script
target remote localhost:3333
monitor sleep 500
monitor poll
monitor flash probe 0
monitor flash erase 0 0 0
monitor flash write 0 main.bin 0x0
monitor reset run
monitor sleep 500
monitor shutdown
FLASH lpc2xxx_jtagkey.cfg
#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface ft2232
ft2232_device_desc “Amontec JTAGkey A”
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0xcff8
jtag_speed 4
#use combined on interfaces or targets that can’t set TRST/SRST separately
reset_config trst_and_srst trst_pulls_srst
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
#target configuration
daemon_startup reset
#target
#target arm7tdmi
target arm7tdmi little run_and_init 0 arm7tdmi-s_r4
run_and_halt_time 0 30
working_area 0 0x40000000 0x4000 nobackup
#flash configuration
flash bank lpc2000 0x0 0x7d000 0 0 lpc2000_v2 0 12000 calc_checksum