Skip to content

Commit bd91cf8

Browse files
Add support for new revisions of secure PSoC64 devices
This change also adds support GenericMemAP class which allows to access memory of the target via Access Ports which do not have CPU core behind them.
1 parent ed54d26 commit bd91cf8

32 files changed

+4681
-2666
lines changed

pyocd/__main__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# pyOCD debugger
44
# Copyright (c) 2018-2020 Arm Limited
5+
# Copyright (c) 2020 Cypress Semiconductor Corporation
56
# SPDX-License-Identifier: Apache-2.0
67
#
78
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,6 +50,7 @@
4950
from .flash.eraser import FlashEraser
5051
from .flash.file_programmer import FileProgrammer
5152
from .core import options
53+
from .coresight.generic_mem_ap import GenericMemAPTarget
5254

5355
try:
5456
import cmsis_pack_manager
@@ -691,6 +693,9 @@ def do_gdbserver(self):
691693
if self._args.elf:
692694
session.board.target.elf = os.path.expanduser(self._args.elf)
693695
for core_number, core in session.board.target.cores.items():
696+
# Don't create a server for CPU-less memory Access Port.
697+
if isinstance(session.board.target.cores[core_number], GenericMemAPTarget):
698+
continue
694699
# Don't create a server if this core is not listed by the user.
695700
if core_number not in core_list:
696701
continue

pyocd/board/board_ids.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ def __init__(self, name, target, binary):
197197
"1900": BoardInfo( "CY8CKIT-062-WIFI-BT", "cy8c6xx7", "l1_cy8c6xx7.bin", ),
198198
"1901": BoardInfo( "CY8CPROTO-062-4343W", "cy8c6xxA", "l1_cy8c6xxa.bin", ),
199199
"1902": BoardInfo( "CY8CKIT-062-BLE", "cy8c6xx7", "l1_cy8c6xx7.bin", ),
200-
"1903": BoardInfo( "CYW9P62S1-43012EVB-01","cy8c6xx7", "l1_cy8c6xx7.bin", ),
200+
"1903": BoardInfo( "CYW9P62S1-43012EVB-01","cy8c6xx7_s25fs512s", "l1_cy8c6xx7.bin", ),
201201
"1904": BoardInfo( "CY8CPROTO-063-BLE", "cy8c6xx7_nosmif", "l1_cy8c6xx7.bin", ),
202202
"1905": BoardInfo( "CY8CKIT-062-4343W", "cy8c6xxA", "l1_cy8c6xxa.bin", ),
203203
"1906": BoardInfo( "CYW943012P6EVB-01", "cy8c6xx7", "l1_cy8c6xx7.bin", ),
204-
"1907": BoardInfo( "CY8CPROTO-064-SB", "cy8c64xx_cm4", "l1_cy8c6xx7.bin", ),
204+
"1907": BoardInfo( "CY8CPROTO-064-SB", "cy8c64xx_cm4_s25hx512t", "l1_cy8c6xx7.bin",),
205205
"1908": BoardInfo( "CYW9P62S1-43438EVB-01","cy8c6xx7", "l1_cy8c6xx7.bin", ),
206206
"1909": BoardInfo( "CY8CPROTO-062S2-43012","cy8c6xxA", "l1_cy8c6xxa.bin", ),
207207
"190A": BoardInfo( "CY8CKIT-064S2-4343W", "cy8c64xA_cm4", "l1_cy8c6xxa.bin", ),
@@ -212,7 +212,7 @@ def __init__(self, name, target, binary):
212212
"190F": BoardInfo( "CY8CPROTO-064B0S1-BLE","cy8c64xx_cm4_nosmif", "l1_cy8c6xx7.bin", ),
213213
"1910": BoardInfo( "CY8CKIT-064B0S2-4343W","cy8c64xA_cm4", "l1_cy8c6xxa.bin", ),
214214
"1911": BoardInfo( "CY8CKIT-064S0S2-4343W","cy8c64xA_cm4", "l1_cy8c6xxa.bin", ),
215-
"1912": BoardInfo( "CYFEATHER-RP01", "cy8c6xxA", "l1_cy8c6xxa.bin", ),
215+
"1912": BoardInfo( "CYSBSYSKIT-01", "cy8c6xxA", "l1_cy8c6xxa.bin", ),
216216
"2201": BoardInfo( "WIZwik_W7500", "w7500", "l1_w7500mbed.bin", ),
217217
"2600": BoardInfo( "ep_agora", "nrf52840", None, ),
218218
"3300": BoardInfo( "CC3220SF_LaunchXL", "cc3220sf", "l1_cc3220sf.bin", ),

pyocd/coresight/generic_mem_ap.py

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# pyOCD debugger
2+
# Copyright (c) 2020 Cypress Semiconductor Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
import logging
18+
19+
from .component import CoreSightCoreComponent
20+
from ..core.target import Target
21+
22+
LOG = logging.getLogger(__name__)
23+
24+
DEAD_VALUE = 0
25+
26+
27+
class GenericMemAPTarget(Target, CoreSightCoreComponent):
28+
"""! @brief This target represents ARM debug Access Port without a CPU
29+
30+
It may be used to access the address space of the target via Access Ports
31+
without real ARM CPU core behind it. For instance Cypress PSoC64 devices have
32+
three APs implemented in the hardware:
33+
* AP #0 -> CPU-less AHB AP
34+
* AP #1 -> Cortex-M0+ AP
35+
* AP #2 -> Cortex-M4F AP
36+
Depending on the protection state, AP #1 and AP #2 can be permanently disabled.
37+
This class allows to communicate with Secure FW running on the target via AP #0.
38+
39+
Most of the methods in this class (except memory access methods) are empty/dummy.
40+
"""
41+
42+
def __init__(self, session, ap, memory_map=None, core_num=0, cmpid=None, address=None):
43+
Target.__init__(self, session, memory_map)
44+
CoreSightCoreComponent.__init__(self, ap, cmpid, address)
45+
self.core_number = core_num
46+
self.core_type = DEAD_VALUE
47+
self._target_context = None
48+
self.register_list = []
49+
50+
def add_child(self, cmp):
51+
pass
52+
53+
@property
54+
def supported_security_states(self):
55+
return Target.SecurityState.NONSECURE,
56+
57+
def init(self):
58+
pass
59+
60+
def disconnect(self, resume=True):
61+
pass
62+
63+
def write_memory(self, addr, value, transfer_size=32):
64+
self.ap.write_memory(addr, value, transfer_size)
65+
66+
def read_memory(self, addr, transfer_size=32, now=True):
67+
return self.ap.read_memory(addr, transfer_size, True)
68+
69+
def read_memory_block8(self, addr, size):
70+
return self.ap.read_memory_block8(addr, size)
71+
72+
def write_memory_block8(self, addr, data):
73+
self.ap.write_memory_block8(addr, data)
74+
75+
def write_memory_block32(self, addr, data):
76+
self.ap.write_memory_block32(addr, data)
77+
78+
def read_memory_block32(self, addr, size):
79+
return self.ap.read_memory_block32(addr, size)
80+
81+
def halt(self):
82+
pass
83+
84+
def step(self, disable_interrupts=True, start=0, end=0):
85+
pass
86+
87+
def reset(self, reset_type=None):
88+
pass
89+
90+
def reset_and_halt(self, reset_type=None):
91+
self.reset(reset_type)
92+
pass
93+
94+
def get_state(self):
95+
return Target.State.HALTED
96+
97+
def get_security_state(self):
98+
return Target.SecurityState.NONSECURE
99+
100+
def is_running(self):
101+
return self.get_state() == Target.State.RUNNING
102+
103+
def is_halted(self):
104+
return self.get_state() == Target.State.HALTED
105+
106+
def resume(self):
107+
pass
108+
109+
def find_breakpoint(self, addr):
110+
return None
111+
112+
def read_core_register(self, reg):
113+
return DEAD_VALUE
114+
115+
def read_core_register_raw(self, reg):
116+
return DEAD_VALUE
117+
118+
def read_core_registers_raw(self, reg_list):
119+
return [DEAD_VALUE] * len(reg_list)
120+
121+
def write_core_register(self, reg, data):
122+
pass
123+
124+
def write_core_register_raw(self, reg, data):
125+
pass
126+
127+
def write_core_registers_raw(self, reg_list, data_list):
128+
pass
129+
130+
def set_breakpoint(self, addr, type=Target.BreakpointType.AUTO):
131+
return False
132+
133+
def remove_breakpoint(self, addr):
134+
pass
135+
136+
def get_breakpoint_type(self, addr):
137+
return None
138+
139+
def set_watchpoint(self, addr, size, type):
140+
return False
141+
142+
def remove_watchpoint(self, addr, size, type):
143+
pass
144+
145+
def set_vector_catch(self, enable_mask):
146+
pass
147+
148+
def get_vector_catch(self):
149+
return 0
150+
151+
def get_target_xml(self):
152+
return None
153+
154+
def get_halt_reason(self):
155+
return Target.HaltReason.DEBUG
156+
157+
def get_target_context(self, core=None):
158+
return self._target_context
159+
160+
def set_target_context(self, context):
161+
self._target_context = context
162+
163+
def create_init_sequence(self):
164+
pass
165+
166+
def mass_erase(self):
167+
pass

pyocd/target/builtin/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
from . import target_RTL8195AM
8080
from . import target_CC3220SF
8181
from . import target_CC3220SF
82+
from ..family import target_psoc6
8283
from .cypress import target_CY8C6xxA
8384
from .cypress import target_CY8C6xx7
8485
from .cypress import target_CY8C6xx5
@@ -177,10 +178,14 @@
177178
'cc3220sf': target_CC3220SF.CC3220SF,
178179
'cy8c6xxa': target_CY8C6xxA.CY8C6xxA,
179180
'cy8c6xx7': target_CY8C6xx7.CY8C6xx7,
181+
'cy8c6xx7_s25fs512s': target_CY8C6xx7.CY8C6xx7_S25FS512S,
180182
'cy8c6xx7_nosmif': target_CY8C6xx7.CY8C6xx7_nosmif,
181183
'cy8c6xx5': target_CY8C6xx5.CY8C6xx5,
184+
'cy8c64_sysap': target_psoc6.cy8c64_sysap,
182185
'cy8c64xx_cm0': target_CY8C64xx.cy8c64xx_cm0,
183186
'cy8c64xx_cm4': target_CY8C64xx.cy8c64xx_cm4,
187+
'cy8c64xx_cm0_s25hx512t': target_CY8C64xx.cy8c64xx_cm0_s25hx512t,
188+
'cy8c64xx_cm4_s25hx512t': target_CY8C64xx.cy8c64xx_cm4_s25hx512t,
184189
'cy8c64xx_cm0_nosmif': target_CY8C64xx.cy8c64xx_cm0_nosmif,
185190
'cy8c64xx_cm4_nosmif': target_CY8C64xx.cy8c64xx_cm4_nosmif,
186191
'cy8c64xa_cm0': target_CY8C64xA.cy8c64xA_cm0,
@@ -191,8 +196,11 @@
191196
'musca_b1' : target_musca_b1.MuscaB1,
192197
'lpc55s69' : target_LPC55S69Jxxxxx.LPC55S69,
193198
'lpc55s28' : target_LPC55S28Jxxxxx.LPC55S28,
199+
'cy8c64xx_cm0_full_flash' : target_CY8C64xx.cy8c64xx_cm0_full_flash,
194200
'cy8c64xx_cm4_full_flash' : target_CY8C64xx.cy8c64xx_cm4_full_flash,
201+
'cy8c64xa_cm0_full_flash' : target_CY8C64xA.cy8c64xA_cm0_full_flash,
195202
'cy8c64xa_cm4_full_flash' : target_CY8C64xA.cy8c64xA_cm4_full_flash,
203+
'cy8c64x5_cm0_full_flash' : target_CY8C64x5.cy8c64x5_cm0_full_flash,
196204
'cy8c64x5_cm4_full_flash' : target_CY8C64x5.cy8c64x5_cm4_full_flash,
197205
'm252kg6ae' : target_M252KG6AE.M252KG6AE,
198206
'm263kiaae' : target_M263KIAAE.M263KIAAE,

pyocd/target/builtin/cypress/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pyOCD debugger
2-
# Copyright (c) 2013-2019 Arm Limited
2+
# Copyright (c) 2020 Cypress Semiconductor Corporation
33
# SPDX-License-Identifier: Apache-2.0
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");

pyocd/target/builtin/cypress/flash_algos/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pyOCD debugger
2-
# Copyright (c) 2013-2019 Arm Limited
2+
# Copyright (c) 2020 Cypress Semiconductor Corporation
33
# SPDX-License-Identifier: Apache-2.0
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)