nrf51.cfg 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. #
  3. # script for Nordic nRF51 series, a Cortex-M0 chip
  4. #
  5. source [find target/swj-dp.tcl]
  6. if { [info exists CHIPNAME] } {
  7. set _CHIPNAME $CHIPNAME
  8. } else {
  9. set _CHIPNAME nrf51
  10. }
  11. if { [info exists ENDIAN] } {
  12. set _ENDIAN $ENDIAN
  13. } else {
  14. set _ENDIAN little
  15. }
  16. # Work-area is a space in RAM used for flash programming
  17. # By default use 16kB
  18. if { [info exists WORKAREASIZE] } {
  19. set _WORKAREASIZE $WORKAREASIZE
  20. } else {
  21. set _WORKAREASIZE 0x4000
  22. }
  23. if { [info exists CPUTAPID] } {
  24. set _CPUTAPID $CPUTAPID
  25. } else {
  26. set _CPUTAPID 0x0bb11477
  27. }
  28. swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID
  29. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
  30. set _TARGETNAME $_CHIPNAME.cpu
  31. target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
  32. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  33. if {![using_hla]} {
  34. # The chip supports standard ARM/Cortex-M0 SYSRESETREQ signal
  35. cortex_m reset_config sysresetreq
  36. }
  37. flash bank $_CHIPNAME.flash nrf51 0x00000000 0 1 1 $_TARGETNAME
  38. flash bank $_CHIPNAME.uicr nrf51 0x10001000 0 1 1 $_TARGETNAME
  39. #
  40. # The chip should start up from internal 16Mhz RC, so setting adapter
  41. # clock to 1Mhz should be OK
  42. #
  43. adapter speed 1000
  44. proc enable_all_ram {} {
  45. # nRF51822 Product Anomaly Notice (PAN) #16 explains that not all RAM banks
  46. # are reliably enabled after reset on some revisions (contrary to spec.) So after
  47. # resetting we enable all banks via the RAMON register
  48. mww 0x40000524 0xF
  49. }
  50. $_TARGETNAME configure -event reset-end { enable_all_ram }