You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

80 lines
2.0 KiB

  1. if { [info exists CHIPNAME] } {
  2. set _CHIPNAME $CHIPNAME
  3. } else {
  4. set _CHIPNAME pic32mx
  5. }
  6. if { [info exists ENDIAN] } {
  7. set _ENDIAN $ENDIAN
  8. } else {
  9. set _ENDIAN little
  10. }
  11. if { [info exists CPUTAPID ] } {
  12. set _CPUTAPID $CPUTAPID
  13. } else {
  14. # force an error till we get a good number
  15. set _CPUTAPID 0x30938053
  16. }
  17. # default working area is 16384
  18. if { [info exists WORKAREASIZE] } {
  19. set _WORKAREASIZE $WORKAREASIZE
  20. } else {
  21. set _WORKAREASIZE 0x4000
  22. }
  23. jtag_nsrst_delay 100
  24. jtag_ntrst_delay 100
  25. #use combined on interfaces or targets that can't set TRST/SRST separately
  26. reset_config srst_only
  27. #jtag scan chain
  28. #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
  29. jtag newtap $_CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUTAPID
  30. set _TARGETNAME $_CHIPNAME.cpu
  31. target create $_TARGETNAME mips_m4k -endian $_ENDIAN -chain-position $_TARGETNAME
  32. #
  33. # At reset the pic32mx does not allow code execution from RAM
  34. # we have to setup the BMX registers to allow this.
  35. # One limitation is that we loose the first 2k of RAM.
  36. #
  37. global _PIC32MX_DATASIZE
  38. global _PIC32MX_PROGSIZE
  39. set _PIC32MX_DATASIZE 0x800
  40. set _PIC32MX_PROGSIZE [expr ($_WORKAREASIZE - $_PIC32MX_DATASIZE)]
  41. $_TARGETNAME configure -work-area-phys 0xa0000800 -work-area-size $_PIC32MX_PROGSIZE -work-area-backup 0
  42. $_TARGETNAME configure -event reset-init {
  43. #
  44. # from reset the pic32 cannot execute code in ram - enable ram execution
  45. # minimum offset from start of ram is 2k
  46. #
  47. global _PIC32MX_DATASIZE
  48. global _PIC32MX_PROGSIZE
  49. # BMXCON
  50. mww 0xbf882000 0x001f0040
  51. # BMXDKPBA: 2k kernel data @ 0xa0000800
  52. mww 0xbf882010 $_PIC32MX_DATASIZE
  53. # BMXDUDBA: 16k kernel program @ 0xa0000800
  54. mww 0xbf882020 $_PIC32MX_PROGSIZE
  55. # BMXDUPBA: 0k user program
  56. mww 0xbf882030 $_PIC32MX_PROGSIZE
  57. }
  58. set _FLASHNAME $_CHIPNAME.flash
  59. flash bank $_FLASHNAME pic32mx 0x1fc00000 0 0 0 $_TARGETNAME
  60. set _FLASHNAME $_CHIPNAME.flash
  61. flash bank $_FLASHNAME pic32mx 0x1d000000 0 0 0 $_TARGETNAME
  62. # For more information about the configuration files, take a look at:
  63. # openocd.texi