Ubuntu 24.04下安装使用pyocd Jlink

Ubuntu 24.04下安装使用pyocd Jlink

兼容J-link OB ARM仿真下载调试器 SWD编程器, 淘宝7-9元一套

安装

安装Jlink驱动

1
2
去这个地址下载deb程序
https://www.segger.com/downloads/jlink/

安装Python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$ sudo apt install python-is-python3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  python-is-python3
0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.
Need to get 2,684 B of archives.
After this operation, 15.4 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu noble/main amd64 python-is-python3 all 3.11.4-1 [2,684 B]
Fetched 2,684 B in 2s (1,672 B/s)             
Selecting previously unselected package python-is-python3.
(Reading database ... 158342 files and directories currently installed.)
Preparing to unpack .../python-is-python3_3.11.4-1_all.deb ...
Unpacking python-is-python3 (3.11.4-1) ...
Setting up python-is-python3 (3.11.4-1) ...
Processing triggers for man-db (2.12.0-4build2) ...
1
2
3
4
$ python
Python 3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

安装 pipx

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$ sudo apt install pipx
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  python3-argcomplete python3-packaging python3-pip-whl python3-platformdirs python3-psutil python3-setuptools-whl python3-userpath python3-venv python3.12-venv
The following NEW packages will be installed:
  pipx python3-argcomplete python3-packaging python3-pip-whl python3-platformdirs python3-psutil python3-setuptools-whl python3-userpath python3-venv python3.12-venv
0 upgraded, 10 newly installed, 0 to remove and 35 not upgraded.
Need to get 3,508 kB of archives.
After this operation, 7,832 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3-pip-whl all 24.0+dfsg-1ubuntu1.1 [1,703 kB]
Get:2 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3-setuptools-whl all 68.1.2-2ubuntu1.1 [716 kB]
Get:3 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3.12-venv amd64 3.12.3-1ubuntu0.5 [5,678 B]
Get:4 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3-venv amd64 3.12.3-0ubuntu2 [1,034 B]
Get:5 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 python3-argcomplete all 3.1.4-1ubuntu0.1 [33.8 kB]
Get:6 http://archive.ubuntu.com/ubuntu noble/main amd64 python3-packaging all 24.0-1 [41.1 kB]
Get:7 http://archive.ubuntu.com/ubuntu noble/main amd64 python3-platformdirs all 4.2.0-1 [16.1 kB]
Get:8 http://archive.ubuntu.com/ubuntu noble/universe amd64 python3-userpath all 1.9.1-1 [9,416 B]
Get:9 http://archive.ubuntu.com/ubuntu noble/universe amd64 pipx all 1.4.3-1 [787 kB]
Get:10 http://archive.ubuntu.com/ubuntu noble/main amd64 python3-psutil amd64 5.9.8-2build2 [195 kB]
Fetched 3,508 kB in 3s (1,301 kB/s)       
Selecting previously unselected package python3-pip-whl.
(Reading database ... 161768 files and directories currently installed.)
Preparing to unpack .../0-python3-pip-whl_24.0+dfsg-1ubuntu1.1_all.deb ...
Unpacking python3-pip-whl (24.0+dfsg-1ubuntu1.1) ...
Selecting previously unselected package python3-setuptools-whl.
Preparing to unpack .../1-python3-setuptools-whl_68.1.2-2ubuntu1.1_all.deb ...
Unpacking python3-setuptools-whl (68.1.2-2ubuntu1.1) ...
Selecting previously unselected package python3.12-venv.
Preparing to unpack .../2-python3.12-venv_3.12.3-1ubuntu0.5_amd64.deb ...
Unpacking python3.12-venv (3.12.3-1ubuntu0.5) ...
Selecting previously unselected package python3-venv.
Preparing to unpack .../3-python3-venv_3.12.3-0ubuntu2_amd64.deb ...
Unpacking python3-venv (3.12.3-0ubuntu2) ...
Selecting previously unselected package python3-argcomplete.
Preparing to unpack .../4-python3-argcomplete_3.1.4-1ubuntu0.1_all.deb ...
Unpacking python3-argcomplete (3.1.4-1ubuntu0.1) ...
Selecting previously unselected package python3-packaging.
Preparing to unpack .../5-python3-packaging_24.0-1_all.deb ...
Unpacking python3-packaging (24.0-1) ...
Selecting previously unselected package python3-platformdirs.
Preparing to unpack .../6-python3-platformdirs_4.2.0-1_all.deb ...
Unpacking python3-platformdirs (4.2.0-1) ...
Selecting previously unselected package python3-userpath.
Preparing to unpack .../7-python3-userpath_1.9.1-1_all.deb ...
Unpacking python3-userpath (1.9.1-1) ...
Selecting previously unselected package pipx.
Preparing to unpack .../8-pipx_1.4.3-1_all.deb ...
Unpacking pipx (1.4.3-1) ...
Selecting previously unselected package python3-psutil.
Preparing to unpack .../9-python3-psutil_5.9.8-2build2_amd64.deb ...
Unpacking python3-psutil (5.9.8-2build2) ...
Setting up python3-setuptools-whl (68.1.2-2ubuntu1.1) ...
Setting up python3-pip-whl (24.0+dfsg-1ubuntu1.1) ...
Setting up python3-platformdirs (4.2.0-1) ...
Setting up python3-psutil (5.9.8-2build2) ...
Setting up python3-packaging (24.0-1) ...
Setting up python3-argcomplete (3.1.4-1ubuntu0.1) ...
Setting up python3-userpath (1.9.1-1) ...
Setting up python3.12-venv (3.12.3-1ubuntu0.5) ...
Setting up python3-venv (3.12.3-0ubuntu2) ...
Setting up pipx (1.4.3-1) ...
Processing triggers for man-db (2.12.0-4build2) ...

安装pyocd

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
$ pipx install pyocd
  installed package pyocd 0.36.0, installed using Python 3.12.3
  These apps are now globally available
    - pyocd
    - pyocd-gdbserver
  Note: '/home/knightli/.local/bin' is not on your PATH environment variable. These apps will not be globally accessible until your PATH is updated. Run `pipx ensurepath` to automatically add it, or manually modify your PATH in
    your shell's config file (i.e. ~/.bashrc).
done!  🌟 
$ pipx ensurepath
Success! Added /home/knightli/.local/bin to the PATH environment variable.

Consider adding shell completions for pipx. Run 'pipx completions' for instructions.

You will need to open a new terminal or re-login for the PATH changes to take effect.

Otherwise pipx is ready to go!  🌟 

pyocd的使用

-V 列出版本号

1
2
knightli@knightli-py32:~$ pyocd -V
0.36.0

pyocd list 命令

1
2
3
4
5
6
7
8
-p 命令使用来查看调试器的信息,
pyocd list / pyocd list -p
列出连接到电脑上的 dap link 或者 jlink的信息

knightli@knightli-py32:~$ pyocd list -p
  #   Probe/Board               Unique ID    Target  
-----------------------------------------------------
  0   Segger J-Link (unknown)   4294967295   n/a  
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
knightli@knightli-py32:~$ pyocd list -t
列出所支持的IC,可以是内置的,也可以是通过安装pack获得支持的.
Source这一列  builtin 表示内置 pack表示通过安装pack获得支持的.


  Name                      Vendor                   Part Number                  Families   Source   
------------------------------------------------------------------------------------------------------
  air001                    AirM2M                   Air001                                  builtin  
  air32f103xb               AirM2M                   Air32F103xB                             builtin  
  air32f103xc               AirM2M                   Air32F103xC                             builtin  
  air32f103xe               AirM2M                   Air32F103xE                             builtin  
  air32f103xg               AirM2M                   Air32F103xG                             builtin  
  air32f103xp               AirM2M                   Air32F103xP                             builtin  
  cc3220sf                  Texas Instruments        CC3220SF                                builtin  
  cortex_m                  Generic                  CoreSightTarget                         builtin  
  cy8c64_sysap              Cypress                  cy8c64_sysap                            builtin  
  cy8c64x5_cm0              Cypress                  cy8c64x5_cm0                            builtin  
  cy8c64x5_cm0_full_flash   Cypress                  cy8c64x5_cm0_full_flash                 builtin  
  cy8c64x5_cm4              Cypress                  cy8c64x5_cm4                            builtin  
  cy8c64x5_cm4_full_flash   Cypress                  cy8c64x5_cm4_full_flash                 builtin  
  cy8c64xa_cm0              Cypress                  cy8c64xA_cm0                            builtin  
  cy8c64xa_cm0_full_flash   Cypress                  cy8c64xA_cm0_full_flash                 builtin  
  cy8c64xa_cm4              Cypress                  cy8c64xA_cm4                            builtin  
  cy8c64xa_cm4_full_flash   Cypress                  cy8c64xA_cm4_full_flash                 builtin  
  cy8c64xx_cm0              Cypress                  cy8c64xx_cm0                            builtin  
  cy8c64xx_cm0_full_flash   Cypress                  cy8c64xx_cm0_full_flash                 builtin  
  cy8c64xx_cm0_nosmif       Cypress                  cy8c64xx_cm0_nosmif                     builtin  
  cy8c64xx_cm0_s25hx512t    Cypress                  cy8c64xx_cm0_s25hx512t                  builtin  
  cy8c64xx_cm4              Cypress                  cy8c64xx_cm4                            builtin  
  cy8c64xx_cm4_full_flash   Cypress                  cy8c64xx_cm4_full_flash                 builtin  
  cy8c64xx_cm4_nosmif       Cypress                  cy8c64xx_cm4_nosmif                     builtin  
  cy8c64xx_cm4_s25hx512t    Cypress                  cy8c64xx_cm4_s25hx512t                  builtin  
  cy8c6xx5                  Cypress                  CY8C6xx5                                builtin  
  cy8c6xx7                  Cypress                  CY8C6xx7                                builtin  
  cy8c6xx7_nosmif           Cypress                  CY8C6xx7_nosmif                         builtin  
  cy8c6xx7_s25fs512s        Cypress                  CY8C6xx7_S25FS512S                      builtin  
  cy8c6xxa                  Cypress                  CY8C6xxA                                builtin  
  hc32a460xe                HDSC                     HC32F460xE                              builtin  
  hc32a4a0xi                HDSC                     HC32F4A0xI                              builtin  
  hc32f003                  HDSC                     HC32F003                                builtin  
  hc32f005                  HDSC                     HC32F005                                builtin  
  hc32f030                  HDSC                     HC32F030                                builtin  
  hc32f072                  HDSC                     HC32F072                                builtin  
  hc32f120x6                HDSC                     HC32F120x6TA                            builtin  
  hc32f120x8                HDSC                     HC32F120x8TA                            builtin  
  hc32f160xa                HDSC                     HC32F160xA                              builtin  
  hc32f160xc                HDSC                     HC32F160xC                              builtin  
  hc32f190                  HDSC                     HC32F190                                builtin  
  hc32f196                  HDSC                     HC32F196                                builtin  
  hc32f448xa                HDSC                     HC32F448xA                              builtin  
  hc32f448xc                HDSC                     HC32F448xC                              builtin  
  hc32f451xc                HDSC                     HC32F451xC                              builtin  
  hc32f451xe                HDSC                     HC32F451xE                              builtin  
  hc32f452xc                HDSC                     HC32F452xC                              builtin  
  hc32f452xe                HDSC                     HC32F452xE                              builtin  
  hc32f460xc                HDSC                     HC32F460xC                              builtin  
  hc32f460xe                HDSC                     HC32F460xE                              builtin  
  hc32f4a0xg                HDSC                     HC32F4A0xG                              builtin  
  hc32f4a0xi                HDSC                     HC32F4A0xI                              builtin  
  hc32l072                  HDSC                     HC32L072                                builtin  
  hc32l073                  HDSC                     HC32L073                                builtin  
  hc32l110                  HDSC                     HC32L110                                builtin  
  hc32l130                  HDSC                     HC32L130                                builtin  
  hc32l136                  HDSC                     HC32L136                                builtin  
  hc32l190                  HDSC                     HC32L190                                builtin  
  hc32l196                  HDSC                     HC32L196                                builtin  
  hc32m120                  HDSC                     HC32M120                                builtin  
  hc32m120x6                HDSC                     HC32M120                                builtin  
  hc32m423xa                HDSC                     HC32M423xA                              builtin  
  k20d50m                   NXP                      K20D50M                                 builtin  
  k22f                      NXP                      K22F                                    builtin  
  k22fa12                   NXP                      K22FA12                                 builtin  
  k28f15                    NXP                      K28F15                                  builtin  
  k32l2b3                   NXP                      K32L2B3                                 builtin  
  k32w042s                  NXP                      K32W042S                                builtin  
  k64f                      NXP                      K64F                                    builtin  
  k66f18                    NXP                      K66F18                                  builtin  
  k82f25615                 NXP                      K82F25615                               builtin  
  ke15z7                    NXP                      KE15Z7                                  builtin  
  ke17z7                    NXP                      KE17Z7                                  builtin  
  ke18f16                   NXP                      KE18F16                                 builtin  
  kinetis                   NXP                      Kinetis                                 builtin  
  kl02z                     NXP                      KL02Z                                   builtin  
  kl05z                     NXP                      KL05Z                                   builtin  
  kl25z                     NXP                      KL25Z                                   builtin  
  kl26z                     NXP                      KL26Z                                   builtin  
  kl27z4                    NXP                      KL27Z4                                  builtin  
  kl28z                     NXP                      KL28x                                   builtin  
  kl43z4                    NXP                      KL43Z4                                  builtin  
  kl46z                     NXP                      KL46Z                                   builtin  
  kl82z7                    NXP                      KL82Z7                                  builtin  
  kv10z7                    NXP                      KV10Z7                                  builtin  
  kv11z7                    NXP                      KV11Z7                                  builtin  
  kw01z4                    NXP                      KW01Z4                                  builtin  
  kw24d5                    NXP                      KW24D5                                  builtin  
  kw36z4                    NXP                      KW36Z4                                  builtin  
  kw40z4                    NXP                      KW40Z4                                  builtin  
  kw41z4                    NXP                      KW41Z4                                  builtin  
  lpc11u24                  NXP                      LPC11U24                                builtin  
  lpc11xx_32                NXP                      LPC11XX_32                              builtin  
  lpc1768                   NXP                      LPC1768                                 builtin  
  lpc4088                   NXP                      LPC4088                                 builtin  
  lpc4088dm                 NXP                      LPC4088dm                               builtin  
  lpc4088qsb                NXP                      LPC4088qsb                              builtin  
  lpc4330                   NXP                      LPC4330                                 builtin  
  lpc54114                  NXP                      LPC54114                                builtin  
  lpc54608                  NXP                      LPC54608                                builtin  
  lpc5526                   NXP                      LPC5526                                 builtin  
  lpc55s16                  NXP                      LPC55S16                                builtin  
  lpc55s28                  NXP                      LPC55S28                                builtin  
  lpc55s36                  NXP                      LPC55S36                                builtin  
  lpc55s69                  NXP                      LPC55S69                                builtin  
  lpc800                    NXP                      LPC800                                  builtin  
  lpc824                    NXP                      LPC824                                  builtin  
  lpc845                    NXP                      LPC845                                  builtin  
  m2354kjfae                Nuvoton                  M2354KJFAE                              builtin  
  m252kg6ae                 Nuvoton                  M252KG6AE                               builtin  
  m263kiaae                 Nuvoton                  M263KIAAE                               builtin  
  m467hjhae                 Nuvoton                  M467HJHAE                               builtin  
  m487jidae                 Nuvoton                  M487JIDAE                               builtin  
  max32600                  Maxim                    MAX32600                                builtin  
  max32620                  Maxim                    MAX32620                                builtin  
  max32625                  Maxim                    MAX32625                                builtin  
  max32630                  Maxim                    MAX32630                                builtin  
  max32660                  Maxim                    MAX32660                                builtin  
  max32666                  Maxim                    MAX32666                                builtin  
  max32670                  Maxim                    MAX32670                                builtin  
  mimxrt1010                NXP                      MIMXRT1011xxxxx                         builtin  
  mimxrt1015                NXP                      MIMXRT1015xxxxx                         builtin  
  mimxrt1020                NXP                      MIMXRT1021xxxxx                         builtin  
  mimxrt1024                NXP                      MIMXRT1024xxxxx                         builtin  
  mimxrt1050                NXP                      MIMXRT1052xxxxB_hyperflash              builtin  
  mimxrt1050_hyperflash     NXP                      MIMXRT1052xxxxB_hyperflash              builtin  
  mimxrt1050_quadspi        NXP                      MIMXRT1052xxxxB_quadspi                 builtin  
  mimxrt1060                NXP                      MIMXRT1062xxxxA                         builtin  
  mimxrt1064                NXP                      MIMXRT1064xxxxA                         builtin  
  mimxrt1170_cm4            NXP                      MIMXRT1176xxxxx_CM4                     builtin  
  mimxrt1170_cm7            NXP                      MIMXRT1176xxxxx_CM7                     builtin  
  mps3_an522                Arm                      AN522                                   builtin  
  mps3_an540                Arm                      AN540                                   builtin  
  musca_a1                  Arm                      MuscaA1                                 builtin  
  musca_b1                  Arm                      MuscaB1                                 builtin  
  musca_s1                  Arm                      MuscaS1                                 builtin  
  ncs36510                  ONSemiconductor          NCS36510                                builtin  
  nrf51                     Nordic Semiconductor     NRF51                                   builtin  
  nrf51822                  Nordic Semiconductor     NRF51                                   builtin  
  nrf52                     Nordic Semiconductor     NRF52832                                builtin  
  nrf52832                  Nordic Semiconductor     NRF52832                                builtin  
  nrf52833                  Nordic Semiconductor     NRF52833                                builtin  
  nrf52840                  Nordic Semiconductor     NRF52840                                builtin  
  nrf91                     Nordic Semiconductor     NRF91XX                                 builtin  
  rp2040                    Raspberry Pi             RP2040Core0                             builtin  
  rp2040_core0              Raspberry Pi             RP2040Core0                             builtin  
  rp2040_core1              Raspberry Pi             RP2040Core1                             builtin  
  rtl8195am                 Realtek Semiconductor    RTL8195AM                               builtin  
  rtl8762c                  Realtek Semiconductor    RTL8762C                                builtin  
  s32k344                   NXP                      S32K344                                 builtin  
  s5js100                   Samsung                  S5JS100                                 builtin  
  stm32f051                 STMicroelectronics       STM32F051                               builtin  
  stm32f103rc               STMicroelectronics       STM32F103RC                             builtin  
  stm32f412xe               STMicroelectronics       STM32F412xE                             builtin  
  stm32f412xg               STMicroelectronics       STM32F412xG                             builtin  
  stm32f429xg               STMicroelectronics       STM32F429xG                             builtin  
  stm32f429xi               STMicroelectronics       STM32F429xI                             builtin  
  stm32f439xg               STMicroelectronics       STM32F439xG                             builtin  
  stm32f439xi               STMicroelectronics       STM32F439xI                             builtin  
  stm32f767zi               STMicroelectronics       STM32F767xx                             builtin  
  stm32h723xx               STMicroelectronics       STM32H723xx                             builtin  
  stm32h743xx               STMicroelectronics       STM32H743xx                             builtin  
  stm32h7b0xx               STMicroelectronics       STM32H7B0xx                             builtin  
  stm32l031x6               STMicroelectronics       STM32L031x6                             builtin  
  stm32l432kc               STMicroelectronics       STM32L432xC                             builtin  
  stm32l475xc               STMicroelectronics       STM32L475xC                             builtin  
  stm32l475xe               STMicroelectronics       STM32L475xE                             builtin  
  stm32l475xg               STMicroelectronics       STM32L475xG                             builtin  
  w7500                     WIZnet                   W7500                                   builtin  
  ytm32b1ld0                Yuntu Microelectronics   YTM32B1LD0                              builtin  
  ytm32b1le0                Yuntu Microelectronics   YTM32B1LE0                              builtin  
  ytm32b1md1                Yuntu Microelectronics   YTM32B1MD1                              builtin  
  ytm32b1me0                YTMicro                  YTM32B1ME0                              builtin  

pyocd pack 命令

pyocd 通过两种方法支持 MCU,一个是内置的(builtin),这个数量有限,还有一个是通过 pack 来支持,需要用pyocd 操作什么 MCU,安装对应的 pack , 类似 keil5 ,新安装的 Keil5 不支持任何单片机,如果要使用新安装的keil 支持某类型号单片机,需要安装对应的软件包。 pyocd 提供了一个内置的子命令来对pack进行管理,安装、查找、删除等

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
knightli@knightli-py32:~$ pyocd pack -h
usage: pyocd pack [-h] [-v] [-q] [-L LOGGERS=LEVEL] [--color [{always,auto,never}]] [-c] [-u] [-s] [-f GLOB] [-i GLOB] [-n] [-H]  ...

options:
  -h, --help            show this help message and exit

logging:
  -v, --verbose         Increase logging level. Can be specified multiple times.
  -q, --quiet           Decrease logging level. Can be specified multiple times.
  -L LOGGERS=LEVEL, --log-level LOGGERS=LEVEL
                        Set log level of loggers whose name matches any of the comma-separated list of glob-style patterns. Log level must be one of (critical, error, warning, info, debug). Can be
                        specified multiple times. Example: -L*.trace,pyocd.core.*=debug
  --color [{always,auto,never}]
                        Control color logging. Default is auto.

subcommands:
  
    clean               Delete the pack index and all installed packs.
    find                Report pack(s) in the index containing matching device part numbers.
    install             Download and install pack(s) containing matching device part numbers.
    show                Show the list of installed packs.
    update              Update the pack index.

pack operations:
  -c, --clean           (Deprecated; use clean subcommand.) Erase all stored pack information.
  -u, --update          (Deprecated; use update subcommand.) Update the pack index.
  -s, --show            (Deprecated; use show subcommand.) Show the list of installed packs.
  -f GLOB, --find GLOB  (Deprecated; use find subcommand.) Report pack(s) in the index containing matching device part numbers.
  -i GLOB, --install GLOB
                        (Deprecated; use install subcommand.) Download and install pack(s) containing matching device part numbers.

pack options:
  -n, --no-download     Just list the pack(s) that would be downloaded, don't actually download anything.
  -H, --no-header       Don't print a table header.

更新索引目录

1
2
3
knightli@knightli-py32:~$ pyocd pack update
0000195 I Updating pack index... [pack_cmd]
Downloading descriptors (1603/1603)

查找需要支持的IC

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
knightli@knightli-py32:~$ pyocd pack find py32
  Part          Vendor   Pack                Version   Installed  
------------------------------------------------------------------
  PY32E407xC    Puya     Puya.PY32E4xx_DFP   1.0.0     False      
  PY32E407xD    Puya     Puya.PY32E4xx_DFP   1.0.0     False      
  PY32E407xE    Puya     Puya.PY32E4xx_DFP   1.0.0     False      
  PY32F002Ax5   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F002Bx5   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F002Xx2   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F002Xx4   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F002Xx5   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F003x4    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F003x6    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F003x7    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F003x8    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F030x4    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F030x6    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F030x7    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F030x8    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F031x4    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F031x6    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F031x7    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F031x8    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040Cx6   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040Cx8   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040Cx9   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040CxB   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040Ex6   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040Ex8   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040Ex9   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040ExB   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040x6    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040x8    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040x9    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F040xB    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071Cx6   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071Cx8   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071Cx9   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071CxB   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071Ex6   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071Ex8   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071Ex9   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071ExB   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071x6    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071x8    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071x9    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F071xB    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072Cx6   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072Cx8   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072Cx9   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072CxB   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072Ex6   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072Ex8   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072Ex9   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072ExB   Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072x6    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072x8    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072x9    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F072xB    Puya     Puya.PY32F0xx_DFP   1.2.2     False      
  PY32F303x8    Puya     Puya.PY32F3xx_DFP   1.0.0     False      
  PY32F303xB    Puya     Puya.PY32F3xx_DFP   1.0.0     False      
  PY32F303xC    Puya     Puya.PY32F3xx_DFP   1.0.0     False      
  PY32F403xB    Puya     Puya.PY32F4xx_DFP   1.0.1     False      
  PY32F403xC    Puya     Puya.PY32F4xx_DFP   1.0.1     False      
  PY32F403xD    Puya     Puya.PY32F4xx_DFP   1.0.1     False      
  PY32F410xB    Puya     Puya.PY32F4xx_DFP   1.0.1     False      
  PY32L020x5    Puya     Puya.PY32L0xx_DFP   1.0.0     False      
  PY32M010x5    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M020x6    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M030x8    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M031x8    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M070CxB   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M070xB    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32MD310x8   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32MD320x8   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32MD410x8   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32MD420x8   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32T020Bx6   Puya     Puya.PY32T0xx_DFP   1.0.2     False      
  PY32T020x5    Puya     Puya.PY32T0xx_DFP   1.0.2     False      
  PY32T020x6    Puya     Puya.PY32T0xx_DFP   1.0.2     False      
  PY32T092xC    Puya     Puya.PY32T0xx_DFP   1.0.2     False   

安装 pack -i 后面对应 Part 列

1
2
3
4
knightli@knightli-py32:~$ pyocd pack -i PY32F002Ax5
Downloading packs (press Control-C to cancel):
    Puya.PY32F0xx_DFP.1.2.2
Downloading descriptors (001/001)

安装完成后继续 find, 可以看到 一个pack对应几个part

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
knightli@knightli-py32:~$ pyocd pack find py32
  Part          Vendor   Pack                Version   Installed  
------------------------------------------------------------------
  PY32E407xC    Puya     Puya.PY32E4xx_DFP   1.0.0     False      
  PY32E407xD    Puya     Puya.PY32E4xx_DFP   1.0.0     False      
  PY32E407xE    Puya     Puya.PY32E4xx_DFP   1.0.0     False      
  PY32F002Ax5   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F002Bx5   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F002Xx2   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F002Xx4   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F002Xx5   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F003x4    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F003x6    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F003x7    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F003x8    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F030x4    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F030x6    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F030x7    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F030x8    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F031x4    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F031x6    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F031x7    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F031x8    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040Cx6   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040Cx8   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040Cx9   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040CxB   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040Ex6   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040Ex8   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040Ex9   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040ExB   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040x6    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040x8    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040x9    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F040xB    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071Cx6   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071Cx8   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071Cx9   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071CxB   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071Ex6   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071Ex8   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071Ex9   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071ExB   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071x6    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071x8    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071x9    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F071xB    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072Cx6   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072Cx8   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072Cx9   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072CxB   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072Ex6   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072Ex8   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072Ex9   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072ExB   Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072x6    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072x8    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072x9    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F072xB    Puya     Puya.PY32F0xx_DFP   1.2.2     True       
  PY32F303x8    Puya     Puya.PY32F3xx_DFP   1.0.0     False      
  PY32F303xB    Puya     Puya.PY32F3xx_DFP   1.0.0     False      
  PY32F303xC    Puya     Puya.PY32F3xx_DFP   1.0.0     False      
  PY32F403xB    Puya     Puya.PY32F4xx_DFP   1.0.1     False      
  PY32F403xC    Puya     Puya.PY32F4xx_DFP   1.0.1     False      
  PY32F403xD    Puya     Puya.PY32F4xx_DFP   1.0.1     False      
  PY32F410xB    Puya     Puya.PY32F4xx_DFP   1.0.1     False      
  PY32L020x5    Puya     Puya.PY32L0xx_DFP   1.0.0     False      
  PY32M010x5    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M020x6    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M030x8    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M031x8    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M070CxB   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32M070xB    Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32MD310x8   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32MD320x8   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32MD410x8   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32MD420x8   Puya     Puya.PY32Mxxx_DFP   1.0.4     False      
  PY32T020Bx6   Puya     Puya.PY32T0xx_DFP   1.0.2     False      
  PY32T020x5    Puya     Puya.PY32T0xx_DFP   1.0.2     False      
  PY32T020x6    Puya     Puya.PY32T0xx_DFP   1.0.2     False      
  PY32T092xC    Puya     Puya.PY32T0xx_DFP   1.0.2     False      

pack show

1
2
3
4
knightli@knightli-py32:~$ pyocd pack show
  Pack                Version  
-------------------------------
  Puya.PY32F0xx_DFP   1.2.2  

擦除芯片

1
2
3
4
knightli@knightli-py32:~/py32f0-template$ pyocd erase -t py32f003x4 -c
0003869 I Erasing chip... [eraser]
0007944 I Chip erase complete [eraser]
knightli@knightli-py32:~/py32f0-template$ 

刷写芯片

1
2
3
4
knightli@knightli-py32:~/py32f0-template$ pyocd flash -t py32f003x4 Build/app.hex 
0003310 I Loading /home/knightli/py32f0-template/Build/app.hex [load_cmd]
[==================================================] 100%
0047672 I Erased 12288 bytes (3 sectors), programmed 10112 bytes (79 pages), skipped 0 bytes (0 pages) at 0.22 kB/s [loader]

py32f0-template flash

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
knightli@knightli-py32:~/py32f0-template$ make flash
pyocd erase -t py32f003x4 --chip --config ./Misc/pyocd.yaml
0003761 I Erasing chip... [eraser]
0005480 I Chip erase complete [eraser]
pyocd load Build/app.elf -t py32f003x4 --config ./Misc/pyocd.yaml
0001227 I Loading /home/knightli/py32f0-template/Build/app.elf [load_cmd]
[==================================================] 100%
0043537 I Erased 12288 bytes (3 sectors), programmed 10112 bytes (79 pages), skipped 0 bytes (0 pages) at 0.23 kB/s [loader]
knightli@knightli-py32:~/py32f0-template$ more Misc/pyocd.yaml 
pack:
  - Misc/Puya.PY32F0xx_DFP.1.1.7.pack
记录并分享
Built with Hugo
主题 StackJimmy 设计