PyOCD Notes
Installation
Ubuntu20.04
For Ubuntu20.04 the version in apt repository is 0.13.1+dfsg-1, which is too low to recognize J-Link probe
$ apt-cache show python3-pyocd
Package: python3-pyocd
Architecture: all
Version: 0.13.1+dfsg-1
Priority: optional
When you run pyocd-tool list
it won't detect the jlink probe
Remove
sudo apt remove python3-pyocd
Then install from pip
pip install pyocd
This will work (it's a J-Link clone)
~$ pyocd list
# Probe/Board Unique ID Target
----------------------------------------------------
0 Segger J-Link (unknown) 123456 n/a
Ubuntu 22.04
This is instantly available but not recommended
sudo pip install pyocd
# or with a mirror
sudo pip install pyocd -i https://mirrors.ustc.edu.cn/pypi/web/simple/
# This will install pyocd (currently pyocd-0.34.2) into:
/usr/local/bin/pyocd
/usr/local/bin/pyocd-gdbserver
/usr/local/lib/python3.10/dist-packages/pyocd-0.34.2.dist-info/*
/usr/local/lib/python3.10/dist-packages/pyocd/*
This is recommended but not instantly available (you need logout & login)
pip uninstall pyocd
# This will install pyocd into:
/home/milton/.local/bin/pyocd
/home/milton/.local/bin/pyocd-gdbserver
/home/milton/.local/lib/python3.10/site-packages/pyocd-0.34.2.dist-info/*
/home/milton/.local/lib/python3.10/site-packages/pyocd/*
You don't need to add .local/bin to the PATH because .profile already takes care of it, but it won't take effect until your next login
Basic Commands
# Show helps
pyocd --help
pyocd list --help
pyocd pack --help
# List information about probes
pyocd list
# List available targets
pyocd list -t
# Manage CMSIS-Packs for target support, clean packs
pyocd pack -c
# List install packs
pyocd pack -s
# Update pack index
pyocd pack -u
# Show pack info according to IC type
pyocd pack -f stm32f103
# Install pack for specified IC type
pyocd pack -i stm32f103
# Reset a target device.
pyocd reset
# Run debug probe server.
pyocd server
Add New Targets
According to Target Support, pyocd list -t
will list built-in targets, if you want to add new targets, you should run the following commands
# Clean packs
pyocd pack -c
# List install packs
pyocd pack -s
# Update pack index
pyocd pack -u
# Show pack info according to IC type
pyocd pack -f stm32f103
# Install pack for specified IC type
pyocd pack -i stm32f103
The above command pyocd pack -u
will download all .pdsc files into $HOME/.local/share/cmsis-pack-manager/, and generate aliases.json and index.json. But this command may not succeeded -- it's very slow and full of connection errors and format errors.
If you just want specified target types, and you happen to have the pack files, you can manually add the target support by creating a configuration file.
create a file named pyocd.yaml
with the following content
pack:
- ./Misc/ArteryTek.AT32F403A_407_DFP.2.1.3.pack
- [relative or absolute paths to other pack files]
Then run pyocd from the same folder, it will take this file as configuration and treat these pack files as installed,
$ pyocd list -t
Name Vendor Part Number Families Source
-----------------------------------------------------------------------------------------------------------------------
_at32f403acct7 ArteryTek -AT32F403ACCT7 AT32F40x Series, AT32F403A pack
_at32f403accu7 ArteryTek -AT32F403ACCU7 AT32F40x Series, AT32F403A pack
_at32f403acet7 ArteryTek -AT32F403ACET7 AT32F40x Series, AT32F403A pack
...
_at32f407vet7 ArteryTek -AT32F407VET7 AT32F40x Series, AT32F407 pack
_at32f407vgt7 ArteryTek -AT32F407VGT7 AT32F40x Series, AT32F407 pack
cc3220sf Texas Instruments CC3220SF builtin
cortex_m Generic CoreSightTarget builtin
You can rename this configuration file and place it to other path, and specify this configuration with --config
$ pyocd list -t --config ./Misc/pyocd_renamed.yaml
Name Vendor Part Number Families Source
-----------------------------------------------------------------------------------------------------------------------
_at32f403acct7 ArteryTek -AT32F403ACCT7 AT32F40x Series, AT32F403A pack
_at32f403accu7 ArteryTek -AT32F403ACCU7 AT32F40x Series, AT32F403A pack
_at32f403acet7 ArteryTek -AT32F403ACET7 AT32F40x Series, AT32F403A pack
_at32f403aceu7 ArteryTek -AT32F403ACEU7 AT32F40x Series, AT32F403A pack
...
_at32f407vet7 ArteryTek -AT32F407VET7 AT32F40x Series, AT32F407 pack
_at32f407vgt7 ArteryTek -AT32F407VGT7 AT32F40x Series, AT32F407 pack
cc3220sf Texas Instruments CC3220SF builtin
cortex_m Generic CoreSightTarget builtin
cy8c64_sysap Cypress cy8c64_sysap builtin
Operations
Take AT32F403ACGT7 for example.
Reset
Reset
pyocd reset -t _at32f403acgt7 --config somewhere/pyocd.yaml
Reset and halt
pyocd reset -l -t _at32f403acgt7 --config somewhere/pyocd.yaml
Erase
Erase entire chip, target is _at32f403acgt7
$ pyocd erase -t _at32f403acgt7 -c --config somewhere/pyocd.yaml
0000972 I Erasing chip... [eraser]
0003906 I Chip erase complete [eraser]
Flash(Load)
$ pyocd load -t _at32f403acgt7 ./led_toggle.hex --config somewhere/pyocd.yaml
0000957 I Loading /home/milton/somewhere/led_toggle.hex [load_cmd]
[==================================================] 100%
0001481 I Erased 4096 bytes (2 sectors), programmed 3072 bytes (3 pages), skipped 0 bytes (0 pages) at 5.77 kB/s [loader]
Enter Commander Mode
$ pyocd commander -v -v -t _at32f403acgt7 --config somewhere/pyocd.yaml
This will display the chip details
0000882 D STLink probe 0669FF525252714987194517 firmware version: V2J39M27 [stlink]
...
0000899 D flash algo: [code=0x2e0] [b1=0x2e0,0x6e0] [b2=0x6e0,0xae0] [stack=0x2ae0; 0x2000 b] (ram=0x20000000, 0x4000 b) [flash_algo]
0000901 I Target type is _at32f421c8t7 [board]
0000903 D STLink probe 0669FF525252714987194517 firmware version: V2J39M27 [stlink]
0000904 D Running task load_svd [sequencer]
...
0000940 I DP IDR = 0x2ba01477 (v1 rev2) [dap]
...
0000943 D Using accelerated memory access interface for AHB-AP#0 [ap]
0000943 I AHB-AP#0 IDR = 0x24770011 (AHB-AP var1 rev2) [ap]
0000944 D AHB-AP#0 default HPROT=3 HNONSEC=0 [ap]
0000945 D AHB-AP#0 implemented HPROT=3 HNONSEC=0 [ap]
0000945 D Running task find_components [sequencer]
0000946 D Running task init_ap.0 [sequencer]
0000949 I AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=43b:Arm part=4c4) [rom_table]
0000952 I [0]<e000e000:SCS v7-M class=14 designer=43b:Arm part=000> [rom_table]
0000953 I [1]<e0001000:DWT v7-M class=14 designer=43b:Arm part=002> [rom_table]
0000954 I [2]<e0002000:FPB v7-M class=14 designer=43b:Arm part=003> [rom_table]
0000956 I [3]<e0000000:ITM v7-M class=14 designer=43b:Arm part=001> [rom_table]
0000959 I [4]<e0040000:TPIU M4 class=9 designer=43b:Arm part=9a1 devtype=11 archid=0000 devid=ca1:0:0> [rom_table]
0000960 W Invalid coresight component, cidr=0x0 [rom_table]
0000960 I [5]e0041000: cidr=0, pidr=0, component invalid> [rom_table]
0000960 D Running task create_cores [sequencer]
0000960 D Creating SCS component [discovery]
0000961 D selected core #0 [soc_target]
0000962 I CPU core #0 is Cortex-M4 r0p1 [cortex_m]
0000963 D Running task set_default_reset_type [sequencer]
0000963 D Running task create_components [sequencer]
0000963 D Creating DWT component [discovery]
0000964 I 4 hardware watchpoints [dwt]
0000967 D Creating FPB component [discovery]
0000967 I 6 hardware breakpoints, 4 literal comparators [fpb]
0000968 D fpb has been disabled [fpb]
0000972 D Creating ITM component [discovery]
0000974 D Creating TPIU component [discovery]
...
Connected to -AT32F421C8T7 [Running]: 0669FF525252714987194517
Reference
- PyOCD Official Site
- Installation https://pyocd.io/docs/installing.html
- Add targets https://pyocd.io/docs/target_support.html
- Configuration https://pyocd.io/docs/configuration.html
- https://github.com/MDK-Packs/
- https://www.keil.com/dd2/pack/
PyOCD Notes的更多相关文章
- ASP.NET Core 1.1.0 Release Notes
ASP.NET Core 1.1.0 Release Notes We are pleased to announce the release of ASP.NET Core 1.1.0! Antif ...
- Android Weekly Notes Issue #237
Android Weekly Issue #237 December 25th, 2016 Android Weekly Issue #237 这是本年的最后一篇issue, 感谢大家. 本期内容包括 ...
- Android Weekly Notes Issue #230
Android Weekly Notes Issue #230 November 6th, 2016 Android Weekly Issue #230. Android Weekly笔记, 本期内容 ...
- Android Weekly Notes Issue #229
Android Weekly Issue #229 October 30th, 2016 Android Weekly Issue #229 Android Weekly笔记, 本期内容包括: 性能库 ...
- Android Weekly Notes Issue #227
Android Weekly Issue #227 October 16th, 2016 Android Weekly Issue #227. 本期内容包括: Google的Mobile Vision ...
- Android Weekly Notes Issue #221
Android Weekly Issue #221 September 4th, 2016 Android Weekly Issue #221 ARTICLES & TUTORIALS And ...
- Android Weekly Notes Issue #219
Android Weekly Issue #219 August 21st, 2016 Android Weekly Issue #219 ARTICLES & TUTORIALS Andro ...
- MAGIC XPA最新版本Magic xpa 2.4c Release Notes
New Features, Feature Enhancements and Behavior ChangesSubforms – Behavior Change for Unsupported Ta ...
- Magic xpa 2.5发布 Magic xpa 2.5 Release Notes
Magic xpa 2.5發佈 Magic xpa 2.5 Release Notes Magic xpa 2.5 Release NotesNew Features, Feature Enhance ...
- Git for Windows v2.11.0 Release Notes
homepage faq contribute bugs questions Git for Windows v2.11.0 Release Notes Latest update: December ...
随机推荐
- Pgsql之查询一个月份的天数
前几天干活儿的时候,项目中有这么个需求,需要用pgsql查询某个月份有多少天,下面贴代码: select date_part('days', date_trunc('month', to_timest ...
- [转帖]配置cri-docker使kubernetes1.24以docker作为运行时
从kubernetes 1.24开始,dockershim已经从kubelet中移除,但因为历史问题docker却不支持kubernetes主推的CRI(容器运行时接口)标准,所以docker不能再作 ...
- memtester 以及 mlc 简单学习
memtester 以及 mlc 简单学习 下载 memtester https://pyropus.ca./software/memtester/ 下载好后直接进行 make 和make insta ...
- [转帖]总结:nginx502:Tomcat调优之acceptCount
问题背景:UI页面点击会偶尔返回error,检查调用日志,发现nginx报502报错,因此本文即排查502报错原因. 如下红框可知,访问本机个备机的服务502了,用时3秒左右(可见并不是超时) 先给出 ...
- 一招轻松解决node内存溢出问题
node启动项目造成内存溢出的解决办法 我们在使用node启动项目的时在项目较大的时候,可能会造成内存溢出.为什么会造成内存溢出呢? 要回答上面这个问题,我们要了解node中是如何分配内存的. Nod ...
- 每日一道面试题:Java中序列化与反序列化
写在开头 哈喽大家好,在高铁上码字的感觉是真不爽啊,小桌板又拥挤,旁边的小朋友也比较的吵闹,影响思绪,但这丝毫不影响咱学习的劲头!哈哈哈,在这喧哗的车厢中,思考着这样的一个问题,Java中的对象是如何 ...
- 领域知识图谱-中式菜谱知识图谱:实现知识图谱可视化和知识库智能问答系统(KBQA)
领域知识图谱-中式菜谱知识图谱:实现知识图谱可视化和知识库智能问答系统(KBQA) A knowledge graph for Chinese cookbook(中式菜谱知识图谱),可以实现知识图谱可 ...
- 深度学习应用篇-自然语言处理[10]:N-Gram、SimCSE介绍,更多技术:数据增强、智能标注、多分类算法、文本信息抽取、多模态信息抽取、模型压缩算法等
深度学习应用篇-自然语言处理[10]:N-Gram.SimCSE介绍,更多技术:数据增强.智能标注.多分类算法.文本信息抽取.多模态信息抽取.模型压缩算法等 1.N-Gram N-Gram是一种基于统 ...
- 数据挖掘机器学习[五]---汽车交易价格预测详细版本{模型融合(Stacking、Blending、Bagging和Boosting)}
题目出自阿里天池赛题链接:零基础入门数据挖掘 - 二手车交易价格预测-天池大赛-阿里云天池 相关文章: 特征工程详解及实战项目[参考] 数据挖掘---汽车车交易价格预测[一](测评指标:EDA) 数据 ...
- C++ Qt开发:数据库与TableView多组件联动
Qt 是一个跨平台C++图形界面开发库,利用Qt可以快速开发跨平台窗体应用程序,在Qt中我们可以通过拖拽的方式将不同组件放到指定的位置,实现图形化开发极大的方便了开发效率,本章将重点介绍TableVi ...