# infineon/kitprog3 architecture

> Architecture diagram of the GitHub repository infineon/kitprog3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/infineon/kitprog3
- Repository: https://github.com/infineon/kitprog3

## Overview

#### Purpose and deliverables
KitProg3 is embedded firmware for the PSoC5LP-based KitProg3 debug/programming probe. It builds with PSoC Creator 4.4 into HEX and Cypress bootloader (`.cyacd`) images; distribution and field updates are performed by the external `fw-loader` utility. The DAPLink codebase itself is explicitly external.
- `KitProg3.cydsn/KitProg3.cyprj`
- `KitProg3.cydsn/KitProg3.cydwr`
- `KitProg3.cywrk`

#### Firmware entry and system composition
The primary application starts in `main.c` and coordinates probe operation through hardware/device definitions, KitProg state, and generated PSoC peripheral code. The PSoC schematic is a material hardware boundary: it defines the board wiring and components consumed by the generated source.
- `KitProg3.cydsn/main.c`
- `KitProg3.cydsn/kitprog.h`
- `KitProg3.cydsn/TopDesign/TopDesign.cysch`

#### USB host interface and command boundary
USB is the host-facing control plane. The USB interface/user-HID layers receive host requests and bridge them into firmware command processing; generated USBFS vendor and endpoint ISR code sits below this boundary. Host protocol compatibility is therefore concentrated at the USB/command interfaces rather than in transport drivers.
- `KitProg3.cydsn/usbinterface.c`
- `KitProg3.cydsn/usb_user_hid.c`
- `KitProg3.cydsn/commandprocessor.h`

#### Debug-access protocol stack
The probe’s target-debug path supports CMSIS-DAP-facing logic plus SWD and JTAG data-port implementations. DAP configuration/vendor extensions adapt the standard debug protocol to KitProg behavior, while SWD/JTAG layers control physical target access.
- `KitProg3.cydsn/DAP.c`
- `KitProg3.cydsn/SW_DP.c`
- `KitProg3.cydsn/JTAG_DP.c`

#### Application modes and target bridges
Mode switching and bridge interfaces separate normal debug/provisioning functions from target-facing bridge behavior. The application switch is the likely control boundary for selecting probe functions, while bridge APIs isolate higher-level commands from concrete target transports.
- `KitProg3.cydsn/app_switch.c`
- `KitProg3.cydsn/bridgesInterface.c`
- `KitProg3.cydsn/swd.c`

#### Hardware control and concurrency
Power, LEDs, reset-related ISR logic, and mutexes manage board-visible state and timing-sensitive access. These components operate below command/protocol layers and must preserve electrical and synchronization constraints when target transactions occur.
- `KitProg3.cydsn/power.c`
- `KitProg3.cydsn/led.c`
- `KitProg3.cydsn/mutex.c`

#### Boot and deployment boundaries
A separate PSoC bootloader project provides the firmware-update runtime; the main application emits the update artifact it consumes. Windows driver packages provide host enumeration/support for KitProg-family USB and UART devices, but are not firmware runtime code.
- `KitProg3_Bootloader.cydsn/main.c`
- `KitProg3_Bootloader.cydsn/KitProg3_Bootloader.cyprj`
- `drivers/KitProg3/KitProg3/Win7/KitProg3.inf`

#### Shared component infrastructure
The repository also contains a reusable PSoC Creator SPI Master component/library, including generated embedded C API and Creator-side customizer code. It is design-time component infrastructure, distinct from the probe application and bootloader projects.
- `KitProg3_Library.cylib/SPI_Master_v2_50/API/SPI_Master.c`
- `KitProg3_Library.cylib/SPI_Master_v2_50/SPI_Master_v2_50.cysch`

Main entry points: [`KitProg3.cydsn/KitProg3.cyprj`](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/KitProg3.cyprj) (Probe application project), [`KitProg3.cydsn/main.c`](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/main.c) (Firmware entry), [`KitProg3.cydsn/usbinterface.c`](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/usbinterface.c) (USB host interface), [`KitProg3.cydsn/TopDesign/TopDesign.cysch`](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/TopDesign/TopDesign.cysch) (Board schematic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_probe["Probe Firmware"]
  node_app_project["Probe application project<br/>PSoC project<br/>[KitProg3.cyprj]"]
  node_hardware_design["Board schematic<br/>hardware design<br/>[TopDesign.cysch]"]
  node_app_main["Firmware entry<br/>application entry<br/>[main.c]"]
  node_kitprog_state["KitProg state<br/>device definitions<br/>[kitprog.h]"]
  node_usb_interface["USB host interface<br/>USB control plane<br/>[usbinterface.c]"]
  node_usb_hid["User HID layer<br/>USB request adapter<br/>[usb_user_hid.c]"]
  node_command_boundary["Command processor<br/>command API<br/>[commandprocessor.h]"]
  node_app_switch["Application modes<br/>mode controller<br/>[app_switch.c]"]
  node_board_control["Power, LEDs &amp; mutexes<br/>board control<br/>[power.c]"]
end

subgraph group_debug["Target Debug"]
  node_bridge_api["Target bridge API<br/>bridge interface<br/>[bridgesInterface.c]"]
  node_dap["CMSIS-DAP logic<br/>debug protocol<br/>[DAP.c]"]
  node_swd_dp["SWD data port<br/>debug transport<br/>[SW_DP.c]"]
  node_jtag_dp["JTAG data port<br/>debug transport<br/>[JTAG_DP.c]"]
  node_swd_phy["SWD physical access<br/>target I/O<br/>[swd.c]"]
end

subgraph group_deploy["Build &amp; Deployment"]
  node_workspace["PSoC Creator workspace<br/>[KitProg3.cywrk]"]
  node_bootloader_project["Bootloader project<br/>PSoC bootloader"]
  node_bootloader_entry["Bootloader entry<br/>boot runtime<br/>[main.c]"]
  node_windows_driver["Windows USB driver<br/>host driver package<br/>[KitProg3.inf]"]
end

subgraph group_component["Component Library"]
  node_spi_component["SPI Master component<br/>PSoC Creator library<br/>[SPI_Master.c]"]
  node_spi_schematic["SPI component schematic<br/>component design"]
end

node_workspace -->|"contains"| node_app_project
node_workspace -->|"contains"| node_bootloader_project
node_app_project -->|"uses design"| node_hardware_design
node_app_project -->|"builds"| node_app_main
node_hardware_design -->|"provides USB peripherals"| node_usb_interface
node_hardware_design -->|"provides board peripherals"| node_board_control
node_app_main -->|"coordinates"| node_kitprog_state
node_app_main -->|"initializes"| node_usb_interface
node_app_main -->|"selects mode"| node_app_switch
node_usb_interface -->|"receives requests through"| node_usb_hid
node_usb_hid -->|"dispatches"| node_command_boundary
node_command_boundary -->|"selects functions"| node_app_switch
node_app_switch -->|"routes target commands"| node_bridge_api
node_bridge_api -->|"invokes debug access"| node_dap
node_dap -->|"uses SWD"| node_swd_dp
node_dap -->|"uses JTAG"| node_jtag_dp
node_swd_dp -->|"drives"| node_swd_phy
node_board_control -->|"protects access"| node_swd_phy
node_app_project -.->|"emits update image for"| node_bootloader_project
node_bootloader_project -->|"builds"| node_bootloader_entry
node_windows_driver -.->|"host enumeration"| node_usb_interface
node_spi_schematic -->|"generates API"| node_spi_component

click node_workspace "https://github.com/infineon/kitprog3/blob/master/KitProg3.cywrk"
click node_app_project "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/KitProg3.cyprj"
click node_hardware_design "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/TopDesign/TopDesign.cysch"
click node_app_main "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/main.c"
click node_kitprog_state "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/kitprog.h"
click node_usb_interface "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/usbinterface.c"
click node_usb_hid "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/usb_user_hid.c"
click node_command_boundary "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/commandprocessor.h"
click node_app_switch "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/app_switch.c"
click node_bridge_api "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/bridgesInterface.c"
click node_dap "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/DAP.c"
click node_swd_dp "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/SW_DP.c"
click node_jtag_dp "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/JTAG_DP.c"
click node_swd_phy "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/swd.c"
click node_board_control "https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/power.c"
click node_bootloader_project "https://github.com/infineon/kitprog3/blob/master/KitProg3_Bootloader.cydsn/KitProg3_Bootloader.cyprj"
click node_bootloader_entry "https://github.com/infineon/kitprog3/blob/master/KitProg3_Bootloader.cydsn/main.c"
click node_windows_driver "https://github.com/infineon/kitprog3/blob/master/drivers/KitProg3/KitProg3/Win7/KitProg3.inf"
click node_spi_component "https://github.com/infineon/kitprog3/blob/master/KitProg3_Library.cylib/SPI_Master_v2_50/API/SPI_Master.c"
click node_spi_schematic "https://github.com/infineon/kitprog3/blob/master/KitProg3_Library.cylib/SPI_Master_v2_50/SPI_Master_v2_50.cysch"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_project,node_hardware_design,node_app_main,node_kitprog_state,node_usb_interface,node_usb_hid,node_command_boundary,node_app_switch,node_board_control toneBlue
class node_bridge_api,node_dap,node_swd_dp,node_jtag_dp,node_swd_phy toneAmber
class node_workspace,node_bootloader_project,node_bootloader_entry,node_windows_driver toneMint
class node_spi_component,node_spi_schematic toneRose
```

## Components

### Probe Firmware

- [Probe application project](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/KitProg3.cyprj): PSoC project · `KitProg3.cydsn/KitProg3.cyprj`
- [Board schematic](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/TopDesign/TopDesign.cysch): hardware design · Defines wired PSoC components consumed by generated firmware. · `KitProg3.cydsn/TopDesign/TopDesign.cysch`
- [Firmware entry](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/main.c): application entry · `KitProg3.cydsn/main.c`
- [KitProg state](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/kitprog.h): device definitions · `KitProg3.cydsn/kitprog.h`
- [USB host interface](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/usbinterface.c): USB control plane · `KitProg3.cydsn/usbinterface.c`
- [User HID layer](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/usb_user_hid.c): USB request adapter · `KitProg3.cydsn/usb_user_hid.c`
- [Command processor](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/commandprocessor.h): command API · Host protocol command boundary. · `KitProg3.cydsn/commandprocessor.h`
- [Application modes](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/app_switch.c): mode controller · `KitProg3.cydsn/app_switch.c`
- [Power, LEDs & mutexes](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/power.c): board control · Coordinates board-visible state and synchronized target access. · `KitProg3.cydsn/power.c`

### Target Debug

- [Target bridge API](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/bridgesInterface.c): bridge interface · `KitProg3.cydsn/bridgesInterface.c`
- [CMSIS-DAP logic](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/DAP.c): debug protocol · Includes KitProg DAP configuration and vendor extensions. · `KitProg3.cydsn/DAP.c`
- [SWD data port](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/SW_DP.c): debug transport · `KitProg3.cydsn/SW_DP.c`
- [JTAG data port](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/JTAG_DP.c): debug transport · `KitProg3.cydsn/JTAG_DP.c`
- [SWD physical access](https://github.com/infineon/kitprog3/blob/master/KitProg3.cydsn/swd.c): target I/O · `KitProg3.cydsn/swd.c`

### Build & Deployment

- [PSoC Creator workspace](https://github.com/infineon/kitprog3/blob/master/KitProg3.cywrk): workspace · `KitProg3.cywrk`
- [Bootloader project](https://github.com/infineon/kitprog3/blob/master/KitProg3_Bootloader.cydsn/KitProg3_Bootloader.cyprj): PSoC bootloader · Separate update runtime for application images. · `KitProg3_Bootloader.cydsn/KitProg3_Bootloader.cyprj`
- [Bootloader entry](https://github.com/infineon/kitprog3/blob/master/KitProg3_Bootloader.cydsn/main.c): boot runtime · `KitProg3_Bootloader.cydsn/main.c`
- [Windows USB driver](https://github.com/infineon/kitprog3/blob/master/drivers/KitProg3/KitProg3/Win7/KitProg3.inf): host driver package · Supports KitProg-family USB and UART enumeration. · `drivers/KitProg3/KitProg3/Win7/KitProg3.inf`

### Component Library

- [SPI Master component](https://github.com/infineon/kitprog3/blob/master/KitProg3_Library.cylib/SPI_Master_v2_50/API/SPI_Master.c): PSoC Creator library · Reusable design-time component with generated embedded API. · `KitProg3_Library.cylib/SPI_Master_v2_50/API/SPI_Master.c`
- [SPI component schematic](https://github.com/infineon/kitprog3/blob/master/KitProg3_Library.cylib/SPI_Master_v2_50/SPI_Master_v2_50.cysch): component design · `KitProg3_Library.cylib/SPI_Master_v2_50/SPI_Master_v2_50.cysch`

## Connections

- PSoC Creator workspace → Probe application project: contains
- PSoC Creator workspace → Bootloader project: contains
- Probe application project → Board schematic: uses design
- Probe application project → Firmware entry: builds
- Board schematic → USB host interface: provides USB peripherals
- Board schematic → Power, LEDs & mutexes: provides board peripherals
- Firmware entry → KitProg state: coordinates
- Firmware entry → USB host interface: initializes
- Firmware entry → Application modes: selects mode
- USB host interface → User HID layer: receives requests through
- User HID layer → Command processor: dispatches
- Command processor → Application modes: selects functions
- Application modes → Target bridge API: routes target commands
- Target bridge API → CMSIS-DAP logic: invokes debug access
- CMSIS-DAP logic → SWD data port: uses SWD
- CMSIS-DAP logic → JTAG data port: uses JTAG
- SWD data port → SWD physical access: drives
- Power, LEDs & mutexes → SWD physical access: protects access
- Probe application project → Bootloader project: emits update image for
- Bootloader project → Bootloader entry: builds
- Windows USB driver → USB host interface: host enumeration
- SPI component schematic → SPI Master component: generates API
