rsl10.cfg 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. #
  3. # RSL10: ARM Cortex-M3
  4. #
  5. source [find target/swj-dp.tcl]
  6. if { [info exists CHIPNAME] } {
  7. set _CHIPNAME $CHIPNAME
  8. } else {
  9. set _CHIPNAME rsl10
  10. }
  11. if { [info exists WORKAREASIZE] } {
  12. set _WORKAREASIZE $WORKAREASIZE
  13. } else {
  14. set _WORKAREASIZE 0x8000
  15. }
  16. if { [info exists CPUTAPID] } {
  17. set _CPUTAPID $CPUTAPID
  18. } else {
  19. set _CPUTAPID 0x2ba01477
  20. }
  21. swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID
  22. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
  23. set _TARGETNAME $_CHIPNAME.cpu
  24. target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
  25. $_TARGETNAME configure -work-area-phys 0x200000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  26. # TODO: configure reset
  27. # reset_config srst_only srst_nogate connect_assert_srst
  28. $_TARGETNAME configure -event examine-fail rsl10_lock_warning
  29. proc rsl10_check_connection {} {
  30. set target [target current]
  31. set dap [$target cget -dap]
  32. set IDR [$dap apreg 0 0xfc]
  33. if {$IDR != 0x24770011} {
  34. echo "Error: Cannot access RSL10 AP, maybe connection problem!"
  35. return 1
  36. }
  37. return 0
  38. }
  39. proc rsl10_lock_warning {} {
  40. if {[rsl10_check_connection]} {return}
  41. poll off
  42. echo "****** WARNING ******"
  43. echo "RSL10 device probably has lock engaged."
  44. echo "Debug access is denied."
  45. echo "Use 'rsl10 unlock key1 key2 key3 key4' to erase and unlock the device."
  46. echo "****** ....... ******"
  47. echo ""
  48. }
  49. flash bank $_CHIPNAME.main rsl10 0x00100000 0x60000 0 0 $_TARGETNAME
  50. flash bank $_CHIPNAME.nvr1 rsl10 0x00080000 0x800 0 0 $_TARGETNAME
  51. flash bank $_CHIPNAME.nvr2 rsl10 0x00080800 0x800 0 0 $_TARGETNAME
  52. flash bank $_CHIPNAME.nvr3 rsl10 0x00081000 0x800 0 0 $_TARGETNAME
  53. # TODO: implement flashing for nvr4
  54. # flash bank $_CHIPNAME.nvr4 rsl10 0x00081800 0x400 0 0 $_TARGETNAME