Created
August 24, 2012 04:05
-
-
Save arsane/3445323 to your computer and use it in GitHub Desktop.
openocd pic32mx configuration file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debug_level 0 | |
#log_output flash.log | |
# Daemon configuration | |
telnet_port 0 | |
tcl_port 0 | |
gdb_port 0 | |
interface ft2232 | |
ft2232_device_desc "Olimex OpenOCD JTAG" | |
ft2232_layout olimex-jtag | |
ft2232_vid_pid 0x15ba 0x0003 | |
ft2232_latency 1 | |
adapter_khz 1000 | |
adapter_nsrst_delay 100 | |
jtag_ntrst_delay 100 | |
#jtag scan chain | |
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE) | |
jtag newtap pic32mx cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id 0x50974053 | |
target create pic32mx.cpu mips_m4k -endian little -chain-position pic32mx.cpu | |
# | |
# At reset the pic32mx does not allow code execution from RAM | |
# we have to setup the BMX registers to allow this. | |
# One limitation is that we loose the first 2k of RAM. | |
# | |
global _PIC32MX_DATASIZE | |
global _WORKAREASIZE | |
set _PIC32MX_DATASIZE 0x800 | |
set _WORKAREASIZE 0x8000 | |
set _PIC32MX_PROGSIZE [expr ($_WORKAREASIZE - $_PIC32MX_DATASIZE)] | |
pic32mx.cpu configure -work-area-phys 0xa0000800 -work-area-size $_PIC32MX_PROGSIZE -work-area-backup 0 | |
pic32mx.cpu configure -event reset-init { | |
# | |
# from reset the pic32 cannot execute code in ram - enable ram execution | |
# minimum offset from start of ram is 2k | |
# | |
global _PIC32MX_DATASIZE | |
global _WORKAREASIZE | |
# BMXCON | |
mww 0xbf882000 0x001f0040 | |
# BMXDKPBA: 2k kernel data @ 0xa0000800 | |
mww 0xbf882010 $_PIC32MX_DATASIZE | |
# BMXDUDBA: 14k kernel program @ 0xa0000800 - (BMXDUDBA - BMXDKPBA) | |
mww 0xbf882020 $_WORKAREASIZE | |
# BMXDUPBA: 0k user program - (BMXDUPBA - BMXDUDBA) | |
mww 0xbf882030 $_WORKAREASIZE | |
} | |
reset_config trst_and_srst | |
flash bank pic32mx.flash0 pic32mx 0x1fc00000 0x3000 4 4 pic32mx.cpu | |
# add virtual banks for kseg0 and kseg1 | |
flash bank vbank0 virtual 0xbfc00000 0x3000 4 4 pic32mx.cpu pic32mx.flash0 | |
flash bank vbank1 virtual 0x9fc00000 0x3000 4 4 pic32mx.cpu pic32mx.flash0 | |
flash bank pic32mx.flash1 pic32mx 0x1d000000 0x80000 4 4 pic32mx.cpu | |
# add virtual banks for kseg0 and kseg1 | |
flash bank vbank2 virtual 0xbd000000 0x80000 4 4 pic32mx.cpu pic32mx.flash1 | |
flash bank vbank3 virtual 0x9d000000 0x80000 4 4 pic32mx.cpu pic32mx.flash1 | |
init | |
reset init | |
poll | |
echo "+------------------------------------------------+" | |
echo "| Erase Flash |" | |
echo "+------------------------------------------------+" | |
#pic32 unlock erase all the flash memory, no need to do it twice. | |
pic32mx unlock pic32mx.flash1 | |
reset init | |
#mdw 0xbfc00000 40 | |
#mdw 0xbd000000 40 | |
echo "+------------------------------------------------+" | |
echo "| Program Image |" | |
echo "+------------------------------------------------+" | |
set _IMAGE image.elf | |
flash write_image $_IMAGE | |
#mdw 0xbfc00000 40 | |
#mdw 0xbd000000 40 | |
echo "+------------------------------------------------+" | |
echo "| Verify Image |" | |
echo "+------------------------------------------------+" | |
verify_image $_IMAGE | |
reset halt | |
shutdown | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment