野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9219|回复: 22

野火的板子(RT1052)使用gcc工具链+pyocd+DAPLink成功点灯

[复制链接]
发表于 2020-3-20 12:48:46 | 显示全部楼层 |阅读模式
本帖最后由 lizimu 于 2020-3-20 12:52 编辑

如题,先把工程共享出来,问题和细节慢慢补完.
SDK_2.3.0_EVK-MIMXRT1050.zip (4.71 MB, 下载次数: 57)

把文件名后缀zip改回7z
回复

使用道具 举报

 楼主| 发表于 2020-3-20 17:11:38 | 显示全部楼层
工具链版本:
gcc-arm-none-eabi-9-2019-q4-major
1.PNG
Python 3.8.1
pyocd-0.23.0
2.PNG


回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-3-20 17:16:50 | 显示全部楼层
进入目录 SDK_2.3.0_EVK-MIMXRT1050/boards/firemimxrt1052/demo_apps/test_rt1052/armgcc
设置工具链环境变量 export ARMGCC_DIR=/opt/gcc-arm-none-eabi-9-2019-q4-major
运行 ./build_flexspi_nor_debug.sh
3.PNG
运行成功应该会输出如下信息
4.PNG
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-3-20 17:23:21 | 显示全部楼层
添加野火板子flash下载算法:
将 SDK_2.3.0_EVK-MIMXRT1050\boards\firemimxrt1052 目录下的 target_MIMXRT1052CVL5B.py
复制到 Python38/Lib/site-packages/pyocd/target/builtin 目录下并编辑此目录下的 __init__.py 文件
添加内容
from . import target_MIMXRT1052CVL5B
'mimxrt1052cvl5b': target_MIMXRT1052CVL5B.MIMXRT1052CVL5B

5.PNG

6.PNG




回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-3-20 17:28:52 | 显示全部楼层
进入 SDK_2.3.0_EVK-MIMXRT1050\boards\firemimxrt1052\demo_apps\test_rt1052\armgcc\flexspi_nor_debug 目录能看到生成的 hex map等文件
运行 pyocd-flashtool.exe -t mimxrt1052cvl5b -se .\test_rt1052.hex 命令将文件下载的flash
(-se 仅对用到的flash块做清空, -ce 清空整个flash)
成功下载应该能看到如下输出
7.PNG
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-3-20 17:38:58 | 显示全部楼层
启动调试
先运行 pyocd-gdbserver.exe --target mimxrt1052cvl5b 命令
再运行 arm-none-eabi-gdb -q
1.PNG
2.PNG
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-3-20 17:40:17 | 显示全部楼层
gdb.init内容如下:
commands start
file test_rt1052.elf
target remote localhost:3333
monitor reset
monitor halt
load
disconnect
target remote localhost:3333
b main
c
回复 支持 反对

使用道具 举报

发表于 2020-3-20 22:11:11 | 显示全部楼层
回复

使用道具 举报

发表于 2020-6-19 10:28:18 | 显示全部楼层
楼主很厉害啊,请问一下我想一直在STM32H7上使用PYOCD的话 遇到问题了,提交到了github的iss但是还没有人回应,楼主有空帮忙看看吗?
https://github.com/mbedmicro/pyOCD/issues/900
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-19 17:27:49 | 显示全部楼层
whjxxxxx 发表于 2020-6-19 10:28
楼主很厉害啊,请问一下我想一直在STM32H7上使用PYOCD的话 遇到问题了,提交到了github的iss但是还没有人回 ...

我也遇到了这个问题,不过临时解决了..
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-19 17:30:26 | 显示全部楼层
本帖最后由 lizimu 于 2020-6-19 17:34 编辑


捕获.PNG 直接把keil的h7xx的pack包放到这个路径
2.5.0是包的版本.

回复 支持 反对

使用道具 举报

发表于 2020-6-20 10:08:09 | 显示全部楼层
lizimu 发表于 2020-6-19 17:30
直接把keil的h7xx的pack包放到这个路径
2.5.0是包的版本.

我的版本是2.3.0难道是版本的问题?
楼主能贴一下target_STM32H7XX.py文件吗?
楼主方便加个企鹅沟通吗?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-20 10:19:46 | 显示全部楼层
whjxxxxx 发表于 2020-6-20 10:08
我的版本是2.3.0难道是版本的问题?
楼主能贴一下target_STM32H7XX.py文件吗?
楼主方便加个企鹅沟通吗? ...

加了pack包,不需要添加target_XXXX文件了.
回复 支持 反对

使用道具 举报

发表于 2020-6-20 10:25:56 | 显示全部楼层
lizimu 发表于 2020-6-20 10:19
加了pack包,不需要添加target_XXXX文件了.

感谢楼主的回复,2.5的pack包正在下载
回复 支持 反对

使用道具 举报

发表于 2020-6-20 10:27:30 | 显示全部楼层
lizimu 发表于 2020-6-20 10:19
加了pack包,不需要添加target_XXXX文件了.

另外请教一下楼主,我是参考的这个文档https://github.com/mbedmicro/pyO ... ding_new_targets.md。不需要添加target的文件的方法是使用的哪一个呢?
回复 支持 反对

使用道具 举报

发表于 2020-6-20 10:57:39 | 显示全部楼层
lizimu 发表于 2020-6-20 10:19
加了pack包,不需要添加target_XXXX文件了.

楼主您好,我按照你的方式把pack包放入了指定了路径使用了命令 pyocd gdbserver --pack=C:\Users\Administrator\AppData\Local\cmsis-pack-manager\cmsis-pack-manager\Keil\Keil.STM32H7xx_DFP.2.5.0.pack
  1. C:\Users\Administrator>pyocd gdbserver --pack=C:\Users\Administrator\AppData\Local\cmsis-pack-manager\cmsis-pack-manager\Keil\Keil.STM32H7xx_DFP.2.5.0.pack
  2. 0000363:INFO:board:Target type is cortex_m
  3. 0000364:WARNING:board:Generic 'cortex_m' target type is selected; is this intentional? You will be able to debug but not program flash. To set the target type use the '--target' argument or 'target_override' option. Use 'pyocd list --targets' to see available targets types.
  4. 0000382:INFO:dap:DP IDR = 0x6ba02477 (v2 rev6)
  5. 0000391:INFO:ap:AP#0 IDR = 0x84770001 (AHB-AP var0 rev8)
  6. 0000400:INFO:ap:AP#1 IDR = 0x84770001 (AHB-AP var0 rev8)
  7. 0000407:INFO:ap:AP#2 IDR = 0x54770002 (APB-AP var0 rev5)
  8. 0000418:INFO:rom_table:AP#0 Class 0x1 ROM table #0 [url=home.php?mod=space&uid=5830]@[/url] 0xe00fe000 (designer=020 part=450)
  9. 0000424:INFO:rom_table:[0]<e00ff000:ROM class=1 designer=43b part=4c7>
  10. 0000424:INFO:rom_table:  AP#0 Class 0x1 ROM table #1 @ 0xe00ff000 (designer=43b part=4c7)
  11. 0000434:INFO:rom_table:  [0]<e000e000:SCS-M4 class=14 designer=43b part=00c>
  12. 0000437:INFO:rom_table:  [1]<e0001000:DWT class=14 designer=43b part=002>
  13. 0000443:INFO:rom_table:  [2]<e0002000:FPB class=14 designer=43b part=00e>
  14. 0000446:INFO:rom_table:  [3]<e0000000:ITM class=14 designer=43b part=001>
  15. 0000451:INFO:rom_table:[1]<e0041000:ETM-M7 class=9 designer=43b part=975 devtype=13 archid=4a13 devid=0:0:0>
  16. 0000456:INFO:rom_table:[2]<e0043000:CTI class=9 designer=43b part=906 devtype=14 archid=0000 devid=40800:0:0>
  17. 0000460:INFO:rom_table:AP#2 Class 0x1 ROM table #0 @ 0xe00e0000 (designer=020 part=450)
  18. 0000468:WARNING:rom_table:Invalid coresight component, cidr=0x0
  19. 0000469:INFO:rom_table:[2]<e00e3000: cidr=0, pidr=0, component invalid>
  20. 0000475:WARNING:rom_table:Invalid coresight component, cidr=0x0
  21. 0000477:INFO:rom_table:[3]<e00e4000: cidr=0, pidr=0, component invalid>
  22. 0000486:INFO:rom_table:[4]<e00e5000:TSGEN class=15 designer=43b part=101>
  23. 0000489:ERROR:rom_table:Error attempting to probe CoreSight component referenced by ROM table entry #5: SWD/JTAG Transfer Fault @ 0xe00f0fbc-0xe00f0fff
  24. Traceback (most recent call last):
  25.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 343, in read_ap_multiple
  26.     result = self._link.reg_read_repeat(count, ap_reg, dap_index=0, now=now)
  27.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 849, in reg_read_repeat
  28.     return reg_read_repeat_cb()
  29.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 844, in reg_read_repeat_cb
  30.     res = transfer.get_result()
  31.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 141, in get_result
  32.     self.daplink.flush()
  33.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 658, in flush
  34.     self._read_packet()
  35.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 887, in _read_packet
  36.     decoded_data = cmd.decode_data(raw_data)
  37.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 449, in decode_data
  38.     data = self._decode_transfer_data(data)
  39.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 356, in _decode_transfer_data
  40.     self._check_response(data[2])
  41.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 335, in _check_response
  42.     raise DAPAccessIntf.TransferFaultError()
  43. pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferFaultError

  44. The above exception was the direct cause of the following exception:

  45. Traceback (most recent call last):
  46.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\rom_table.py", line 339, in _read_table
  47.     self._handle_table_entry(entry, entryNumber)
  48.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\rom_table.py", line 389, in _handle_table_entry
  49.     cmpid.read_id_registers()
  50.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\rom_table.py", line 109, in read_id_registers
  51.     regs = self.ap.read_memory_block32(self.top_address + self.IDR_READ_START, self.IDR_READ_COUNT)
  52.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\ap.py", line 142, in _locking
  53.     return func(self, *args, **kwargs)
  54.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\ap.py", line 680, in _read_memory_block32
  55.     resp += self._read_block32(addr, n//4)
  56.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\ap.py", line 142, in _locking
  57.     return func(self, *args, **kwargs)
  58.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\ap.py", line 640, in _read_block32
  59.     resp = self.dp.probe.read_ap_multiple((self.ap_num << APSEL_SHIFT) | MEM_AP_DRW, size)
  60.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 346, in read_ap_multiple
  61.     six.raise_from(self._convert_exception(exc), exc)
  62.   File "<string>", line 3, in raise_from
  63. pyocd.core.exceptions.TransferFaultError: SWD/JTAG Transfer Fault @ 0xe00f0fbc-0xe00f0fff
  64. 0000494:INFO:cortex_m:CPU core #0 is Cortex-M7 r1p1
  65. 0000505:INFO:cortex_m:FPU present: FPv5
  66. 0000509:INFO:dwt:4 hardware watchpoints
  67. 0000513:INFO:fpb:8 hardware breakpoints, 1 literal comparators
  68. 0000531:INFO:server:Semihost server started on port 4444 (core 0)
  69. 0000533:INFO:gdbserver:GDB server started on port 3333 (core 0)
  70. 0040649:INFO:gdbserver:One client connected!
  71. 0091762:INFO:gdbserver:Client disconnected!

  72. C:\Users\Administrator>pyocd gdbserver --pack=C:\Users\Administrator\AppData\Local\cmsis-pack-manager\cmsis-pack-manager\Keil\Keil.STM32H7xx_DFP.2.5.0.pack
  73. 0000363:INFO:board:Target type is cortex_m
  74. 0000363:WARNING:board:Generic 'cortex_m' target type is selected; is this intentional? You will be able to debug but not program flash. To set the target type use the '--target' argument or 'target_override' option. Use 'pyocd list --targets' to see available targets types.
  75. 0000377:INFO:dap:DP IDR = 0x6ba02477 (v2 rev6)
  76. 0000386:INFO:ap:AP#0 IDR = 0x84770001 (AHB-AP var0 rev8)
  77. 0000395:INFO:ap:AP#1 IDR = 0x84770001 (AHB-AP var0 rev8)
  78. 0000403:INFO:ap:AP#2 IDR = 0x54770002 (APB-AP var0 rev5)
  79. 0000414:INFO:rom_table:AP#0 Class 0x1 ROM table #0 @ 0xe00fe000 (designer=020 part=450)
  80. 0000420:INFO:rom_table:[0]<e00ff000:ROM class=1 designer=43b part=4c7>
  81. 0000420:INFO:rom_table:  AP#0 Class 0x1 ROM table #1 @ 0xe00ff000 (designer=43b part=4c7)
  82. 0000430:INFO:rom_table:  [0]<e000e000:SCS-M4 class=14 designer=43b part=00c>
  83. 0000434:INFO:rom_table:  [1]<e0001000:DWT class=14 designer=43b part=002>
  84. 0000438:INFO:rom_table:  [2]<e0002000:FPB class=14 designer=43b part=00e>
  85. 0000442:INFO:rom_table:  [3]<e0000000:ITM class=14 designer=43b part=001>
  86. 0000446:INFO:rom_table:[1]<e0041000:ETM-M7 class=9 designer=43b part=975 devtype=13 archid=4a13 devid=0:0:0>
  87. 0000450:INFO:rom_table:[2]<e0043000:CTI class=9 designer=43b part=906 devtype=14 archid=0000 devid=40800:0:0>
  88. 0000454:INFO:rom_table:AP#2 Class 0x1 ROM table #0 @ 0xe00e0000 (designer=020 part=450)
  89. 0000460:WARNING:rom_table:Invalid coresight component, cidr=0x0
  90. 0000461:INFO:rom_table:[2]<e00e3000: cidr=0, pidr=0, component invalid>
  91. 0000464:WARNING:rom_table:Invalid coresight component, cidr=0x0
  92. 0000465:INFO:rom_table:[3]<e00e4000: cidr=0, pidr=0, component invalid>
  93. 0000472:INFO:rom_table:[4]<e00e5000:TSGEN class=15 designer=43b part=101>
  94. 0000474:ERROR:rom_table:Error attempting to probe CoreSight component referenced by ROM table entry #5: SWD/JTAG Transfer Fault @ 0xe00f0fbc-0xe00f0fff
  95. Traceback (most recent call last):
  96.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 343, in read_ap_multiple
  97.     result = self._link.reg_read_repeat(count, ap_reg, dap_index=0, now=now)
  98.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 849, in reg_read_repeat
  99.     return reg_read_repeat_cb()
  100.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 844, in reg_read_repeat_cb
  101.     res = transfer.get_result()
  102.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 141, in get_result
  103.     self.daplink.flush()
  104.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 658, in flush
  105.     self._read_packet()
  106.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 887, in _read_packet
  107.     decoded_data = cmd.decode_data(raw_data)
  108.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 449, in decode_data
  109.     data = self._decode_transfer_data(data)
  110.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 356, in _decode_transfer_data
  111.     self._check_response(data[2])
  112.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 335, in _check_response
  113.     raise DAPAccessIntf.TransferFaultError()
  114. pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferFaultError

  115. The above exception was the direct cause of the following exception:

  116. Traceback (most recent call last):
  117.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\rom_table.py", line 339, in _read_table
  118.     self._handle_table_entry(entry, entryNumber)
  119.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\rom_table.py", line 389, in _handle_table_entry
  120.     cmpid.read_id_registers()
  121.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\rom_table.py", line 109, in read_id_registers
  122.     regs = self.ap.read_memory_block32(self.top_address + self.IDR_READ_START, self.IDR_READ_COUNT)
  123.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\ap.py", line 142, in _locking
  124.     return func(self, *args, **kwargs)
  125.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\ap.py", line 680, in _read_memory_block32
  126.     resp += self._read_block32(addr, n//4)
  127.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\ap.py", line 142, in _locking
  128.     return func(self, *args, **kwargs)
  129.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\coresight\ap.py", line 640, in _read_block32
  130.     resp = self.dp.probe.read_ap_multiple((self.ap_num << APSEL_SHIFT) | MEM_AP_DRW, size)
  131.   File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 346, in read_ap_multiple
  132.     six.raise_from(self._convert_exception(exc), exc)
  133.   File "<string>", line 3, in raise_from
  134. pyocd.core.exceptions.TransferFaultError: SWD/JTAG Transfer Fault @ 0xe00f0fbc-0xe00f0fff
  135. 0000479:INFO:cortex_m:CPU core #0 is Cortex-M7 r1p1
  136. 0000489:INFO:cortex_m:FPU present: FPv5
  137. 0000493:INFO:dwt:4 hardware watchpoints
  138. 0000497:INFO:fpb:8 hardware breakpoints, 1 literal comparators
  139. 0000513:INFO:server:Semihost server started on port 4444 (core 0)
  140. 0000513:INFO:gdbserver:GDB server started on port 3333 (core 0)
复制代码
打印了这些信息,但是在F407上 和 F429 测试是不会打印这么多信息的,可以正确连接下载调试
回复 支持 反对

使用道具 举报

发表于 2020-6-20 11:27:04 | 显示全部楼层
通过pack的方式只能调试 并不能下载程序
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-20 14:36:00 | 显示全部楼层
whjxxxxx 发表于 2020-6-20 11:27
通过pack的方式只能调试 并不能下载程序

内部flash可以下载,外部flash我也没搞定.
回复 支持 反对

使用道具 举报

发表于 2020-6-21 15:20:14 | 显示全部楼层
lizimu 发表于 2020-6-20 14:36
内部flash可以下载,外部flash我也没搞定.

我最近也在研究这个,后续有进展我们再交流啊
回复 支持 反对

使用道具 举报

发表于 2020-7-30 11:05:33 | 显示全部楼层
lizimu 发表于 2020-6-20 14:36
内部flash可以下载,外部flash我也没搞定.

STM32H750XBH6 下载QSPI FLASH已经测试成功
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-7-30 19:57:55 | 显示全部楼层
whjxxxxx 发表于 2020-7-30 11:05
STM32H750XBH6 下载QSPI FLASH已经测试成功

怎么做分享一下.
回复 支持 反对

使用道具 举报

发表于 2020-8-4 10:40:17 | 显示全部楼层
lizimu 发表于 2020-7-30 19:57
怎么做分享一下.

其实和片内的区别不大,你要确保编译器编译出来的ELF文件是你的片外的地址,比如H7的 0x90000000
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-8-4 15:49:14 | 显示全部楼层
whjxxxxx 发表于 2020-8-4 10:40
其实和片内的区别不大,你要确保编译器编译出来的ELF文件是你的片外的地址,比如H7的 0x90000000 ...

这个我知道的,在链接脚本里设置,外置flash下载算法如何加载呢?我试过按片内的来,但是失败了.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-11-23 18:50 , Processed in 0.071891 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表