Skip to content

pru_i2s: move driver to source/i2s and build firmware with pru_rules.mak - #186

Open
a1248924 wants to merge 10 commits into
mainfrom
a0497643_PINDSW-8487_PRU_I2S
Open

a1248924 wants to merge 10 commits into
mainfrom
a0497643_PINDSW-8487_PRU_I2S

Conversation

@a1248924

@a1248924 a1248924 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator
  • Move driver (pru_i2s_drv.c/h, pru_i2s_config.h) to source/i2s/ and add source/i2s/makefile with all/clean targets
  • Rewrite 8 per-core firmware makefiles to use pru_rules.mak (PRU_VERSION=3, outputs in ti-pru-cgt/generated/)
  • Update example.projectspec files: -v4 -> -v3
  • Update README to reflect new directory structure and build flow
  • libs is an independent makefile and has to be built before building the example app
  • libs output are generated in the example directory

Signed-off by Ayushman a-ayushman@ti.com

@qodo-code-review

qodo-code-review Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Separate PRU I2S driver library and standardize firmware builds

🐞 Bug fix ✨ Enhancement ⚙️ Configuration changes 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Move the I2S driver into source/i2s and build its library separately from the application.
• Build board-specific firmware arrays through shared PRU rules before compiling the host
 application.
• Align CCS projects, CI, and documentation with the new paths and build order.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 0 capabilities

  • Fault-specific containment limits risk to the originating changed behavior.
Behavioral complexity 🟡 Medium 🧩 Interacting branches, Compatibility cases

  • Before, the application makefiles could invoke the parent library build; after, library production is a separate target and root/CI must establish it before host linking.
  • New correctness conditions are target ordering, matching PROFILE names, device-specific output names, and fresh-clone versus incremental-build behavior.
  • The compiler and archive operations themselves are established mechanisms.
Sources

makefile[8-12]

all:
	$(MAKE) -C source
	$(MAKE) libs
	$(MAKE) pru
	$(MAKE) host
Potential damage 🟡 Medium 🩹 Temporary loss

  • Conservative damage bound for the originating changed behavior; downstream capabilities remain contained.
  • If the library target, output directory, profile, or build ordering is wrong, the affected PRU I2S application cannot link.
  • Reverting restores the former implicit build path; no persistent runtime state or external effect requires repair.
  • Code rollback or rerunning the corrected build restores the capability; the source does not establish automatic repair beyond rerunning make.
Sources

makefile[8-12]

all:
	$(MAKE) -C source
	$(MAKE) libs
	$(MAKE) pru
	$(MAKE) host
Assessed commit e4150c4
Diagram

graph TD
  Root["Repository make"] --> LibBuild["Library build"] --> Library[("Driver library")] --> App["R5F application"]
  Root --> Firmware["PRU firmware"] --> Headers[("Board arrays")] --> App
  CCS["CCS CI"] --> LibBuild
  CCS --> Firmware
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Build the library implicitly with each host project
  • ➕ Avoids a separate make libs step for local application builds.
  • ➖ Reintroduces hidden build work in CCS and host builds.
  • ➖ Makes library ownership and parallel-build ordering less explicit.
2. Use one parameterized firmware makefile
  • ➕ Reduces repeated settings across the eight firmware variants.
  • ➖ Requires additional dispatch logic for distinct CCS projects and output names.
  • ➖ Broadens this migration beyond adopting the existing shared PRU rules.

Recommendation: Keep the explicit, project-owned library target and reuse pru_rules.mak: they establish clear build boundaries without changing CCS project structure. Verify fresh and parallel builds for both boards, particularly generated-header locations and the documented silicon-version setting; the diff currently specifies -v3.

Files changed (52) +672 / -209

Enhancement (1) +87 / -0
makefileBuild device-specific I2S driver archives +87/-0

Build device-specific I2S driver archives

• Adds debug/release ARM builds for AM261x and AM263x, configurable output placement, and a separate clean target. The archive contains the driver, leaving application configuration in the example.

source/i2s/makefile

Bug fix (4) +67 / -105
makefileSeparate library targets and order firmware before host +42/-89

Separate library targets and order firmware before host

• Dispatches library builds to source/i2s, keeps clean separate from libs-clean, and sequences firmware before the R5F build even under parallel make. Updates firmware paths and guards build targets with the project eligibility check.

examples/pru_i2s/makefile

makefileRequire a prebuilt AM261x driver library +12/-8

Require a prebuilt AM261x driver library

• Uses relocated include paths, replaces implicit library building with a missing-library error, and tolerates generated-header dependency entries.

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

makefileRequire a prebuilt AM263x driver library +12/-8

Require a prebuilt AM263x driver library

• Uses relocated include paths, replaces implicit library building with a missing-library error, and tolerates generated-header dependency entries.

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

pru_rules.makCreate firmware-array destination directories +1/-0

Create firmware-array destination directories

• Creates the configured MCU+ header destination directory before copying generated firmware arrays.

pru_rules.mak

Refactor (23) +6 / -16
fw_regs.asmRelocate I2S firmware register definitions +0/-0

Relocate I2S firmware register definitions

• Moves the assembly register definitions into the lowercase i2s firmware directory without a shown content change.

examples/pru_i2s/firmware/i2s/fw_regs.asm

linker.cmdRelocate I2S linker script +0/-0

Relocate I2S linker script

• Moves the linker script with the I2S firmware sources without a shown content change.

examples/pru_i2s/firmware/i2s/linker.cmd

makefile_projectspecRelocate AM261x I2S TX CCS build wrapper +0/-0

Relocate AM261x I2S TX CCS build wrapper

• Moves the CCS project make wrapper under the lowercase i2s path without a shown content change.

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

makefile_projectspecRelocate AM263x I2S TX CCS build wrapper +0/-0

Relocate AM263x I2S TX CCS build wrapper

• Moves the CCS project make wrapper under the lowercase i2s path without a shown content change.

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

makefile_projectspecRelocate AM261x I2S RX CCS build wrapper +0/-0

Relocate AM261x I2S RX CCS build wrapper

• Moves the CCS project make wrapper under the lowercase i2s path without a shown content change.

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

makefile_projectspecRelocate AM263x I2S RX CCS build wrapper +0/-0

Relocate AM263x I2S RX CCS build wrapper

• Moves the CCS project make wrapper under the lowercase i2s path without a shown content change.

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

pru_i2s_interface.hRelocate I2S firmware interface +0/-0

Relocate I2S firmware interface

• Moves the I2S firmware interface header into the lowercase protocol directory without a shown content change.

examples/pru_i2s/firmware/i2s/pru_i2s_interface.h

pru_i2s_main.asmRelocate I2S firmware assembly +0/-0

Relocate I2S firmware assembly

• Moves the I2S firmware assembly into the lowercase protocol directory without a shown content change.

examples/pru_i2s/firmware/i2s/pru_i2s_main.asm

pru_i2s_regs.hRelocate I2S firmware register header +0/-0

Relocate I2S firmware register header

• Moves the firmware register header alongside the I2S assembly without a shown content change.

examples/pru_i2s/firmware/i2s/pru_i2s_regs.h

fw_regs.asmRelocate TDM4 firmware register definitions +0/-0

Relocate TDM4 firmware register definitions

• Moves the assembly register definitions into the lowercase tdm4 firmware directory without a shown content change.

examples/pru_i2s/firmware/tdm4/fw_regs.asm

linker.cmdRelocate TDM4 linker script +0/-0

Relocate TDM4 linker script

• Moves the linker script with the TDM4 firmware sources without a shown content change.

examples/pru_i2s/firmware/tdm4/linker.cmd

makefile_projectspecRelocate AM261x TDM4 TX CCS build wrapper +0/-0

Relocate AM261x TDM4 TX CCS build wrapper

• Moves the CCS project make wrapper under the lowercase tdm4 path without a shown content change.

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

makefile_projectspecRelocate AM263x TDM4 TX CCS build wrapper +0/-0

Relocate AM263x TDM4 TX CCS build wrapper

• Moves the CCS project make wrapper under the lowercase tdm4 path without a shown content change.

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

makefile_projectspecRelocate AM261x TDM4 RX CCS build wrapper +0/-0

Relocate AM261x TDM4 RX CCS build wrapper

• Moves the CCS project make wrapper under the lowercase tdm4 path without a shown content change.

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

makefile_projectspecRelocate AM263x TDM4 RX CCS build wrapper +0/-0

Relocate AM263x TDM4 RX CCS build wrapper

• Moves the CCS project make wrapper under the lowercase tdm4 path without a shown content change.

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

pru_i2s_interface.hRelocate TDM4 firmware interface +0/-0

Relocate TDM4 firmware interface

• Moves the TDM4 firmware interface header into the lowercase protocol directory without a shown content change.

examples/pru_i2s/firmware/tdm4/pru_i2s_interface.h

pru_i2s_main.asmRelocate TDM4 firmware assembly +0/-0

Relocate TDM4 firmware assembly

• Moves the TDM4 firmware assembly into the lowercase protocol directory without a shown content change.

examples/pru_i2s/firmware/tdm4/pru_i2s_main.asm

pru_i2s_regs.hRelocate TDM4 firmware register header +0/-0

Relocate TDM4 firmware register header

• Moves the firmware register header alongside the TDM4 assembly without a shown content change.

examples/pru_i2s/firmware/tdm4/pru_i2s_regs.h

pru_i2s_diagnostic.cInclude board-selected firmware arrays +4/-4

Include board-selected firmware arrays

• Removes protocol-directory prefixes from four firmware-array includes so board-specific include paths select the generated headers.

examples/pru_i2s/pru_i2s_app/pru_i2s_diagnostic.c

icss_pru_i2s_fw.hCentralize the shared firmware register map +0/-0

Centralize the shared firmware register map

• Moves the C register-map header to source/i2s for use by both the driver and firmware projects without a shown content change.

source/i2s/icss_pru_i2s_fw.h

pru_i2s_config.hRelocate I2S driver configuration +0/-0

Relocate I2S driver configuration

• Moves the driver configuration header into source/i2s without a shown content change.

source/i2s/pru_i2s_config.h

pru_i2s_drv.cUse the relocated firmware register header +1/-1

Use the relocated firmware register header

• Moves the driver implementation into source/i2s and replaces its former firmware-tree include with the colocated register header.

source/i2s/pru_i2s_drv.c

pru_i2s_drv.hKeep the public driver header independent of app configuration +1/-11

Keep the public driver header independent of app configuration

• Moves the public header into source/i2s, uses the colocated firmware register map, and removes the application-owned PRUI2S_applyAppConfig declaration.

source/i2s/pru_i2s_drv.h

Documentation (3) +72 / -34
README.mdDocument project-owned library targets +6/-0

Document project-owned library targets

• Explains when project libraries are built, how to rebuild them after source changes, and why libs-clean is separate from clean.

README.md

README.mdDescribe the relocated driver and build workflow +61/-34

Describe the relocated driver and build workflow

• Updates the directory map, board-specific firmware outputs, separate library build instructions, CCS build order, and driver responsibilities.

examples/pru_i2s/README.md

pru_i2s_app_config.cClarify application configuration behavior +5/-0

Clarify application configuration behavior

• Adds pseudocode describing how configuration entries are applied and errors returned; executable behavior is unchanged.

examples/pru_i2s/pru_i2s_app/pru_i2s_app_config.c

Other (21) +440 / -54
ccs_build.ymlBuild project libraries before CCS projects +19/-0

Build project libraries before CCS projects

• Adds a device-aware make libs step when an MCU+ SDK is available, supplying the SDK and ARM compiler paths before CCS builds.

.github/workflows/ccs_build.yml

makefileDispatch library targets to eligible examples +17/-1

Dispatch library targets to eligible examples

• Adds libs and libs-clean dispatch for pru_i2s without invoking those targets for other examples.

examples/makefile

example.projectspecRedirect AM261x I2S TX CCS project +5/-5

Redirect AM261x I2S TX CCS project

• Updates include and shared-header paths, selects -v3, and generates the array inside the CCS project.

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

makefileUse shared rules for AM261x I2S TX firmware +42/-0

Use shared rules for AM261x I2S TX firmware

• Configures pru_rules.mak with PRU0 TX defines and an AM261x-specific array-header destination.

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

example.projectspecRedirect AM263x I2S TX CCS project +5/-5

Redirect AM263x I2S TX CCS project

• Updates include and shared-header paths, selects -v3, and generates the array inside the CCS project.

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

makefileUse shared rules for AM263x I2S TX firmware +41/-0

Use shared rules for AM263x I2S TX firmware

• Configures pru_rules.mak with PRU0 TX defines and an AM263x-specific array-header destination.

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

example.projectspecRedirect AM261x I2S RX CCS project +5/-5

Redirect AM261x I2S RX CCS project

• Updates include and shared-header paths, selects -v3, and generates the PRU1 array inside the CCS project.

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

makefileUse shared rules for AM261x I2S RX firmware +40/-0

Use shared rules for AM261x I2S RX firmware

• Configures pru_rules.mak with PRU1 RX defines and an AM261x-specific array-header destination.

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

example.projectspecRedirect AM263x I2S RX CCS project +5/-5

Redirect AM263x I2S RX CCS project

• Updates include and shared-header paths, selects -v3, and generates the PRU1 array inside the CCS project.

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

makefileUse shared rules for AM263x I2S RX firmware +40/-0

Use shared rules for AM263x I2S RX firmware

• Configures pru_rules.mak with PRU1 RX defines and an AM263x-specific array-header destination.

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

example.projectspecRedirect AM261x TDM4 TX CCS project +5/-5

Redirect AM261x TDM4 TX CCS project

• Updates include and shared-header paths, selects -v3, and generates the TDM4 PRU0 array inside the CCS project.

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

makefileUse shared rules for AM261x TDM4 TX firmware +41/-0

Use shared rules for AM261x TDM4 TX firmware

• Configures pru_rules.mak with PRU0 TX defines and an AM261x-specific TDM4 array destination.

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

example.projectspecRedirect AM263x TDM4 TX CCS project +5/-5

Redirect AM263x TDM4 TX CCS project

• Updates include and shared-header paths, selects -v3, and generates the TDM4 PRU0 array inside the CCS project.

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

makefileUse shared rules for AM263x TDM4 TX firmware +41/-0

Use shared rules for AM263x TDM4 TX firmware

• Configures pru_rules.mak with PRU0 TX defines and an AM263x-specific TDM4 array destination.

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

example.projectspecRedirect AM261x TDM4 RX CCS project +5/-5

Redirect AM261x TDM4 RX CCS project

• Updates include and shared-header paths, selects -v3, and generates the TDM4 PRU1 array inside the CCS project.

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

makefileUse shared rules for AM261x TDM4 RX firmware +40/-0

Use shared rules for AM261x TDM4 RX firmware

• Configures pru_rules.mak with PRU1 RX defines and an AM261x-specific TDM4 array destination.

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

example.projectspecRedirect AM263x TDM4 RX CCS project +5/-5

Redirect AM263x TDM4 RX CCS project

• Updates include and shared-header paths, selects -v3, and generates the TDM4 PRU1 array inside the CCS project.

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

makefileUse shared rules for AM263x TDM4 RX firmware +40/-0

Use shared rules for AM263x TDM4 RX firmware

• Configures pru_rules.mak with PRU1 RX defines and an AM263x-specific TDM4 array destination.

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

example.projectspecLink the external AM261x driver library in CCS +8/-6

Link the external AM261x driver library in CCS

• Uses relocated driver and board-array include paths, removes implicit library prebuild, and copies application configuration into the CCS project.

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

example.projectspecLink the external AM263x driver library in CCS +8/-3

Link the external AM263x driver library in CCS

• Uses relocated driver and board-array include paths, removes implicit library prebuild, and copies application configuration into the CCS project.

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

makefileBuild project libraries before firmware and host +23/-4

Build project libraries before firmware and host

• Adds repository-level libs and libs-clean targets, runs libs before PRU and host builds, and documents their separate cleanup behavior.

makefile

@qodo-code-review

qodo-code-review Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Code Review by Qodo


View medium (2)
Remediation recommended
1. Header directory creation errors ignored 📘
Description
The new -$(MKDIR) $(dir $(MCU_HEX_PATH)) line in post-build prefixes the command with -, so
make ignores its exit status and continues. The following -$(COPY) step is also ignored, so if
directory creation fails, the array header is never written to MCU_HEX_PATH and the build still
reports success.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
In `pru_rules.mak`, the post-build step creates the destination directory for the array header with `-$(MKDIR)`, and copies the header with `-$(COPY)`. The leading `-` makes make ignore failures, so a failed directory creation or copy leaves the firmware header missing while the build succeeds.

## Fix Focus Areas
- pru_rules.mak[163-169]

## Recommended Fix
Remove the leading `-` from the `$(MKDIR)` line so a failure stops the build. For the `$(COPY)` line, keep the ignore only if a missing header is acceptable, and otherwise remove the `-` there too. Verify by running a firmware build with the target directory missing and confirming the build reports an error.

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

Dismiss ↗ | View ↗

2. Source builds omit the I2S driver 🐞
Description
source/i2s/makefile defines the new library’s all target, but source/makefile still recurses
only into rpmsg. Running the repository’s source-library build therefore never produces an I2S
archive, even though the example build produces one through a separate call.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new I2S library is built by the example makefile but omitted from the repository-level source build.

## Fix Focus Areas
- source/makefile[3-16]
- source/i2s/makefile[45-50]

## Recommended Fix
Add the I2S subdirectory to the source build's recursion, preserving the existing dependency and device-selection behavior.

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

Dismiss ↗ | View ↗


View low (1)
Informational
3. Studio-built firmware headers lose their license text 🐞
Description
The rewritten postBuildStep in all eight firmware example.projectspec files runs only `hexpru -o
../<name>_array.h and no longer prepends source/firmware/pru_load_bin_copyright.h`. As a result,
headers built in Studio have no copyright or license header, while the same headers built through
pru_rules.mak post-build still get one.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Headers generated by the Studio post-build step no longer include the TI copyright/license header, unlike the make-built ones.

## Fix Focus Areas
- examples/pru_i2s/firmware/i2s/pru0_tx/am261x-lp/icssm0-pru0_fw/ti-pru-cgt/example.projectspec[55-57]

## Recommended Fix
In all eight firmware projectspecs, have hexpru write to a temporary file, then concatenate `${OPEN_PRU_PATH}/source/firmware/pru_load_bin_copyright.h` with it into `../<name>_array.h`. Use a portable command, for example the CCS-shipped cat on win32 as the original steps did. Alternatively, document that Studio-built headers are not meant for redistribution.

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

Dismiss ↗ | View ↗


Comment thread source/i2s/makefile Resolved
Comment thread examples/pru_i2s/makefile Resolved
Comment thread source/i2s/makefile Resolved
Comment thread source/i2s/makefile Resolved
Comment thread examples/pru_i2s/makefile Resolved
Comment thread source/i2s/makefile Resolved
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 929475c to ba6662c Compare October 26, 2026 09:47
@a1248924 a1248924 mentioned this pull request Oct 26, 2026
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from ba6662c to 8d57a17 Compare October 26, 2026 10:08
Comment thread source/i2s/makefile Resolved
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 8d57a17 to 9e5d826 Compare October 26, 2026 11:17
Comment thread source/i2s/pru_i2s_app_config.c Resolved
Comment thread source/i2s/makefile Resolved
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 2 times, most recently from de67ca4 to 25b3ade Compare October 26, 2026 12:40
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 25b3ade to b178148 Compare October 26, 2026 17:36
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from b178148 to 26cdfea Compare October 26, 2026 17:57
Comment thread source/i2s/pru_i2s_app_config.c Resolved
Comment thread examples/pru_i2s/README.md Resolved
Comment thread examples/pru_i2s/makefile Resolved
Comment thread examples/pru_i2s/README.md Resolved
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 3 times, most recently from 03abdf5 to 086e0fc Compare October 26, 2026 19:57
Comment thread source/i2s/makefile Resolved
Comment thread source/i2s/makefile Resolved
Comment thread examples/pru_i2s/README.md Resolved

@pratheesh pratheesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes on 44ca8db8. The move and the firmware makefiles work, and make all builds for am261x, but one build order bug remains and the description and README don't match the tree.

Please fix before merge

1. make -j8 host fails on a fresh tree. It stops at pru_i2s_diagnostic.c:163 with fatal error: 'pru_i2s_tdm4_pru1_array.h' not found. makefile:77 and makefile:80 make pru and $(DEVICE_NON_PRU) unordered prerequisites of host, so under -j the app can compile before the firmware headers exist. Serial make host and make -j8 all pass. This is the dependency that was marked as fixed in the earlier thread. Having the host recipe call $(MAKE) pru first, then build the host code, would fix it.

2. -v4 and -v3 still disagree. All 8 firmware example.projectspec files still say -v4, while all 8 makefiles set PRU_VERSION := 3. The PR description says "-v4 -> -v3" and README line 226 says -v3. -v3 is the right value for ICSSM: pru_rules.mak documents 3 as PRU-ICSS, and examples/empty uses it for am261x and am263x. The four am263x firmware images came out byte-identical with either flag, so this is an inconsistency and not a firmware bug, but please make the projectspecs -v3. This is also dhavaljk's open question.

3. README doesn't match the tree.

  • Lines 172 and 222 say the array headers go to firmware/i2s/generated/ and firmware/tdm4/generated/, gitignored. Those directories don't exist. The headers land in firmware/i2s/ and firmware/tdm4/, untracked and not ignored, so they can be committed by accident.
  • Line 209 calls make "Build only firmware", but it builds firmware, library and app.

Should fix

4. source/i2s depends on the example. source/i2s/makefile:38-39 adds examples/pru_i2s/firmware and examples to the include path, line 45 writes the library to examples/pru_i2s/lib, and pru_i2s_drv.c:39 includes <pru_i2s/firmware/tdm4/icss_pru_i2s_fw.h>. That leaves the library unusable without this example.

5. Dead pru_i2s_app_config copies. source/i2s/ now has near-identical copies of pru_i2s_app/pru_i2s_app_config.c and .h. The app makefile no longer compiles its own copy, so the files in pru_i2s_app/ are dead. Please delete them, or keep the config in the example, since it is example-specific.

6. CCS Debug library name. PROFILE=${ConfigName} builds ...Debug.lib, but the Debug configuration links ...debug.lib (am263x projectspec line 93). Release is consistent at line 106. From reading the files, this should work on Windows and fail on a case-sensitive host. I did not run it.

Minor

  • make clean compiles the library before deleting it, because clean_lib (makefile:88) depends on $(DEVICE_NON_PRU).
  • The title "fixes to PR8 185" is hard to read later. Something like "pru_i2s: move driver to source/i2s and use pru_rules.mak" would help.

What checks out

  • make all for am261x builds firmware (4 cores), library and app.
  • All four am263x firmware cores build with -v3.
  • git grep finds no leftover firmware/I2S or firmware/TDM4 references.
  • The pru_i2s_drv.c, pru_i2s_drv.h and pru_i2s_diagnostic.c changes are include paths only.
  • It merges cleanly with current main.

Not tested

The am263x library and app (no am263x SDK here), a CCS project import, Linux, and any hardware. To run make on Windows I had to work around the quoted "$(TARGET)" in pru_rules.mak locally. That also fails on an unmodified examples/empty, so it isn't from this PR. dhavaljk's question about building on both Windows and Linux is still open.

@nsaulnier-ti

Copy link
Copy Markdown
Collaborator

@a1248924 thanks for the work here, I really appreciate it. Everything that I spot-checked about the build infrastructure looks good, and takes up a lot less repo space.

I didn't have time to dig into the driver design, so not sure if Pratheesh's automated review holds up or not about the driver dependency on the example, potential file duplication, etc. My instinct is that a driver that may be reused across multiple examples should be in the source/ directory, but I don't know how the file structure should work.

The project-level makefile tentatively looks fine to me. I know we were debugging behavior of -jN builds on windows since it was allowing R5F firmware to get built ahead of the PRU firmware, I thought we might have resolved the behavior but I can't remember now - maybe could find breadcrumbs in the webex chat

@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 44ca8db to 4d14ec8 Compare November 18, 2026 11:06
@a1248924

Copy link
Copy Markdown
Collaborator Author

Thanks for the review @pratheesh,
i have tried to fix the comments and re-reviewed with claude and added two new commits for the changes, source/i2s and driver are now not dependent on the i2s example and also other reviews mentioned have been fixed.

Will check for build status and new qodo comments

regarding this comment :
Lines 172 and 222 say the array headers go to firmware/i2s/generated/ and firmware/tdm4/generated/, gitignored. Those directories don't exist. The headers land in firmware/i2s/ and firmware/tdm4/, untracked and not ignored, so they can be committed by accident.

i have fixed the documentation part, but this behavior is also present for other examples, the .h is generated and gets tracked for empty examples also so i followed that here

Comment thread source/i2s/makefile Resolved
@a1248924

Copy link
Copy Markdown
Collaborator Author

Thanks @nsaulnier-ti for having a look at the changes,
i have added 2 new commits based on the comments from Pratheesh, so you can re-review the changes

@pratheesh pratheesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-checked the six points from my 11-04 review against 4d14ec86 (the branch was rebased, so I rebuilt from a clean tree each time).

Fixed:

  1. make -j8 host from a clean tree now exits 0 and builds the am261x app.
  2. README firmware paths are corrected.
  3. source/i2s no longer reaches into examples/: icss_pru_i2s_fw.h now lives in source/i2s. The old I2S and TDM4 copies differed only in the include-guard comment.
  4. The Debug configuration links the Debug library name.
  5. make clean no longer builds the library first.

New: the full am263x host build (firmware, library, app) passes with MCU+ SDK am263x 26.01.00.08. I couldn't test this last time.

Still open:

  • PRU_VERSION := 4 / -v4 on ICSSM. It is consistent now, but every other am261x/am263x makefile on main uses 3, and 4 is the ICSSG value. I rebuilt all four am263x firmwares with PRU_VERSION=3, and the array headers are identical, so this is only a convention issue. Please use 3 to match the rest of the repo.
  • Generated *_array.h headers are neither tracked nor ignored. After a build they show as ??. On main, the only tracked *_array.h files are pru_i2s's own (firmware/I2S, firmware/TDM4), and this PR deletes them, so no other example tracks generated headers. Please add them to .gitignore, or say which way you want it.
  • Qodo's "add i2s to source/makefile". A plain SUBDIRS += i2s would break the top-level build, because source/i2s all builds both am261x and am263x against a single MCU_PLUS_SDK_PATH. If it goes in, it needs DEVICE gating.
  • Title. "apply changes for issue : fixes to PR8 185" doesn't describe the change.

Minor: pru_i2s_app_config.c is example configuration compiled into the driver library. That works, but it ties the library to this example.

Not run on hardware. CI is green (14/14).

@a1248924

Copy link
Copy Markdown
Collaborator Author

Regarding the open items :

  1. will use -v3 till its resolved
  2. we decided to keep/track the .h files as per discussion, that is the observed behavior for all other examples as well
  3. Regarding this item from QODO: Qodo's "add i2s to source/makefile". A plain SUBDIRS += i2s would break the top-level build, because source/i2s all builds both am261x and am263x against a single MCU_PLUS_SDK_PATH. If it goes in, it needs DEVICE gating.
    -> Not adding i2s to source/makefile. Its all builds both am261x and am263x against one MCU_PLUS_SDK_PATH, so it would fail on every other device in the CI matrix. The library is built per device from examples/pru_i2s through build_lib_$(DEVICE), and no other example links it. Let me know if we want to add it

fixed the other comments in a new commit, will check the QODO comments

@a1248924 a1248924 changed the title apply changes for issue : fixes to PR8 185 pru_i2s: move driver to source/i2s and build firmware with pru_rules.mak : fixes to PR8 185 Nov 19, 2026
Comment thread examples/pru_i2s/makefile
host: pre_build_message
$(MAKE) pru
$(MAKE) build_lib_$(DEVICE)
$(MAKE) $(DEVICE_NON_PRU) ARGUMENTS_MCUPLUS=all

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.

Ok, we moved the driver code over to source/ directory, which I think is a good call. We also don't build the driver code from the top-level makefile, which I think is fine as long as the project-level makefile enforces the sequence that the library must be built before the R5F code is built (now that you have those on 2 separate lines, the order is enforced, even with -f).

Now I am trying to decide if it makes sense to put the OUTPUTS from the driver library all in the same output directory in source/i2s. Or if we should consider another design because of the potential for conflicts (e.g., top-level make -j triggering multiple projects at once, and then one project deleting the other project's library files between the compile and archive steps in the source/i2s/makefile execution). We wouldn't see any conflicts now since we only build one processor at a time and there is only one i2s project at the moment. I would like to hear yall's thoughts

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Got some suggestions from Claude :

The investigator's findings line up with my race tests, and together they point to the layout the MCU+ SDK uses. I haven't changed anything yet.

What the MCU+ SDK does

For its R5F ti-arm-clang libraries (source/drivers/makefile.am263x.r5f.ti-arm-clang.freertos):

  • Objects: each goes in its own directory, obj//ti-arm-clang//... (line 220).
  • Archives: they stay in a flat lib/, with device and profile in the name (lines 13 and 219).
  • clean: it removes only that device and profile's object directory and archive (lines 246-249).
  • scrub: a separate target removes the whole obj/ and lib/ trees.
  • Invocation: the SDK builds one DEVICE per make call.

How source/i2s differs

│ │ SDK │ source/i2s today │
│ Object location│ per device and profile directory│ shared lib/, with the device in the file name but not the profile
│ Archive │ flat lib/, device and profile in the name │ same │
│ clean │ only this config's files │ the whole lib/ │

source/rpmsg isn't comparable. It has one device-independent archive, so it can't conflict across devices.

What my tests showed

  • Different devices at once: safe, because the object names include the device.
  • Same device, debug and release at once: 1 of 5 runs failed. Both builds use pru_i2s_drv_.obj, so one can delete or overwrite the other's object between compile and archive.
  • clean during a build: this is the reviewer's scenario. The build exited 0 but lib/ was empty afterward. These are timing-dependent races, so the failure rates aren't a measure of how often they'd happen.

Proposal

Match the SDK. Only source/i2s/makefile changes:

  1. Objects: compile into source/i2s/obj///. .gitignore already covers obj/ and lib/.
  2. Archives: keep them in source/i2s/lib/. The two app makefiles and the two projectspecs don't change.
  3. clean: remove only the current profile's object directories and archives. I'd add a scrub that removes the whole obj/ and lib/. The example's clean_lib would call clean.
  4. Stale archive members: this also settles the earlier delete-before-build question. Each build can delete its own archive before ar, which only touches that config's file.

That isolates each device and profile pair, so a clean for one can't remove another's files. One limit remains: two builds of the same device and profile at once would still share their object directory. That's unavoidable without a lock, and the SDK has the same limit.

Let me know if this seems ok to implement

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.

The proposal doesn't actually address the race condition listed, just the clean comment. I'm open to putting the lib output directory somewhere in examples/i2s// like in the original implementation if that's what makes sense. Pushing out to the team to see if anyone else has comments.

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.

The more I think about it, the more I am leaning towards putting the outputs for a specific project in that project's directory. But let's get input from the rest of the team.

If all build outputs go into the projects instead of source/i2s/lib, then we don't need to clean source/i2s from the top-level make. In that case, we would just add a note to source/makefile that i2s is called and cleaned from individual projects rather than from a top-level make / clean

Comment thread examples/pru_i2s/README.md Outdated
make DEVICE=am263x # Build for AM263x
```

**Build only firmware:**

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.

Are there specific reasons to document building only the firmware? Why not just cd examples/pru_i2s and make?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i think this was in the original PR and not needed,
will remove this

Comment thread source/i2s/makefile Resolved
Comment thread examples/pru_i2s/makefile
$(MAKE) pru
$(MAKE) build_lib_$(DEVICE)
$(MAKE) $(DEVICE_NON_PRU) ARGUMENTS_MCUPLUS=all

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.

The other thing that changed was going from deleting the library outputs every build before re-building the library outputs, to now only deleting library outputs on a clean from the project-level. Was that an intentional decision? Which approach do we want to take?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

hmm, for this i think i found a similar behavior for the libs in the rpmsg examples :
from claude:

The rpmsg library follows the same pattern—no pre-build delete, clean just does RMDIR lib—but builds incrementally with normal make dependencies. I'll check if it shares the same stale-member issue. · summary

Ran 1 shell command

Yes, partly. source/rpmsg is the only other library in the repo, and it behaves like our current version:

  • No delete before archiving: it runs arpru r $(TARGET) $(OBJECTS), which updates the archive in place.
  • Clean: make clean is just RMDIR lib.
  • Same weakness: if a source file were removed from its object list, its old member would stay in rpmsg.lib too. Nobody has hit that because the library hasn't changed shape.

What differs is that rpmsg is a normal incremental make build. It has object rules and $(TARGET): $(OBJECTS), so make only rebuilds when sources change. source/i2s is not incremental. It runs the compiler and ar unconditionally on every call.

What that means for the decision

  • Matching rpmsg: our current behavior is consistent with the other library in the repo. The reviewer's question is fair, because main's pru_i2s did the opposite.
  • The stale-member risk is real but specific to our change: the library lost a member (pru_i2s_app_config) in this PR, so stale archives from earlier builds can exist. That mostly affects people who built the old version in place, and a make clean fixes it.
  • Third option: convert source/i2s to proper incremental rules like rpmsg. That is a bigger rewrite for a library with one source file, and I'd not do it for this comment.

the solution looks something like this :
Recommendation

Go back to deleting before building, and keep the clean target too. It's a one-line change per device in source/i2s/makefile: remove only the archive being rebuilt with $(RM) $(GEN_DIR)/pru_i2s..r5f.ti-arm-clang.$(PROFILE).lib. I'd delete only the current profile's file, not *.lib like main. Deleting every profile on each build is what I'd avoid, because a Debug build in CCS would wipe the Release library.

Does this sound okay or should we look for some other way?

@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 81874c5 to 08530da Compare November 20, 2026 07:08
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 08530da to 1b53160 Compare November 20, 2026 07:36

@pratheesh pratheesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-checked against 1b53160c, building from a clean tree each time (MCU+ SDK am261x 11.00.00.29 and am263x 26.01.00.08, clpru 2.3.3, CCS 21 gmake). Not run on hardware.

Fixed since my 11-19 review:

  • -v3 / PRU_VERSION := 3 in all 8 firmware makefiles and projectspecs, matching the other ICSSM examples.
  • App config is out of the driver library. pru_i2s_app_config.c/.h now live in pru_i2s_app/, both app makefiles and projectspecs compile them, and PRUI2S_applyAppConfig is gone from pru_i2s_drv.h.
  • Dead firmware/include paths are removed from all makefiles and projectspecs, as @nsaulnier-ti asked.
  • make -j8 host from a clean tree passes for am261x and am263x (firmware, library, app). make clean leaves examples/pru_i2s and source/i2s with no untracked or ignored files.

Qodo's device-switch finding is real, and I reproduced it. Without cleaning in between, I built am261x, then am263x, then am261x again:

  • All four *_array.h files under firmware/i2s and firmware/tdm4 still held the am263x images after the last build. Their hashes matched the am263x build, not the first am261x build.
  • The log shows why: the four am261x .out files were "up to date", so pru_rules.mak skipped the hexpru + copy step. The am261x app then recompiled pru_i2s_diagnostic.c and relinked against the am263x arrays.
  • This isn't cosmetic. pru_i2s_interface.h picks different BCLK/FS/SD pins under SOC_AM261X and SOC_AM263X, so the am261x image would drive am263x pin assignments, and the build gives no error.
  • Main has the same pattern: the old per-firmware makefiles also copied to one shared path inside the .out recipe only. That part I read from the code and did not run, so this predates the PR. But this PR rewrites that path, so it's the cheap place to fix it. Device-specific destinations, for example firmware/i2s/<device>/ with the app include path selected per device, would fix it and also make the next point simpler.

On the library output location (@nsaulnier-ti's thread on makefile:82): I agree with putting outputs under each project. The obj-per-device/profile proposal fixes clean for one config wiping another, but two projects that share source/i2s/lib can still race on the same archive. That is the case Nick raised, and it grows with every new i2s project. If the library and the firmware arrays are both written under the consuming project's build directory, the cross-project race and the stale-header problem above both go away. source/makefile then doesn't need an i2s entry, just the note Nick suggested. On the delete-before-build question: removing only the current config's archive before ar is fine whichever layout you choose. It stops stale members. For example, ar rc never drops the pru_i2s_app_config_*.obj member that a library built from an earlier head of this PR contains. I reasoned that from ar semantics and didn't test it.

Still open from before:

  • The generated *_array.h headers are still untracked and not ignored. After a build, all four show as ??. The README no longer says "gitignored", but the files themselves haven't changed. Please add them to .gitignore, or have them generated per device as above.
  • The title is better. The trailing ": fixes to PR8 185" still reads like an internal ticket reference.

CI is green (14/14).

@a1248924

Copy link
Copy Markdown
Collaborator Author

for this review comment : The generated *_array.h headers are still untracked and not ignored. After a build, all four show as ??. The README no longer says "gitignored", but the files themselves haven't changed. Please add them to .gitignore, or have them generated per device as above.

i think after discussion we decided to keep the .h files tracked and not gitignored (but not pushed to the repo)

on the libs output, i will try to move the outputs to the examples directory to avoid the race conditions when multiple examples use the drivers/libs build/delete

- Move driver (pru_i2s_drv.c/h, pru_i2s_config.h) to source/i2s/ and add source/i2s/makefile with all/clean targets
- Rewrite 8 per-core firmware makefiles to use pru_rules.mak (PRU_VERSION=3, outputs in ti-pru-cgt/generated/)
- Update example.projectspec files: -v4 -> -v3
- Add firmware/I2S/generated/ and firmware/TDM4/generated/ for array header outputs; update app include paths accordingly
- Restructure top-level makefile: guard pru/host inside BUILD_PROJECT check, all: calls
- Update README to reflect new directory structure and build flow
Signed-off by Ayushman a-ayushman@ti.com
signed-off by Ayushman <a-ayushman@ti.com>
…, Debug lib name)

- makefile: host builds pru firmware, then the driver library, then the R5F
  app as ordered recipe steps, so "make -j host" no longer compiles the app
  before the firmware array headers exist; all calls host
- makefile: clean_lib no longer depends on the device targets, so "make clean"
  does not build the library before removing it
- firmware makefiles (8) and README: PRU_VERSION 3 -> 4 (-v4)
- README: correct array header location, firmware-only build command and
  build directory
- remove unused pru_i2s_app/pru_i2s_app_config.{c,h}; the source/i2s copies
  are the ones built into the library
- app projectspecs: link ...Debug.lib to match the PROFILE=${ConfigName} name

Signed-off-by: Ayushman <a-ayushman@ti.com>
- move icss_pru_i2s_fw.h to source/i2s/ as the single copy shared by the PRU
  firmware and the R5F driver (the firmware/i2s and firmware/tdm4 copies were
  identical apart from a guard comment); the driver now includes it locally
- source/i2s/makefile: drop the examples/ include paths and write the library
  to source/i2s/lib, matching source/rpmsg
- firmware makefiles and projectspecs: add source/i2s to the include path and
  link the header from its new location
- app makefiles and projectspecs: link the library from source/i2s/lib
- README: update the file tree and library path

Signed-off-by: Ayushman <a-ayushman@ti.com>
- move pru_i2s_app_config.{c,h} from source/i2s back into
  examples/pru_i2s/pru_i2s_app; it is example configuration, so it is no
  longer compiled into the driver library. The app makefiles and projectspecs
  now build it
- source/i2s/pru_i2s_drv.h: drop the PRUI2S_applyAppConfig() declaration, the
  function is defined by the example and not by the library
- PRU_VERSION 4 -> 3 in the 8 firmware makefiles, -v4 -> -v3 in the 8 firmware
  projectspecs and the README note (PRU-ICSS, as in examples/empty)
- README: remove the "gitignored" wording for the generated array headers
- remove the unused examples/pru_i2s/firmware/include path (directory does
  not exist) from the 8 firmware makefiles and projectspecs
- README: drop the "Build only firmware" block; no other example documents
  `make pru`, and the full build is `make` from examples/pru_i2s

Signed-off-by: Ayushman <a-ayushman@ti.com>
The example no longer builds or cleans the driver library as part of its
own build. The library has its own targets, like the MCU+ SDK libraries.

- add "libs" and "libs-clean" to examples/pru_i2s/makefile. "clean" no
  longer removes the library
- the library output belongs to the example: examples/pru_i2s/lib. The
  output directory of source/i2s/makefile is now overridable (GEN_DIR ?=)
- the application only links the existing library. If it is missing,
  the build stops with a message to run "make libs"
- remove the library rebuild rule from the application makefiles and the
  library preBuildStep from the application projectspecs
- library names are lowercase (debug/release) like the MCU+ SDK library
  names, in the makefile and the projectspecs
- delete the archive of the profile being built before running ar, so a
  rebuild cannot keep stale members. The temporary object file name
  includes the profile, so a debug and a release build do not collide
- README: build the library first, rebuild after driver changes, libs-clean

Signed-off-by: Ayushman <a-ayushman@ti.com>
Libraries owned by a project are built and cleaned separately from the
project, like the MCU+ SDK libraries. Today only pru_i2s has one.

- "make libs" builds, "make libs-clean" cleans the libraries of the
  projects listed in LIBS_SUBDIRS in examples/makefile
- "make" (all) builds the libraries first, so a fresh clone and the make
  CI are unchanged. "make clean" does not remove them
- update the help text and the README
- ccs_build.yml: the CCS projects only link the library, so build it with
  "make libs" before the CCS import

Signed-off-by: Ayushman <a-ayushman@ti.com>
The PRU firmware headers of am261x and am263x were copied to the same
path, firmware/i2s/ and firmware/tdm4/. After building am261x, am263x,
then am261x again, the am261x .out files were up to date, so the headers
were not generated again and the am261x application was built with the
am263x firmware images (different pins, no build error).

- copy the headers to firmware/<board>/, am261x-lp or am263x-cc. The I2S
  and TDM4 header names differ, so one directory per board is enough
- the application includes firmware/<board>/ instead of firmware/i2s
  and firmware/tdm4
- pru_rules.mak creates the destination directory before the copy
- README: describe the new location

The CCS projects are not affected: the firmware postBuildStep writes the
header into the workspace project.

Signed-off-by: Ayushman <a-ayushman@ti.com>
@a1248924
a1248924 force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 1b53160 to 34c5680 Compare November 26, 2026 07:54
Comment thread pru_rules.mak
Comment on lines 165 to 167
ifeq ($(BUILD_MCUPLUS),y)
-$(MKDIR) $(dir $(MCU_HEX_PATH))
-$(COPY) $(TARGET_HEX) $(MCU_HEX_PATH)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Header directory creation errors ignored 📘 Rule violation ≡ Correctness

The new -$(MKDIR) $(dir $(MCU_HEX_PATH)) line in post-build prefixes the command with -, so
make ignores its exit status and continues. The following -$(COPY) step is also ignored, so if
directory creation fails, the array header is never written to MCU_HEX_PATH and the build still
reports success.
Agent Prompt
## Issue description
In `pru_rules.mak`, the post-build step creates the destination directory for the array header with `-$(MKDIR)`, and copies the header with `-$(COPY)`. The leading `-` makes make ignore failures, so a failed directory creation or copy leaves the firmware header missing while the build succeeds.

## Fix Focus Areas
- pru_rules.mak[163-169]

## Recommended Fix
Remove the leading `-` from the `$(MKDIR)` line so a failure stops the build. For the `$(COPY)` line, keep the ignore only if a missing header is acceptable, and otherwise remove the `-` there too. Verify by running a firmware build with the target directory missing and confirming the build reports an error.

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

Dismiss ↗ | View ↗

@a1248924 a1248924 Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the - on post-build is the existing repo convention, and the new mkdir follows it. A failed copy surfaces as a missing-header compile error in the app. Making the post-build steps strict would change every example, so it should be a separate change -> Claude

@nsaulnier-ti i can follow up on this in a seperate PR, is that ok ?

- remove PRUI2S_pruGpioPadConfig() and PRUICSS_intcSetSysEvtChMap(),
  they do not exist. The pins are configured by SysConfig
- PRUI2S_initPpBufs() is static and called by PRUI2S_open(), do not list
  it as an API
- PRUI2S_open() does not initialize the INTC, the application calls
  PRUICSS_intcInit() before PRUI2S_init()
- say that PRUI2S_applyAppConfig() is part of the example, not of the
  driver library
- directory structure: list pru_i2s_app_config.c/.h, source/i2s and the
  real names of the generated headers

Signed-off-by: Ayushman <a-ayushman@ti.com>
@a1248924 a1248924 changed the title pru_i2s: move driver to source/i2s and build firmware with pru_rules.mak : fixes to PR8 185 pru_i2s: move driver to source/i2s and build firmware with pru_rules.mak Nov 26, 2026
@a1248924

Copy link
Copy Markdown
Collaborator Author

based on discussions i have pushed the changes in new commits, @nsaulnier-ti, you can re-review

Summary of Issues fixed:

Issue: The driver library was built and cleaned as part of the example, its output sat in a shared source/i2s/lib, and concurrent builds could clash.
Fix:

  • make libs and make libs-clean are separate targets, wired through examples/makefile (LIBS_SUBDIRS := pru_i2s) and the root makefile.
  • The root make still builds the libraries first.
  • make clean leaves the library alone.
  • The library goes to examples/pru_i2s/lib/, via GEN_DIR ?= in source/i2s/makefile.

Issue: The app rebuilt the library itself (a makefile rule and a CCS preBuildStep), and CCS CI relied on that.
Fix:

  • The app only links the library. If it's missing, the build stops with "run 'make libs'".
  • The rule and the preBuildStep are removed.
  • ccs_build.yml runs make libs before importing projects.

Issue: Building am261x, then am263x, then am261x left am263x headers in the am261x app, with different pins and no error.
Fix:

  • Headers are copied to firmware//, and the app includes that directory.
  • pru_rules.mak gets one added line, a mkdir before the copy.
  • After the same sequence, the am261x headers now match the first am261x build.

Issue: Debug and release builds of one device shared an object file, and failed 1 in 5. ar rc also kept stale members.
Fix:

  • The profile is in the object name.
  • The profile's archive is deleted before ar.
  • 16 concurrent runs gave 0 failures.

Issue: The …Debug.lib / …Release.lib names in the projectspecs didn't match the lowercase names in the makefiles.
Fix: Everything is lowercase now.

Issue: The README listed functions that don't exist (PRUI2S_pruGpioPadConfig, PRUICSS_intcSetSysEvtChMap), listed a static function as API, and gave the wrong INTC step.
Fix: The README is corrected. It also documents "run make libs first", libs-clean, and the new directory layout.

Tested: Windows, gmake, am261x and am263x, full clean builds of the rebased tree. rpmsg on am64x is unaffected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants