Skip to content

Am263x: PRU-I2S#8

Open
rajul-bhambay wants to merge 3 commits intomainfrom
a0497643_PINDSW-8487_PRU_I2S
Open

Am263x: PRU-I2S#8
rajul-bhambay wants to merge 3 commits intomainfrom
a0497643_PINDSW-8487_PRU_I2S

Conversation

@rajul-bhambay
Copy link
Copy Markdown
Collaborator

@rajul-bhambay rajul-bhambay commented Apr 17, 2025

User description

  • Firmware changes
  • Application changes
  • Restructured driver apis

Fixes: PINDSW-8487


PR Type

Enhancement


Description

• Complete PRU I2S driver implementation with comprehensive API for initialization, open/close, read/write operations
• Support for both I2S and TDM4 modes with interleaved/non-interleaved data format conversion
• PRU firmware binaries and assembly code for both TX and RX operations on PRU0 and PRU1
• Interrupt handling with callback mechanisms for Tx, Rx, and error events
• Hardware abstraction layer for PRU firmware loading, ICSS INTC configuration, and GPIO setup
• Diagnostic application with FreeRTOS support for AM263X and AM261X platforms
• TCA6416 IO expander driver for hardware configuration
• Build system integration with makefiles, linker scripts, and project configurations
• Runtime Object View (ROV) configuration for debugging support


Diagram Walkthrough

flowchart LR
  A["PRU I2S Driver"] --> B["I2S Firmware"]
  A --> C["TDM4 Firmware"]
  B --> D["PRU0 TX Binary"]
  B --> E["PRU1 RX Binary"]
  C --> F["PRU0 TDM TX Binary"]
  C --> G["PRU1 TDM RX Binary"]
  A --> H["Diagnostic App"]
  H --> I["AM263X Platform"]
  H --> J["AM261X Platform"]
  H --> K["TCA6416 IO Expander"]
  A --> L["PRUSS INTC Mapping"]
  A --> M["Hardware Abstraction"]
Loading

File Walkthrough

Relevant files
Enhancement
20 files
pru_i2s_drv.c
Complete PRU I2S driver implementation with hardware abstraction

source/pru_i2s/driver/pru_i2s_drv.c

• Complete PRU I2S driver implementation with initialization,
open/close, read/write operations
• Support for both interleaved and
non-interleaved data formats with conversion functions
• Interrupt
handling for Tx, Rx, and error events with callback mechanisms

Hardware abstraction for PRU firmware loading, ICSS INTC
configuration, and GPIO setup

+2379/-0
main.c
FreeRTOS main application for AM263x PRU I2S diagnostic   

examples/pru_i2s_diagnostic/single_channel/am263x-cc/r5fss0-0_freertos/main.c

• FreeRTOS main application entry point for AM263x platform
• Task
creation and scheduler initialization for PRU I2S diagnostic example

System and board initialization with proper task stack allocation

+84/-0   
pru_i2s_drv.h
PRU I2S Driver Header Implementation                                         

source/pru_i2s/include/pru_i2s_drv.h

• Complete PRU I2S driver header file with comprehensive API
definitions
• Defines data structures for configuration, parameters,
and I/O buffers
• Includes function declarations for driver
initialization, open/close, read/write operations
• Contains
hardware-specific constants and register definitions for AM263X and
AM261X SoCs

+1053/-0
pru_i2s_diagnostic.c
PRU I2S Diagnostic Application Implementation                       

examples/pru_i2s_diagnostic/pru_i2s_diagnostic.c

• Complete diagnostic application for PRU I2S functionality testing

Implements Tx/Rx interrupt handlers with error handling and statistics
tracking
• Supports both TDM and I2S modes with configurable firmware
selection
• Includes I2C IO expander configuration for AM263X hardware
setup

+679/-0 
icss_pru_i2s_fw.h
TDM4 Firmware Register Definitions                                             

source/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h

• Firmware register definitions and bit field mappings for TDM4 mode

Defines register offsets, addresses, and bit field masks for PRU I2S
firmware
• Includes ping-pong buffer control and error status register
definitions

+197/-0 
icss_pru_i2s_fw.h
I2S Firmware Register Definitions                                               

source/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h

• Firmware register definitions and bit field mappings for standard
I2S mode
• Identical structure to TDM4 version with same register
layout and definitions
• Provides firmware interface constants for I2S
protocol implementation

+197/-0 
ioexp_tca6416.c
TCA6416 IO Expander Driver Implementation                               

examples/pru_i2s_diagnostic/board/ioexp_tca6416.c

• I2C IO expander driver implementation for TCA6416 chip
• Provides
functions for opening, configuring, and controlling GPIO pins

Includes I2C transaction handling and register read/write operations

+287/-0 
pru_i2s_interface.h
New I2S firmware interface header with pin configurations

source/pru_i2s/firmware/I2S/pru_i2s_interface.h

• Added new assembly header file defining I2S interface constants and
pin configurations
• Includes conditional compilation for different
SoCs (AM263X, AM261X) and PRU instances
• Defines pin mappings, buffer
addresses, error positions, and interrupt event numbers
• Contains
configuration for both TX and RX I2S instances with different pin
assignments

+213/-0 
pru_i2s_interface.h
New TDM4 firmware interface header with TDM-specific configurations

source/pru_i2s/firmware/TDM4/pru_i2s_interface.h

• Added TDM4 variant of I2S interface header with similar structure to
I2S version
• Includes same SoC and PRU conditional compilation
support
• Defines TDM-specific constants like TDM_CHANNELS and
MAX_TDM_CHANNELS
• Contains different BYTES_TO_LOAD value (2) and
samples per channel (16) for TDM mode

+209/-0 
data.h
I2S diagnostic example data definitions and buffer configurations

examples/pru_i2s_diagnostic/data.h

• Added comprehensive data definitions for I2S diagnostic example

Defines buffer sizes, constants for audio processing, and error
handling
• Includes ping-pong buffer configurations and memory layout
definitions
• Contains pre-initialized TX buffer data with test
patterns

+99/-0   
ioexp_tca6416.h
TCA6416 IO expander driver header with complete API           

examples/pru_i2s_diagnostic/board/ioexp_tca6416.h

• Added complete TCA6416 IO expander driver header file
• Defines API
functions for opening, configuring, and controlling IO expander

Includes data structures for configuration parameters and attributes

Provides constants for input/output modes and pin states

+210/-0 
pru_i2s_tdm4_pru0_array.h
PRU0 TDM4 firmware binary array                                                   

source/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h

• Added compiled PRU0 firmware binary array for TDM4 mode
• Contains
both instruction array (pru_prupru_i2s0_image_0_0) and data array

Provides pre-compiled firmware ready for loading into PRU0

+191/-0 
pru_i2s_pru0_array.h
PRU0 I2S firmware binary array                                                     

source/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h

• Added compiled PRU0 firmware binary array for standard I2S mode

Contains instruction and data arrays for PRU0 I2S firmware
• Provides
pre-compiled firmware binary ready for deployment

+187/-0 
pru_i2s_tdm4_pru1_array.h
PRU1 TDM4 firmware binary array                                                   

source/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h

• Added compiled PRU1 firmware binary array for TDM4 mode
• Contains
instruction array and data array for PRU1 TDM4 firmware
• Provides
pre-compiled firmware for PRU1 in TDM4 configuration

+184/-0 
pru_i2s_pru1_array.h
PRU1 I2S firmware binary array                                                     

source/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h

• Added compiled PRU1 firmware binary array for standard I2S mode

Contains instruction and data arrays for PRU1 I2S firmware
• Provides
pre-compiled firmware binary for PRU1 deployment

+174/-0 
pru_i2s_regs.h
TDM4 PRU register definitions and mappings                             

source/pru_i2s/firmware/TDM4/pru_i2s_regs.h

• Added TDM4-specific register definitions and assignments
• Defines
PRU register mappings for TX/RX operations, counters, and buffers

Includes conditional compilation for different I2S modes (TX/RX)

Contains register assignments for ping-pong buffers and status
tracking

+114/-0 
pru_i2s_regs.h
I2S PRU register definitions and mappings                               

source/pru_i2s/firmware/I2S/pru_i2s_regs.h

• Added I2S-specific register definitions and assignments
• Defines
PRU register mappings similar to TDM4 but for standard I2S
• Includes
register assignments for audio data, buffers, and control
• Contains
conditional compilation for TX/RX modes and profiling

+113/-0 
main.c
AM261X I2S diagnostic main application with FreeRTOS         

examples/pru_i2s_diagnostic/single_channel/am261x-lp/r5fss0-0_freertos/main.c

• Added main application file for AM261X LaunchPad I2S diagnostic

Implements FreeRTOS-based main function with task creation
• Calls
pru_i2s_diagnostic_main function and handles task management

Includes standard system and board initialization

+84/-0   
fw_regs.asm
I2S firmware register initialization assembly                       

source/pru_i2s/firmware/I2S/fw_regs.asm

• Added firmware register initialization assembly file for I2S

Defines firmware register section with configuration values
• Includes
conditional compilation for different TX configurations
• Sets up pin
numbers, buffer addresses, and system event numbers

+113/-0 
fw_regs.asm
TDM4 firmware register initialization assembly                     

source/pru_i2s/firmware/TDM4/fw_regs.asm

• Added firmware register initialization assembly file for TDM4

Similar structure to I2S version with TDM4-specific configurations

Defines register section with buffer addresses and pin assignments

Includes conditional compilation for different modes and PRU instances

+113/-0 
Configuration changes
8 files
pru_i2s_pruss_intc_mapping.h
PRUSS interrupt controller mapping definitions and macros

source/pru_i2s/include/pru_i2s_pruss_intc_mapping.h

• PRUSS interrupt controller mapping definitions and constants

System event, channel, and host interrupt mapping macros
• INTC
initialization data structure template with proper MISRA C compliance

+200/-0 
syscfg_c.rov.xs
ROV configuration for AM261x FreeRTOS debugging                   

examples/pru_i2s_diagnostic/single_channel/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs

• Runtime Object View (ROV) configuration file for debugging support

FreeRTOS ROV integration for AM261x platform

+8/-0     
product.json
Product Metadata Configuration Update                                       

.metadata/product.json

• Added include path for sysconfig directory
• Added "/open_pru"
component to the components list

+2/-1     
pru_i2s_master_icss.cmd
I2S PRU firmware linker command file                                         

source/pru_i2s/firmware/I2S/pru_i2s_master_icss.cmd

• Added linker command file for I2S PRU firmware
• Defines memory
layout for ICSSG PRU with instruction and data memory sections

Includes peripheral memory mappings and section allocations

Configures firmware registers, output samples, and debug buffer
sections

+88/-0   
pru_i2s_master_icss.cmd
TDM4 PRU firmware linker command file                                       

source/pru_i2s/firmware/TDM4/pru_i2s_master_icss.cmd

• Added linker command file for TDM4 PRU firmware
• Identical
structure to I2S linker file with same memory layout
• Defines ICSSG
memory sections and peripheral mappings
• Configures section
allocations for TDM4 firmware variant

+88/-0   
syscfg_c.rov.xs
ROV configuration for FreeRTOS debugging                                 

examples/pru_i2s_diagnostic/single_channel/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs

• Added Runtime Object View (ROV) configuration file
• Defines ROV
files for FreeRTOS debugging support
• Simple configuration file for
debugging tools integration

+8/-0     
makefile_ccs_bootimage_gen
Boot image generation makefile with security features       

examples/pru_i2s_diagnostic/single_channel/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen

• Added comprehensive makefile for boot image generation
• Defines
build targets for different image formats (appimage, MCELF, signed)

Includes multi-core image generation and XIP support
• Contains
security features like image signing and encryption

+141/-0 
makefile
Added I2S diagnostic example to build system                         

examples/makefile

• Added pru_i2s_diagnostic to the list of subdirectories to build

Simple one-line addition to include new example in build system

+1/-1     
Additional files
37 files
makefile +106/-0 
readme.md +304/-0 
example.syscfg +333/-0 
example.projectspec +114/-0 
makefile +370/-0 
makefile_projectspec +20/-0   
example.syscfg +313/-0 
example.projectspec +120/-0 
makefile +374/-0 
makefile_ccs_bootimage_gen +141/-0 
makefile_projectspec +20/-0   
example.projectspec +85/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +85/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +84/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +84/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
pru_i2s_main.asm +502/-0 
example.projectspec +85/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +85/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +84/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +84/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
pru_i2s_main.asm +517/-0 

@rajul-bhambay rajul-bhambay changed the title Am263x: PRU-I2S Am263x: PRU-I2S[WIP] Apr 17, 2025
@rajul-bhambay
Copy link
Copy Markdown
Collaborator Author

rajul-bhambay commented Apr 17, 2025

  • Firmware changes
  • Application changes
  • Restructured driver apis

Fixes: PINDSW-8487

Pending Items:
->Include Standard I2S firmware (currently its TDM4)
-> Testing
_> Documentation of code

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 2 times, most recently from 96bf0b7 to a27184b Compare April 24, 2025 05:41
@nsaulnier-ti
Copy link
Copy Markdown
Collaborator

Hey @rajul-bhambay, what is TDM4? I assume something to do with time-domain multiplexing, instead of a typo for TDA4?

@rajul-bhambay
Copy link
Copy Markdown
Collaborator Author

Hey @rajul-bhambay, what is TDM4? I assume something to do with time-domain multiplexing, instead of a typo for TDA4?

Hey @nsaulnier-ti , TDM4 (time division multiplexing 4 channels) is a mode of communication of audio signals. We have 2 modes, I2S and TDM4/TDM8 which is suppported by the TI's TAS6424Q1 coded (class-D amplifier).

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 2 times, most recently from 26e87e1 to 29b5691 Compare May 9, 2025 10:55
@rajul-bhambay rajul-bhambay changed the title Am263x: PRU-I2S[WIP] Am263x: PRU-I2S Jun 23, 2025
@@ -0,0 +1,186 @@
%%{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this file. Can we remove?

@@ -0,0 +1,77 @@
%%{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this file. Can we remove?

@@ -0,0 +1,52 @@
/*
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this file. Can we remove?

@@ -0,0 +1,280 @@
/*
* Copyright (C) 2021 Texas Instruments Incorporated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update copyright year in all files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this file to board sub-folder as it is not a core example function

/* Function Definitions */
/* ========================================================================== */

int32_t TCA6416_open(TCA6416_Config *config, const TCA6416_Params *params)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this code now? Is this not supported in MCU+ SDK SysConfig under IOEXP module?

#define TEST_PRUI2S0_IDX ( 0 ) /* Test PRU I2S 0 index */
#define TEST_PRUI2S1_IDX ( 1 ) /* Test PRU I2S 1 index */

#define TDM4 ( 1 ) /* TDM4 mode (change to 0 for I2S)*/
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we have tested both modes. Can you confirm?

*/


void i2s_i2c_io_expander(void)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's review if this can be removed - by using SysConfig

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you review this?

/* debug, increment ISR count */
gPruI2s1RxIsrCnt++;
/* debug, drive GPIO high */
GPIO_pinWriteHigh(CONFIG_GPIO_DEBUG1_BASE_ADDR, CONFIG_GPIO_DEBUG1_PIN);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this GPIO code under some debug macro? Else it adds unnecessary latency to ISRs

@@ -0,0 +1,200 @@
/*
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to SysConfig?

@dhavaljk
Copy link
Copy Markdown
Collaborator

Can we merge commit? Don't think we need 4

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 3 times, most recently from cd4d050 to 172a2d0 Compare June 26, 2025 12:02
Copy link
Copy Markdown
Collaborator

@pratheesh-ti pratheesh-ti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete the documentation changes to merge

Comment thread source/pru_i2s/driver/pru_i2s_drv.c Outdated
@@ -0,0 +1,2692 @@
/*
* Copyright (C) 2021 Texas Instruments Incorporated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the copyright year

Comment thread source/pru_i2s/driver/pru_i2s_drv.c Outdated

#include <stdint.h>
#include <drivers/hw_include/cslr.h>
#include <drivers\hw_include\am263x\cslr_iomux.h>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be consistent with use of "/" vs ""

Comment thread source/pru_i2s/driver/pru_i2s_drv.c Outdated
#include <kernel/dpl/SemaphoreP.h>
#include <drivers\hw_include\am263px\cslr_intr_r5fss0_core0.h>
#include <drivers\pinmux\am263x\pinmux.h>
//#include "ti_drivers_config.h"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove if not relevant

Comment thread source/pru_i2s/driver/pru_i2s_drv.c Outdated
#define PRUI2S_PRU_INTC_SYSEVT2_IDX ( 2 ) /* I2S error system event index */

/* Number INTC channels per PRU */
#define PRUI2S_PRUICSS_INTC_NUM_CHANNELS_PER_PRU \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next line is not really warranted here?

Comment thread examples/pru_i2s/driver/pru_i2s_drv.c Outdated
pSwipAttrs->rxPin[i].pinNum = temp8b;
}

/* TBD: SoC PAD address lookup */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove if not relevant anymore

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file seems to redefine a bunch of functions definted in pruicss driver in MCU+ SDK. Is this intentional?

@@ -0,0 +1,200 @@
/*
* Copyright (c) 2021, Texas Instruments Incorporated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the year

@@ -0,0 +1,280 @@
/*
* Copyright (C) 2021 Texas Instruments Incorporated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this file to board sub-folder as it is not a core example function

@@ -0,0 +1,113 @@
;
; Copyright (c) 2021, Texas Instruments Incorporated
; All rights reserved.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add firmware design document in md format here under firmware/I2S/docs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check this comment @rajul-bhambay

* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <stdio.h>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Readme.md following other examples in open-pru, explaining the examples and other details

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 034f165 to 52e4c10 Compare July 10, 2025 11:08
pratheesh-ti
pratheesh-ti previously approved these changes Jul 11, 2025
Copy link
Copy Markdown
Collaborator

@pratheesh-ti pratheesh-ti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding firmware documentation. Can do dedicated PR for this

@nsaulnier-ti
Copy link
Copy Markdown
Collaborator

@dhavaljk @manojKoppolu @rajul-bhambay let's discuss the overall structure of this project and the source folder, perhaps on Wednesday's meeting?

I am trying to understand the logic of the overall project structure (e.g., not actually including any PRU code under examples, keeping it all under source), and function of different folders (especially .meta). If we want to keep the proposed structure of "source" [1], we would need to move the files a bit:

source

  • linkers
  • macros
  • defines
  • drivers
    • pru_i2s

[1] https://confluence.itg.ti.com/display/ProcSW/OpenPRU+Repository+Structure+Proposal

Copy link
Copy Markdown
Collaborator

@nsaulnier-ti nsaulnier-ti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to understand the logic behind the folder structures before we merge this in. Best to discuss verbally in the team meeting.

@pratheesh-ti
Copy link
Copy Markdown
Collaborator

/review

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Mar 30, 2026

Persistent review updated to latest commit 4eff401

Comment on lines +157 to +183
INITIAL_STATE:
; start iterating
; wait until the input BCLK is low
; then branch to wait for the rising edge
QBBS INITIAL_STATE, r31, I2S_INSTANCE_BCLK_PIN

;Wait until there are 4 transitions of FS H-L-H-L-H
INITIAL_STATE_FS:
; start iterating
; wait until the input FS is low
; then branch to wait for the rising edge
QBBS INITIAL_STATE_FS, r31, I2S_INSTANCE_FS_PIN

INITIAL_STATE_FS1:
; wait until the input FS is high
QBBC INITIAL_STATE_FS1, r31, I2S_INSTANCE_FS_PIN

INITIAL_STATE_FS2:
; wait until the input FS is low
QBBS INITIAL_STATE_FS2, r31, I2S_INSTANCE_FS_PIN

BCLK_RISING_EDGE_HIGH1:
QBBS BCLK_RISING_EDGE_HIGH1, r31, I2S_INSTANCE_BCLK_PIN

BCLK_RISING_EDGE_LOW:
; wait until we see a high value
QBBC BCLK_RISING_EDGE_LOW, r31, I2S_INSTANCE_BCLK_PIN
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. qbbs wait loops unbounded 📘 Rule violation ⛯ Reliability

The firmware contains self-branching wait loops (e.g., waiting for BCLK/FS transitions) with no
explicit termination/timeout condition. This can lead to runaway execution if the expected signal
never arrives.
Agent Prompt
## Issue description
Signal-wait loops can run forever if BCLK/FS is missing or stuck.

## Issue Context
Several labels (`INITIAL_STATE`, `INITIAL_STATE_FS*`, `BCLK_RISING_EDGE_*`) busy-wait using self-branches without any bounded termination.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[157-183]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +42 to +53
main:
.if $isdefed("I2S_TX")
;err_stat = err_stat >> 1. Remove the Rx Overflow error bit.
LSR err_stat, err_stat, 1
;If there was an underflow/FrameSync Error, clearup thr Tx PingPong Buffer space
;err_stat is already initialized during normal operation.
; FS_ERROR UNDERFLOW_ERROR
; 0 0 No Error
; 0 1 Under Flow error
; 1 0 FS Error
; 1 1 Both errors
QBEQ CONTIUNE_INIT, err_stat, 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. err_stat used before init 📘 Rule violation ⛯ Reliability

Startup code uses err_stat before the register-clearing ZERO &r0, 128 executes. This violates
the requirement to explicitly initialize register state at startup and may cause unpredictable
control flow on cold boot.
Agent Prompt
## Issue description
`err_stat` is used prior to the global register clear/initialization.

## Issue Context
The register clear occurs at `CONTIUNE_INIT`, but `err_stat` is shifted and compared earlier.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[42-74]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +1 to +3
;
; Copyright (C) 2024-2025 Texas Instruments Incorporated
;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Missing file-name header fields 📘 Rule violation ⚙ Maintainability

Several newly-added source/header files include a TI copyright header but do not state the file name
in the header. This violates the required file header content for traceability/legal compliance.
Agent Prompt
## Issue description
File headers are missing an explicit file-name line.

## Issue Context
Compliance requires each source/header to include both the file name and TI copyright.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[1-3]
- examples/pru_i2s/firmware/I2S/pru_i2s_interface.h[1-3]
- examples/pru_i2s/firmware/I2S/pru_i2s_regs.h[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +42 to +46
main:
.if $isdefed("I2S_TX")
;err_stat = err_stat >> 1. Remove the Rx Overflow error bit.
LSR err_stat, err_stat, 1
;If there was an underflow/FrameSync Error, clearup thr Tx PingPong Buffer space
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. main label/opcodes mis-cased 📘 Rule violation ⚙ Maintainability

The PRU assembly uses a lowercase label (main:) and uppercase opcodes (e.g., LSR, LDI) instead
of the required casing conventions. This violates PRU assembly naming/style rules and reduces
consistency/searchability.
Agent Prompt
## Issue description
PRU assembly label/opcode casing does not match required conventions.

## Issue Context
Compliance expects uppercase labels and lowercase opcodes for consistency.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[42-46]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +114 to +167
if ((pSwipAttrs->pruInstId == PRUICSS_PRU0) && ((*gPruFwImageInfo)[0].pPruImemImg != NULL))
{
/* Update base address */
pSwipAttrs->baseAddr = (uint32_t)AddrTranslateP_getLocalAddr(pSwipAttrs->baseAddr);

/* Parse info in PRU image #0, update SW IP info */
status = PRUI2S_getPruFwImageInfo(&((*gPruFwImageInfo)[0]), pSwipAttrs);
if (status != SystemP_SUCCESS)
{
retStatus = PRUI2S_DRV_SERR_INIT;
break;
}

/* Set FW image pointer */
pObj->pPruFwImageInfo = &((*gPruFwImageInfo)[0]);
}
else if ((pSwipAttrs->pruInstId == PRUICSS_PRU1) && ((*gPruFwImageInfo)[1].pPruImemImg != NULL))
{
/* Update base address */
pSwipAttrs->baseAddr = (uint32_t)AddrTranslateP_getLocalAddr(pSwipAttrs->baseAddr);

/* Parse info in PRU image #1, update SW IP info */
status = PRUI2S_getPruFwImageInfo(&((*gPruFwImageInfo)[1]), pSwipAttrs);
if (status != SystemP_SUCCESS)
{
retStatus = PRUI2S_DRV_SERR_INIT;
break;
}

/* Set FW image pointer */
pObj->pPruFwImageInfo = &((*gPruFwImageInfo)[1]);
}
else
{
/* Error, no PRU FW image for selected core type */
retStatus = PRUI2S_DRV_SERR_INIT_FWIMG;
break;
}

/* Check SW IP parameters */
status = PRUI2S_checkSwipParams(pSwipAttrs);
if (status != SystemP_SUCCESS)
{
retStatus = PRUI2S_DRV_SERR_INIT;
break;
}

gPruI2sDrvNumValidCfg++;
}

*pNumValidCfg = gPruI2sDrvNumValidCfg;
if (retStatus == PRUI2S_DRV_SOK)
{
gPruI2sDrvInit = TRUE;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Init count out-of-bounds 🐞 Bug ✓ Correctness

PRUI2S_init increments gPruI2sDrvNumValidCfg without resetting it when initialization fails and is
retried. Since PRUI2S_open trusts gPruI2sDrvNumValidCfg for bounds checking, repeated failed init
attempts can allow out-of-bounds indexing into gPruI2sConfig.
Agent Prompt
## Issue description
`PRUI2S_init()` increments `gPruI2sDrvNumValidCfg` but does not reset it at the start of init attempts. If init fails (so `gPruI2sDrvInit` stays FALSE) and init is retried, the count can accumulate across attempts. `PRUI2S_open()` uses this count for bounds checking and then indexes `gPruI2sConfig[index]`, so an inflated count can allow out-of-bounds access.

## Issue Context
This is an error-recovery path bug: it may not show up during successful init, but it breaks retry logic and can turn a recoverable init failure into memory corruption.

## Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[61-173]
- examples/pru_i2s/driver/pru_i2s_drv.c[284-290]

## Suggested fix
- At the beginning of `PRUI2S_init()` (inside the `gPruI2sDrvInit == FALSE` block), set `gPruI2sDrvNumValidCfg = 0;`.
- Add defensive bounds in `PRUI2S_open()` as well (e.g., `index < PRU_I2S_NUM_CONFIG` AND `index < gPruI2sDrvNumValidCfg`).
- Optionally, if init fails after constructing per-instance mutexes, consider cleaning up those constructed mutexes before returning to avoid leaking/duplicating state across retries.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

PRU I2S Driver and Firmware Implementation for AM263X and AM261X

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Complete PRU I2S driver implementation with comprehensive API for initialization, configuration,
  and data transfer operations supporting both interleaved and non-interleaved data formats
• PRU firmware implementation for both I2S and TDM4 modes with assembly code, register definitions,
  and compiled binary images for PRU0 and PRU1
• Diagnostic application demonstrating PRU I2S Tx/Rx loopback with dual instance support, interrupt
  handlers, and semaphore-based synchronization
• TCA6416 I2C IO expander driver for GPIO pin configuration with thread-safe operations
• Interrupt management infrastructure including PRU-ARM event mappings, INTC configuration, and host
  interrupt notifications
• FreeRTOS application support for AM263X and AM261X boards with main entry points and system
  initialization
• Build infrastructure including linker command files, makefiles, and project specifications for
  both firmware and application compilation
• Product metadata updates to include PRU component references
Diagram
flowchart LR
  A["PRU I2S Driver<br/>pru_i2s_drv.c/h"] --> B["Firmware Layer<br/>I2S & TDM4 Modes"]
  B --> C["PRU0/PRU1<br/>Binary Images"]
  A --> D["Interrupt Management<br/>INTC Mapping"]
  A --> E["Application<br/>Diagnostic App"]
  E --> F["Board Support<br/>IO Expander"]
  E --> G["FreeRTOS<br/>AM263X/AM261X"]
  H["Data Structures<br/>Buffers & Config"] --> A
  H --> E
Loading

Grey Divider

File Changes

1. examples/pru_i2s/driver/pru_i2s_drv.c ✨ Enhancement +2484/-0

Complete PRU I2S driver implementation with full API

• Comprehensive PRU I2S driver implementation with 2484 lines of code covering initialization,
 configuration, and data transfer operations
• Core driver functions: PRUI2S_init(), PRUI2S_open(), PRUI2S_close(), PRUI2S_write(),
 PRUI2S_read() with support for both interleaved and non-interleaved data formats
• Interrupt management functions: PRUI2S_enableInt(), PRUI2S_disableInt(), PRUI2S_clearInt()
 for Tx, Rx, and error interrupts
• Low-level PRU initialization, ICSS INTC configuration, ping/pong buffer management, and PAD
 register configuration
• PRUICSS helper functions for event management and interrupt controller setup

examples/pru_i2s/driver/pru_i2s_drv.c


2. examples/pru_i2s/include/pru_i2s_pruss_intc_mapping.h ⚙️ Configuration changes +200/-0

PRU interrupt mapping and INTC configuration definitions

• Header file defining PRU-ARM interrupt event mappings and INTC configuration constants
• Defines system event numbers (PRU_ARM_EVENT00-15), channel definitions, and host enable masks
• Provides PRUICSS_INTC_INITDATA macro for initializing interrupt controller with default values
• Supports multiple PRU event outputs and polarity/type configurations

examples/pru_i2s/include/pru_i2s_pruss_intc_mapping.h


3. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

FreeRTOS ROV debugging configuration file

• Runtime Object View (ROV) configuration file for FreeRTOS kernel debugging support
• Minimal configuration specifying FreeRTOS ROV plugin reference

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


View more (62)
4. examples/pru_i2s/include/pru_i2s_drv.h ✨ Enhancement +1053/-0

PRU I2S Driver Header with Complete API Definitions

• Comprehensive PRU I2S driver header file with 1053 lines defining data structures, macros, and
 function prototypes
• Defines core types: PRUI2S_Handle, PRUI2S_Params, PRUI2S_Object, PRUI2S_SwipAttrs, and
 PRUI2S_Config
• Includes firmware register definitions, interrupt configuration, and ping/pong buffer management
• Declares 20+ public API functions for initialization, open/close, read/write, and error handling

examples/pru_i2s/include/pru_i2s_drv.h


5. examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c ✨ Enhancement +679/-0

PRU I2S Diagnostic Application with Loopback Testing

• Diagnostic application demonstrating PRU I2S Tx/Rx loopback with dual instance support
• Implements interrupt handlers for Tx, Rx, and error events with comprehensive error tracking
• Includes main processing loop with semaphore-based synchronization and optional channel mixing
• Configures I2C IO expander for AM263X SoC and manages ping/pong buffer transfers

examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c


6. examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

TDM4 Firmware Register Definitions and Bit Fields

• Firmware register definitions for TDM4 mode PRU I2S implementation
• Defines register offsets and bit-field masks for configuration, status, and control registers
• Includes ping/pong buffer selection, error status tracking, and system event mapping
• Supports up to 3 Tx and 2 Rx I2S channels with configurable sampling frequency and slot width

examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h


7. examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

I2S Firmware Register Definitions and Bit Fields

• Firmware register definitions for standard I2S mode PRU I2S implementation
• Defines register offsets and bit-field masks for configuration, status, and control registers
• Includes ping/pong buffer selection, error status tracking, and system event mapping
• Supports up to 3 Tx and 2 Rx I2S channels with configurable sampling frequency and slot width

examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h


8. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c ✨ Enhancement +287/-0

TCA6416 IO Expander Driver Implementation

• TCA6416 I2C IO expander driver implementation for GPIO pin configuration
• Provides functions to open/close device, configure pin modes, and set output states
• Implements thread-safe operations using semaphore-based locking mechanism
• Supports 16 IO pins organized in 2 ports with read/modify/write register access

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c


9. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

FreeRTOS ROV Configuration File

• Runtime Object View (ROV) configuration file for FreeRTOS debugging support
• Minimal configuration specifying FreeRTOS ROV plugin for runtime inspection

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


10. examples/pru_i2s/firmware/I2S/pru_i2s_interface.h ✨ Enhancement +213/-0

I2S Interface Configuration Header for PRU Firmware

• New header file defining I2S pin configurations and register addresses for AM263X and AM261X SOCs
• Configures BCLK, FS, and SD (serial data) pins for both PRU0 and PRU1 instances
• Defines firmware register space addresses for TX/RX buffer management and error handling
• Specifies host interrupt event mappings for TX, RX, and error notifications

examples/pru_i2s/firmware/I2S/pru_i2s_interface.h


11. examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h ✨ Enhancement +209/-0

TDM4 Mode I2S Interface Configuration Header

• New header file for TDM4 mode I2S pin and register configurations
• Similar structure to I2S mode with SOC-specific pin mappings for AM263X and AM261X
• Defines TDM-specific constants including channel slots and samples per channel
• Includes firmware register addresses and host interrupt event mappings

examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h


12. examples/pru_i2s/pru_i2s_app/data.h ✨ Enhancement +99/-0

Application Data Structures and Buffer Definitions

• New header defining system configuration constants for buffer management and error handling
• Declares ping-pong buffer structures and TX/RX buffer sizes in shared memory
• Initializes TX buffer with test pattern data (0xaaaaffff pattern)
• Defines IO expander indices and audio processing gain constants

examples/pru_i2s/pru_i2s_app/data.h


13. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h ✨ Enhancement +210/-0

TCA6416 IO Expander Driver Header Interface

• New header file for TCA6416 IO Expander driver interface
• Defines API functions for opening, closing, and configuring IO pins
• Includes structures for driver configuration, parameters, and attributes
• Provides macros for pin mode (input/output) and output state (HIGH/LOW) control

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h


14. examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h ✨ Enhancement +114/-0

TDM4 Mode PRU Register Definitions and Mappings

• New header defining PRU register mappings for TDM4 mode firmware
• Maps general purpose registers to specific functions (buffers, counters, data)
• Defines bit fields within registers for status tracking and control
• Includes conditional register definitions based on TX/RX mode

examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h


15. examples/pru_i2s/firmware/I2S/pru_i2s_regs.h ✨ Enhancement +113/-0

I2S Mode PRU Register Definitions and Mappings

• New header defining PRU register mappings for I2S mode firmware
• Maps registers for buffer management, audio data, and status tracking
• Defines bit-level fields for ping-pong buffer status and error conditions
• Includes conditional definitions for TX-only, RX-only, and bidirectional modes

examples/pru_i2s/firmware/I2S/pru_i2s_regs.h


16. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h ✨ Enhancement +159/-0

TDM4 Mode PRU0 Firmware Binary Image Arrays

• New file containing compiled PRU firmware binary arrays for TDM4 mode on PRU0
• Includes instruction array (pru_prupru_i2s0_image_0_0) and debug/metadata array
 (pru_prupru_i2s0_image_0_1)
• Binary data represents assembled PRU assembly code for TDM4 I2S operation

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h


17. examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h ✨ Enhancement +155/-0

I2S Mode PRU0 Firmware Binary Image Arrays

• New file containing compiled PRU firmware binary arrays for I2S mode on PRU0
• Includes instruction array and metadata array for PRU0 firmware
• Binary representation of assembled PRU assembly code for standard I2S operation

examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h


18. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h ✨ Enhancement +152/-0

TDM4 Mode PRU1 Firmware Binary Image Arrays

• New file containing compiled PRU firmware binary arrays for TDM4 mode on PRU1
• Includes instruction and metadata arrays for PRU1 TDM4 firmware
• Binary data for PRU1-specific TDM4 I2S implementation

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h


19. examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h ✨ Enhancement +142/-0

I2S Mode PRU1 Firmware Binary Image Arrays

• New file containing compiled PRU firmware binary arrays for I2S mode on PRU1
• Includes instruction and metadata arrays for PRU1 I2S firmware
• Binary representation of assembled PRU assembly code for PRU1 I2S operation

examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h


20. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM263X Board FreeRTOS Application Main Entry Point

• New main entry point for AM263X board FreeRTOS application
• Initializes system and board, creates main task, and starts FreeRTOS scheduler
• Calls pru_i2s_diagnostic_main() function for PRU I2S diagnostic operations

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c


21. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM261X LaunchPad FreeRTOS Application Main Entry Point

• New main entry point for AM261X LaunchPad FreeRTOS application
• Initializes system and board, creates main task, and starts FreeRTOS scheduler
• Calls pru_i2s_diagnostic_main() function for PRU I2S diagnostic operations

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c


22. examples/pru_i2s/firmware/I2S/linker.cmd ⚙️ Configuration changes +88/-0

I2S Mode PRU Firmware Linker Command File

• New linker command file for I2S mode PRU firmware compilation
• Defines memory map for PRU instruction RAM, data RAM, and shared memory
• Maps section allocations for code, data, and debug buffers
• Includes peripheral register address mappings via CREGISTER definitions

examples/pru_i2s/firmware/I2S/linker.cmd


23. examples/pru_i2s/firmware/TDM4/linker.cmd ⚙️ Configuration changes +88/-0

TDM4 Mode PRU Firmware Linker Command File

• New linker command file for TDM4 mode PRU firmware compilation
• Defines identical memory map structure as I2S mode for consistency
• Maps PRU memory regions and peripheral registers via CREGISTER definitions
• Allocates sections for code, data, and debug buffers

examples/pru_i2s/firmware/TDM4/linker.cmd


24. examples/pru_i2s/firmware/I2S/pru_i2s_main.asm ✨ Enhancement +502/-0

I2S Protocol Implementation PRU Assembly Firmware

• New main assembly file implementing I2S protocol handling on PRU firmware
• Implements BCLK and FS edge detection, audio data transmission and reception
• Includes ping-pong buffer management and error detection (underflow, overflow, frame sync)
• Handles initialization, data loading, and host interrupt notifications

examples/pru_i2s/firmware/I2S/pru_i2s_main.asm


25. .metadata/product.json ⚙️ Configuration changes +2/-1

Product Metadata Configuration Updates

• Added sysconfig include path for MCU+ SDK
• Added /open_pru component reference

.metadata/product.json


26. examples/makefile Additional files +1/-1

...

examples/makefile


27. examples/pru_i2s/README.md Additional files +464/-0

...

examples/pru_i2s/README.md


28. examples/pru_i2s/firmware/I2S/fw_regs.asm Additional files +113/-0

...

examples/pru_i2s/firmware/I2S/fw_regs.asm


29. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


30. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +91/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


31. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


32. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


33. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


34. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


35. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


36. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


37. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


38. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


39. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


40. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


41. examples/pru_i2s/firmware/TDM4/fw_regs.asm Additional files +113/-0

...

examples/pru_i2s/firmware/TDM4/fw_regs.asm


42. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


43. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


44. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


45. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


46. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


47. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


48. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


49. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


50. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


51. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


52. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


53. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


54. examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm Additional files +517/-0

...

examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm


55. examples/pru_i2s/makefile Additional files +115/-0

...

examples/pru_i2s/makefile


56. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg Additional files +333/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg


57. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +118/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec


58. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +373/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile


59. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


60. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


61. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg Additional files +313/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg


62. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +124/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec


63. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +375/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile


64. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


65. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 1, 2026

Persistent review updated to latest commit 35cb893

Comment on lines +109 to +146
.if $isdefed("I2S_TX")
;read the Tx buffer address provided by host. This should be in Shared memory
; point to the PING audio buffer
LDI scratchreg0, I2S_TX_BUF_PING_ADD
LBBO &tx_buffer_address, scratchreg0, 0, 4
MOV tx_ping_buffer_address, tx_buffer_address
.endif

;read the buffer size provided by host. buffer size is ping+pong
LDI scratchreg0, I2S_PING_PONG_BUFSIZE_ADD
LBBO &tx_buf_size, scratchreg0, 0, 2
;Shift right by 1 to get PING/PONG size buffer size
LSR tx_buf_size, tx_buf_size, 1
.if $isdefed("I2S_RX")
MOV rx_buf_size, tx_buf_size
;Rx buffer size is one less than PING/PONG buffer size
SUB rx_buf_size, rx_buf_size, 1

;read the Rx buffer address provided by host
LDI scratchreg0, I2S_RX_BUF_PING_ADD
LBBO &rx_buffer_address, scratchreg0, 0, 4
MOV rx_ping_buffer_address, rx_buffer_address
LDI rx_sd_counter, I2S_SAMPLES_PER_CHANNEL
.endif

;Initialize the end address of the Tx/Rx buffers
.if $isdefed("I2S_TX")
ADD tx_buffer_address_end, tx_buffer_address, tx_buf_size
.endif
.if $isdefed("I2S_RX")
ADD rx_buffer_address_end, rx_buffer_address, rx_buf_size
.endif

;Initialize the PONG buffer addresses
.if $isdefed("I2S_TX")
MOV tx_pong_buffer_address, tx_buffer_address_end
.endif
.if $isdefed("I2S_RX")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. tx_buffer_address lacks bounds check 📘 Rule violation ⛨ Security

The PRU firmware reads host-provided buffer addresses/sizes and performs LBBO/SBBO using them
without validating that the effective address range stays within an allowed region. This can lead to
out-of-bounds PRU memory accesses if the host provides a bad address or size.
Agent Prompt
## Issue description
The firmware consumes host-provided buffer base addresses and sizes and uses them for PRU memory accesses without validating that the full `[base, base+size)` range lies within an allowed shared-memory region.

## Issue Context
This PRU firmware reads `I2S_TX_BUF_PING_ADD`, `I2S_PING_PONG_BUFSIZE_ADD`, and `I2S_RX_BUF_PING_ADD`, then computes `*_buffer_address_end` and later performs `LBBO`/`SBBO` based on those computed pointers.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[109-146]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +117 to +132
;read the buffer size provided by host. buffer size is ping+pong
LDI scratchreg0, I2S_PING_PONG_BUFSIZE_ADD
LBBO &tx_buf_size, scratchreg0, 0, 2
;Shift right by 1 to get PING/PONG size buffer size
LSR tx_buf_size, tx_buf_size, 1
.if $isdefed("I2S_RX")
MOV rx_buf_size, tx_buf_size
;Rx buffer size is one less than PING/PONG buffer size
SUB rx_buf_size, rx_buf_size, 1

;read the Rx buffer address provided by host
LDI scratchreg0, I2S_RX_BUF_PING_ADD
LBBO &rx_buffer_address, scratchreg0, 0, 4
MOV rx_ping_buffer_address, rx_buffer_address
LDI rx_sd_counter, I2S_SAMPLES_PER_CHANNEL
.endif
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. rx_buf_size underflow risk 📘 Rule violation ≡ Correctness

The firmware derives rx_buf_size from the host-provided ping-pong size and then does `SUB
rx_buf_size, rx_buf_size, 1` without checking for 0/1 values. This can underflow and make
rx_buffer_address_end invalid, causing out-of-bounds accesses.
Agent Prompt
## Issue description
`rx_buf_size` is computed as `tx_buf_size - 1` without validating that `tx_buf_size` is large enough, which can underflow and break bounds calculations.

## Issue Context
`tx_buf_size` is loaded from `I2S_PING_PONG_BUFSIZE_ADD` and right-shifted by 1 to get single-buffer size; `rx_buf_size` is then set to that value and decremented.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[117-132]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +213 to +266
/* Open drivers to open the UART driver for console */
Drivers_open();
Board_driversOpen();

DebugP_log("PRU I2S test started ...\r\n");
DebugP_log("Build timestamp : %s %s\r\n", __DATE__, __TIME__);

/* Debug, configure GPIO */
#ifdef SOC_AM263X
GPIO_setDirMode(CONFIG_GPIO_DEBUG0_BASE_ADDR, CONFIG_GPIO_DEBUG0_PIN, CONFIG_GPIO_DEBUG0_DIR);
GPIO_pinWriteHigh(CONFIG_GPIO_DEBUG0_BASE_ADDR, CONFIG_GPIO_DEBUG0_PIN);
GPIO_pinWriteLow(CONFIG_GPIO_DEBUG0_BASE_ADDR, CONFIG_GPIO_DEBUG0_PIN);
GPIO_setDirMode(CONFIG_GPIO_DEBUG1_BASE_ADDR, CONFIG_GPIO_DEBUG1_PIN, CONFIG_GPIO_DEBUG1_DIR);
GPIO_pinWriteHigh(CONFIG_GPIO_DEBUG1_BASE_ADDR, CONFIG_GPIO_DEBUG1_PIN);
GPIO_pinWriteLow(CONFIG_GPIO_DEBUG1_BASE_ADDR, CONFIG_GPIO_DEBUG1_PIN);
#endif
/* Configure I2C IO Expander,
route PRUn signals to HSEC */
#ifdef SOC_AM263X
i2s_i2c_io_expander();
#endif
/* Construct semaphores */
status = SemaphoreP_constructBinary(&gPruI2s0TxSemObj, 0);
if (status == SystemP_FAILURE)
{
DebugP_log("ERROR: SemaphoreP_constructBinary() gPruI2s0TxSemObj\r\n");
return;
}
status = SemaphoreP_constructBinary(&gPruI2s1RxSemObj, 0);
if (status == SystemP_FAILURE)
{
DebugP_log("ERROR: SemaphoreP_constructBinary() gPruI2s1RxSemObj\r\n");
return;
}

/* Initialize PRU I2S driver */
status = PRUI2S_init(&numValidCfg, &gPruFwImageInfo);
if (status == PRUI2S_DRV_SERR_INIT_FWIMG)
{
DebugP_log("WARNING: PRUI2S_init() no FW image for configuration\r\n");
}
else if (status != PRUI2S_DRV_SOK)
{
DebugP_log("ERROR: PRUI2S_init()\r\n");
return;
}
DebugP_assert(numValidCfg != 0);

if (((numValidCfg-1) < TEST_PRUI2S0_IDX) ||
((numValidCfg-1) < TEST_PRUI2S1_IDX))
{
DebugP_log("ERROR: Invalid test configuration()\r\n");
return;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Diagnostic early returns skip cleanup 📘 Rule violation ☼ Reliability

The diagnostic application returns early on multiple error paths after opening drivers/constructing
resources, without consistently closing PRU-I2S handles, destructing semaphores, or calling
Board_driversClose()/Drivers_close(). This can leak resources and leave the system in a
partially initialized state.
Agent Prompt
## Issue description
Error paths in `pru_i2s_diagnostic_main()` return early without consistently cleaning up opened drivers, PRUI2S instances, and semaphores.

## Issue Context
The function calls `Drivers_open()`/`Board_driversOpen()` and constructs semaphores, then has multiple `return;` statements on failures.

## Fix Focus Areas
- examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c[213-266]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +343 to +370
/* Lock instance */
SemaphoreP_pend(pObj->pruInstLock, SystemP_WAIT_FOREVER);

if ((pObj->isOpen == FALSE) && (pObj->pruIcssHandle == NULL))
{
/* Copy parameters to Object */
if (pPrms != NULL)
{
pObj->prms = *pPrms;
}
else
{
PRUI2S_paramsInit(&pObj->prms);
}

/* Check parameters are valid */
status = PRUI2S_checkOpenParams(pSwipAttrs, &pObj->prms);
}

if (status == SystemP_SUCCESS)
{
/*
* Construct interrupts
*/

/* Use pObj->prms consistently to avoid NULL dereference */
if (pObj->prms.i2sTxCallbackFxn != NULL)
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Open allows double-open 🐞 Bug ☼ Reliability

PRUI2S_open() does not return an error when the instance is already open; it skips parameter
validation but still proceeds to construct interrupts and reinitialize PRU/INTC/FW, risking
duplicated HWIs and corrupted instance state.
Agent Prompt
### Issue description
`PRUI2S_open()` can be called multiple times for the same `index` without failing. When `pObj->isOpen == TRUE`, it skips parameter copy/validation but still proceeds to (re)construct interrupts and reinitialize PRU state.

### Issue Context
This can lead to duplicate Hwi objects, unexpected interrupt behavior, and inconsistent PRU/INTC state.

### Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[343-372]
- examples/pru_i2s/driver/pru_i2s_drv.c[446-468]

### What to change
- After acquiring `pObj->pruInstLock`, add a guard:
  - If `pObj->isOpen == TRUE` (and/or `pObj->pruIcssHandle != NULL`), release the lock and return `NULL` (or a defined error via a separate API).
- Ensure failure paths don’t call `PRUI2S_close()` on a partially-open object if you choose to return early for already-open.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +65 to +74
INCLUDES_common := \
-I${CG_TOOL_ROOT}/include/c \
-I${MCU_PLUS_SDK_PATH}/source \
-I${OPEN_PRU_PATH}/source \
-I${OPEN_PRU_PATH}/examples/pru_i2s_diagnostic \
-I${MCU_PLUS_SDK_PATH}/source/kernel/freertos/FreeRTOS-Kernel/include \
-I${MCU_PLUS_SDK_PATH}/source/kernel/freertos/portable/TI_ARM_CLANG/ARM_CR5F \
-I${MCU_PLUS_SDK_PATH}/source/kernel/freertos/config/am263x/r5f \
t-I${MCU_PLUS_SDK_PATH}/source/pru_io/driver
-Igenerated \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Am263x makefile include typo 🐞 Bug ≡ Correctness

The AM263x MCU+ app makefile contains an invalid include flag line (t-I...) and is missing the
trailing continuation backslash, which will break makefile parsing and/or omit required include
paths.
Agent Prompt
### Issue description
The AM263x ti-arm-clang makefile has a malformed include path entry: `t-I${MCU_PLUS_SDK_PATH}/source/pru_io/driver` (note the leading `t-`) and it lacks a trailing `\` line continuation. This will break `INCLUDES_common` and likely fail the build.

### Issue Context
This makefile is used to build the `am263x-cc/r5fss0-0_freertos` diagnostic app.

### Fix Focus Areas
- examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile[65-74]

### What to change
- Replace `t-I${MCU_PLUS_SDK_PATH}/source/pru_io/driver` with a valid include entry:
  - `-I${MCU_PLUS_SDK_PATH}/source/pru_io/driver \`
- Ensure the line ends with `\` if more include paths follow.
- Verify the `-I${OPEN_PRU_PATH}/examples/...` include directory is correct for this repo layout (it currently points to `examples/pru_i2s_diagnostic`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread examples/pru_i2s/makefile Outdated
Comment on lines +95 to +113
am261x_mcuplus:
# am261x-lp - Build driver library
$(MAKE) -C lib/am261x/r5f/ti-arm-clang $(ARGUMENTS_MCUPLUS)
# am261x-lp - R5F application
$(MAKE) -C pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang $(ARGUMENTS_MCUPLUS)

am263x:
# am263x-cc - I2S protocol
$(MAKE) -C firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt $(ARGUMENTS_PRU)
$(MAKE) -C firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt $(ARGUMENTS_PRU)
# am263x-cc - TDM4 protocol
$(MAKE) -C firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt $(ARGUMENTS_PRU)
$(MAKE) -C firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt $(ARGUMENTS_PRU)

am263x_mcuplus:
# am263x-cc - Build driver library
$(MAKE) -C lib/am263x/r5f/ti-arm-clang $(ARGUMENTS_MCUPLUS)
# am263x-cc - R5F application
$(MAKE) -C pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang $(ARGUMENTS_MCUPLUS)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

6. Missing lib build directory 🐞 Bug ☼ Reliability

examples/pru_i2s/makefile invokes $(MAKE) -C lib/am261x/... and lib/am263x/... for *_mcuplus
targets, but the PR does not include any corresponding lib/ directories in the repository
checkout, so these targets will fail.
Agent Prompt
### Issue description
The top-level `examples/pru_i2s/makefile` defines `am261x_mcuplus` and `am263x_mcuplus` targets that run `make` in `lib/am261x/...` and `lib/am263x/...`, but the repo does not contain these directories in the current PR.

### Issue Context
This will break `make all` for pru_i2s whenever `DEVICE_NON_PRU` includes `*_mcuplus`.

### Fix Focus Areas
- examples/pru_i2s/makefile[95-113]

### What to change
- Either:
  1) Add the missing `examples/pru_i2s/lib/...` (or `lib/...`) directories and their makefiles as intended, OR
  2) Update the `-C` paths to the correct existing location(s) (e.g., build steps under `pru_i2s_app/...` or MCU+ SDK paths), OR
  3) Remove/guard the *_mcuplus targets until the library build infrastructure is present.
- If these are expected to be generated, add the generation step before invoking `make -C lib/...`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +231 to +266
/* Set output port register address - needed for next read */
I2C_Transaction_init(&i2cTransaction);
buffer[0] = TCA6416_REG_OUTPUT_PORT_0 + port;
i2cTransaction.writeBuf = buffer;
i2cTransaction.writeCount = 1U;
i2cTransaction.targetAddress = i2cAddress;
status += I2C_transfer(config->i2cHandle, &i2cTransaction);

/* Read config register value */
I2C_Transaction_init(&i2cTransaction);
i2cTransaction.readBuf = buffer;
i2cTransaction.readCount = 1;
i2cTransaction.targetAddress = i2cAddress;
status += I2C_transfer(config->i2cHandle, &i2cTransaction);

/* Set output or input mode to particular IO pin - read/modify/write */
I2C_Transaction_init(&i2cTransaction);
if(TCA6416_OUT_STATE_HIGH == state)
{
buffer[1] = buffer[0] | (0x01 << portPin);
}
else
{
buffer[1] = buffer[0] & ~(0x01 << portPin);
}
buffer[0] = TCA6416_REG_OUTPUT_PORT_0 + port;
i2cTransaction.writeBuf = buffer;
i2cTransaction.writeCount = 2;
i2cTransaction.targetAddress = i2cAddress;
status += I2C_transfer(config->i2cHandle, &i2cTransaction);

SemaphoreP_post(&config->lockObj);
}

return (status);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

7. I2c status accumulation bug 🐞 Bug ≡ Correctness

TCA6416_setOutput() uses status += I2C_transfer(...) and continues after failures, which can hide
errors, produce invalid return codes, and perform read/modify/write based on invalid register data.
Agent Prompt
### Issue description
`TCA6416_setOutput()` uses `status += I2C_transfer(...)` for multiple transfers and proceeds regardless of intermediate failures. This can mask failures and cause incorrect read/modify/write behavior.

### Issue Context
The same file’s `TCA6416_config()` uses the safer pattern: compare each transfer result to `SystemP_SUCCESS` and set `status = SystemP_FAILURE` on error.

### Fix Focus Areas
- examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c[231-266]
- examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c[158-196]

### What to change
- Replace `status += I2C_transfer(...)` with explicit checks:
  - `status = I2C_transfer(...); if (status != SystemP_SUCCESS) { ... }`
- On failure, stop further transactions and still `SemaphoreP_post()` before returning.
- Keep return values consistent with the rest of the driver (`SystemP_SUCCESS`/`SystemP_FAILURE`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Add PRU I2S driver with firmware, diagnostic application, and multi-platform support for AM261x and AM263x

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Complete PRU I2S driver implementation with full API supporting initialization, open/close,
  read/write operations, and interrupt handling
• Dual-mode firmware support for both I2S and TDM4 audio streaming with configurable channels and
  sampling rates
• Comprehensive diagnostic application demonstrating real-time full-duplex audio streaming with
  ping-pong buffer management
• PRU firmware binaries for both PRU0 (TX) and PRU1 (RX) cores with register definitions and
  bit-field macros
• TCA6416 IO expander driver for board-level pin control and configuration
• Support for AM261x LaunchPad and AM263x Control Card platforms with SOC-specific configurations
• FreeRTOS application framework with interrupt-driven ISR handling and semaphore-based task
  synchronization
• PRUICSS interrupt mapping and controller initialization for system event handling
• Build system integration with makefile updates for example compilation
Diagram
flowchart LR
  A["PRU I2S Driver<br/>pru_i2s_drv.c"] --> B["Driver API<br/>pru_i2s_drv.h"]
  C["I2S Firmware<br/>pru_i2s_main.asm"] --> D["I2S Binaries<br/>pru_i2s_pru0/1_array.h"]
  E["TDM4 Firmware<br/>pru_i2s_main.asm"] --> F["TDM4 Binaries<br/>pru_i2s_tdm4_pru0/1_array.h"]
  B --> G["Diagnostic App<br/>pru_i2s_diagnostic.c"]
  D --> G
  F --> G
  G --> H["AM261x/AM263x<br/>FreeRTOS Apps"]
  I["IO Expander<br/>ioexp_tca6416.c"] --> H
  J["Config & Syscfg<br/>pru_i2s_config.h"] --> H
Loading

Grey Divider

File Changes

1. examples/pru_i2s/driver/pru_i2s_drv.c ✨ Enhancement +2068/-0

Complete PRU I2S driver implementation with full API

• Implements complete PRU I2S driver with 2068 lines including initialization, open/close,
 read/write operations
• Provides interleaved and non-interleaved I/O buffer support with ping-pong buffer management
• Includes interrupt handling (Tx, Rx, Error) with enable/disable/clear functions
• Implements firmware image parsing, parameter validation, and PRU core management

examples/pru_i2s/driver/pru_i2s_drv.c


2. examples/pru_i2s/include/pru_i2s_pruss_intc_mapping.h ⚙️ Configuration changes +200/-0

PRUICSS interrupt mapping and configuration definitions

• Defines PRUICSS interrupt mapping constants and macros for system events
• Provides channel, output, and host enable mask definitions
• Includes PRUICSS interrupt controller initialization data structure

examples/pru_i2s/include/pru_i2s_pruss_intc_mapping.h


3. examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h ⚙️ Configuration changes +197/-0

PRU I2S firmware register definitions and bit fields

• Defines firmware register offsets and addresses for PRU I2S control
• Specifies bit field masks and shifts for register access
• Includes register definitions for ping-pong buffer, status, and error handling

examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h


View more (69)
4. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

ROV configuration for AM261x FreeRTOS application

• Adds Runtime Object View (ROV) configuration file for FreeRTOS kernel
• Enables ROV tool support for debugging and runtime analysis

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


5. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

ROV configuration for AM263x FreeRTOS application

• Adds Runtime Object View (ROV) configuration file for FreeRTOS kernel
• Enables ROV tool support for debugging and runtime analysis

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


6. examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c ✨ Enhancement +1442/-0

PRU I2S diagnostic application with real-time audio streaming

• Comprehensive PRU I2S diagnostic application demonstrating real-time audio streaming with
 full-duplex, Tx-only, and Rx-only modes
• Implements ping-pong buffer management, ISR-based interrupt handling, and semaphore-based
 ISR-to-task synchronization
• Includes firmware loading, PRU core initialization, error detection/reporting, and detailed
 statistics collection
• Supports both I2S and TDM modes with conditional compilation based on SysConfig configuration

examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c


7. examples/pru_i2s/include/pru_i2s_drv.h ✨ Enhancement +817/-0

PRU I2S driver header with API definitions and firmware interface

• Defines PRU I2S driver API with structures for parameters, attributes, and IO buffers
• Provides function declarations for driver initialization, instance management, read/write
 operations, and interrupt handling
• Includes firmware register definitions and bit-field macros for PRU I2S firmware communication
• Establishes error codes, interrupt types, and configuration constants for PRU I2S subsystem

examples/pru_i2s/include/pru_i2s_drv.h


8. examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

PRU I2S firmware register definitions and bit-field macros

• Defines firmware register offsets and addresses for PRU I2S configuration and status
• Provides bit-field definitions for firmware registers controlling Tx/Rx channels, sampling
 frequency, and error status
• Establishes ping-pong buffer selection and status register bit positions
• Maps firmware pseudo-registers for runtime configuration and state monitoring

examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h


9. examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h ✨ Enhancement +155/-0

PRU I2S firmware binary image for PRU0 core

• Contains PRU I2S firmware binary image for PRU0 core (instruction memory array)
• Includes firmware data memory initialization array with configuration parameters
• Firmware supports I2S audio streaming with configurable channels and sampling rates

examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h


10. examples/pru_i2s/firmware/I2S/pru_i2s_interface.h ✨ Enhancement +213/-0

I2S firmware interface configuration header

• New header file defining I2S pin configurations and register addresses for AM263X and AM261X SoCs
• Configures BCLK, FS, and SD pins for both PRU0 and PRU1 cores with conditional compilation
• Defines firmware register space addresses for TX/RX buffer management and error status tracking
• Sets up host interrupt event mappings for I2S TX, RX, and error conditions

examples/pru_i2s/firmware/I2S/pru_i2s_interface.h


11. examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h ✨ Enhancement +209/-0

TDM4 firmware interface configuration header

• New header file for TDM4 mode pin and register configurations similar to I2S mode
• Defines TDM-specific constants including channel slots and samples per channel (16 vs 32 for I2S)
• Provides SOC-specific pin mappings for AM263X and AM261X with PRU0/PRU1 variants
• Includes firmware register addresses and host interrupt event definitions

examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h


12. examples/pru_i2s/pru_i2s_app/data.h ✨ Enhancement +99/-0

Application data structures and buffer definitions

• New header defining application-level constants for buffer management and audio processing
• Specifies ping-pong buffer configuration, RX/TX buffer sizes, and storage factors
• Includes IO expander indices and audio gain constants for debug loopback mode
• Declares global RX and TX buffer arrays with specific memory section attributes

examples/pru_i2s/pru_i2s_app/data.h


13. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c ✨ Enhancement +287/-0

TCA6416 IO expander driver implementation

• New driver implementation for TCA6416 I2C-based IO expander
• Provides functions to open/close device, configure pins as input/output, and set output states
• Implements thread-safe access using semaphore-based locking mechanism
• Includes read-modify-write operations for register access via I2C transactions

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c


14. examples/pru_i2s/include/pru_i2s_config.h ⚙️ Configuration changes +177/-0

PRU I2S driver user configuration header

• New configuration header providing user-editable PRU I2S driver parameters
• Defines PRUI2S_UserConfig structure for ICSS instance and PRU core selection
• Includes example configurations for AM261x LaunchPad and AM263x Control Card
• Provides macro-based default configuration selection based on SOC type

examples/pru_i2s/include/pru_i2s_config.h


15. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h ✨ Enhancement +210/-0

TCA6416 IO expander driver header

• New header file defining TCA6416 IO expander driver API and data structures
• Declares configuration structures for parameters, attributes, and driver state
• Provides function prototypes for open, close, config, setOutput, and initialization
• Includes macro definitions for pin modes (input/output) and output states (high/low)

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h


16. examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h ✨ Enhancement +114/-0

TDM4 firmware register definitions

• New assembly header defining PRU register mappings for TDM4 firmware
• Maps PRU registers to logical names for buffer management, pin control, and state tracking
• Includes conditional register allocation based on I2S_RX and I2S_TX modes
• Defines bit-field assignments for status flags and counters

examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h


17. examples/pru_i2s/firmware/I2S/pru_i2s_regs.h ✨ Enhancement +113/-0

I2S firmware register definitions

• New assembly header defining PRU register mappings for I2S firmware
• Allocates registers for buffer addressing, audio sample data, and frame sync tracking
• Provides conditional register definitions based on TX/RX mode and profiling options
• Defines bit-field assignments for buffer selection and error status

examples/pru_i2s/firmware/I2S/pru_i2s_regs.h


18. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h ✨ Enhancement +159/-0

TDM4 PRU0 compiled firmware binary array

• New header containing compiled TDM4 PRU0 firmware as binary arrays
• Includes 32-bit instruction array and 8-bit metadata array for firmware loading
• Generated from PRU assembly compilation for AM263x Control Card ICSSM0-PRU0
• Provides pre-compiled firmware image for runtime loading onto PRU core

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h


19. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h ✨ Enhancement +152/-0

TDM4 PRU1 compiled firmware binary array

• New header containing compiled TDM4 PRU1 firmware as binary arrays
• Includes 32-bit instruction array and 8-bit metadata array for firmware loading
• Generated from PRU assembly compilation for AM263x Control Card ICSSM0-PRU1
• Provides pre-compiled firmware image for runtime loading onto second PRU core

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h


20. examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h ✨ Enhancement +142/-0

I2S PRU1 compiled firmware binary array

• New header containing compiled I2S PRU1 firmware as binary arrays
• Includes 32-bit instruction array and 8-bit metadata array for firmware loading
• Generated from PRU assembly compilation for I2S mode on PRU1
• Provides pre-compiled firmware image for runtime loading

examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h


21. examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c ⚙️ Configuration changes +107/-0

PRU I2S application configuration implementation

• New application configuration file defining PRU I2S instance settings
• Implements PRUI2S_applyAppConfig() function to apply user configurations to driver
• Provides configuration table for multiple PRU I2S instances with SOC-specific defaults
• Supports both AM261x LaunchPad and AM263x Control Card platforms

examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c


22. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM263x Control Card FreeRTOS main entry point

• New main entry point for AM263x Control Card FreeRTOS application
• Initializes system and board, creates FreeRTOS task for PRU I2S diagnostic
• Sets up static task allocation with proper stack management
• Calls pru_i2s_diagnostic_main() as the primary application task

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c


23. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM261x LaunchPad FreeRTOS main entry point

• New main entry point for AM261x LaunchPad FreeRTOS application
• Initializes system and board, creates FreeRTOS task for PRU I2S diagnostic
• Sets up static task allocation with proper stack management
• Calls pru_i2s_diagnostic_main() as the primary application task

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c


24. examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.h ⚙️ Configuration changes +70/-0

PRU I2S diagnostic application configuration header

• New header defining PRU I2S diagnostic application constants and configuration
• Specifies I2S vs TDM mode selection and instance enable flags
• Defines test instance indices for PRU I2S 0 (TX) and PRU I2S 1 (RX)
• Provides compile-time configuration for diagnostic application behavior

examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.h


25. examples/pru_i2s/firmware/I2S/linker.cmd ⚙️ Configuration changes +88/-0

I2S firmware linker command file

• New linker command file for I2S PRU firmware compilation
• Defines memory layout for PRU instruction RAM, data RAM, and shared memory
• Maps sections (.text, .data, .fwRegs, .dbgBuf) to appropriate memory regions
• Includes peripheral register definitions and reserved memory regions

examples/pru_i2s/firmware/I2S/linker.cmd


26. examples/pru_i2s/firmware/TDM4/linker.cmd ⚙️ Configuration changes +88/-0

TDM4 firmware linker command file

• New linker command file for TDM4 PRU firmware compilation
• Defines identical memory layout to I2S linker for PRU instruction and data RAM
• Maps firmware sections to appropriate memory regions with CREGISTER assignments
• Includes peripheral register space definitions for PRU configuration

examples/pru_i2s/firmware/TDM4/linker.cmd


27. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec ⚙️ Configuration changes +86/-0

TDM4 PRU0 firmware CCS project specification

• New CCS project specification for TDM4 PRU0 firmware compilation
• Configures compiler and linker options for AM263x Control Card ICSSM0-PRU0
• Defines post-build step to generate firmware array header file using hexpru tool
• Includes file references to assembly sources and linker command file

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


28. examples/makefile ✨ Enhancement +1/-1

Add PRU I2S example to build system

• Added pru_i2s to the SUBDIRS list for example builds
• Enables compilation of PRU I2S example alongside other examples
• Maintains alphabetical ordering in subdirectory list

examples/makefile


29. .metadata/product.json Additional files +2/-1

...

.metadata/product.json


30. examples/pru_i2s/README.md Additional files +464/-0

...

examples/pru_i2s/README.md


31. examples/pru_i2s/firmware/I2S/fw_regs.asm Additional files +113/-0

...

examples/pru_i2s/firmware/I2S/fw_regs.asm


32. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


33. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +91/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


34. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


35. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


36. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


37. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


38. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


39. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


40. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


41. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


42. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


43. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


44. examples/pru_i2s/firmware/I2S/pru_i2s_main.asm Additional files +502/-0

...

examples/pru_i2s/firmware/I2S/pru_i2s_main.asm


45. examples/pru_i2s/firmware/TDM4/fw_regs.asm Additional files +113/-0

...

examples/pru_i2s/firmware/TDM4/fw_regs.asm


46. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


47. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


48. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


49. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


50. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


51. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


52. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


53. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


54. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


55. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


56. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


57. examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm Additional files +517/-0

...

examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm


58. examples/pru_i2s/makefile Additional files +115/-0

...

examples/pru_i2s/makefile


59. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg Additional files +359/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg


60. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +118/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec


61. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +375/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile


62. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


63. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


64. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg Additional files +372/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg


65. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +124/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec


66. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +377/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile


67. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


68. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


69. source/.meta/pru_i2s/pru_i2s.syscfg.js Additional files +318/-0

...

source/.meta/pru_i2s/pru_i2s.syscfg.js


70. source/.meta/pru_i2s/pru_i2s_config.c.xdt Additional files +114/-0

...

source/.meta/pru_i2s/pru_i2s_config.c.xdt


71. source/.meta/pru_i2s/pru_i2s_templates.c.xdt Additional files +178/-0

...

source/.meta/pru_i2s/pru_i2s_templates.c.xdt


72. source/.meta/pru_i2s/pru_i2s_templates.h.xdt Additional files +140/-0

...

source/.meta/pru_i2s/pru_i2s_templates.h.xdt


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 8, 2026

Persistent review updated to latest commit 52124f1

Comment thread examples/pru_i2s/driver/pru_i2s_drv.c Outdated
Comment on lines +533 to +633
DebugP_log("[PRUI2S_open] Constructing interrupts...\r\n");
if (pObj->prms.i2sTxCallbackFxn != NULL)
{
DebugP_log("[PRUI2S_open] Constructing Tx interrupt (intNum=%d)\r\n", pSwipAttrs->i2sTxHostIntNum);
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = pSwipAttrs->i2sTxHostIntNum;
hwiPrms.callback = pObj->prms.i2sTxCallbackFxn;
hwiPrms.priority = pObj->prms.i2sTxIntrPri;
hwiPrms.args = (void *)pCfg;
status = HwiP_construct(&pObj->i2sTxHwiObj, &hwiPrms);
if (status == SystemP_SUCCESS)
{
pObj->i2sTxHwiHandle = &pObj->i2sTxHwiObj;
DebugP_log("[PRUI2S_open] Tx interrupt constructed successfully\r\n");
}
}
else
{
DebugP_log("[PRUI2S_open] Tx callback is NULL, skipping Tx interrupt\r\n");
}

if (status == SystemP_SUCCESS && pObj->prms.i2sRxCallbackFxn != NULL)
{
DebugP_log("[PRUI2S_open] Constructing Rx interrupt (intNum=%d)\r\n", pSwipAttrs->i2sRxHostIntNum);
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = pSwipAttrs->i2sRxHostIntNum;
hwiPrms.callback = pObj->prms.i2sRxCallbackFxn;
hwiPrms.priority = pObj->prms.i2sRxIntrPri;
hwiPrms.args = (void *)pCfg;
status = HwiP_construct(&pObj->i2sRxHwiObj, &hwiPrms);
if (status == SystemP_SUCCESS)
{
pObj->i2sRxHwiHandle = &pObj->i2sRxHwiObj;
DebugP_log("[PRUI2S_open] Rx interrupt constructed successfully\r\n");
}
}
else if (status == SystemP_SUCCESS)
{
DebugP_log("[PRUI2S_open] Rx callback is NULL, skipping Rx interrupt\r\n");
}

if (status == SystemP_SUCCESS && pObj->prms.i2sErrCallbackFxn != NULL)
{
DebugP_log("[PRUI2S_open] Constructing Error interrupt (intNum=%d)\r\n", pSwipAttrs->i2sErrHostIntNum);
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = pSwipAttrs->i2sErrHostIntNum;
hwiPrms.callback = pObj->prms.i2sErrCallbackFxn;
hwiPrms.priority = pObj->prms.i2sErrIntrPri;
hwiPrms.args = (void *)pCfg;
status = HwiP_construct(&pObj->i2sErrHwiObj, &hwiPrms);
if (status == SystemP_SUCCESS)
{
pObj->i2sErrHwiHandle = &pObj->i2sErrHwiObj;
DebugP_log("[PRUI2S_open] Error interrupt constructed successfully\r\n");
}
}
else if (status == SystemP_SUCCESS)
{
DebugP_log("[PRUI2S_open] Error callback is NULL, skipping Error interrupt\r\n");
}
}

if (status == SystemP_SUCCESS)
{
/* Initialize PRU */
DebugP_log("[PRUI2S_open] Initializing PRU/FW/buffers...\r\n");
DebugP_log("[PRUI2S_open] Calling PRUI2S_initPru...\r\n");
status = PRUI2S_initPru(pCfg);
DebugP_log("[PRUI2S_open] PRUI2S_initPru returned: %d\r\n", status);

/* Initialize PRU I2S FW */
if (status == SystemP_SUCCESS)
{
DebugP_log("[PRUI2S_open] Calling PRUI2S_initFw...\r\n");
status = PRUI2S_initFw(pCfg);
DebugP_log("[PRUI2S_open] PRUI2S_initFw returned: %d\r\n", status);
}

/* Initialize ping/pong buffers */
if (status == SystemP_SUCCESS)
{
DebugP_log("[PRUI2S_open] Calling PRUI2S_initPpBufs...\r\n");
status = PRUI2S_initPpBufs(pCfg);
DebugP_log("[PRUI2S_open] PRUI2S_initPpBufs returned: %d\r\n", status);
}
}

if (status == SystemP_SUCCESS)
{
DebugP_log("[PRUI2S_open] Instance %d successfully opened\r\n", index);
pObj->isOpen = TRUE;
handle = (PRUI2S_Handle)pCfg;
}

/* Unlock instance */
DebugP_log("[PRUI2S_open] Unlocking instance %d\r\n", index);
SemaphoreP_post(pObj->pruInstLock);
DebugP_log("[PRUI2S_open] EXIT: returning handle=%08X\r\n", (uint32_t)handle);

return handle;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. prui2s_open() missing error cleanup 📘 Rule violation ☼ Reliability

PRUI2S_open() constructs interrupt objects and can later fail, returning NULL without
destructing previously-constructed HWIs. This can leak resources and leave partially-initialized
interrupt state.
Agent Prompt
## Issue description
`PRUI2S_open()` can fail after constructing one or more `HwiP` objects, but it returns without destructing the successfully-constructed interrupts.

## Issue Context
This violates the requirement to clean up all partially-acquired resources on error paths.

## Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[533-633]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +31 to +36
; .sect ".text:main"
.clink
.global main

.include "pru_i2s_interface.h"
.include "pru_i2s_regs.h"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Tdm4 main missing .retain 📘 Rule violation ☼ Reliability

firmware/TDM4/pru_i2s_main.asm lacks the required .retain and .retainrefs directives for
assembly-based .out generation. This risks dropped sections/references and incorrect output
images.
Agent Prompt
## Issue description
The TDM4 PRU assembly main file is missing `.retain`/`.retainrefs`, which are required to ensure correct `.out` generation.

## Issue Context
This is a common requirement for PRU assembly-only projects so the linker does not drop sections.

## Fix Focus Areas
- examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm[31-36]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +646 to +663
int32_t PRUI2S_close(
PRUI2S_Handle handle
)
{
PRUI2S_Config *pCfg;
PRUI2S_Object *pObj;
PRUI2S_SwipAttrs *pSwipAttrs;
int32_t status = SystemP_SUCCESS;
int32_t retStatus = PRUI2S_DRV_SOK;

/* Get pointers */
pCfg = (PRUI2S_Config *)handle;
pObj = pCfg->object;
pSwipAttrs = pCfg->attrs;

/* Lock instance */
SemaphoreP_pend(pObj->pruInstLock, SystemP_WAIT_FOREVER);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Null handle dereference 🐞 Bug ☼ Reliability

Multiple public PRU I2S APIs (e.g., PRUI2S_close/enable/clearInt/write/read) cast and dereference
handle (and pIoBuf) without NULL checks, which can crash on error-path cleanup or caller
mistakes. For example, PRUI2S_close() immediately dereferences handle to access pCfg->object.
Agent Prompt
### Issue description
Public PRU I2S APIs dereference `handle` (and sometimes `pIoBuf`) without NULL checks, causing NULL-pointer crashes.

### Issue Context
`PRUI2S_open()` returns `NULL` on failure, so defensive checks in APIs like `PRUI2S_close`, `PRUI2S_enable`, `PRUI2S_clearInt`, `PRUI2S_write`, and `PRUI2S_read` prevent cleanup-path crashes and make the API safer.

### Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[646-770]
- examples/pru_i2s/driver/pru_i2s_drv.c[780-904]
- examples/pru_i2s/driver/pru_i2s_drv.c[919-981]
- examples/pru_i2s/driver/pru_i2s_drv.c[1427-1471]

### Suggested change
- At the top of each public API, add:
  - `if (handle == NULL) return PRUI2S_DRV_SERR_INV_PRMS;`
  - For buffer APIs: `if (pIoBuf == NULL || pIoBuf->ioBufAddr == NULL) return PRUI2S_DRV_SERR_INV_PRMS;`
- Consider also validating `pObj->pruIcssHandle != NULL` where it is required for a call.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +1685 to +1703
/* Check ping/pong buffer size */
if ((status == SystemP_SUCCESS) &&
(pPrms->pingPongBufSz == 0))
{
status = SystemP_FAILURE;
}

/* Check I2S error parameters */
if ((status == SystemP_SUCCESS) && (pPrms->i2sErrCallbackFxn != NULL))
{
/* Check I2S error interrupt priority */
if (pPrms->i2sErrIntrPri > MAX_VIM_INTR_PRI_VAL)
{
status = SystemP_FAILURE;
}
}

return status;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Odd buffer size allowed 🐞 Bug ≡ Correctness

PRUI2S_checkOpenParams() only rejects pingPongBufSz == 0, but PRUI2S_write() rejects odd sizes
while PRUI2S_read() performs memcpy using pingPongBufSz/2 without validating even/non-zero. This
can lead to inconsistent behavior where writes fail but reads still run with truncated/incorrect
half-buffer sizing.
Agent Prompt
### Issue description
The driver inconsistently validates `pingPongBufSz`: open() allows odd sizes, write() rejects them, read() does not reject them.

### Issue Context
Both read and write derive half-buffer size via `pingPongBufSz/2`. Ping/pong implies the total size should be divisible by 2.

### Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[1618-1703]
- examples/pru_i2s/driver/pru_i2s_drv.c[832-904]
- examples/pru_i2s/driver/pru_i2s_drv.c[919-981]

### Suggested change
- Enforce `pingPongBufSz != 0` and `(pingPongBufSz % 2) == 0` in `PRUI2S_checkOpenParams()` so invalid sizes are rejected at open.
- Mirror the same validation in `PRUI2S_read()` for defense-in-depth (as already done in `PRUI2S_write()`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread .metadata/product.json
Comment on lines 5 to 14
"documentationPath": "../docs",
"includePaths": [
"../source",
"C:/ti/mcu_plus_sdk/source/sysconfig",
],
"components": [

"/open_pru",
],
"devices": [
"AM64x",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Invalid json trailing commas 🐞 Bug ≡ Correctness

.metadata/product.json contains trailing commas in arrays (e.g., includePaths/devices/components),
which makes the file invalid strict JSON and can break any tooling that parses it as JSON. The PR
adds an includePaths entry that retains this invalid trailing comma pattern.
Agent Prompt
### Issue description
`.metadata/product.json` is not valid strict JSON due to trailing commas in arrays.

### Issue Context
Many JSON parsers used by build/config tooling reject trailing commas.

### Fix Focus Areas
- .metadata/product.json[5-21]

### Suggested change
- Remove trailing commas after the last element in `includePaths`, `components`, `devices` (and anywhere else in the file).
- If the consuming tooling expects JSON5, consider renaming to `.json5` and documenting it; otherwise keep strict JSON compliance.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copy link
Copy Markdown
Member

@manojKoppolu manojKoppolu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rajul,

Please rebase your PR and do force push to trigger CI make build

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 52124f1 to 7211e79 Compare April 13, 2026 06:08
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

PRU I2S Driver and Firmware Implementation with Dual-Mode Audio Support

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Complete PRU I2S driver implementation with comprehensive API support for initialization,
  open/close, read/write operations, and interrupt management
• Dual-mode firmware support for both standard I2S and TDM4 audio interfaces with separate PRU0
  (transmit) and PRU1 (receive) implementations
• Full-duplex and half-duplex audio streaming capabilities with ping-pong buffer management and
  real-time interrupt handling
• Diagnostic application demonstrating real-time audio streaming with multi-channel support, error
  detection, and optional loopback functionality
• Platform support for AM261x LaunchPad and AM263x Control Card with FreeRTOS integration
• TCA6416 IO expander driver for pin control and configuration on supported platforms
• Comprehensive firmware register definitions, pin mappings, and linker configurations for both I2S
  and TDM4 modes
• Pre-compiled firmware binary arrays for immediate deployment to PRU cores
Diagram
flowchart LR
  A["PRU I2S Driver<br/>pru_i2s_drv.c/h"] --> B["Firmware Layer<br/>I2S & TDM4 Modes"]
  B --> C["PRU0 TX<br/>Firmware Binary"]
  B --> D["PRU1 RX<br/>Firmware Binary"]
  A --> E["Application<br/>pru_i2s_diagnostic.c"]
  E --> F["Platform Support<br/>AM261x/AM263x"]
  F --> G["IO Expander<br/>TCA6416"]
  E --> H["FreeRTOS<br/>Integration"]
Loading

Grey Divider

File Changes

1. examples/pru_i2s/driver/pru_i2s_drv.c ✨ Enhancement +1902/-0

Complete PRU I2S driver implementation with full API support

• Implements complete PRU I2S driver with 1902 lines of code including initialization, open/close,
 read/write operations
• Provides interleaved and non-interleaved data format support for Tx/Rx operations with ping-pong
 buffering
• Implements interrupt management (enable/disable/clear) for I2S Tx, Rx, and error events
• Includes parameter validation, PRU core initialization, firmware register access, and error status
 handling

examples/pru_i2s/driver/pru_i2s_drv.c


2. examples/pru_i2s/include/pru_i2s_drv.h ✨ Enhancement +776/-0

PRU I2S driver header with API definitions and structures

• Defines comprehensive driver API with 776 lines including structures, enums, and function
 declarations
• Specifies PRUI2S_Params, PRUI2S_Object, PRUI2S_SwipAttrs structures for configuration and
 state management
• Declares public APIs for initialization, open/close, read/write, interrupt control, and error
 handling
• Includes firmware register definitions and bit-field masks for PRU I2S control

examples/pru_i2s/include/pru_i2s_drv.h


3. examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

Firmware register definitions for PRU I2S control

• Defines firmware register offsets and addresses for PRU I2S control (197 lines)
• Specifies register bit-field definitions for Tx/Rx ping-pong selection, status, and error handling
• Provides constants for firmware configuration including buffer addresses, system events, and pin
 numbers

examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h


View more (68)
4. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

ROV configuration for FreeRTOS debugging support

• Adds Runtime Object View (ROV) configuration file for FreeRTOS debugging support
• Specifies ROV tool integration for kernel/freertos runtime object inspection

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


5. examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c ✨ Enhancement +1427/-0

PRU I2S diagnostic application with real-time audio streaming

• Comprehensive PRU I2S diagnostic application with real-time audio streaming over I2S/TDM
 interfaces
• Implements ping-pong buffer management, multi-channel Tx/Rx operations, and ISR-based interrupt
 handling
• Supports full-duplex, half-duplex Tx-only, and half-duplex Rx-only streaming modes
• Includes detailed error detection, statistics tracking, and optional Rx-to-Tx loopback
 functionality

examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c


6. examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

PRU I2S firmware register definitions and bit fields

• Defines firmware register base addresses and offsets for PRU I2S control
• Specifies register bit fields for configuration parameters (sampling frequency, bits per slot,
 buffer addresses)
• Maps interrupt system events and ping-pong buffer status/selection registers

examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h


7. examples/pru_i2s/firmware/I2S/pru_i2s_interface.h ✨ Enhancement +213/-0

I2S mode firmware pin and interrupt configuration

• Defines I2S pin mappings for PRU0/PRU1 cores on AM263X and AM261X SoCs
• Specifies BCLK, FSYNC, and data line (Tx/Rx) pin configurations
• Maps interrupt event numbers and cycle counter register addresses for firmware

examples/pru_i2s/firmware/I2S/pru_i2s_interface.h


8. examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h ✨ Enhancement +209/-0

TDM4 mode firmware pin and interrupt configuration

• Defines TDM4 pin mappings for PRU0/PRU1 cores on AM263X and AM261X SoCs
• Specifies BCLK, FSYNC, and TDM data line configurations with 6-channel TDM support
• Maps interrupt event numbers and cycle counter register addresses for TDM firmware

examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h


9. examples/pru_i2s/pru_i2s_app/data.h ✨ Enhancement +99/-0

PRU I2S application data structures and buffer definitions

• Defines system configuration constants (timeouts, error thresholds, logging intervals)
• Specifies buffer management parameters and ping-pong buffer sizes for Tx/Rx operations
• Declares audio buffers with section attributes and initializes Tx buffer with test data

examples/pru_i2s/pru_i2s_app/data.h


10. examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c ✨ Enhancement +110/-0

PRU I2S application configuration implementation

• Implements application configuration for PRU I2S instances with user-configurable ICSS and PRU
 core selection
• Provides configuration table for multiple PRU cores with platform-specific settings
• Includes PRUI2S_applyAppConfig() function to apply user configuration to driver

examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c


11. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c ✨ Enhancement +287/-0

TCA6416 IO Expander Driver Implementation

• Implements TCA6416 I2C IO expander driver with functions for open, close, configuration, and
 output control
• Provides I2C-based register read/modify/write operations for pin mode and state management
• Includes mutex-based synchronization for thread-safe IO expander access
• Supports 16 IO pins with configurable input/output modes and output states

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c


12. examples/pru_i2s/include/pru_i2s_config.h ⚙️ Configuration changes +177/-0

PRU I2S Configuration Header with Platform Presets

• Defines PRUI2S_UserConfig structure for PRU I2S driver configuration with ICSS instance and PRU
 core selection
• Provides predefined configuration macros for AM261x LaunchPad and AM263x Control Card platforms
• Includes platform-specific conditional compilation for automatic configuration selection
• Documents user-editable parameters for I2S/TDM mode, channels, sampling frequency, and bits per
 slot

examples/pru_i2s/include/pru_i2s_config.h


13. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h ✨ Enhancement +210/-0

TCA6416 IO Expander Driver Header with API Definitions

• Defines TCA6416 driver API with structures for parameters, attributes, and configuration
• Declares functions for driver lifecycle management (open/close) and IO pin control
• Provides macros for IO pin modes (input/output) and output states (high/low)
• Includes comprehensive documentation for all public APIs and data structures

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h


14. examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h ✨ Enhancement +114/-0

PRU I2S TDM4 Firmware Register Definitions

• Defines PRU register mappings for TDM4 mode I2S firmware implementation
• Allocates registers for audio data buffers, frame sync counters, and channel management
• Includes conditional register definitions for TX-only, RX-only, and bidirectional modes
• Maps registers for ping-pong buffer management and error status tracking

examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h


15. examples/pru_i2s/firmware/I2S/pru_i2s_regs.h ✨ Enhancement +113/-0

PRU I2S Standard Mode Firmware Register Definitions

• Defines PRU register mappings for standard I2S mode firmware implementation
• Allocates registers for audio data buffers, frame sync counters, and channel management
• Includes conditional register definitions for TX-only, RX-only, and bidirectional modes
• Maps registers for ping-pong buffer management and error status tracking

examples/pru_i2s/firmware/I2S/pru_i2s_regs.h


16. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h ✨ Enhancement +159/-0

TDM4 Mode PRU0 Transmit Firmware Binary Array

• Contains compiled PRU firmware binary arrays for TDM4 mode PRU0 (transmit)
• Includes instruction code array (pru_prupru_i2s0_image_0_0) and configuration data array
 (pru_prupru_i2s0_image_0_1)
• Provides pre-compiled firmware image for deployment to PRU0 core

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h


17. examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h ✨ Enhancement +155/-0

I2S Mode PRU0 Transmit Firmware Binary Array

• Contains compiled PRU firmware binary arrays for standard I2S mode PRU0 (transmit)
• Includes instruction code array (pru_prupru_i2s0_image_0_0) and configuration data array
 (pru_prupru_i2s0_image_0_1)
• Provides pre-compiled firmware image for deployment to PRU0 core

examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h


18. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h ✨ Enhancement +152/-0

TDM4 Mode PRU1 Receive Firmware Binary Array

• Contains compiled PRU firmware binary arrays for TDM4 mode PRU1 (receive)
• Includes instruction code array (pru_prupru_i2s1_image_0_0) and configuration data array
 (pru_prupru_i2s1_image_0_1)
• Provides pre-compiled firmware image for deployment to PRU1 core

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h


19. examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h ✨ Enhancement +142/-0

I2S Mode PRU1 Receive Firmware Binary Array

• Contains compiled PRU firmware binary arrays for standard I2S mode PRU1 (receive)
• Includes instruction code array (pru_prupru_i2s1_image_0_0) and configuration data array
 (pru_prupru_i2s1_image_0_1)
• Provides pre-compiled firmware image for deployment to PRU1 core

examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h


20. examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.h ⚙️ Configuration changes +94/-0

PRU I2S Application Configuration Header

• Defines application-level configuration constants for PRU I2S mode selection (I2S vs TDM)
• Provides instance enable flags and indices for PRU I2S 0 (transmit) and PRU I2S 1 (receive)
• Declares function prototype for applying application configuration to PRU I2S driver

examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.h


21. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM263x Control Card FreeRTOS Main Entry Point

• Implements FreeRTOS main entry point for AM263x Control Card platform
• Initializes system and board components, creates main task, and starts FreeRTOS scheduler
• Calls pru_i2s_diagnostic_main() for PRU I2S application logic

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c


22. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM261x LaunchPad FreeRTOS Main Entry Point

• Implements FreeRTOS main entry point for AM261x LaunchPad platform
• Initializes system and board components, creates main task, and starts FreeRTOS scheduler
• Calls pru_i2s_diagnostic_main() for PRU I2S application logic

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c


23. examples/pru_i2s/firmware/I2S/linker.cmd ⚙️ Configuration changes +88/-0

I2S Mode PRU Firmware Linker Command File

• Defines memory layout for PRU instruction and data memory regions
• Maps PRU IMEM, DMEM, and shared memory sections with appropriate sizes
• Configures peripheral register spaces (CREGISTER) for PRU access
• Allocates sections for firmware code, data, and debug buffers

examples/pru_i2s/firmware/I2S/linker.cmd


24. examples/pru_i2s/firmware/TDM4/linker.cmd ⚙️ Configuration changes +88/-0

TDM4 Mode PRU Firmware Linker Command File

• Defines memory layout for PRU instruction and data memory regions
• Maps PRU IMEM, DMEM, and shared memory sections with appropriate sizes
• Configures peripheral register spaces (CREGISTER) for PRU access
• Allocates sections for firmware code, data, and debug buffers

examples/pru_i2s/firmware/TDM4/linker.cmd


25. examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm ✨ Enhancement +517/-0

TDM4 Mode PRU I2S Firmware Main Assembly Implementation

• Implements main PRU firmware loop for TDM4 mode I2S/audio processing
• Handles BCLK and frame sync edge detection, audio data transmission and reception
• Manages ping-pong buffer switching and host notification via interrupts
• Includes error handling for underflow, overflow, and frame sync errors

examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm


26. examples/pru_i2s/firmware/I2S/fw_regs.asm ⚙️ Configuration changes +113/-0

I2S Mode Firmware Register Configuration Section

• Defines firmware register section with configuration parameters for I2S mode
• Initializes TX/RX channel counts, sampling frequency, and bits per slot
• Sets buffer addresses, sizes, and interrupt event numbers
• Configures pin assignments for BCLK, frame sync, and data lines

examples/pru_i2s/firmware/I2S/fw_regs.asm


27. examples/pru_i2s/firmware/TDM4/fw_regs.asm ⚙️ Configuration changes +113/-0

TDM4 Mode Firmware Register Configuration Section

• Defines firmware register section with configuration parameters for TDM4 mode
• Initializes TX/RX channel counts, sampling frequency, and bits per slot
• Sets buffer addresses, sizes, and interrupt event numbers
• Configures pin assignments for BCLK, frame sync, and data lines

examples/pru_i2s/firmware/TDM4/fw_regs.asm


28. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec ⚙️ Configuration changes +20/-0

TDM4 PRU0 TX AM261x LaunchPad Build Makefile

• Provides build automation makefile for TDM4 PRU0 transmit firmware on AM261x LaunchPad
• Defines CCS project build, clean, and export targets
• Configures project name and build profile settings

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


29. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec ⚙️ Configuration changes +20/-0

TDM4 PRU0 TX AM263x Control Card Build Makefile

• Provides build automation makefile for TDM4 PRU0 transmit firmware on AM263x Control Card
• Defines CCS project build, clean, and export targets
• Configures project name and build profile settings

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


30. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

AM263x Control Card FreeRTOS ROV Configuration

• Configures Runtime Object View (ROV) tool integration for FreeRTOS debugging
• References FreeRTOS ROV JavaScript module for runtime object inspection

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


31. .metadata/product.json Additional files +2/-1

...

.metadata/product.json


32. examples/makefile Additional files +1/-1

...

examples/makefile


33. examples/pru_i2s/README.md Additional files +464/-0

...

examples/pru_i2s/README.md


34. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


35. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +91/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


36. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


37. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


38. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


39. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


40. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


41. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


42. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


43. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


44. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


45. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


46. examples/pru_i2s/firmware/I2S/pru_i2s_main.asm Additional files +502/-0

...

examples/pru_i2s/firmware/I2S/pru_i2s_main.asm


47. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


48. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


49. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


50. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


51. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


52. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


53. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


54. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


55. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


56. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


57. examples/pru_i2s/makefile Additional files +115/-0

...

examples/pru_i2s/makefile


58. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg Additional files +359/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg


59. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +118/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec


60. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +375/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile


61. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


62. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


63. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg Additional files +372/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg


64. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +124/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec


65. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +377/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile


66. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


67. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


68. source/.meta/pru_i2s/pru_i2s.syscfg.js Additional files +318/-0

...

source/.meta/pru_i2s/pru_i2s.syscfg.js


69. source/.meta/pru_i2s/pru_i2s_config.c.xdt Additional files +114/-0

...

source/.meta/pru_i2s/pru_i2s_config.c.xdt


70. source/.meta/pru_i2s/pru_i2s_templates.c.xdt Additional files +178/-0

...

source/.meta/pru_i2s/pru_i2s_templates.c.xdt


71. source/.meta/pru_i2s/pru_i2s_templates.h.xdt Additional files +140/-0

...

source/.meta/pru_i2s/pru_i2s_templates.h.xdt


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 13, 2026

Code Review by Qodo

Grey Divider

New Review Started

This review has been superseded by a new analysis

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 7211e79 to c4e4775 Compare April 13, 2026 06:13
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

PRU I2S Driver and Firmware Implementation for AM261x and AM263x

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Complete PRU I2S driver implementation with full API support for initialization, open/close,
  read/write operations
• Support for both I2S and TDM4 modes with interleaved and non-interleaved buffer management
• Comprehensive PRU firmware implementation in assembly for Tx/Rx operations with ping-pong buffer
  handling
• Diagnostic application with real-time audio streaming, ISR-based interrupt handling, and error
  tracking
• TCA6416 IO expander driver for hardware pin configuration
• Platform support for AM261x LaunchPad and AM263x Control Card with FreeRTOS integration
• Firmware binary arrays for PRU0 (Tx) and PRU1 (Rx) in both I2S and TDM4 modes
• Complete build infrastructure with makefiles, linker scripts, and project specifications
• ROV (Runtime Object View) configuration for FreeRTOS debugging support
Diagram
flowchart LR
  A["PRU I2S Driver<br/>pru_i2s_drv.c"] --> B["Public API<br/>pru_i2s_drv.h"]
  C["I2S Firmware<br/>pru_i2s_main.asm"] --> D["I2S Binary Arrays<br/>pru_i2s_pru0/1_array.h"]
  E["TDM4 Firmware<br/>pru_i2s_main.asm"] --> F["TDM4 Binary Arrays<br/>pru_i2s_tdm4_pru0/1_array.h"]
  B --> G["Diagnostic App<br/>pru_i2s_diagnostic.c"]
  D --> G
  F --> G
  H["IO Expander<br/>ioexp_tca6416.c"] --> G
  I["App Config<br/>pru_i2s_app_config.c"] --> G
  G --> J["FreeRTOS Main<br/>main.c"]
  K["Firmware Registers<br/>icss_pru_i2s_fw.h"] --> C
  K --> E
  L["Pin Config<br/>pru_i2s_interface.h"] --> C
  L --> E
Loading

Grey Divider

File Changes

1. examples/pru_i2s/driver/pru_i2s_drv.c ✨ Enhancement +1902/-0

PRU I2S driver implementation with full API support

• Implements complete PRU I2S driver with 1902 lines of code including initialization, open/close,
 read/write operations
• Provides interleaved and non-interleaved (conversion) I/O buffer support for Tx/Rx data transfers
• Implements interrupt management (enable/disable/clear) for I2S Tx, Rx, and error events
• Includes ping/pong buffer management and error status handling with firmware register access

examples/pru_i2s/driver/pru_i2s_drv.c


2. examples/pru_i2s/include/pru_i2s_drv.h ✨ Enhancement +776/-0

PRU I2S driver header with public API definitions

• Defines PRU I2S driver public API with 776 lines including structures, macros, and function
 declarations
• Declares core functions: PRUI2S_init(), PRUI2S_open(), PRUI2S_close(), PRUI2S_read(),
 PRUI2S_write()
• Defines data structures: PRUI2S_Params, PRUI2S_Object, PRUI2S_SwipAttrs, PRUI2S_IoBuf,
 PRUI2S_IoBufC
• Includes configuration tables and global state management for multiple PRU I2S instances

examples/pru_i2s/include/pru_i2s_drv.h


3. examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

Firmware register definitions for PRU I2S interface

• Defines firmware register map and offsets for PRU I2S communication (197 lines)
• Specifies register addresses for Tx/Rx ping/pong buffers, sampling frequency, and error status
• Defines bit-field masks and shifts for firmware register access
• Includes constants for INTC system events and I2S pin configuration

examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h


View more (68)
4. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

ROV configuration for FreeRTOS debugging

• Adds Runtime Object View (ROV) configuration file for FreeRTOS debugging support
• Specifies ROV files needed for runtime object inspection

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


5. examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c ✨ Enhancement +1427/-0

PRU I2S diagnostic application with real-time streaming

• Comprehensive PRU I2S diagnostic application with real-time audio streaming over I2S/TDM
 interfaces
• Implements ping-pong buffer management for continuous data flow with full-duplex, Tx-only, and
 Rx-only modes
• ISR-based interrupt handling with semaphore synchronization for Tx/Rx completion and error
 detection
• Detailed error tracking and statistics collection for overflow, underflow, and frame sync errors

examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c


6. examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

PRU I2S firmware register definitions and bit fields

• Defines firmware register base addresses and offsets for PRU I2S configuration
• Specifies bit field masks and shifts for firmware register access (channel counts, sampling
 frequency, buffer addresses)
• Maps ping-pong buffer selection, status, and error status registers

examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h


7. examples/pru_i2s/firmware/I2S/pru_i2s_interface.h ✨ Enhancement +213/-0

I2S mode firmware pin and interrupt configuration

• Assembly header defining I2S pin mappings for AM263x and AM261x SoCs with PRU0/PRU1 configurations
• Specifies BCLK, FSYNC, and data line (TX/RX) pin positions and shifts for GPIO output
• Configures interrupt event numbers and host IRQ mappings for Tx, Rx, and error interrupts

examples/pru_i2s/firmware/I2S/pru_i2s_interface.h


8. examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h ✨ Enhancement +209/-0

TDM4 mode firmware pin and interrupt configuration

• Assembly header defining TDM4 pin mappings for AM263x and AM261x SoCs with PRU0/PRU1
 configurations
• Specifies BCLK, FSYNC, and TDM data line pin positions for GPIO output
• Configures TDM-specific parameters including 16 samples per channel and 6 TDM channel slots

examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h


9. examples/pru_i2s/pru_i2s_app/data.h ✨ Enhancement +99/-0

PRU I2S application data buffers and configuration constants

• Defines constants for system configuration (semaphore timeout, error thresholds, logging
 intervals)
• Specifies buffer management parameters including ping-pong buffer sizes for Tx/Rx operations
• Declares audio buffer storage with section attributes and initializes Tx buffer with test pattern
 data

examples/pru_i2s/pru_i2s_app/data.h


10. examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c ✨ Enhancement +110/-0

PRU I2S application configuration implementation

• Implements application configuration table for PRU I2S instances with ICSS and PRU core selection
• Provides PRUI2S_applyAppConfig() function to apply user configuration to driver before
 initialization
• Supports flexible hardware configuration for AM261x and AM263x platforms

examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c


11. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c ✨ Enhancement +287/-0

TCA6416 IO Expander Driver Implementation

• Implements TCA6416 I2C IO expander driver with functions for open, close, config, and setOutput
 operations
• Provides register definitions for TCA6416 input/output and configuration ports
• Includes mutex-based synchronization for thread-safe I2C transactions
• Supports configuring IO pins as input/output and setting output states via I2C

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c


12. examples/pru_i2s/include/pru_i2s_config.h ⚙️ Configuration changes +177/-0

PRU I2S Configuration Header with Platform Presets

• Defines PRUI2S_UserConfig structure for PRU I2S configuration with ICSS instance and PRU core
 selection
• Provides predefined configuration macros for AM261x LaunchPad and AM263x Control Card platforms
• Includes platform-specific defaults using conditional compilation based on SOC type
• Documents auto-detection capability for I2S parameters from firmware

examples/pru_i2s/include/pru_i2s_config.h


13. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h ✨ Enhancement +210/-0

TCA6416 IO Expander Driver Header Interface

• Defines TCA6416 driver API with structures for configuration, parameters, and attributes
• Declares functions for opening/closing driver and configuring IO pins as input/output
• Provides macros for IO pin modes (input/output) and output states (high/low)
• Includes comprehensive documentation for all public APIs and data structures

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h


14. examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h ✨ Enhancement +114/-0

TDM4 PRU I2S Firmware Register Definitions

• Defines PRU register mappings for TDM4 I2S firmware implementation
• Allocates registers for Tx/Rx buffer management, frame sync, and channel data
• Includes conditional register definitions for Tx-only, Rx-only, and bidirectional modes
• Sets up registers for error status tracking and ping-pong buffer management

examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h


15. examples/pru_i2s/firmware/I2S/pru_i2s_regs.h ✨ Enhancement +113/-0

I2S PRU Firmware Register Definitions

• Defines PRU register mappings for standard I2S firmware implementation
• Allocates registers for Tx/Rx buffer management, frame sync, and channel data
• Includes conditional register definitions for different operational modes
• Sets up registers for error status and ping-pong buffer state tracking

examples/pru_i2s/firmware/I2S/pru_i2s_regs.h


16. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h ✨ Enhancement +159/-0

TDM4 PRU0 Firmware Binary Image Arrays

• Contains compiled TDM4 PRU I2S firmware binary arrays for PRU0 (Tx)
• Includes instruction array (pru_prupru_i2s0_image_0_0) with firmware bytecode
• Provides configuration data array (pru_prupru_i2s0_image_0_1) with firmware parameters
• Used for loading firmware into PRU0 at runtime

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h


17. examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h ✨ Enhancement +155/-0

I2S PRU0 Firmware Binary Image Arrays

• Contains compiled I2S PRU firmware binary arrays for PRU0 (Tx)
• Includes instruction array with firmware bytecode for standard I2S mode
• Provides configuration data array with firmware parameters
• Used for loading firmware into PRU0 at runtime

examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h


18. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h ✨ Enhancement +152/-0

TDM4 PRU1 Firmware Binary Image Arrays

• Contains compiled TDM4 PRU I2S firmware binary arrays for PRU1 (Rx)
• Includes instruction array with firmware bytecode for receive operations
• Provides configuration data array with firmware parameters
• Used for loading firmware into PRU1 at runtime

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h


19. examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h ✨ Enhancement +142/-0

I2S PRU1 Firmware Binary Image Arrays

• Contains compiled I2S PRU firmware binary arrays for PRU1 (Rx)
• Includes instruction array with firmware bytecode for receive operations
• Provides configuration data array with firmware parameters
• Used for loading firmware into PRU1 at runtime

examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h


20. examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.h ⚙️ Configuration changes +94/-0

PRU I2S Application Configuration Header

• Defines application-level configuration constants for PRU I2S mode selection (I2S vs TDM)
• Provides instance enable flags for PRU I2S 0 and 1 instances
• Declares instance indices for test configuration
• Includes function prototype for applying application configuration

examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.h


21. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM263x Control Card FreeRTOS Main Entry Point

• Implements main entry point for AM263x Control Card PRU I2S application
• Sets up FreeRTOS task creation and scheduler initialization
• Calls system and board initialization before launching diagnostic main
• Provides static task allocation and priority configuration

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c


22. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM261x LaunchPad FreeRTOS Main Entry Point

• Implements main entry point for AM261x LaunchPad PRU I2S application
• Sets up FreeRTOS task creation and scheduler initialization
• Calls system and board initialization before launching diagnostic main
• Provides static task allocation and priority configuration

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c


23. examples/pru_i2s/firmware/I2S/linker.cmd ⚙️ Configuration changes +88/-0

I2S PRU Firmware Linker Command File

• Defines memory layout for PRU instruction and data memory regions
• Maps PRU IMEM, DMEM, and shared memory sections
• Configures peripheral register spaces and CREGISTER mappings
• Allocates sections for code, data, and firmware registers

examples/pru_i2s/firmware/I2S/linker.cmd


24. examples/pru_i2s/firmware/TDM4/linker.cmd ⚙️ Configuration changes +88/-0

TDM4 PRU Firmware Linker Command File

• Defines memory layout for TDM4 PRU instruction and data memory regions
• Maps PRU IMEM, DMEM, and shared memory sections
• Configures peripheral register spaces and CREGISTER mappings
• Allocates sections for code, data, and firmware registers

examples/pru_i2s/firmware/TDM4/linker.cmd


25. examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm ✨ Enhancement +517/-0

TDM4 PRU I2S Firmware Main Assembly Implementation

• Implements main PRU firmware loop for TDM4 I2S audio processing
• Handles Tx/Rx buffer management with ping-pong switching
• Manages frame sync and bit clock edge detection for audio sampling
• Includes error handling for underflow, overflow, and frame sync errors

examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm


26. examples/pru_i2s/firmware/I2S/fw_regs.asm ⚙️ Configuration changes +113/-0

I2S Firmware Register Configuration Assembly

• Defines firmware register section with I2S configuration parameters
• Sets up Tx/Rx channel counts, sampling frequency, and bits per slot
• Configures buffer addresses and sizes for ping-pong operation
• Defines interrupt event numbers and pin assignments for I2S signals

examples/pru_i2s/firmware/I2S/fw_regs.asm


27. examples/pru_i2s/firmware/TDM4/fw_regs.asm ⚙️ Configuration changes +113/-0

TDM4 Firmware Register Configuration Assembly

• Defines firmware register section with TDM4 configuration parameters
• Sets up Tx/Rx channel counts, sampling frequency, and bits per slot
• Configures buffer addresses and sizes for ping-pong operation
• Defines interrupt event numbers and pin assignments for TDM signals

examples/pru_i2s/firmware/TDM4/fw_regs.asm


28. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec ⚙️ Configuration changes +20/-0

TDM4 PRU0 AM261x LaunchPad Build Makefile

• Provides build automation for TDM4 PRU0 firmware on AM261x LaunchPad
• Defines CCS project build, clean, and export targets
• Configures project name and build profile settings
• Automates firmware compilation and project generation

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


29. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec ⚙️ Configuration changes +20/-0

TDM4 PRU0 AM263x Control Card Build Makefile

• Provides build automation for TDM4 PRU0 firmware on AM263x Control Card
• Defines CCS project build, clean, and export targets
• Configures project name and build profile settings
• Automates firmware compilation and project generation

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


30. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

AM263x FreeRTOS ROV Configuration File

• Configures Runtime Object View (ROV) tool integration for FreeRTOS
• References FreeRTOS ROV JavaScript module for debugging support
• Enables runtime inspection of FreeRTOS kernel objects

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


31. .metadata/product.json Additional files +2/-1

...

.metadata/product.json


32. examples/makefile Additional files +1/-1

...

examples/makefile


33. examples/pru_i2s/README.md Additional files +464/-0

...

examples/pru_i2s/README.md


34. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


35. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +91/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


36. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


37. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


38. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


39. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


40. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


41. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


42. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


43. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


44. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


45. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


46. examples/pru_i2s/firmware/I2S/pru_i2s_main.asm Additional files +502/-0

...

examples/pru_i2s/firmware/I2S/pru_i2s_main.asm


47. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


48. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


49. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


50. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


51. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


52. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


53. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


54. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


55. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


56. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


57. examples/pru_i2s/makefile Additional files +115/-0

...

examples/pru_i2s/makefile


58. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg Additional files +359/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg


59. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +118/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec


60. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +375/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile


61. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


62. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


63. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg Additional files +372/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg


64. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +124/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec


65. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +377/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile


66. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


67. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


68. source/.meta/pru_i2s/pru_i2s.syscfg.js Additional files +318/-0

...

source/.meta/pru_i2s/pru_i2s.syscfg.js


69. source/.meta/pru_i2s/pru_i2s_config.c.xdt Additional files +114/-0

...

source/.meta/pru_i2s/pru_i2s_config.c.xdt


70. source/.meta/pru_i2s/pru_i2s_templates.c.xdt Additional files +178/-0

...

source/.meta/pru_i2s/pru_i2s_templates.c.xdt


71. source/.meta/pru_i2s/pru_i2s_templates.h.xdt Additional files +140/-0

...

source/.meta/pru_i2s/pru_i2s_templates.h.xdt


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 13, 2026

Code Review by Qodo

Grey Divider

New Review Started

This review has been superseded by a new analysis

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from c4e4775 to 8ab787e Compare April 13, 2026 06:20
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

PRU I2S Driver and Firmware Implementation with Real-Time Audio Streaming Support

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Implements complete PRU I2S driver with full lifecycle management (initialization, open/close,
  read/write operations)
• Provides both interleaved and non-interleaved I/O buffer operations for Tx/Rx data handling with
  interrupt management
• Adds comprehensive PRU I2S diagnostic application with real-time audio streaming over I2S/TDM
  interfaces
• Implements ping-pong buffer management for continuous data flow with full-duplex, Tx-only, and
  Rx-only modes
• Includes PRU firmware implementations for both I2S and TDM4 modes with assembly-level audio data
  transmission/reception
• Provides pre-compiled firmware binary arrays for PRU0 (transmit) and PRU1 (receive) for both I2S
  and TDM4 modes
• Adds TCA6416 IO expander driver for hardware pin control and configuration
• Includes platform-specific configurations for AM261x LaunchPad and AM263x Control Card
• Provides complete build infrastructure with makefiles, linker scripts, and project specifications
• Adds FreeRTOS ROV (Runtime Object View) configuration for debugging support
Diagram
flowchart LR
  A["PRU I2S Driver<br/>pru_i2s_drv.c/h"] --> B["Driver API<br/>Init/Open/Close<br/>Read/Write"]
  C["PRU Firmware<br/>I2S & TDM4 Modes"] --> D["Firmware Binaries<br/>PRU0/PRU1 Arrays"]
  E["Diagnostic App<br/>pru_i2s_diagnostic.c"] --> F["Audio Streaming<br/>Ping-Pong Buffers<br/>ISR Handling"]
  B --> F
  D --> F
  G["Platform Config<br/>AM261x/AM263x"] --> B
  H["IO Expander<br/>TCA6416 Driver"] --> F
Loading

Grey Divider

File Changes

1. examples/pru_i2s/driver/pru_i2s_drv.c ✨ Enhancement +1902/-0

PRU I2S driver implementation with full lifecycle management

• Implements complete PRU I2S driver with 1902 lines of code including initialization, open/close,
 read/write operations
• Provides both interleaved and non-interleaved (conversion) I/O buffer operations for Tx/Rx data
 handling
• Implements interrupt management (enable/disable/clear) for I2S Tx, Rx, and error events
• Includes helper functions for PRU initialization, firmware setup, ping/pong buffer management, and
 parameter validation

examples/pru_i2s/driver/pru_i2s_drv.c


2. examples/pru_i2s/include/pru_i2s_drv.h ✨ Enhancement +776/-0

PRU I2S driver header with API definitions and structures

• Defines comprehensive PRU I2S driver API with 776 lines including type definitions, structures,
 and function declarations
• Declares public APIs for driver initialization, instance management (open/close/enable), and data
 I/O operations
• Defines internal data structures (PRUI2S_Object, PRUI2S_SwipAttrs, PRUI2S_Params) and
 configuration tables
• Includes firmware register definitions and bit-field macros for PRU I2S control

examples/pru_i2s/include/pru_i2s_drv.h


3. examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

Firmware register definitions for PRU I2S control

• Defines firmware register map with 197 lines including register offsets, sizes, and bit-field
 definitions
• Specifies I2S configuration registers (Tx/Rx count, sampling frequency, bits per slot, buffer
 addresses)
• Defines ping/pong buffer selection and status registers for Tx/Rx data management
• Includes error status register definitions for overflow, underflow, and frame sync errors

examples/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h


View more (68)
4. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

ROV configuration for FreeRTOS debugging integration

• Adds Runtime Object View (ROV) configuration file for FreeRTOS debugging support
• Specifies ROV tool integration for kernel/freertos runtime object inspection

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


5. examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c ✨ Enhancement +1427/-0

PRU I2S Real-Time Audio Streaming Diagnostic Application

• Comprehensive PRU I2S diagnostic application with real-time audio streaming over I2S/TDM
 interfaces
• Implements ping-pong buffer management for continuous data flow with full-duplex, Tx-only, and
 Rx-only modes
• ISR-based interrupt handling with semaphore synchronization for Tx/Rx completion and error events
• Detailed error detection, reporting, and statistics collection with configurable thresholds
• Complete initialization sequence from PRU-ICSS setup through firmware loading to streaming loop
 execution

examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c


6. examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h ✨ Enhancement +197/-0

PRU I2S Firmware Register Interface Header

• Defines firmware register base addresses and offsets for PRU I2S configuration and status
• Specifies bit field masks and shifts for register access (channel counts, sampling frequency,
 buffer addresses)
• Maps ping-pong buffer selection and status registers for Tx/Rx operations
• Defines error status register bit positions for overflow, underflow, and frame sync errors

examples/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h


7. examples/pru_i2s/firmware/I2S/pru_i2s_interface.h ✨ Enhancement +213/-0

PRU I2S Firmware Pin and Interrupt Configuration

• Defines I2S pin mappings for AM263X and AM261X SoCs with PRU0/PRU1 differentiation
• Specifies GPIO pin numbers and positions for BCLK, FSYNC, and data lines (Tx/Rx)
• Maps interrupt event numbers for Tx, Rx, and error handling with host event routing
• Configures sample counts and TDM channel parameters for firmware operation

examples/pru_i2s/firmware/I2S/pru_i2s_interface.h


8. examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h ✨ Enhancement +209/-0

PRU I2S TDM4 Mode Firmware Pin Configuration

• Defines TDM4 mode pin mappings for AM263X and AM261X SoCs with PRU0/PRU1 support
• Specifies GPIO pin assignments for BCLK, FSYNC, and TDM data lines
• Maps interrupt event numbers for Tx, Rx, and error handling in TDM mode
• Configures TDM-specific parameters including sample counts and maximum channel slots

examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h


9. examples/pru_i2s/pru_i2s_app/data.h ✨ Enhancement +99/-0

PRU I2S Application Data Buffers and Configuration Constants

• Defines system configuration constants for semaphore timeouts, error thresholds, and logging
 intervals
• Specifies ping-pong buffer management constants and audio processing parameters
• Declares Tx/Rx buffer storage with section attributes for memory placement
• Initializes transmit buffer with test pattern data for audio streaming validation

examples/pru_i2s/pru_i2s_app/data.h


10. examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c ✨ Enhancement +110/-0

PRU I2S Application Configuration Setup Function

• Implements application configuration function to apply user settings to PRU I2S driver
• Defines configuration table for PRU core instances with ICSS instance and PRU ID mapping
• Provides PRUI2S_applyAppConfig() function to set user configuration before driver initialization
• Supports flexible hardware configuration for different SoC platforms (AM261x, AM263x)

examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c


11. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c ✨ Enhancement +287/-0

TCA6416 IO Expander Driver Implementation

• Implements TCA6416 I2C IO expander driver with functions to open, close, configure, and set output
 pins
• Provides TCA6416_open() to initialize the driver with I2C handle and semaphore protection
• Implements TCA6416_config() for pin mode configuration (input/output) via I2C read-modify-write
• Implements TCA6416_setOutput() to control pin output state (HIGH/LOW) with thread-safe access

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.c


12. examples/pru_i2s/include/pru_i2s_config.h ⚙️ Configuration changes +177/-0

PRU I2S Configuration Header with Platform Examples

• Defines PRUI2S_UserConfig structure for PRU I2S configuration with ICSS instance and PRU core
 selection
• Provides example configurations for AM261x LaunchPad and AM263x Control Card platforms
• Includes platform-specific macros for auto-detection of I2S parameters from firmware
• Documents user-editable configuration parameters for I2S/TDM mode, channels, and sampling
 frequency

examples/pru_i2s/include/pru_i2s_config.h


13. examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h ✨ Enhancement +210/-0

TCA6416 IO Expander Driver Header and API

• Defines TCA6416 driver API header with structures for configuration, parameters, and attributes
• Declares functions: TCA6416_open(), TCA6416_close(), TCA6416_config(), TCA6416_setOutput()
• Defines macros for IO pin modes (input/output) and output states (HIGH/LOW)
• Includes comprehensive documentation for I2C-based IO expander control

examples/pru_i2s/pru_i2s_app/board/ioexp_tca6416.h


14. examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h ✨ Enhancement +114/-0

TDM4 Mode PRU I2S Register Definitions

• Defines PRU register mappings for TDM4 mode I2S firmware implementation
• Maps PRU general-purpose registers to I2S-specific functions (buffer addresses, counters, pin
 positions)
• Configures registers for transmit/receive data handling, frame sync, and error status tracking
• Supports both TX-only and RX configurations with conditional register assignments

examples/pru_i2s/firmware/TDM4/pru_i2s_regs.h


15. examples/pru_i2s/firmware/I2S/pru_i2s_regs.h ✨ Enhancement +113/-0

I2S Mode PRU Register Definitions

• Defines PRU register mappings for standard I2S mode firmware implementation
• Maps PRU general-purpose registers to I2S-specific functions (buffer addresses, counters, pin
 positions)
• Configures registers for transmit/receive data handling, frame sync, and error status tracking
• Supports both TX-only and RX configurations with conditional register assignments

examples/pru_i2s/firmware/I2S/pru_i2s_regs.h


16. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h ✨ Enhancement +159/-0

TDM4 Mode PRU0 Firmware Binary Array

• Contains compiled PRU firmware binary arrays for TDM4 mode PRU0 (transmit)
• Includes instruction array pru_prupru_i2s0_image_0_0[] with machine code
• Includes data/configuration array pru_prupru_i2s0_image_0_1[] with firmware parameters
• Provides pre-compiled firmware for deployment without runtime compilation

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h


17. examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h ✨ Enhancement +155/-0

I2S Mode PRU0 Firmware Binary Array

• Contains compiled PRU firmware binary arrays for I2S mode PRU0 (transmit)
• Includes instruction array pru_prupru_i2s0_image_0_0[] with machine code
• Includes data/configuration array pru_prupru_i2s0_image_0_1[] with firmware parameters
• Provides pre-compiled firmware for deployment without runtime compilation

examples/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h


18. examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h ✨ Enhancement +152/-0

TDM4 Mode PRU1 Firmware Binary Array

• Contains compiled PRU firmware binary arrays for TDM4 mode PRU1 (receive)
• Includes instruction array pru_prupru_i2s1_image_0_0[] with machine code
• Includes data/configuration array pru_prupru_i2s1_image_0_1[] with firmware parameters
• Provides pre-compiled firmware for deployment without runtime compilation

examples/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h


19. examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h ✨ Enhancement +142/-0

I2S Mode PRU1 Firmware Binary Array

• Contains compiled PRU firmware binary arrays for I2S mode PRU1 (receive)
• Includes instruction array pru_prupru_i2s1_image_0_0[] with machine code
• Includes data/configuration array pru_prupru_i2s1_image_0_1[] with firmware parameters
• Provides pre-compiled firmware for deployment without runtime compilation

examples/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h


20. examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.h ⚙️ Configuration changes +94/-0

PRU I2S Application Configuration Header

• Defines application-level configuration constants for PRU I2S mode selection (I2S vs TDM)
• Provides instance enable flags for PRU I2S0 (Tx) and PRU I2S1 (Rx)
• Declares PRUI2S_applyAppConfig() function for applying user configuration to driver
• Includes instance indices and test configuration macros for application setup

examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.h


21. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM263x Control Card Main Application Entry Point

• Implements main entry point for AM263x Control Card PRU I2S application
• Initializes system and board, creates FreeRTOS task for PRU I2S diagnostic
• Sets up static task object and stack for main task execution
• Calls pru_i2s_diagnostic_main() for application-specific I2S functionality

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/main.c


22. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c ✨ Enhancement +84/-0

AM261x LaunchPad Main Application Entry Point

• Implements main entry point for AM261x LaunchPad PRU I2S application
• Initializes system and board, creates FreeRTOS task for PRU I2S diagnostic
• Sets up static task object and stack for main task execution
• Calls pru_i2s_diagnostic_main() for application-specific I2S functionality

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/main.c


23. examples/pru_i2s/firmware/I2S/linker.cmd ⚙️ Configuration changes +88/-0

I2S Mode PRU Linker Command File

• Defines memory layout for PRU instruction and data RAM allocation
• Maps PRU IMEM (16kB) for instruction code and DMEM sections for data
• Configures shared memory (64kB) and peripheral register spaces via CREGISTER mappings
• Allocates sections for text, data, firmware registers, and debug buffers

examples/pru_i2s/firmware/I2S/linker.cmd


24. examples/pru_i2s/firmware/TDM4/linker.cmd ⚙️ Configuration changes +88/-0

TDM4 Mode PRU Linker Command File

• Defines memory layout for PRU instruction and data RAM allocation
• Maps PRU IMEM (16kB) for instruction code and DMEM sections for data
• Configures shared memory (64kB) and peripheral register spaces via CREGISTER mappings
• Allocates sections for text, data, firmware registers, and debug buffers

examples/pru_i2s/firmware/TDM4/linker.cmd


25. examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm ✨ Enhancement +517/-0

TDM4 Mode PRU I2S Main Firmware Assembly

• Implements main PRU firmware logic for TDM4 mode I2S/audio processing
• Handles initialization, buffer management, and ping-pong buffer switching
• Implements bit-level audio data transmission/reception synchronized with BCLK and FS signals
• Includes error handling for underflow, overflow, and frame sync errors

examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm


26. examples/pru_i2s/firmware/I2S/fw_regs.asm ✨ Enhancement +113/-0

I2S Mode Firmware Register Initialization

• Defines firmware register section for I2S mode with configuration parameters
• Initializes TX/RX channel counts, sampling frequency, and bits per slot
• Sets up buffer addresses, interrupt event numbers, and pin assignments
• Configures ping-pong buffer status and error status registers

examples/pru_i2s/firmware/I2S/fw_regs.asm


27. examples/pru_i2s/firmware/TDM4/fw_regs.asm ✨ Enhancement +113/-0

TDM4 Mode Firmware Register Initialization

• Defines firmware register section for TDM4 mode with configuration parameters
• Initializes TX/RX channel counts, sampling frequency, and bits per slot
• Sets up buffer addresses, interrupt event numbers, and pin assignments
• Configures ping-pong buffer status and error status registers

examples/pru_i2s/firmware/TDM4/fw_regs.asm


28. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec ⚙️ Configuration changes +20/-0

TDM4 PRU0 AM261x LaunchPad Build Makefile

• Provides build automation makefile for TDM4 PRU0 firmware on AM261x LaunchPad
• Defines CCS Eclipse project build, clean, and export targets
• Configures project name and build profile (Release/Debug)
• Automates firmware compilation and project generation

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


29. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec ⚙️ Configuration changes +20/-0

TDM4 PRU0 AM263x Control Card Build Makefile

• Provides build automation makefile for TDM4 PRU0 firmware on AM263x Control Card
• Defines CCS Eclipse project build, clean, and export targets
• Configures project name and build profile (Release/Debug)
• Automates firmware compilation and project generation

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


30. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs ⚙️ Configuration changes +8/-0

AM263x Control Card ROV Configuration

• Configures Runtime Object View (ROV) tool integration for AM263x Control Card
• References FreeRTOS ROV plugin for runtime debugging and inspection
• Enables visualization of FreeRTOS kernel objects during debugging

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs


31. .metadata/product.json Additional files +2/-1

...

.metadata/product.json


32. examples/makefile Additional files +1/-1

...

examples/makefile


33. examples/pru_i2s/README.md Additional files +464/-0

...

examples/pru_i2s/README.md


34. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


35. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +91/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


36. examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


37. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


38. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


39. examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile_projectspec


40. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


41. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


42. examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


43. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


44. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


45. examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/I2S/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


46. examples/pru_i2s/firmware/I2S/pru_i2s_main.asm Additional files +502/-0

...

examples/pru_i2s/firmware/I2S/pru_i2s_main.asm


47. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


48. examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/makefile


49. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec Additional files +86/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/example.projectspec


50. examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile


51. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


52. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile


53. examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am261x-lp/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


54. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec Additional files +85/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/example.projectspec


55. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile Additional files +90/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile


56. examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/firmware/TDM4/pru1_rx/am263x-cc/icssm0-pru1_fw/ti-pru-cgt/makefile_projectspec


57. examples/pru_i2s/makefile Additional files +115/-0

...

examples/pru_i2s/makefile


58. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg Additional files +359/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/example.syscfg


59. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +118/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec


60. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +375/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile


61. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


62. examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


63. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg Additional files +372/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/example.syscfg


64. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec Additional files +124/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/example.projectspec


65. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile Additional files +377/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile


66. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen Additional files +141/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen


67. examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec Additional files +20/-0

...

examples/pru_i2s/pru_i2s_app/am263x-cc/r5fss0-0_freertos/ti-arm-clang/makefile_projectspec


68. source/.meta/pru_i2s/pru_i2s.syscfg.js Additional files +318/-0

...

source/.meta/pru_i2s/pru_i2s.syscfg.js


69. source/.meta/pru_i2s/pru_i2s_config.c.xdt Additional files +114/-0

...

source/.meta/pru_i2s/pru_i2s_config.c.xdt


70. source/.meta/pru_i2s/pru_i2s_templates.c.xdt Additional files +178/-0

...

source/.meta/pru_i2s/pru_i2s_templates.c.xdt


71. source/.meta/pru_i2s/pru_i2s_templates.h.xdt Additional files +140/-0

...

source/.meta/pru_i2s/pru_i2s_templates.h.xdt


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 13, 2026

Persistent review updated to latest commit 8ab787e

@qodo-code-review
Copy link
Copy Markdown

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: Build (am62x)

Failed stage: Build [❌]

Failed test name: ""

Failure summary:

The GitHub Action failed during the make -j$(nproc) DEVICE=am62x build because the examples build
attempted to run make pru in a directory that has no pru target for the am62x device.
- The first
hard failure is in examples/spi_loopback:
- Project spi_loopback does not have a build option for
am62x
- make[3]: *** No rule to make target 'pru'. Stop. (around log lines 678-680)
- This error
propagates upward and causes the overall build to fail:
- make[2]: *** [makefile:24: pru_i2s]
Error 2 (line ~684)
- make[1]: *** [makefile:26: examples] Error 2 (line ~766)
- make: ***
[makefile:9: all] Error 2 (line ~768)
Notes: Other messages like Project gpio_toggle does not have a
build option for am62x / Project ... does not have a build option for am62x appear earlier, but the
build stops when make cannot find the pru rule in examples/spi_loopback.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

394:  �[36;1mif [ -n "" ]; then�[0m
395:  �[36;1m  SDK_ARG="MCU_PLUS_SDK_PATH=$HOME/ti/"�[0m
396:  �[36;1mfi�[0m
397:  �[36;1mmake -j$(nproc) DEVICE=am62x ${SDK_ARG}�[0m
398:  shell: /usr/bin/bash -e {0}
399:  ##[endgroup]
400:  make -C source
401:  make[1]: Entering directory '/home/runner/work/open-pru/open-pru/source'
402:  make -C rpmsg all
403:  make[2]: Entering directory '/home/runner/work/open-pru/open-pru/source/rpmsg'
404:  mkdir -p lib
405:  mkdir -p lib
406:  Building file: pru_rpmsg.c
407:  Building file: pru_virtqueue.c
408:  Invoking: PRU Compiler
409:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/include/linux -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=lib --obj_directory=lib --pp_directory=lib -ppd -ppa -g --endian=little  pru_rpmsg.c
410:  Invoking: PRU Compiler
411:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/include/linux -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=lib --obj_directory=lib --pp_directory=lib -ppd -ppa -g --endian=little  pru_virtqueue.c
412:  Finished building: "pru_virtqueue.c"
...

448:  Project gpio_toggle does not have a build option for am62x
449:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/gpio/gpio_toggle'
450:  make -C intc/intc_mcu pru
451:  make[4]: Entering directory '/home/runner/work/open-pru/open-pru/examples/empty/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
452:  mkdir -p generated
453:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/academy/intc/intc_mcu'
454:  make[4]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_assembly/solution'
455:  make -C firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt all
456:  Project intc_mcu does not have a build option for am62x
457:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/intc/intc_mcu'
458:  make -C c_and_inline_assembly/solution pru
459:  Building file: "../../../main.asm"
460:  make[5]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/assembly_code/solution/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
461:  mkdir -p generated
462:  Invoking: PRU Compiler
463:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.asm
464:  make[5]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_assembly/solution/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
465:  mkdir -p generated
466:  make[4]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_inline_assembly/solution'
467:  make -C firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt all
468:  Building file: "../../../main.asm"
469:  Building file: "../../../assm_add.asm"
470:  Invoking: PRU Compiler
471:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.asm
472:  make[5]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_inline_assembly/solution/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
473:  mkdir -p generated
474:  Invoking: PRU Compiler
475:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/assm_add.obj ../../../assm_add.asm
476:  Building file: "../../../main.c"
477:  Invoking: PRU Compiler
478:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.c
479:  Finished building: "../../../main.asm"
480:  Finished building: "../../../main.asm"
481:  "../../../main.c", line 46: warning #112-D: statement is unreachable
482:  Finished building: "../../../assm_add.asm"
483:  "../../../main.c", line 26: warning #552-D: variable "z" was set but never used
484:  Building target: "generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.out"
485:  Invoking: PRU Linker
486:  Building file: "../../../main.c"
487:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.map --xml_link_info=generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --entry_point=main --disable_auto_rts -o generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.out 
488:  Building target: "generated/empty_am62x-sk_pruss0_pru0_fw.out"
489:  Invoking: PRU Compiler
490:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.c
491:  Invoking: PRU Linker
492:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/empty_am62x-sk_pruss0_pru0_fw.map --xml_link_info=generated/empty_am62x-sk_pruss0_pru0_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --entry_point=main --disable_auto_rts -o generated/empty_am62x-sk_pruss0_pru0_fw.out 
493:  <Linking>
...

498:  Finished building target: "generated/empty_am62x-sk_pruss0_pru0_fw.out"
499:  /home/runner/ti/ti-cgt-pru_2.3.3/bin/hexpru --diag_wrap=off --array --array:name_prefix=PRU0Firmware -o generated/empty_am62x-sk_pruss0_pru0_fw.h generated/empty_am62x-sk_pruss0_pru0_fw.out
500:  /home/runner/ti/ti-cgt-pru_2.3.3/bin/hexpru --diag_wrap=off --array --array:name_prefix=PRU0Firmware -o generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.h generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.out
501:  Translating to Array format...
502:  "generated/empty_am62x-sk_pruss0_pru0_fw.out" .text ==> .text
503:  cat /home/runner/work/open-pru/open-pru/source/firmware/pru_load_bin_copyright.h generated/empty_am62x-sk_pruss0_pru0_fw.h > generated/empty_am62x-sk_pruss0_pru0_fw.h.temp
504:  Translating to Array format...
505:  "generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.out" .text ==> .text
506:  cat /home/runner/work/open-pru/open-pru/source/firmware/pru_load_bin_copyright.h generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.h > generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.h.temp
507:  mv generated/empty_am62x-sk_pruss0_pru0_fw.h.temp generated/empty_am62x-sk_pruss0_pru0_fw.h
508:  mv generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.h.temp generated/pru_add_assembly_am62x-sk_pruss0_pru0_fw.h
509:  Finished building: "../../../main.c"
510:  Finished building: "../../../main.c"
511:  Building target: "generated/pru_add_c_and_inline_assembly_am62x-sk_pruss0_pru0_fw.out"
512:  Invoking: PRU Linker
513:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/pru_add_c_and_inline_assembly_am62x-sk_pruss0_pru0_fw.map --xml_link_info=generated/pru_add_c_and_inline_assembly_am62x-sk_pruss0_pru0_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --stack_size=0x100 --heap_size=0x100 -i/home/runner/ti/ti-cgt-pru_2.3.3/lib -i/home/runner/ti/ti-cgt-pru_2.3.3/include --library=libc.a -o generated/pru_add_c_and_inline_assembly_am62x-sk_pruss0_pru0_fw.out 
514:  Building target: "generated/pru_add_c_and_assembly_am62x-sk_pruss0_pru0_fw.out"
515:  <Linking>
516:  Invoking: PRU Linker
517:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/assm_add.obj generated/main.obj linker.cmd -mgenerated/pru_add_c_and_assembly_am62x-sk_pruss0_pru0_fw.map --xml_link_info=generated/pru_add_c_and_assembly_am62x-sk_pruss0_pru0_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --stack_size=0x100 --heap_size=0x100 -i/home/runner/ti/ti-cgt-pru_2.3.3/lib -i/home/runner/ti/ti-cgt-pru_2.3.3/include --library=libc.a -o generated/pru_add_c_and_assembly_am62x-sk_pruss0_pru0_fw.out 
518:  <Linking>
...

535:  cp generated/empty_am62x-sk_pruss0_pru0_fw.h /home/runner/work/open-pru/open-pru/examples/empty/firmware/am62x-sk/pru0_load_bin.h
536:  cp generated/pru_add_c_and_assembly_am62x-sk_pruss0_pru0_fw.h /home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_assembly/solution/firmware/am62x-sk/pru0_load_bin.h
537:  make[5]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/assembly_code/solution/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
538:  make -C firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt all
539:  make[5]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_inline_assembly/solution/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
540:  make -C firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt all
541:  make[5]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/assembly_code/solution/firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt'
542:  mkdir -p generated
543:  make[4]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/empty/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
544:  make -C firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt all
545:  Building file: "../../../main.asm"
546:  make[5]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_assembly/solution/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
547:  make[5]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_inline_assembly/solution/firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt'
548:  mkdir -p generated
549:  Invoking: PRU Compiler
550:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.asm
551:  make -C firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt all
552:  make[4]: Entering directory '/home/runner/work/open-pru/open-pru/examples/empty/firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt'
553:  mkdir -p generated
554:  Building file: "../../../main.c"
555:  Building file: "../../../main.asm"
556:  Invoking: PRU Compiler
557:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.c
558:  Invoking: PRU Compiler
559:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.asm
560:  make[5]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_and_assembly/solution/firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt'
561:  mkdir -p generated
562:  Finished building: "../../../main.asm"
563:  Building file: "../../../assm_add.asm"
564:  Invoking: PRU Compiler
565:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/assm_add.obj ../../../assm_add.asm
566:  Finished building: "../../../main.asm"
567:  "../../../main.c", line 46: warning #112-D: statement is unreachable
568:  "../../../main.c", line 26: warning #552-D: variable "z" was set but never used
569:  Building target: "generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.out"
570:  Invoking: PRU Linker
571:  Building target: "generated/empty_am62x-sk_pruss0_pru1_fw.out"
572:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.map --xml_link_info=generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --entry_point=main --disable_auto_rts -o generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.out 
573:  Finished building: "../../../assm_add.asm"
574:  <Linking>
575:  Building file: "../../../main.c"
576:  Invoking: PRU Linker
577:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/empty_am62x-sk_pruss0_pru1_fw.map --xml_link_info=generated/empty_am62x-sk_pruss0_pru1_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --entry_point=main --disable_auto_rts -o generated/empty_am62x-sk_pruss0_pru1_fw.out 
578:  <Linking>
579:  Invoking: PRU Compiler
580:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.c
581:  "../../../main.c", line 46: warning #112-D: statement is unreachable
...

584:  Finished building target: "generated/empty_am62x-sk_pruss0_pru1_fw.out"
585:  /home/runner/ti/ti-cgt-pru_2.3.3/bin/hexpru --diag_wrap=off --array --array:name_prefix=PRU1Firmware -o generated/empty_am62x-sk_pruss0_pru1_fw.h generated/empty_am62x-sk_pruss0_pru1_fw.out
586:  /home/runner/ti/ti-cgt-pru_2.3.3/bin/hexpru --diag_wrap=off --array --array:name_prefix=PRU1Firmware -o generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.h generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.out
587:  Translating to Array format...
588:  "generated/empty_am62x-sk_pruss0_pru1_fw.out" .text ==> .text
589:  Translating to Array format...
590:  "generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.out" .text ==> .text
591:  cat /home/runner/work/open-pru/open-pru/source/firmware/pru_load_bin_copyright.h generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.h > generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.h.temp
592:  cat /home/runner/work/open-pru/open-pru/source/firmware/pru_load_bin_copyright.h generated/empty_am62x-sk_pruss0_pru1_fw.h > generated/empty_am62x-sk_pruss0_pru1_fw.h.temp
593:  Finished building: "../../../main.c"
594:  mv generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.h.temp generated/pru_add_assembly_am62x-sk_pruss0_pru1_fw.h
595:  mv generated/empty_am62x-sk_pruss0_pru1_fw.h.temp generated/empty_am62x-sk_pruss0_pru1_fw.h
596:  Finished building: "../../../main.c"
597:  Building target: "generated/pru_add_c_and_inline_assembly_am62x-sk_pruss0_pru1_fw.out"
598:  Invoking: PRU Linker
599:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/pru_add_c_and_inline_assembly_am62x-sk_pruss0_pru1_fw.map --xml_link_info=generated/pru_add_c_and_inline_assembly_am62x-sk_pruss0_pru1_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --stack_size=0x100 --heap_size=0x100 -i/home/runner/ti/ti-cgt-pru_2.3.3/lib -i/home/runner/ti/ti-cgt-pru_2.3.3/include --library=libc.a -o generated/pru_add_c_and_inline_assembly_am62x-sk_pruss0_pru1_fw.out 
600:  Building target: "generated/pru_add_c_and_assembly_am62x-sk_pruss0_pru1_fw.out"
601:  <Linking>
602:  Invoking: PRU Linker
603:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/assm_add.obj generated/main.obj linker.cmd -mgenerated/pru_add_c_and_assembly_am62x-sk_pruss0_pru1_fw.map --xml_link_info=generated/pru_add_c_and_assembly_am62x-sk_pruss0_pru1_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --stack_size=0x100 --heap_size=0x100 -i/home/runner/ti/ti-cgt-pru_2.3.3/lib -i/home/runner/ti/ti-cgt-pru_2.3.3/include --library=libc.a -o generated/pru_add_c_and_assembly_am62x-sk_pruss0_pru1_fw.out 
604:  <Linking>
...

641:  make -C fft/split_radix_fft_4k_single_core pru
642:  Project mac_multiply does not have a build option for am62x
643:  make[4]: Entering directory '/home/runner/work/open-pru/open-pru/examples/empty_c/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
644:  mkdir -p generated
645:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/examples/fft/split_radix_fft_4k_single_core'
646:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/mac/mac_multiply'
647:  make -C fft/split_radix_fft_post_processing pru
648:  Project split_radix_fft_4k_single_core does not have a build option for am62x
649:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/fft/split_radix_fft_4k_single_core'
650:  make -C LCD_interface pru
651:  make[4]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_code/solution'
652:  make -C firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt all
653:  Building file: "../../../main.c"
654:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/examples/fft/split_radix_fft_post_processing'
655:  Invoking: PRU Compiler
656:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.c
657:  Project split_radix_fft_post_processing does not have a build option for am62x
658:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/fft/split_radix_fft_post_processing'
659:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/examples/LCD_interface'
660:  make -C logic_scope pru
661:  make[5]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_code/solution/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
662:  mkdir -p generated
663:  Project LCD_interface does not have a build option for am62x
664:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/LCD_interface'
665:  make -C pru_emif pru
666:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/examples/logic_scope'
667:  Building file: "../../../main.c"
668:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/examples/pru_emif'
669:  Project logic_scope does not have a build option for am62x
670:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/logic_scope'
671:  Invoking: PRU Compiler
672:  Project pru_emif does not have a build option for am62x
673:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.c
674:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/pru_emif'
675:  make -C pru_i2s pru
676:  make -C spi_loopback pru
677:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/examples/spi_loopback'
678:  Project spi_loopback does not have a build option for am62x
679:  make[3]: *** No rule to make target 'pru'.  Stop.
680:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/spi_loopback'
681:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/examples/pru_i2s'
682:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/pru_i2s'
683:  make -C fir pru
684:  make[2]: *** [makefile:24: pru_i2s] Error 2
685:  make[2]: *** Waiting for unfinished jobs....
686:  "../../../main.c", line 42: warning #112-D: statement is unreachable
687:  "../../../main.c", line 23: warning #552-D: variable "z" was set but never used
688:  make[3]: Entering directory '/home/runner/work/open-pru/open-pru/examples/fir'
689:  Project fir does not have a build option for am62x
690:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/fir'
691:  Finished building: "../../../main.c"
692:  Finished building: "../../../main.c"
693:  Building target: "generated/empty_c_am62x-sk_pruss0_pru0_fw.out"
694:  Invoking: PRU Linker
695:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/empty_c_am62x-sk_pruss0_pru0_fw.map --xml_link_info=generated/empty_c_am62x-sk_pruss0_pru0_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --stack_size=0x100 --heap_size=0x100 -i/home/runner/ti/ti-cgt-pru_2.3.3/lib -i/home/runner/ti/ti-cgt-pru_2.3.3/include --library=libc.a -o generated/empty_c_am62x-sk_pruss0_pru0_fw.out 
696:  <Linking>
697:  Building target: "generated/pru_add_c_am62x-sk_pruss0_pru0_fw.out"
698:  Invoking: PRU Linker
699:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/pru_add_c_am62x-sk_pruss0_pru0_fw.map --xml_link_info=generated/pru_add_c_am62x-sk_pruss0_pru0_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --stack_size=0x100 --heap_size=0x100 -i/home/runner/ti/ti-cgt-pru_2.3.3/lib -i/home/runner/ti/ti-cgt-pru_2.3.3/include --library=libc.a -o generated/pru_add_c_am62x-sk_pruss0_pru0_fw.out 
700:  <Linking>
...

713:  cat /home/runner/work/open-pru/open-pru/source/firmware/pru_load_bin_copyright.h generated/pru_add_c_am62x-sk_pruss0_pru0_fw.h > generated/pru_add_c_am62x-sk_pruss0_pru0_fw.h.temp
714:  mv generated/pru_add_c_am62x-sk_pruss0_pru0_fw.h.temp generated/pru_add_c_am62x-sk_pruss0_pru0_fw.h
715:  cp generated/empty_c_am62x-sk_pruss0_pru0_fw.h /home/runner/work/open-pru/open-pru/examples/empty_c/firmware/am62x-sk/pru0_load_bin.h
716:  cp generated/pru_add_c_am62x-sk_pruss0_pru0_fw.h /home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_code/solution/firmware/am62x-sk/pru0_load_bin.h
717:  make[4]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/empty_c/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
718:  make[5]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_code/solution/firmware/am62x-sk/pruss0_pru0_fw/ti-pru-cgt'
719:  make -C firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt all
720:  make -C firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt all
721:  make[4]: Entering directory '/home/runner/work/open-pru/open-pru/examples/empty_c/firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt'
722:  make[5]: Entering directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_code/solution/firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt'
723:  mkdir -p generated
724:  mkdir -p generated
725:  Building file: "../../../main.c"
726:  Building file: "../../../main.c"
727:  Invoking: PRU Compiler
728:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.c
729:  Invoking: PRU Compiler
730:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" --include_path=/home/runner/ti/ti-cgt-pru_2.3.3/include --include_path=/home/runner/work/open-pru/open-pru/source --include_path=/home/runner/work/open-pru/open-pru/source/firmware/common --include_path=/home/runner/work/open-pru/open-pru/source/include --include_path=/home/runner/work/open-pru/open-pru/source/include/am62x -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little  --output_file=generated/main.obj ../../../main.c
731:  "../../../main.c", line 42: warning #112-D: statement is unreachable
732:  "../../../main.c", line 23: warning #552-D: variable "z" was set but never used
733:  Finished building: "../../../main.c"
734:  Finished building: "../../../main.c"
735:  Building target: "generated/pru_add_c_am62x-sk_pruss0_pru1_fw.out"
736:  Invoking: PRU Linker
737:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -Ooff --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/pru_add_c_am62x-sk_pruss0_pru1_fw.map --xml_link_info=generated/pru_add_c_am62x-sk_pruss0_pru1_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --stack_size=0x100 --heap_size=0x100 -i/home/runner/ti/ti-cgt-pru_2.3.3/lib -i/home/runner/ti/ti-cgt-pru_2.3.3/include --library=libc.a -o generated/pru_add_c_am62x-sk_pruss0_pru1_fw.out 
738:  Building target: "generated/empty_c_am62x-sk_pruss0_pru1_fw.out"
739:  <Linking>
740:  Invoking: PRU Linker
741:  "/home/runner/ti/ti-cgt-pru_2.3.3/bin/clpru" -v3 -O2 --display_error_number --diag_wrap=off --diag_warning=225 --asm_directory=generated --obj_directory=generated --pp_directory=generated -ppd -ppa -g --endian=little -z generated/main.obj linker.cmd -mgenerated/empty_c_am62x-sk_pruss0_pru1_fw.map --xml_link_info=generated/empty_c_am62x-sk_pruss0_pru1_fw_linkInfo.xml --display_error_number --diag_wrap=off --diag_warning=225 --diag_suppress=10063-D --warn_sections --reread_libs --ram_model --stack_size=0x100 --heap_size=0x100 -i/home/runner/ti/ti-cgt-pru_2.3.3/lib -i/home/runner/ti/ti-cgt-pru_2.3.3/include --library=libc.a -o generated/empty_c_am62x-sk_pruss0_pru1_fw.out 
742:  <Linking>
...

751:  Translating to Array format...
752:  "generated/empty_c_am62x-sk_pruss0_pru1_fw.out" .text:_c_int00* ==> .text:_c_int00*
753:  "generated/empty_c_am62x-sk_pruss0_pru1_fw.out" .text ==> .text
754:  cat /home/runner/work/open-pru/open-pru/source/firmware/pru_load_bin_copyright.h generated/empty_c_am62x-sk_pruss0_pru1_fw.h > generated/empty_c_am62x-sk_pruss0_pru1_fw.h.temp
755:  mv generated/pru_add_c_am62x-sk_pruss0_pru1_fw.h.temp generated/pru_add_c_am62x-sk_pruss0_pru1_fw.h
756:  mv generated/empty_c_am62x-sk_pruss0_pru1_fw.h.temp generated/empty_c_am62x-sk_pruss0_pru1_fw.h
757:  cp generated/empty_c_am62x-sk_pruss0_pru1_fw.h /home/runner/work/open-pru/open-pru/examples/empty_c/firmware/am62x-sk/pru1_load_bin.h
758:  cp generated/pru_add_c_am62x-sk_pruss0_pru1_fw.h /home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_code/solution/firmware/am62x-sk/pru1_load_bin.h
759:  make[5]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_code/solution/firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt'
760:  make[4]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/empty_c/firmware/am62x-sk/pruss0_pru1_fw/ti-pru-cgt'
761:  make[4]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs/c_code/solution'
762:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/academy/getting_started_labs'
763:  make[2]: Leaving directory '/home/runner/work/open-pru/open-pru/academy'
764:  make[3]: Leaving directory '/home/runner/work/open-pru/open-pru/examples/empty_c'
765:  make[2]: Leaving directory '/home/runner/work/open-pru/open-pru/examples'
766:  make[1]: *** [makefile:26: examples] Error 2
767:  make[1]: Leaving directory '/home/runner/work/open-pru/open-pru'
768:  make: *** [makefile:9: all] Error 2
769:  ##[error]Process completed with exit code 2.
770:  ##[group]Run actions/upload-artifact@v4

Comment on lines +60 to +68
LDI scratchreg0, I2S_TX_BUF_PING_ADD
LBBO &tx_ping_buffer_address, scratchreg0, 0, 4
LDI scratchreg0, I2S_PING_PONG_BUFSIZE_ADD
LBBO &tx_buf_size, scratchreg0, 0, 2
ADD tx_buffer_address_end, tx_ping_buffer_address, tx_buf_size
ZERO_TX_PING_PONG:
SBBO &ch0_data_tx, tx_ping_buffer_address, 0, 4
ADD tx_ping_buffer_address, tx_ping_buffer_address, 0x4
QBGT ZERO_TX_PING_PONG, tx_ping_buffer_address, tx_buffer_address_end
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. zero_tx_ping_pong loop compares wrong 📘 Rule violation ≡ Correctness

The buffer-clear loop branches using QBGT with operands ordered such that the loop can become
non-terminating and write past the intended end address when tx_ping_buffer_address exceeds
tx_buffer_address_end. This can cause runaway out-of-bounds stores into arbitrary memory.
Agent Prompt
## Issue description
`ZERO_TX_PING_PONG` uses a `QBGT` compare/operand ordering that can cause non-terminating looping after the pointer passes the computed end address, resulting in out-of-bounds `SBBO`.

## Issue Context
This loop is used to clear the TX ping/pong buffer after certain error conditions; the termination condition must stop at the buffer end.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[60-68]
- examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm[59-67]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +7 to +8
export OPEN_PRU_PATH?=$(abspath ../../../../../../../..)
include $(OPEN_PRU_PATH)/imports.mak
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. open_pru_path uses fixed abspath 📘 Rule violation ⚙ Maintainability

The firmware makefile sets OPEN_PRU_PATH using $(abspath ../../../../../../../..) which depends
on the invocation working directory. This can break portability when make is invoked from a
different directory.
Agent Prompt
## Issue description
The makefile computes `OPEN_PRU_PATH` relative to the invocation directory, which is not portable.

## Issue Context
The compliance requirement expects root derivation from the makefile location (for example using `$(lastword $(MAKEFILE_LIST))` and `$(dir ...)`).

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile[7-8]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +33 to +40
.if $isdefed("SOC_AM263X")
.if $isdefed("PRU0")
I2S_INSTANCE_BCLK_PIN .set 6 ; PRG0_PRU0_GPOx
I2S_INSTANCE_BCLK_PIN_POS .set 64 ; 2 << I2S_INSTANCE_BCLK_PIN

I2S_INSTANCE_FS_PIN .set 1
I2S_INSTANCE_FS_PIN_POS .set 2 ; 2 << I2S_INSTANCE_FS_PIN
.else
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. pru_i2s_interface.h missing header guard 📘 Rule violation ☼ Reliability

The assembly header is included via .include but has no four-underscore $isdefed guard, so
multiple inclusion can redefine symbols and cause build errors. This violates the required assembly
header guard pattern.
Agent Prompt
## Issue description
The assembly header `pru_i2s_interface.h` lacks the required include guard, risking symbol redefinition on multiple `.include` paths.

## Issue Context
The repository guideline requires a four-underscore `$isdefed`-based guard (for example `____pru_i2s_interface_h`).

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_interface.h[1-40]
- examples/pru_i2s/firmware/TDM4/pru_i2s_interface.h[1-40]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +960 to +1016
/* Get pointers */
pCfg = (PRUI2S_Config *)handle;
pObj = pCfg->object;
pSwipAttrs = pCfg->attrs;

/* Get number of Tx I2S */
numTxI2s = pSwipAttrs->numTxI2s;

/* Check IO buffer parameter */
for (i = 0; i < numTxI2s; i++)
{
if ((pIoBufC->ioBufLAddr[i] == NULL) ||
(pIoBufC->ioBufRAddr[i] == NULL))
{
retStatus = PRUI2S_DRV_SERR_INV_PRMS;
break;
}
}

if (retStatus == PRUI2S_DRV_SOK)
{
/* Calculate bytes per slot, number of channels, number of slots */
bytesPerSlot = pSwipAttrs->bitsPerSlot / 8;
numTxCh = 2*numTxI2s;
numSlots = pObj->prms.pingPongBufSz / (numTxCh * bytesPerSlot);

if (pSwipAttrs->bitsPerSlot == PRUI2S_BITS_PER_SLOT_16)
{
/* Interleave Left channel data */
for (i = 0; i < numTxI2s; i++)
{
pSrc16b = (int16_t *)pIoBufC->ioBufLAddr[i];
pDst16b = (int16_t *)pObj->txPingPongBuf;
pDst16b += i;

for (j = 0; j < numSlots; j++)
{
*pDst16b = *pSrc16b;
pSrc16b++;
pDst16b += numTxCh;
}
}

/* Interleave Right channel data */
for (i = 0; i < numTxI2s; i++)
{
pSrc16b = (int16_t *)pIoBufC->ioBufRAddr[i];
pDst16b = (int16_t *)pObj->txPingPongBuf;
pDst16b += numTxI2s+i;
for (j = 0; j < numSlots; j++)
{
*pDst16b = *pSrc16b;
pSrc16b++;
pDst16b += numTxCh;
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Writec breaks ping/pong 🐞 Bug ≡ Correctness

PRUI2S_writeC() always writes interleaved samples to the base of txPingPongBuf and never uses
FW_REG_TX_PING_PONG_SEL nor sets FW_REG_TX_PING_PONG_STAT. This breaks the firmware ping/pong
contract and can cause the PRU to consume the wrong half-buffer or never see the buffer as “full”.
Agent Prompt
### Issue description
`PRUI2S_writeC()` writes to `txPingPongBuf` without honoring the firmware-selected ping/pong half-buffer and without setting the FW “buffer full” status bit. This violates the same FW contract that `PRUI2S_write()` follows.

### Issue Context
The firmware exposes `FW_REG_TX_PING_PONG_SEL` and `FW_REG_TX_PING_PONG_STAT` and the interleaved write API already uses them. The conversion write API should follow the same handshake, but write interleaved output into the selected half-buffer.

### Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[942-1051]
- examples/pru_i2s/driver/pru_i2s_drv.c[756-827]

### What to change
- Read `FW_REG_TX_PING_PONG_SEL` to determine ping vs pong.
- Compute `dstBase = (uint8_t*)txPingPongBuf + (sel==PONG ? size : 0)` where `size = pingPongBufSz/2`.
- Interleave into `dstBase` (not the base of the whole ping+pong region).
- Set the corresponding bit in `FW_REG_TX_PING_PONG_STAT` (ping or pong) after the write completes.
- Add the same buffer size validation used in `PRUI2S_write()` (even/non-zero) and bounds checks for the selected half-buffer.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +1085 to +1145
/* Get pointers */
pCfg = (PRUI2S_Config *)handle;
pObj = pCfg->object;
pSwipAttrs = pCfg->attrs;

/* Get number of Rx I2S */
numRxI2s = pSwipAttrs->numRxI2s;

/* Check IO buffer parameter */
for (i = 0; i < numRxI2s; i++)
{
if ((pIoBufC->ioBufLAddr[i] == NULL) ||
(pIoBufC->ioBufRAddr[i] == NULL))
{
retStatus = PRUI2S_DRV_SERR_INV_PRMS;
break;
}
}

if (retStatus == PRUI2S_DRV_SOK)
{
/* Calculate bytes per slot, number of channels, number of slots */
bytesPerSlot = pSwipAttrs->bitsPerSlot / 8;
numRxCh = 2*numRxI2s;
numSlots = pObj->prms.pingPongBufSz / (numRxCh * bytesPerSlot);

if (pSwipAttrs->bitsPerSlot == PRUI2S_BITS_PER_SLOT_16)
{
/* Interleave Left channel data */
for (i = 0; i < numRxI2s; i++)
{
pSrc16b = (int16_t *)pObj->rxPingPongBuf;
pSrc16b += i;
pDst16b = (int16_t *)pIoBufC->ioBufLAddr[i];
for (j = 0; j < numSlots; j++)
{
*pDst16b = *pSrc16b;
pSrc16b += numRxCh;
pDst16b++;
}
}

/* Interleave Right channel data */
for (i = 0; i < numRxI2s; i++)
{
pSrc16b = (int16_t *)pObj->rxPingPongBuf;
pSrc16b += numRxI2s+i;
pDst16b = (int16_t *)pIoBufC->ioBufRAddr[i];
for (j = 0; j < numSlots; j++)
{
*pDst16b = *pSrc16b;
pSrc16b += numRxCh;
pDst16b++;
}
}
}
else if (pSwipAttrs->bitsPerSlot == PRUI2S_BITS_PER_SLOT_32)
{
/* Interleave Left channel data */
for (i = 0; i < numRxI2s; i++)
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Readc breaks ping/pong 🐞 Bug ≡ Correctness

PRUI2S_readC() always reads from the base of rxPingPongBuf and never uses FW_REG_RX_PING_PONG_SEL
nor clears FW_REG_RX_PING_PONG_STAT. This can return stale/wrong audio data and can prevent
firmware/host from advancing ping/pong ownership correctly.
Agent Prompt
### Issue description
`PRUI2S_readC()` reads from `rxPingPongBuf` without honoring the firmware-selected ping/pong half-buffer and does not clear the FW “buffer empty/full” status bit. This violates the same FW contract that `PRUI2S_read()` follows.

### Issue Context
Firmware exposes `FW_REG_RX_PING_PONG_SEL` and `FW_REG_RX_PING_PONG_STAT`. The non-conversion read API already uses these registers.

### Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[1067-1174]
- examples/pru_i2s/driver/pru_i2s_drv.c[843-905]

### What to change
- Read `FW_REG_RX_PING_PONG_SEL` and compute `srcBase = (uint8_t*)rxPingPongBuf + (sel==PONG ? size : 0)`.
- De-interleave from `srcBase` into the caller’s L/R buffers.
- Clear the corresponding bit in `FW_REG_RX_PING_PONG_STAT` (ping or pong) after the read completes.
- Add the same buffer size validation and bounds checks used by `PRUI2S_read()`/`PRUI2S_write()` to avoid out-of-range half-buffer access.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +1536 to +1573
}

/* Check Tx interrupt callback function */
if ((status == SystemP_SUCCESS) && (pPrms->i2sTxCallbackFxn == NULL))
{
status = SystemP_FAILURE;
}

/* Check Tx ping/pong buffer base address.
Tx ping/pong buffer is expected to be in ICSS SHMEM.
Note: Absolute buffer address validation is delegated to application
during PRUI2S_open() when full PRUICSS handle context is available. */
if ((status == SystemP_SUCCESS) && (pPrms->txPingPongBaseAddr == 0))
{
status = SystemP_FAILURE;
}
}

/* Check Rx I2S parameters */
if ((status == SystemP_SUCCESS) && (pSwipAttrs->numRxI2s > 0))
{
/* Check Rx interrupt priority */
if (pPrms->i2sRxIntrPri > MAX_VIM_INTR_PRI_VAL)
{
status = SystemP_FAILURE;
}

/* Check Rx interrupt callback function */
if ((status == SystemP_SUCCESS) && (pPrms->i2sRxCallbackFxn == NULL))
{
status = SystemP_FAILURE;
}

/* Check Rx ping/pong buffer base address */
if ((status == SystemP_SUCCESS) && (pPrms->rxPingPongBaseAddr == 0))
{
status = SystemP_FAILURE;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

6. Open(null) always fails 🐞 Bug ≡ Correctness

PRUI2S_open() claims NULL parameters use defaults, but the defaults set Tx/Rx callbacks to NULL and
PRUI2S_checkOpenParams() rejects NULL callbacks when Tx/Rx is enabled. As a result
PRUI2S_open(index, NULL) will fail for any Tx/Rx-capable instance.
Agent Prompt
### Issue description
`PRUI2S_open(index, NULL)` is documented to use defaults, but defaults set callbacks to NULL and the open-param validation rejects NULL callbacks when Tx/Rx is enabled. This makes the NULL/defaults path non-functional.

### Issue Context
- `PRUI2S_paramsInit()` sets callbacks to NULL.
- `PRUI2S_checkOpenParams()` requires callbacks for Tx/Rx.

### Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[343-364]
- examples/pru_i2s/driver/pru_i2s_drv.c[380-472]
- examples/pru_i2s/driver/pru_i2s_drv.c[1522-1594]

### What to change (pick one consistent design)
Option A (most common): Allow polling/no-interrupt mode
- In `PRUI2S_checkOpenParams()`, do not fail when Tx/Rx callback is NULL; instead only construct/enable interrupts when a callback is provided.
- Update docs/comments to clarify behavior.

Option B: Require explicit params
- Change `PRUI2S_open()` docstring and behavior to reject `pPrms==NULL` (or provide non-NULL default callbacks).

Also consider returning a driver-specific error code instead of generic `SystemP_FAILURE` for easier debugging.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +262 to +326
/* Used to check status and initialization */
static Bool gPruI2sDrvInit = FALSE;

/* Number of valid configurations */
static uint8_t gPruI2sDrvNumValidCfg = 0;

/* PRU I2S objects */
static PRUI2S_Object gPruI2sObject[PRU_I2S_MAX_NUM_INST];

/* PRU I2S SW IP attributes - Minimal configuration
* All INTC, GPIO, and pinmux now managed by SysConfig.
* Only essential base configuration remains here.
*/
/* NOTE: This array is initialized with default values.
* Applications must call PRUI2S_setUserConfig() to configure ICSS instance and PRU core
* before calling PRUI2S_init().
*/
static PRUI2S_SwipAttrs gPruI2sSwipAttrs[PRU_I2S_MAX_NUM_INST] =
{
/* Configuration 0 - Set by PRUI2S_setUserConfig() */
{
.baseAddr = 0, /* Set by PRUI2S_setUserConfig() based on ICSS instance */
.icssInstId = 0, /* Set by PRUI2S_setUserConfig() */
.pruInstId = PRUICSS_PRU0, /* Set by PRUI2S_setUserConfig() */
.numTxI2s = 0, /* Detected from firmware at runtime */
.numRxI2s = 0, /* Detected from firmware at runtime */
.sampFreq = 0, /* Detected from firmware at runtime */
.bitsPerSlot = 0, /* Detected from firmware at runtime */
.i2sTxHostIntNum = 0, /* Detected from firmware at runtime */
.i2sRxHostIntNum = 0, /* Detected from firmware at runtime */
.i2sErrHostIntNum = 0, /* Detected from firmware at runtime */
.i2sTxIcssIntcSysEvt = 0, /* Detected from firmware at runtime */
.i2sRxIcssIntcSysEvt = 0, /* Detected from firmware at runtime */
.i2sErrIcssIntcSysEvt = 0, /* Detected from firmware at runtime */
},
/* Configuration 1 - Set by PRUI2S_setUserConfig() */
{
.baseAddr = 0, /* Set by PRUI2S_setUserConfig() based on ICSS instance */
.icssInstId = 0, /* Set by PRUI2S_setUserConfig() */
.pruInstId = PRUICSS_PRU1, /* Set by PRUI2S_setUserConfig() */
.numTxI2s = 0, /* Detected from firmware at runtime */
.numRxI2s = 0, /* Detected from firmware at runtime */
.sampFreq = 0, /* Detected from firmware at runtime */
.bitsPerSlot = 0, /* Detected from firmware at runtime */
.i2sTxHostIntNum = 0, /* Detected from firmware at runtime */
.i2sRxHostIntNum = 0, /* Detected from firmware at runtime */
.i2sErrHostIntNum = 0, /* Detected from firmware at runtime */
.i2sTxIcssIntcSysEvt = 0, /* Detected from firmware at runtime */
.i2sRxIcssIntcSysEvt = 0, /* Detected from firmware at runtime */
.i2sErrIcssIntcSysEvt = 0, /* Detected from firmware at runtime */
}
};

/* PRU I2S configurations */
static PRUI2S_Config gPruI2sConfig[PRU_I2S_NUM_CONFIG] =
{
{
&gPruI2sObject[0],
&gPruI2sSwipAttrs[0]
},
{
&gPruI2sObject[1],
&gPruI2sSwipAttrs[1]
}
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

7. Globals defined in header 🐞 Bug ⚙ Maintainability

pru_i2s_drv.h defines mutable driver globals (objects/config/state) as static variables in the
header, so every translation unit that includes it allocates its own private copy. This wastes
memory and makes driver state management error-prone (the app will have a separate unused copy from
the driver implementation).
Agent Prompt
### Issue description
The public header `pru_i2s_drv.h` defines mutable driver state as `static` globals. Every `.c` file including this header gets its own private copy, causing memory bloat and making the driver architecture fragile.

### Issue Context
Driver state should live in a single compilation unit (typically `pru_i2s_drv.c`) with `extern` declarations (or accessor APIs) exposed via the header.

### Fix Focus Areas
- examples/pru_i2s/include/pru_i2s_drv.h[262-326]
- examples/pru_i2s/driver/pru_i2s_drv.c[1-200]

### What to change
- In `pru_i2s_drv.h`: remove the `static` definitions of driver globals/config tables; keep only type definitions and function prototypes.
- In `pru_i2s_drv.c`: add the actual definitions for these globals.
- If any of these need to be visible to other modules, declare them as `extern` in the header (preferably avoid exposing internals; provide getter APIs instead).
- Ensure only one definition exists across the build (no per-TU copies).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

- TDM functionality
- I2S functionality

Fixes: PINDSW-8487,9295

Signed-off-by: Rajul Bhambay <r-bhambay@ti.com>
@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 8ab787e to d9175ef Compare April 28, 2026 09:27
@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 28, 2026

Persistent review updated to latest commit d9175ef

Comment on lines +324 to +336
gPruIcssHandle = PRUICSS_open(CONFIG_PRU_ICSS0);
if(gPruIcssHandle == NULL)
{
DebugP_log("\r\n ERROR: PRUICSS_open failed - NULL handle returned\n");
DebugP_assert(0);
}

/* Disable PRU0 core */
status = PRUICSS_disableCore(gPruIcssHandle, pru0_id);
DebugP_assert(SystemP_SUCCESS == status);

/* Disable PRU1 core */
status = PRUICSS_disableCore(gPruIcssHandle, pru1_id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. pruicss_open() not closed 📘 Rule violation ☼ Reliability

The diagnostic app opens a PRUICSS_Handle via PRUICSS_open() but does not close it during
cleanup, risking resource leaks and inconsistent hardware state across runs. This violates the
requirement to always close/cleanup resources on all paths.
Agent Prompt
## Issue description
`PRUICSS_open()` allocates a PRUICSS handle but the app cleanup path never closes it, which can leak resources and leave PRU-ICSS in an unexpected state.

## Issue Context
The app already has a structured `cleanup:` section and closes PRUI2S instances plus `Board_driversClose()` / `Drivers_close()`, so adding PRUICSS handle closure fits the existing pattern.

## Fix Focus Areas
- examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c[324-336]
- examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c[1415-1426]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +42 to +73
main:
.if $isdefed("I2S_TX")
;err_stat = err_stat >> 1. Remove the Rx Overflow error bit.
LSR err_stat, err_stat, 1
;If there was an underflow/FrameSync Error, clearup thr Tx PingPong Buffer space
;err_stat is already initialized during normal operation.
; FS_ERROR UNDERFLOW_ERROR
; 0 0 No Error
; 0 1 Under Flow error
; 1 0 FS Error
; 1 1 Both errors
QBEQ CONTIUNE_INIT, err_stat, 0
;If set, this means underflow has happened.
;Below Initializations can be avoided but after power on, registers
;may contain random addresses and may result in accessing illegal addresses.
LDI ch0_data_tx, 0x0
LDI scratchreg0, 0x0
LDI tx_buf_size, 0x0
LDI scratchreg0, I2S_TX_BUF_PING_ADD
LBBO &tx_ping_buffer_address, scratchreg0, 0, 4
LDI scratchreg0, I2S_PING_PONG_BUFSIZE_ADD
LBBO &tx_buf_size, scratchreg0, 0, 2
ADD tx_buffer_address_end, tx_ping_buffer_address, tx_buf_size
ZERO_TX_PING_PONG:
SBBO &ch0_data_tx, tx_ping_buffer_address, 0, 4
ADD tx_ping_buffer_address, tx_ping_buffer_address, 0x4
QBGT ZERO_TX_PING_PONG, tx_ping_buffer_address, tx_buffer_address_end
.endif

CONTIUNE_INIT:
;Clear registers R0-R29. 4*30=120 bytes
ZERO &r0, 128
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. err_stat used before zero 📘 Rule violation ≡ Correctness

The firmware uses err_stat immediately on entry (shift/branch logic) before clearing/initializing
registers, which can make startup behavior nondeterministic. This violates the requirement to
clear/initialize registers at startup.
Agent Prompt
## Issue description
`err_stat` is read/modified before the firmware clears registers, so its value at cold start is undefined.

## Issue Context
Startup determinism is required; register zeroing should occur before any logic that depends on register contents.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[42-73]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +65 to +74
.if $isdefed("PRU0")
.word 0x10000 ; TX_PING_PONG_BUF_ADDR
.else
.word 0x10200 ; TX_PING_PONG_BUF_ADDR
.endif
.if $isdefed("NUMBER_OF_TX_3")
.short 264 ; PING_PONG_BUF_SZ
.else
.short 256 ; PING_PONG_BUF_SZ
.endif
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Hardcoded buffer addresses in fw_regs.asm 📘 Rule violation ⚙ Maintainability

fw_regs.asm encodes buffer addresses and sizes as numeric literals (e.g., 0x10000, 256, 264)
rather than named constants, reducing maintainability and increasing risk of boundary mistakes. This
violates the no-magic boundary numbers requirement.
Agent Prompt
## Issue description
`fw_regs.asm` uses numeric literals for buffer base addresses and sizes, making it hard to audit/change safely.

## Issue Context
Define these as named constants/macros (or include them from a single header) and use the names in `.word`/`.short` emissions.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/fw_regs.asm[65-74]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +33 to +66
; define registers
.if $isdefed("I2S_PROFILE_FW")
prux_cycle_cnt_0 .set r0
prux_cycle_cnt_1 .set r1
scratchreg_cycle_cnt .set r2
prux_cycle_cnt .set r3
cnt_buffer_address .set r4
cnt_buffer_address_1 .set r5
.endif

; Pin mask registers
.if !$isdefed("I2S_RX")
i2s_instance_fs_pin_pos .set r11
.else
i2s_instance_fs_pin_pos .set r7
i2s_instance1_sd_rx_pin_pos .set r8
i2s_instance2_sd_rx_pin_pos .set r9
.endif

.if !$isdefed("I2S_RX")
;In case of Tx only, use some of the Rx registers.
; tx_buffer_address keeps track of where we are in the audio buffer
tx_buffer_address .set r0
tx_buffer_address_end .set r1
tx_ping_buffer_address .set r2
tx_pong_buffer_address .set r3
; ch0_data_tx is 16/32 bit audio sample
ch0_data_tx .set r4
ch1_data_tx .set r5
ch2_data_tx .set r6
r30_value .set r7
r30_value_1 .set r8
r30_value_2 .set r9
.endif
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Direct register aliases in pru_i2s_regs.h 📘 Rule violation ⚙ Maintainability

The new register header maps functionality to raw PRU registers using .set/.asg aliases (e.g.,
tx_buffer_address .set r0), rather than using .struct/.sassign-based allocation. This violates
the structured register allocation requirement.
Agent Prompt
## Issue description
Register roles are allocated via direct `rN` aliases, increasing the risk of accidental overlap and making audits harder.

## Issue Context
Introduce a `.struct` describing the register layout and assign it using `.sassign`, then reference fields instead of raw `rN` aliases.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_regs.h[33-66]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +1694 to +1765
if (pSwipAttrs->numTxI2s > 0)
{
/* Write Tx ping/pong buffer address */
HW_WR_REG32(pSwipAttrs->baseAddr + FW_REG_TX_PING_PONG_BUF_ADDR, pObj->prms.txPingPongBaseAddr);
}

if (pSwipAttrs->numRxI2s > 0)
{
/* Rx buffer address passed from application is expected to be the target address
(either ICSS local address or absolute system address).
This is now application/SysConfig responsibility to provide correctly.
Firmware will use this address as-is. */
tmpRxPpBufAddr = pObj->prms.rxPingPongBaseAddr;

/* Write Rx ping/pong buffer address */
HW_WR_REG32(pSwipAttrs->baseAddr + FW_REG_RX_PING_PONG_BUF_ADDR, tmpRxPpBufAddr);
}

/* Write ping/pong buffer size */
HW_WR_REG16(pSwipAttrs->baseAddr + FW_REG_PING_PONG_BUF_SZ, pObj->prms.pingPongBufSz);

/* TBD: other FW reg init */

return SystemP_SUCCESS;
}

/* Initializes PRU I2S ping/pong buffers */
static int32_t PRUI2S_initPpBufs(
PRUI2S_Config *pCfg
)
{
PRUI2S_Object *pObj;
PRUI2S_SwipAttrs *pSwipAttrs;
const PRUICSS_HwAttrs *pPruIcssHwAttrs;
int32_t status = SystemP_SUCCESS;


/* Get pointers */
pObj = pCfg->object;
pSwipAttrs = pCfg->attrs;


if (pSwipAttrs->numTxI2s > 0)
{
/* Get PRUICSS hardware attributes from the handle */
pPruIcssHwAttrs = (PRUICSS_HwAttrs *)(pObj->pruIcssHandle->hwAttrs);

if (pPruIcssHwAttrs != NULL)
{
uint32_t pruDramBase = 0;


/* Get PRU-specific DRAM base address from hardware attributes - device/instance agnostic */
/* The PRUICSS handle provides the actual DRAM mapping for any PRU on any device */
if (pSwipAttrs->pruInstId == PRUICSS_PRU0)
{
pruDramBase = (uint32_t)pPruIcssHwAttrs->pru0DramBase;
}
else if (pSwipAttrs->pruInstId == PRUICSS_PRU1)
{
pruDramBase = (uint32_t)pPruIcssHwAttrs->pru1DramBase;
}
else
{
status = SystemP_FAILURE;
}

if ((status == SystemP_SUCCESS) && (pruDramBase != 0))
{
/* Calculate Tx buffer address using PRU DRAM base + application offset */
pObj->txPingPongBuf = (void *)(pruDramBase + pObj->prms.txPingPongBaseAddr);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Tx buffer address mismatch 🐞 Bug ≡ Correctness

The API/documentation treats PRUI2S_Params.txPingPongBaseAddr as an absolute CPU address (example
casts a pointer), but the driver computes the CPU pointer as (pruDramBase + txPingPongBaseAddr)
while firmware is programmed with the raw txPingPongBaseAddr. This inconsistency can make firmware
and CPU access different memory regions and break TX data transfer.
Agent Prompt
### Issue description
`txPingPongBaseAddr` has inconsistent semantics between the public API docs, the CPU-side pointer calculation, and the firmware register programming. This can cause the firmware and CPU to use different addresses for the same ping/pong buffer.

### Issue Context
- Header example sets `txPingPongBaseAddr = (uint32_t)txBuffer` (looks like absolute address).
- Driver computes CPU pointer as `pruDramBase + txPingPongBaseAddr` (treats as offset).
- Driver programs firmware with raw `txPingPongBaseAddr`.

### Fix Focus Areas
- examples/pru_i2s/include/pru_i2s_drv.h[164-180]
- examples/pru_i2s/driver/pru_i2s_drv.c[1694-1714]
- examples/pru_i2s/driver/pru_i2s_drv.c[1720-1765]

### What to change
Choose ONE consistent contract and apply it everywhere:
- **Option A (recommended if FW expects PRU-local offsets):**
  - Rename/comment `txPingPongBaseAddr` to `txPingPongBaseOffset`
  - Update header example to pass an offset within PRU DRAM
  - Keep `pObj->txPingPongBuf = pruDramBase + offset` and write the same offset to firmware (if FW interprets it as PRU-local)
  - Add range validation that offset+size fits PRU DRAM

- **Option B (absolute address contract):**
  - Treat `txPingPongBaseAddr` as absolute CPU/SoC address
  - Set `pObj->txPingPongBuf = AddrTranslateP_getLocalAddr(txPingPongBaseAddr)` (or equivalent)
  - Program firmware with the address format it actually uses (may require translating to PRU-view address)

Also update PRUI2S_checkOpenParams() to validate the chosen contract (alignment, range, even size).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread .metadata/product.json
Comment on lines 6 to 12
"includePaths": [
"../source",
"C:/ti/mcu_plus_sdk/source/sysconfig",
],
"components": [

"/open_pru",
],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

6. Hardcoded sdk include path 🐞 Bug ☼ Reliability

.metadata/product.json adds a Windows-specific absolute include path (C:/ti/...), which will break
builds on non-Windows hosts and in CI environments where that path does not exist. This is a
portability/build blocker for the repo.
Agent Prompt
### Issue description
A Windows-only absolute include path was added to `.metadata/product.json`, breaking portability and CI.

### Issue Context
`includePaths` contains `C:/ti/mcu_plus_sdk/source/sysconfig`.

### Fix Focus Areas
- .metadata/product.json[5-12]

### What to change
- Remove the absolute path.
- Replace with a repo-relative path (if the headers are in-repo), or use a variable-based mechanism supported by the build system (e.g., environment variable or a path relative to an SDK import root already defined in `imports.mak`).
- Ensure includePaths remains valid on Linux/macOS and Windows without local customization.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 29, 2026

Persistent review updated to latest commit 248af3d

Comment on lines +109 to +154
.if $isdefed("I2S_TX")
;read the Tx buffer address provided by host. This should be in Shared memory
; point to the PING audio buffer
LDI scratchreg0, I2S_TX_BUF_PING_ADD
LBBO &tx_buffer_address, scratchreg0, 0, 4
MOV tx_ping_buffer_address, tx_buffer_address
.endif

;read the buffer size provided by host. buffer size is ping+pong
LDI scratchreg0, I2S_PING_PONG_BUFSIZE_ADD
LBBO &tx_buf_size, scratchreg0, 0, 2
;Shift right by 1 to get PING/PONG size buffer size
LSR tx_buf_size, tx_buf_size, 1
.if $isdefed("I2S_RX")
MOV rx_buf_size, tx_buf_size
;Rx buffer size is one less than PING/PONG buffer size
SUB rx_buf_size, rx_buf_size, 1

;read the Rx buffer address provided by host
LDI scratchreg0, I2S_RX_BUF_PING_ADD
LBBO &rx_buffer_address, scratchreg0, 0, 4
MOV rx_ping_buffer_address, rx_buffer_address
LDI rx_sd_counter, I2S_SAMPLES_PER_CHANNEL
.endif

;Initialize the end address of the Tx/Rx buffers
.if $isdefed("I2S_TX")
ADD tx_buffer_address_end, tx_buffer_address, tx_buf_size
.endif
.if $isdefed("I2S_RX")
ADD rx_buffer_address_end, rx_buffer_address, rx_buf_size
.endif

;Initialize the PONG buffer addresses
.if $isdefed("I2S_TX")
MOV tx_pong_buffer_address, tx_buffer_address_end
.endif
.if $isdefed("I2S_RX")
MOV rx_pong_buffer_address, rx_buffer_address_end
ADD rx_pong_buffer_address, rx_pong_buffer_address, 1
.endif

.if $isdefed("I2S_TX")
;Read the first 8/12 bytes from Ping buffer
LBBO &ch0_data_tx, tx_buffer_address, 0, BYTES_TO_LOAD
ADD tx_buffer_address, tx_buffer_address, BYTES_TO_LOAD
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. tx_buffer_address lacks bounds checks 📘 Rule violation ⛨ Security

The PRU firmware reads host-provided buffer address/size values and immediately uses them for LBBO
and end-address arithmetic without validating the range or checking for overflow. This can cause
out-of-bounds reads/writes or unintended memory access if the host provides invalid values or if
address + size wraps.
Agent Prompt
## Issue description
The PRU firmware uses host-provided buffer addresses/sizes for `LBBO` and end-address calculations without validating the range or checking for `address + size` overflow.

## Issue Context
Compliance requires bounds checks for computed memory accesses in PRU assembly to prevent out-of-bounds access and memory corruption.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[109-156]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +303 to +305
* Get PRUI2S SW IP attributes for use in application, e.g.
* - # Tx I2S
* - # Rx I2S
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. e.g./i.e. in comments 📘 Rule violation ⚙ Maintainability

New documentation/comments use e.g. and i.e. instead of the approved phrases. This reduces
documentation consistency and violates the required wording standard.
Agent Prompt
## Issue description
Comments/documentation introduce disallowed abbreviations `e.g.` and `i.e.`.

## Issue Context
Compliance requires using spelled-out equivalents: use `for example` instead of `e.g.`, and `that is` instead of `i.e.`.

## Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[303-305]
- examples/pru_i2s/driver/pru_i2s_drv.c[743-746]
- examples/pru_i2s/include/pru_i2s_drv.h[409-416]
- examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c[96-100]
- examples/pru_i2s/README.md[375-395]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +35 to +41
.sect ".text:main"
.clink
.global main

.include "pru_i2s_interface.h"
.include "pru_i2s_regs.h"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Tabs in pru assembly 📘 Rule violation ⚙ Maintainability

The added PRU assembly uses tab characters for indentation/alignment instead of the required
whitespace rules. This can create inconsistent formatting across environments and violates the
indentation/whitespace standard.
Agent Prompt
## Issue description
PRU assembly uses tab characters for indentation/alignment.

## Issue Context
Compliance requires 4-space indentation and disallows tabs in assembly sources.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[35-41]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +1 to +4
;
; Copyright (C) 2024-2025 Texas Instruments Incorporated
;
; Redistribution and use in source and binary forms, with or without
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Assembly header missing filename 📘 Rule violation ⚙ Maintainability

The new PRU assembly sources include TI copyright text but do not include the required file name in
the source header. This violates the required source header format for attribution and
identification.
Agent Prompt
## Issue description
PRU assembly sources are missing the file name in the header comment block.

## Issue Context
Compliance requires each source/header file header to include the file name and TI attribution.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru_i2s_main.asm[1-4]
- examples/pru_i2s/firmware/TDM4/pru_i2s_main.asm[1-4]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

$(OBJDIR)/%.obj %.obj: %.asm
@echo 'Building file: "$^"'
@echo 'Invoking: PRU Compiler'
"$(CGT_TI_PRU_PATH)/bin/clpru" -DPRU0 -DSLICE0 -v4 --define=SOC_AM263X --define=PRU0 --define=I2S_TX --define=NUMBER_OF_TX_3 --define=I2S_TX_DETECT_UNDERFLOW --include_path="${CG_TOOL_ROOT}/include" --include_path="${MCU_PLUS_SDK_PATH}/source" --include_path="${OPEN_PRU_PATH}/source" --include_path="${OPEN_PRU_PATH}/examples/pru_i2s/firmware/include" --include_path="${OPEN_PRU_PATH}/examples/pru_i2s/firmware/I2S" --define=_DEBUG_=1 -g --diag_warning=225 --diag_wrap=off --display_error_number --endian=little --preproc_with_compile --preproc_dependency="$(basename $(<F)).d_raw" $^
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. clpru line exceeds 129 📘 Rule violation ⚙ Maintainability

A new makefile line containing the clpru invocation exceeds the hard 129-character column limit.
This reduces readability and violates the repository’s source column-limit standard.
Agent Prompt
## Issue description
A makefile command line exceeds the 129-character hard limit.

## Issue Context
Compliance requires non-markdown/non-text source files to stay within a hard maximum of 129 characters per line.

## Fix Focus Areas
- examples/pru_i2s/firmware/I2S/pru0_tx/am263x-cc/icssm0-pru0_fw/ti-pru-cgt/makefile[63-63]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +476 to +519
/* Construct interrupts */
if (pObj->prms.i2sTxCallbackFxn != NULL)
{
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = pSwipAttrs->i2sTxHostIntNum;
hwiPrms.callback = pObj->prms.i2sTxCallbackFxn;
hwiPrms.priority = pObj->prms.i2sTxIntrPri;
hwiPrms.args = (void *)pCfg;
status = HwiP_construct(&pObj->i2sTxHwiObj, &hwiPrms);
if (status == SystemP_SUCCESS)
{
pObj->i2sTxHwiHandle = &pObj->i2sTxHwiObj;
}
}
else
{
}

if (status == SystemP_SUCCESS && pObj->prms.i2sRxCallbackFxn != NULL)
{
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = pSwipAttrs->i2sRxHostIntNum;
hwiPrms.callback = pObj->prms.i2sRxCallbackFxn;
hwiPrms.priority = pObj->prms.i2sRxIntrPri;
hwiPrms.args = (void *)pCfg;
status = HwiP_construct(&pObj->i2sRxHwiObj, &hwiPrms);
if (status == SystemP_SUCCESS)
{
pObj->i2sRxHwiHandle = &pObj->i2sRxHwiObj;
}
}
else if (status == SystemP_SUCCESS)
{
}

if (status == SystemP_SUCCESS && pObj->prms.i2sErrCallbackFxn != NULL)
{
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = pSwipAttrs->i2sErrHostIntNum;
hwiPrms.callback = pObj->prms.i2sErrCallbackFxn;
hwiPrms.priority = pObj->prms.i2sErrIntrPri;
hwiPrms.args = (void *)pCfg;
status = HwiP_construct(&pObj->i2sErrHwiObj, &hwiPrms);
if (status == SystemP_SUCCESS)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

6. Host irq numbers unset 🐞 Bug ≡ Correctness

PRUI2S_open() constructs HwiP interrupts using pSwipAttrs->i2s*HostIntNum, but these fields are
never populated (remain 0 from the header defaults), so callbacks won't run on the intended PRU
events. This breaks Tx/Rx/error interrupt handling and any semaphore-driven streaming loops.
Agent Prompt
### Issue description
`PRUI2S_open()` constructs HwiP interrupts with `pSwipAttrs->i2sTxHostIntNum/i2sRxHostIntNum/i2sErrHostIntNum`, but these values are never initialized and default to `0`, so interrupts are bound to the wrong CPU interrupt.

### Issue Context
- Firmware image parsing populates **system event numbers**, not CPU/VIM interrupt numbers.
- The driver must either (a) be provided host interrupt numbers from SysConfig/board config, or (b) derive them from the INTC init configuration.

### Fix Focus Areas
- examples/pru_i2s/driver/pru_i2s_drv.c[474-522]
- examples/pru_i2s/driver/pru_i2s_drv.c[1399-1442]
- examples/pru_i2s/include/pru_i2s_drv.h[227-326]

### Suggested fix
- Add explicit configuration for host interrupt numbers (e.g., in `PRUI2S_Params`, or via a new `PRUI2S_setHostIntNums()` API) and validate them in `PRUI2S_checkOpenParams()`.
- Ensure the driver’s *single* SwipAttrs instance is updated before `HwiP_construct()`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

- Build fix

Fixes: PINDSW-8487,9295

Signed-off-by: Rajul Bhambay <r-bhambay@ti.com>
@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 248af3d to 2dd5549 Compare April 29, 2026 07:13
- Build fix

Fixes: PINDSW-8487,9295

Signed-off-by: Rajul Bhambay <r-bhambay@ti.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants