apm32f4x.cfg 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. #
  3. # Geehy APM32F4x target
  4. #
  5. # https://global.geehy.com/MCU
  6. #
  7. #
  8. # APM32F4x devices support JTAG and SWD transport.
  9. #
  10. source [find target/swj-dp.tcl]
  11. if { [info exists CHIPNAME] } {
  12. set _CHIPNAME $CHIPNAME
  13. } else {
  14. set _CHIPNAME apm32f4x
  15. }
  16. # Work-area is a space in RAM used for flash programming, by default use 4 KiB.
  17. if { [info exists WORKAREASIZE] } {
  18. set _WORKAREASIZE $WORKAREASIZE
  19. } else {
  20. set _WORKAREASIZE 0x1000
  21. }
  22. if { [info exists CPUTAPID] } {
  23. set _CPUTAPID $CPUTAPID
  24. } else {
  25. if { [using_jtag] } {
  26. set _CPUTAPID 0x4ba00477
  27. } else {
  28. set _CPUTAPID 0x2ba01477
  29. }
  30. }
  31. swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
  32. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
  33. if { [using_jtag] } {
  34. jtag newtap $_CHIPNAME bs -irlen 5
  35. }
  36. set _TARGETNAME $_CHIPNAME.cpu
  37. target create $_TARGETNAME cortex_m -endian little -dap $_CHIPNAME.dap
  38. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  39. set _FLASHNAME $_CHIPNAME.flash
  40. flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME
  41. adapter speed 1000
  42. if {![using_hla]} {
  43. # if srst is not fitted use SYSRESETREQ to perform a soft reset.
  44. cortex_m reset_config sysresetreq
  45. }