1 | # **********************************************************************************************
|
2 | # FLASH PROGRAMMING (using OpenOCD and Amontec JTAGKey)
|
3 | #
|
4 | # Alternate make target for flash programming only
|
5 | #
|
6 | # You must create a special Eclipse make target (program) to run this part of the makefile
|
7 | # (Project -> Create Make Target... then set the Target Name and Make Target to "program")
|
8 | #
|
9 | # OpenOCD is run in "batch" mode with a special configuration file and a script file containing
|
10 | # the flash commands. When flash programming completes, OpenOCD terminates.
|
11 | #
|
12 | # Note that the make file below creates the script file of flash commands "on the fly"
|
13 | #
|
14 | # Programmers: Martin Thomas, Joseph M Dupre, James P Lynch
|
15 | # **********************************************************************************************
|
16 |
|
17 | # specify output filename here (must be *.bin file)
|
18 | TARGET = main.bin
|
19 |
|
20 | # specify the directory where openocd executable resides (openocd-ftd2xx.exe or openocd-pp.exe)
|
21 | OPENOCD_DIR = 'c:\Program Files\openocd-2006re93\bin\'
|
22 |
|
23 | # specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debugger)
|
24 | #OPENOCD = $(OPENOCD_DIR)openocd-pp.exe
|
25 | OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe
|
26 |
|
27 | # specify OpenOCD configuration file (pick the one for your device)
|
28 | #OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-wiggler-flash-program.cfg
|
29 | #OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-jtagkey-flash-program.cfg
|
30 | OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-armusbocd-flash-program.cfg
|
31 |
|
32 | # specify the name and folder of the flash programming script file
|
33 | OPENOCD_SCRIPT = c:\temp\temp.ocd
|
34 |
|
35 | # program the AT91SAM7S256 internal flash memory
|
36 | program: $(TARGET)
|
37 | @echo "Preparing OpenOCD script..."
|
38 | @cmd /c 'echo wait_halt > $(OPENOCD_SCRIPT)'
|
39 | @cmd /c 'echo armv4_5 core_state arm >> $(OPENOCD_SCRIPT)'
|
40 | @cmd /c 'echo flash write 0 $(TARGET) 0x0 >> $(OPENOCD_SCRIPT)'
|
41 | @cmd /c 'echo mww 0xfffffd08 0xa5000401 >> $(OPENOCD_SCRIPT)'
|
42 | @cmd /c 'echo reset >> $(OPENOCD_SCRIPT)'
|
43 | @cmd /c 'echo shutdown >> $(OPENOCD_SCRIPT)'
|
44 | @echo "Flash Programming with OpenOCD..."
|
45 | $(OPENOCD) -f $(OPENOCD_CFG)
|
46 | @echo "Flash Programming Finished."
|