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.
 
 
 
 
 
 

94 lines
3.3 KiB

  1. # Main file for NXP LPC17xx Cortex-M3
  2. #
  3. # !!!!!!
  4. #
  5. # This file should not be included directly, rather
  6. # by the lpc1751.cfg, lpc1752.cfg, etc. which set the
  7. # needed variables to the appropriate values.
  8. #
  9. # !!!!!!
  10. # LPC17xx chips support both JTAG and SWD transports.
  11. # Adapt based on what transport is active.
  12. source [find target/swj-dp.tcl]
  13. if { [info exists CHIPNAME] } {
  14. set _CHIPNAME $CHIPNAME
  15. } else {
  16. error "_CHIPNAME not set. Please do not include lpc17xx.cfg directly, but the specific chip configuration file (lpc1751.cfg, lpc1764.cfg, etc)."
  17. }
  18. # After reset the chip is clocked by the ~4MHz internal RC oscillator.
  19. # When board-specific code (reset-init handler or device firmware)
  20. # configures another oscillator and/or PLL0, set CCLK to match; if
  21. # you don't, then flash erase and write operations may misbehave.
  22. # (The ROM code doing those updates cares about core clock speed...)
  23. #
  24. # CCLK is the core clock frequency in KHz
  25. if { [info exists CCLK] } {
  26. set _CCLK $CCLK
  27. } else {
  28. set _CCLK 4000
  29. }
  30. if { [info exists CPUTAPID] } {
  31. set _CPUTAPID $CPUTAPID
  32. } else {
  33. error "_CPUTAPID not set. Please do not include lpc17xx.cfg directly, but the specific chip configuration file (lpc1751.cfg, lpc1764.cfg, etc)."
  34. }
  35. if { [info exists CPURAMSIZE] } {
  36. set _CPURAMSIZE $CPURAMSIZE
  37. } else {
  38. error "_CPURAMSIZE not set. Please do not include lpc17xx.cfg directly, but the specific chip configuration file (lpc1751.cfg, lpc1764.cfg, etc)."
  39. }
  40. if { [info exists CPUROMSIZE] } {
  41. set _CPUROMSIZE $CPUROMSIZE
  42. } else {
  43. error "_CPUROMSIZE not set. Please do not include lpc17xx.cfg directly, but the specific chip configuration file (lpc1751.cfg, lpc1764.cfg, etc)."
  44. }
  45. #delays on reset lines
  46. adapter_nsrst_delay 200
  47. jtag_ntrst_delay 200
  48. #jtag newtap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
  49. swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
  50. set _TARGETNAME $_CHIPNAME.cpu
  51. target create $_TARGETNAME cortex_m3 -chain-position $_TARGETNAME
  52. # The LPC17xx devices have 8/16/32kB of SRAM In the ARMv7-M "Code" area (at 0x10000000)
  53. $_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size $_CPURAMSIZE
  54. # The LPC17xx devies have 32/64/128/256/512kB of flash memory, managed by ROM code
  55. # (including a boot loader which verifies the flash exception table's checksum).
  56. # flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum]
  57. set _FLASHNAME $_CHIPNAME.flash
  58. flash bank $_FLASHNAME lpc2000 0x0 $_CPUROMSIZE 0 0 $_TARGETNAME \
  59. lpc1700 $_CCLK calc_checksum
  60. # Run with *real slow* clock by default since the
  61. # boot rom could have been playing with the PLL, so
  62. # we have no idea what clock the target is running at.
  63. adapter_khz 10
  64. $_TARGETNAME configure -event reset-init {
  65. # Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
  66. # "User Flash Mode" where interrupt vectors are _not_ remapped,
  67. # and reside in flash instead).
  68. #
  69. # See Table 612. Memory Mapping Control register (MEMMAP - 0x400F C040) bit description
  70. # Bit Symbol Value Description Reset
  71. # value
  72. # 0 MAP Memory map control. 0
  73. # 0 Boot mode. A portion of the Boot ROM is mapped to address 0.
  74. # 1 User mode. The on-chip Flash memory is mapped to address 0.
  75. # 31:1 - Reserved. The value read from a reserved bit is not defined. NA
  76. #
  77. # http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC1768&type=user
  78. mww 0x400FC040 0x01
  79. }