hpm5301evklite.cfg 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Copyright (c) 2023 HPMicro
  2. # SPDX-License-Identifier: BSD-3-Clause
  3. # openocd flash driver argument:
  4. # - option0:
  5. # [31:28] Flash probe type
  6. # 0 - SFDP SDR / 1 - SFDP DDR
  7. # 2 - 1-4-4 Read (0xEB, 24-bit address) / 3 - 1-2-2 Read(0xBB, 24-bit address)
  8. # 4 - HyperFLASH 1.8V / 5 - HyperFLASH 3V
  9. # 6 - OctaBus DDR (SPI -> OPI DDR)
  10. # 8 - Xccela DDR (SPI -> OPI DDR)
  11. # 10 - EcoXiP DDR (SPI -> OPI DDR)
  12. # [27:24] Command Pads after Power-on Reset
  13. # 0 - SPI / 1 - DPI / 2 - QPI / 3 - OPI
  14. # [23:20] Command Pads after Configuring FLASH
  15. # 0 - SPI / 1 - DPI / 2 - QPI / 3 - OPI
  16. # [19:16] Quad Enable Sequence (for the device support SFDP 1.0 only)
  17. # 0 - Not needed
  18. # 1 - QE bit is at bit 6 in Status Register 1
  19. # 2 - QE bit is at bit1 in Status Register 2
  20. # 3 - QE bit is at bit7 in Status Register 2
  21. # 4 - QE bit is at bit1 in Status Register 2 and should be programmed by 0x31
  22. # [15:8] Dummy cycles
  23. # 0 - Auto-probed / detected / default value
  24. # Others - User specified value, for DDR read, the dummy cycles should be 2 * cycles on FLASH datasheet
  25. # [7:4] Misc.
  26. # 0 - Not used
  27. # 1 - SPI mode
  28. # 2 - Internal loopback
  29. # 3 - External DQS
  30. # [3:0] Frequency option
  31. # 1 - 30MHz / 2 - 50MHz / 3 - 66MHz / 4 - 80MHz / 5 - 100MHz / 6 - 120MHz / 7 - 133MHz / 8 - 166MHz
  32. # - option1:
  33. # [31:20] Reserved
  34. # [19:16] IO voltage
  35. # 0 - 3V / 1 - 1.8V
  36. # [15:12] Pin group
  37. # 0 - 1st group / 1 - 2nd group
  38. # [11:8] Connection selection
  39. # 0 - CA_CS0 / 1 - CB_CS0 / 2 - CA_CS0 + CB_CS0 (Two FLASH connected to CA and CB respectively)
  40. # [7:0] Drive Strength
  41. # 0 - Default value
  42. # xpi0 configs
  43. # - flash driver: hpm_xpi
  44. # - flash ctrl index: 0xF3000000
  45. # - base address: 0x80000000
  46. # - flash size: 0x2000000
  47. # - flash option0: 0x7
  48. flash bank xpi0 hpm_xpi 0x80000000 0x2000000 1 1 $_TARGET0 0xF3000000 0x6 0x1000
  49. proc init_clock {} {
  50. $::_TARGET0 riscv dmi_write 0x39 0xF4002000
  51. $::_TARGET0 riscv dmi_write 0x3C 0x1
  52. $::_TARGET0 riscv dmi_write 0x39 0xF4002000
  53. $::_TARGET0 riscv dmi_write 0x3C 0x2
  54. $::_TARGET0 riscv dmi_write 0x39 0xF4000800
  55. $::_TARGET0 riscv dmi_write 0x3C 0xFFFFFFFF
  56. $::_TARGET0 riscv dmi_write 0x39 0xF4000810
  57. $::_TARGET0 riscv dmi_write 0x3C 0xFFFFFFFF
  58. $::_TARGET0 riscv dmi_write 0x39 0xF4000820
  59. $::_TARGET0 riscv dmi_write 0x3C 0xFFFFFFFF
  60. $::_TARGET0 riscv dmi_write 0x39 0xF4000830
  61. $::_TARGET0 riscv dmi_write 0x3C 0xFFFFFFFF
  62. echo "clocks has been enabled!"
  63. }
  64. $_TARGET0 configure -event reset-init {
  65. init_clock
  66. }
  67. $_TARGET0 configure -event gdb-attach {
  68. reset halt
  69. }