rp2040.cfg 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. source [find target/swj-dp.tcl]
  2. source [find mem_helper.tcl]
  3. set _CHIPNAME rp2040
  4. set _CPUTAPID 0x01002927
  5. set _ENDIAN little
  6. swj_newdap $_CHIPNAME.core0 cpu -dp-id $_CPUTAPID -instance-id 0
  7. swj_newdap $_CHIPNAME.core1 cpu -dp-id $_CPUTAPID -instance-id 1
  8. # NOTE target smp makes both targets act a single virtual target on one port for gdb
  9. # (without it you should be able to debug separately on two ports)
  10. # NOTE: "-rtos hwthread" creates a thread per core in smp mode (otherwise it is a single thread for the virtual target)
  11. # Give OpenOCD SRAM1 (64k) to use for e.g. flash programming bounce buffers (should avoid algo stack etc)
  12. # Don't require save/restore, because this isn't something we'd do whilst a user app is running
  13. set _WORKSIZE 0x10000
  14. set _WORKBASE 0x20010000
  15. #core 0
  16. set _TARGETNAME_0 $_CHIPNAME.core0
  17. dap create $_TARGETNAME_0.dap -chain-position $_CHIPNAME.core0.cpu
  18. target create $_TARGETNAME_0 cortex_m -endian $_ENDIAN -coreid 0 -dap $_TARGETNAME_0.dap -rtos hwthread
  19. $_TARGETNAME_0 configure -work-area-phys $_WORKBASE -work-area-size $_WORKSIZE -work-area-backup 0
  20. cortex_m reset_config sysresetreq
  21. #core 1
  22. set _TARGETNAME_1 $_CHIPNAME.core1
  23. dap create $_TARGETNAME_1.dap -chain-position $_CHIPNAME.core1.cpu
  24. target create $_TARGETNAME_1 cortex_m -endian $_ENDIAN -coreid 1 -dap $_TARGETNAME_1.dap -rtos hwthread
  25. $_TARGETNAME_1 configure -work-area-phys $_WORKBASE -work-area-size $_WORKSIZE -work-area-backup 0
  26. cortex_m reset_config sysresetreq
  27. target smp $_TARGETNAME_0 $_TARGETNAME_1
  28. set _FLASHNAME $_CHIPNAME.flash
  29. set _FLASHSIZE 0x200000
  30. set _FLASHBASE 0x10000000
  31. # name driver base, size in bytes, chip_width, bus_width, target used to access
  32. flash bank $_FLASHNAME rp2040_flash $_FLASHBASE $_FLASHSIZE 1 32 $_TARGETNAME_0
  33. # Openocd associates a flash bank with a target (in our case a core) and
  34. # running `openocd -c "program foo.elf"` just grabs the last selected core
  35. # from the TCL context. Select `core0` by default so that flash probe
  36. # succeeds. Note gdb understands there are 2 cores -- this is only for TCL.
  37. targets rp2040.core0
  38. # srst is not fitted so use SYSRESETREQ to perform a soft reset
  39. reset_config srst_nogate
  40. gdb_flash_program enable
  41. gdb_memory_map enable