Skip to content

Commit

Permalink
Merge pull request #901 from bohdan-tymkiv/psoc64-support
Browse files Browse the repository at this point in the history
Add support for new revisions of secure PSoC64 devices
  • Loading branch information
flit authored Jul 1, 2020
2 parents 96ae4f3 + bd91cf8 commit bb6302d
Show file tree
Hide file tree
Showing 32 changed files with 4,681 additions and 2,666 deletions.
5 changes: 5 additions & 0 deletions pyocd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# pyOCD debugger
# Copyright (c) 2018-2020 Arm Limited
# Copyright (c) 2020 Cypress Semiconductor Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -49,6 +50,7 @@
from .flash.eraser import FlashEraser
from .flash.file_programmer import FileProgrammer
from .core import options
from .coresight.generic_mem_ap import GenericMemAPTarget

try:
import cmsis_pack_manager
Expand Down Expand Up @@ -691,6 +693,9 @@ def do_gdbserver(self):
if self._args.elf:
session.board.target.elf = os.path.expanduser(self._args.elf)
for core_number, core in session.board.target.cores.items():
# Don't create a server for CPU-less memory Access Port.
if isinstance(session.board.target.cores[core_number], GenericMemAPTarget):
continue
# Don't create a server if this core is not listed by the user.
if core_number not in core_list:
continue
Expand Down
6 changes: 3 additions & 3 deletions pyocd/board/board_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ def __init__(self, name, target, binary):
"1900": BoardInfo( "CY8CKIT-062-WIFI-BT", "cy8c6xx7", "l1_cy8c6xx7.bin", ),
"1901": BoardInfo( "CY8CPROTO-062-4343W", "cy8c6xxA", "l1_cy8c6xxa.bin", ),
"1902": BoardInfo( "CY8CKIT-062-BLE", "cy8c6xx7", "l1_cy8c6xx7.bin", ),
"1903": BoardInfo( "CYW9P62S1-43012EVB-01","cy8c6xx7", "l1_cy8c6xx7.bin", ),
"1903": BoardInfo( "CYW9P62S1-43012EVB-01","cy8c6xx7_s25fs512s", "l1_cy8c6xx7.bin", ),
"1904": BoardInfo( "CY8CPROTO-063-BLE", "cy8c6xx7_nosmif", "l1_cy8c6xx7.bin", ),
"1905": BoardInfo( "CY8CKIT-062-4343W", "cy8c6xxA", "l1_cy8c6xxa.bin", ),
"1906": BoardInfo( "CYW943012P6EVB-01", "cy8c6xx7", "l1_cy8c6xx7.bin", ),
"1907": BoardInfo( "CY8CPROTO-064-SB", "cy8c64xx_cm4", "l1_cy8c6xx7.bin", ),
"1907": BoardInfo( "CY8CPROTO-064-SB", "cy8c64xx_cm4_s25hx512t", "l1_cy8c6xx7.bin",),
"1908": BoardInfo( "CYW9P62S1-43438EVB-01","cy8c6xx7", "l1_cy8c6xx7.bin", ),
"1909": BoardInfo( "CY8CPROTO-062S2-43012","cy8c6xxA", "l1_cy8c6xxa.bin", ),
"190A": BoardInfo( "CY8CKIT-064S2-4343W", "cy8c64xA_cm4", "l1_cy8c6xxa.bin", ),
Expand All @@ -212,7 +212,7 @@ def __init__(self, name, target, binary):
"190F": BoardInfo( "CY8CPROTO-064B0S1-BLE","cy8c64xx_cm4_nosmif", "l1_cy8c6xx7.bin", ),
"1910": BoardInfo( "CY8CKIT-064B0S2-4343W","cy8c64xA_cm4", "l1_cy8c6xxa.bin", ),
"1911": BoardInfo( "CY8CKIT-064S0S2-4343W","cy8c64xA_cm4", "l1_cy8c6xxa.bin", ),
"1912": BoardInfo( "CYFEATHER-RP01", "cy8c6xxA", "l1_cy8c6xxa.bin", ),
"1912": BoardInfo( "CYSBSYSKIT-01", "cy8c6xxA", "l1_cy8c6xxa.bin", ),
"2201": BoardInfo( "WIZwik_W7500", "w7500", "l1_w7500mbed.bin", ),
"2600": BoardInfo( "ep_agora", "nrf52840", None, ),
"3300": BoardInfo( "CC3220SF_LaunchXL", "cc3220sf", "l1_cc3220sf.bin", ),
Expand Down
167 changes: 167 additions & 0 deletions pyocd/coresight/generic_mem_ap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# pyOCD debugger
# Copyright (c) 2020 Cypress Semiconductor Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from .component import CoreSightCoreComponent
from ..core.target import Target

LOG = logging.getLogger(__name__)

DEAD_VALUE = 0


class GenericMemAPTarget(Target, CoreSightCoreComponent):
"""! @brief This target represents ARM debug Access Port without a CPU
It may be used to access the address space of the target via Access Ports
without real ARM CPU core behind it. For instance Cypress PSoC64 devices have
three APs implemented in the hardware:
* AP #0 -> CPU-less AHB AP
* AP #1 -> Cortex-M0+ AP
* AP #2 -> Cortex-M4F AP
Depending on the protection state, AP #1 and AP #2 can be permanently disabled.
This class allows to communicate with Secure FW running on the target via AP #0.
Most of the methods in this class (except memory access methods) are empty/dummy.
"""

def __init__(self, session, ap, memory_map=None, core_num=0, cmpid=None, address=None):
Target.__init__(self, session, memory_map)
CoreSightCoreComponent.__init__(self, ap, cmpid, address)
self.core_number = core_num
self.core_type = DEAD_VALUE
self._target_context = None
self.register_list = []

def add_child(self, cmp):
pass

@property
def supported_security_states(self):
return Target.SecurityState.NONSECURE,

def init(self):
pass

def disconnect(self, resume=True):
pass

def write_memory(self, addr, value, transfer_size=32):
self.ap.write_memory(addr, value, transfer_size)

def read_memory(self, addr, transfer_size=32, now=True):
return self.ap.read_memory(addr, transfer_size, True)

def read_memory_block8(self, addr, size):
return self.ap.read_memory_block8(addr, size)

def write_memory_block8(self, addr, data):
self.ap.write_memory_block8(addr, data)

def write_memory_block32(self, addr, data):
self.ap.write_memory_block32(addr, data)

def read_memory_block32(self, addr, size):
return self.ap.read_memory_block32(addr, size)

def halt(self):
pass

def step(self, disable_interrupts=True, start=0, end=0):
pass

def reset(self, reset_type=None):
pass

def reset_and_halt(self, reset_type=None):
self.reset(reset_type)
pass

def get_state(self):
return Target.State.HALTED

def get_security_state(self):
return Target.SecurityState.NONSECURE

def is_running(self):
return self.get_state() == Target.State.RUNNING

def is_halted(self):
return self.get_state() == Target.State.HALTED

def resume(self):
pass

def find_breakpoint(self, addr):
return None

def read_core_register(self, reg):
return DEAD_VALUE

def read_core_register_raw(self, reg):
return DEAD_VALUE

def read_core_registers_raw(self, reg_list):
return [DEAD_VALUE] * len(reg_list)

def write_core_register(self, reg, data):
pass

def write_core_register_raw(self, reg, data):
pass

def write_core_registers_raw(self, reg_list, data_list):
pass

def set_breakpoint(self, addr, type=Target.BreakpointType.AUTO):
return False

def remove_breakpoint(self, addr):
pass

def get_breakpoint_type(self, addr):
return None

def set_watchpoint(self, addr, size, type):
return False

def remove_watchpoint(self, addr, size, type):
pass

def set_vector_catch(self, enable_mask):
pass

def get_vector_catch(self):
return 0

def get_target_xml(self):
return None

def get_halt_reason(self):
return Target.HaltReason.DEBUG

def get_target_context(self, core=None):
return self._target_context

def set_target_context(self, context):
self._target_context = context

def create_init_sequence(self):
pass

def mass_erase(self):
pass
8 changes: 8 additions & 0 deletions pyocd/target/builtin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
from . import target_RTL8195AM
from . import target_CC3220SF
from . import target_CC3220SF
from ..family import target_psoc6
from .cypress import target_CY8C6xxA
from .cypress import target_CY8C6xx7
from .cypress import target_CY8C6xx5
Expand Down Expand Up @@ -177,10 +178,14 @@
'cc3220sf': target_CC3220SF.CC3220SF,
'cy8c6xxa': target_CY8C6xxA.CY8C6xxA,
'cy8c6xx7': target_CY8C6xx7.CY8C6xx7,
'cy8c6xx7_s25fs512s': target_CY8C6xx7.CY8C6xx7_S25FS512S,
'cy8c6xx7_nosmif': target_CY8C6xx7.CY8C6xx7_nosmif,
'cy8c6xx5': target_CY8C6xx5.CY8C6xx5,
'cy8c64_sysap': target_psoc6.cy8c64_sysap,
'cy8c64xx_cm0': target_CY8C64xx.cy8c64xx_cm0,
'cy8c64xx_cm4': target_CY8C64xx.cy8c64xx_cm4,
'cy8c64xx_cm0_s25hx512t': target_CY8C64xx.cy8c64xx_cm0_s25hx512t,
'cy8c64xx_cm4_s25hx512t': target_CY8C64xx.cy8c64xx_cm4_s25hx512t,
'cy8c64xx_cm0_nosmif': target_CY8C64xx.cy8c64xx_cm0_nosmif,
'cy8c64xx_cm4_nosmif': target_CY8C64xx.cy8c64xx_cm4_nosmif,
'cy8c64xa_cm0': target_CY8C64xA.cy8c64xA_cm0,
Expand All @@ -191,8 +196,11 @@
'musca_b1' : target_musca_b1.MuscaB1,
'lpc55s69' : target_LPC55S69Jxxxxx.LPC55S69,
'lpc55s28' : target_LPC55S28Jxxxxx.LPC55S28,
'cy8c64xx_cm0_full_flash' : target_CY8C64xx.cy8c64xx_cm0_full_flash,
'cy8c64xx_cm4_full_flash' : target_CY8C64xx.cy8c64xx_cm4_full_flash,
'cy8c64xa_cm0_full_flash' : target_CY8C64xA.cy8c64xA_cm0_full_flash,
'cy8c64xa_cm4_full_flash' : target_CY8C64xA.cy8c64xA_cm4_full_flash,
'cy8c64x5_cm0_full_flash' : target_CY8C64x5.cy8c64x5_cm0_full_flash,
'cy8c64x5_cm4_full_flash' : target_CY8C64x5.cy8c64x5_cm4_full_flash,
'm252kg6ae' : target_M252KG6AE.M252KG6AE,
'm263kiaae' : target_M263KIAAE.M263KIAAE,
Expand Down
2 changes: 1 addition & 1 deletion pyocd/target/builtin/cypress/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pyOCD debugger
# Copyright (c) 2013-2019 Arm Limited
# Copyright (c) 2020 Cypress Semiconductor Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion pyocd/target/builtin/cypress/flash_algos/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pyOCD debugger
# Copyright (c) 2013-2019 Arm Limited
# Copyright (c) 2020 Cypress Semiconductor Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading

0 comments on commit bb6302d

Please sign in to comment.