olimex_sam7_la2.cfg 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. source [find target/at91sam7a2.cfg]
  3. # delays needed to get stable reads of cpu state
  4. jtag_ntrst_delay 10
  5. adapter srst delay 200
  6. # board uses pullup and connects only srst
  7. reset_config srst_open_drain
  8. # srst is connected to NRESET of CPU and fully resets everything...
  9. reset_config srst_only srst_pulls_trst
  10. adapter speed 1
  11. $_TARGETNAME configure -event reset-start {
  12. adapter speed 1
  13. }
  14. $_TARGETNAME configure -event reset-init {
  15. # init script from http://www.mikrocontroller.net/topic/107462
  16. # AT91SAM7A2
  17. # AMC (advanced memory controller)
  18. echo "setting up AMC"
  19. # AMC_CS0 - FLASH 1MB (0x40000000-0x400FFFFF) + DM9000E (0x40100000)
  20. mww 0xFFE00000 0x40003EBD
  21. # AMC_CS1 - RAM low 2MB (0x40400000-0x405FFFFF)
  22. mww 0xFFE00004 0x404030A9
  23. # AMC_CS2 - RAM high 2MB (0x40800000-0x405FFFFF)
  24. #mww 0xFFE00008 0x404030A9
  25. # changed to 0x40_8_
  26. mww 0xFFE00008 0x408030A9
  27. # AMC_MCR
  28. mww 0xFFE00024 0x00000004
  29. # AMC_RCR force remap
  30. mww 0xFFE00020 0x00000001
  31. echo "set up AMC"
  32. sleep 100
  33. # the following base addresses from the original script did not correspond to those from datasheet
  34. # changed bases from 0xFF000000 to 0xFFF00000
  35. # disable watchdog, to prevent unwanted resets
  36. mww 0xFFFA0068 0x00000000
  37. echo "disabled watchdog"
  38. sleep 50
  39. # disable PLL
  40. mww 0xFFFEC004 0x18070004
  41. # PLL = 10 ==> Coreclock = 6Mhz*10/2 = 30 Mhz
  42. mww 0xFFFEC010 0x762D800A
  43. # enable PLL
  44. mww 0xFFFEC000 0x23050004
  45. echo "set up pll"
  46. sleep 100
  47. adapter speed 5000
  48. }
  49. $_TARGETNAME arm7_9 dcc_downloads enable
  50. $_TARGETNAME arm7_9 fast_memory_access enable
  51. # remap: ram at 0, flash at 0x40000000, like reset-init above does
  52. $_TARGETNAME configure -work-area-phys 0x00000000 -work-area-size 0x4000 -work-area-backup 1
  53. flash bank onboard.flash cfi 0x40000000 0x00100000 2 2 at91sam7a2.cpu
  54. # boot: ram at 0x300000, flash at 0x0, useful if board is in funny configuration
  55. #$_TARGETNAME configure -work-area-phys 0x00300000 -work-area-size 0x4000 -work-area-backup 1
  56. #flash bank onboard1.flash cfi 0x00000000 0x00100000 2 2 at91sam7a2.cpu