Application Note
6 of 45
001-84858 Rev. *N
2021-03-23
PSoC 4 Programming Using an External Microcontroller (HSSP)
HSSP Firmware Architecture
All layers used in the firmware architecture, as shown in
, are discussed in the following sections.
2.1
SWD Protocol Physical Layer
Files that constitute the SWD Protocol Physical layer are described:
Table 1
SWD Protocol Physical Layer Files
Source Files
Description
RegisterDefines
(.
h
file)
This file defines the port number, pin number, input/output register, and drive mode
register of the programming pins.
SWD_PhysicalLayer
(.
c
and .
h
files)
These files contain macros and functions to manipulate the programming pins. The
pins are defined in the
RegisterDefines.h
file.
The codes in these files are written for PSoC 5LP as the host microcontroller. If these files are ported to any
other host microcontroller, then you should modify all the functions and macros appropriately.
Note:
See
“
Pin Names and Requirements
” in
the programming specifications of the respective device
listed in the
section for details on the pin configurations on the host side.
2.2
SWD Protocol Packet Layer
Files that constitute the SWD Protocol Packet layer are described:
Table 2
SWD Protocol Packet Layer Files
Source Files
Description
SWD_PacketLayer
(.
c
and .
h
files)
These files define the packet routines for sending the SWD Read and
SWD Write packets per the SWD protocol.
SWD_UpperPacketLayer
(.
c
and .
h
files)
These files use the functions defined in SWD_PacketLayer to
implement functions that directly read and write to the DAP register
and CPU address space.
The functions defined in this layer are called directly by the functions in the
ProgrammingSteps.c
file.
All of these SWD packet functions operate on three global variables
—
swd_PacketHeader
,
swd_PacketAck
, and
swd_PacketData[]
—
that are accessed by the functions in the top layer files, as
shows.
2.3
Fetching Programming Data
Files used for fetching the programming data to the upper layer functions are described:
Table 3
Data Fetch Layer File
Source File
Description
DataFetch
(.
c
and .
h
files)
These files contain the routines to fetch the programming data from the
HexImage.c
file
and then pass that data to the functions in the
ProgrammingSteps.c
file.
The programming data includes flash row data, flash protection data, chip protection
data, Silicon ID, checksum, and the total number of flash rows.
Modify the definitions of the functions based on the method that you use to get the HSSP programming data.