Skip to content

Merge main into a0502729_PRU_I2C: resolve #137 conflict - #173

Merged
pratheesh-ti merged 43 commits into
TexasInstruments:a0502729_PRU_I2Cfrom
pratheesh:sync/pr137-merge-main
Nov 23, 2026
Merged

pratheesh-ti merged 43 commits into
TexasInstruments:a0502729_PRU_I2Cfrom
pratheesh:sync/pr137-merge-main

Conversation

@pratheesh

@pratheesh pratheesh commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #137's merge conflict with main, targeted at #137's branch (a0502729_PRU_I2C).

This is a single merge commit of current main into the branch. The only conflict is examples/makefile SUBDIRS: main added pru_eqep (36ad470) on the same line this branch added pru_i2c. The resolution keeps both:

    LCD_interface logic_scope pru_emif pru_eqep pru_i2c spi_loopback \

The diff of this PR is everything that landed on main since the branch point. Merging it, or running git merge origin/main on the branch and applying the line above, makes #137 mergeable again. This PR is independent of the firmware fixes (#171) and the R5F example (#172); they touch different files.

🤖 Generated with Claude Code

juliosuas and others added 30 commits June 11, 2026 01:02
The OPEN_PRU product version was stale at 07.03.01 in product.json and
in every SysConfig file pinning the OPEN_PRU product. Bump all of them
to the 2026.01.00 release version so SysConfig product resolution and
CCS imports reference the correct product.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…d update description

- Delete device-specific *.content.tirex.json files (AM243x, AM64x,
  AM261x, AM263Px, AM263x)
- Update the description in package.tirex.json to better reflect the
  repository's purpose and supported devices
- Keep version at 2026.01.00 to match the current OpenPRU repo tag,
  per review feedback (this PR does not produce a new tag)

Scoped strictly to issue TexasInstruments#22; out-of-scope package.ccs.json,
product.json, and example.syscfg product-pin changes were reverted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eta-cleanup

Fix issue TexasInstruments#22: Remove device-specific .tirex files and update OPEN_PRU version to 2026.06.00
The OPEN_PRU product version was stale at 07.03.01 in product.json and
in every SysConfig file pinning the OPEN_PRU product. Bump all of them
to the 2026.01.00 release version so SysConfig product resolution and
CCS imports reference the correct product.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per maintainer review on PR TexasInstruments#140 (issue TexasInstruments#108): the OPEN_PRU version
field lives in both .metadata/.tirex/package.tirex.json and
.metadata/product.json. Update the tagging checklist so future tags
bump both files, not just the tirex package descriptor.
…open-pru-version

Update OPEN_PRU product version to 2026.01.00
The column-length best practices (79 soft / 129 hard) were written for
hand-authored source. SysConfig example.syscfg files are machine-
generated: their @cliArgs/@v2CliArgs header lines are single-line
command strings that exceed column 129 by construction and cannot be
wrapped without breaking the tool's round-trip.

Treating those lines as violations produces false-positive review flags
on any PR that touches a .syscfg file (for example the OPEN_PRU version
bump in TexasInstruments#108/TexasInstruments#140, which only edited a token inside pre-existing long
lines). Make the exemption explicit, consistent with the existing
markdown/.txt carve-out, so automated and human reviewers stop flagging
generated content.
Updates all 44 AM26x FreeRTOS R5F makefiles (am261x, am263px, am263x)
to build with MCU+ SDK 11.0. Breaks backwards compatibility with SDK 10.2.

Changes per makefile (aligned to SDK 11.0 pru_io reference makefiles):
- Add -DOS_FREERTOS to DEFINES_common
- Add .freertos. infix to drivers and board library names
- Add -Wl,--gen_xml_func_hash to LFLAGS_common
- Add $(INCLUDES) $(DEFINES) to .S assembly compile rule
- Add --xml_link_info=<name>.lnkxml to linker command
- Remove MULTI_CORE_IMAGE_GEN and OUTRPRC_CMD (elf2rprc.js removed in SDK 11.0)
- Add oeconfig?=None variable
- Replace appimage boot target with MCELF target (genimage.py)
- Add --otfaConfigFile=$(oeconfig) to MCELF image generation
- Update HS signing rule to use BOOTIMAGE_NAME_MCELF
- Add $(RM) *.lnkxml to scrub target (matches SDK convention)

Validated: clean build PASS on am261x, am263px, am263x with SDK 11.0;
cross-entity regression PASS on am243x, am64x, am62x (unchanged devices).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Switch makefile_ccs_bootimage_gen from dual appimage+MCELF generation
(SDK 10.2) to MCELF-only (SDK 11.0+). Update example.projectspec with
-DOS_FREERTOS, --gen_xml_func_hash, and .freertos. library name infix
required by SDK 11.0+.

Validated with full CCS builds (import + build) for SDK 11.0, 11.1,
and 26.0. All 44 AM26x R5F projects pass; am243x, am64x, am62x
regressions clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AM243x: 11.02.00.24 → 12.00.00.26
AM261x: 10.02.00.15 → 11.00.00.29
AM263x: 10.02.00.13 → 11.00.00.19
AM263Px: 10.02.00.15 → 11.00.00.19
AM64x: 11.02.00.24 → 12.00.00.27

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AM261x: 11.00.00.29 → 11_01_00_19
AM263x: 11.00.00.19 → 11_01_00_19
AM263Px: 11.00.00.19 → 11_01_00_19

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
AM261x: 11_01_00_19 → 26_00_00_06
AM263x: 11_01_00_19 → 26_00_00_06
AM263Px: 11_01_00_19 → 26_00_00_06

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Adds using_older_sdks_with_open_pru.md modification [8] covering the
AM26x MCU+ SDK 11.0 makefile changes that break SDK 10.2 compatibility.
Updates AM261x, AM263Px, AM263x tables to reference [8] for SDK 10.2.

Post-break commit following f14285b.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add support for AM26x MCU+ SDK 11.0, 11.1, 26.0.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
For details of this version of OpenPRU repo, refer to
docs/release_notes.md.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
…0_am26x_port_sdk11_0

A0226750 am26x port to MCU+ SDKs 11.0, 11.1, 26.0
…inker-readmes

Fix TexasInstruments#77: update linker command README references
Import PRU Software Support Package (PSSP) project
https://git.ti.com/cgit/pru-software-support-package/pru-software-support-package/tree/examples/am62x/PRU_MAC_Multiply_Accum
https://git.ti.com/cgit/pru-software-support-package/pru-software-support-package/tree/examples/am64x/PRU_MAC_Multiply_Accum

into the OpenPRU repository.

This is a test of new documentation to guide AI agents to perform specific
actions in the OpenPRU project. This project tested the action
"create a new OpenPRU project", when the project does not require any pinmux,
SysConfig, etc.

The project creation was done by claude code. However, I had to code quite a few
manual fixes after the initial project creation.

Tested-by: Rupesh Yadav <r-yadav@ti.com>
Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Import PRU Software Support Package (PSSP) project
https://git.ti.com/cgit/pru-software-support-package/pru-software-support-package/tree/examples/am62x/PRU_Hardware_UART

into the OpenPRU repository.

This is a test of new documentation to guide AI agents to perform specific
actions in the OpenPRU project. This project tested the action
"create a new OpenPRU project", when the project does not require any pinmux,
SysConfig, etc.

The project creation was done by claude code. However, I had to code quite a few
manual fixes after the initial project creation.

Tested-by: Rupesh Yadav <r-yadav@ti.com>
Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add the new mac_c and uart projects to the academy/makefile &
academy/readme.md files.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
These projects are used as the template for most new projects created in
the OpenPRU repository. Update the README template to look the way we expect
new project README files to look.

Additionally, point to central documentation for creating a new project or
building a project, instead of replicating that information per-project.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Standardize the README format to match examples/empty.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Standardize the README format to match examples/empty.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
nsaulnier-ti and others added 13 commits July 11, 2026 04:09
Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add docs_ai/task_port_project.md, which provides guidance to AI agents which are
porting an OpenPRU project from one processor to another processor.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add docs_ai/task_create_project.md, which provides guidance to AI agents which
are creating a new OpenPRU project.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add default AGENTS.md & CLAUDE.md files which point AI agents to the correct
resources.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add a markdown version of the PRU Assembly Language Tools User's Guide v2.3,
document revision C. Markdown files are easier for AI tools to consume than PDF
files. The latest version of the PDF source file can be found at
https://www.ti.com/lit/spruhv6

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add a markdown version of the PRU Optimizing C Compiler User's Guide v2.3,
document revision C. Markdown files are easier for AI tools to consume than PDF
files. The latest version of the PDF source file can be found at
https://www.ti.com/lit/spruhv7

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add a markdown version of the PRU Subsystem Features Comparison app note,
document revision G. Markdown files are easier for AI tools to consume than PDF
files. The latest version of the PDF source file can be found at
https://www.ti.com/lit/sprac90

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add a markdown version of the PRU Subsystem Migration Guide app note,
the initial document revision. Markdown files are easier for AI tools to consume
than PDF files. The latest version of the PDF source file can be found at
https://www.ti.com/lit/spracj8

This app note badly needs to be updated for modern PRU devices. Once the app
note is rewritten, we will update this markdown file to reflect the latest
version of the document.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Add steps for whenever a change to the OpenPRU repo requires updating files
under docs_ai, or for adding additional documentation, tasklists, etc to the
directory.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
We observed that AI agents needed a set of guidelines to consistently execute
certain tasks in the OpenPRU repository. docs_ai/README.md guides AI agents on
how to use the new AI-specific documentation.

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
…_initdata selection

Signed-off-by: Rajul Bhambay <r-bhambay@ti.com>
signed off by Ayushman a-ayushman@ti.com
Resolve the examples/makefile SUBDIRS conflict: main added pru_eqep on the
same line this branch added pru_i2c. Keep both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Pratheesh Gangadhar <pratheesh.gangadhar@gmail.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Merge main into PR #137 and preserve both PRU examples

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Merge current main into PR #137’s branch to resolve its merge conflict.
• Keep both pru_eqep and pru_i2c in the examples build list.
• Bring in main’s intervening examples, SDK compatibility changes, documentation, and CI
 configuration.
Diagram

graph TD
  A["Main branch"] --> C["Merge commit"] --> D["Examples makefile"]
  B["PR 137 branch"] --> C
  D --> E["PRU eQEP example"]
  D --> F["PRU I2C example"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Rebase PR #137 onto main
  • ➕ Avoids a merge commit in the branch history.
  • ➖ Rewrites the existing PR branch and may disrupt collaborators or review references.

Recommendation: Keep the merge approach: it preserves PR #137’s history and resolves the sole reported conflict without changing either example. Review the merge-specific makefile resolution separately from changes already made on main.

Files changed (41) +4229 / -102

Enhancement (9) +1430 / -1
makefileInclude new MAC C and UART lessons +2/-1

Include new MAC C and UART lessons

• Inherited from main: adds 'mac/mac_c' and 'uart/uart_loopback' to the academy aggregate build.

academy/makefile

main.cAdd a C multiply-accumulate lesson +91/-0

Add a C multiply-accumulate lesson

• Inherited from main: computes an example sum of products in PRU C and explains its distinction from the hardware MAC assembly lesson.

academy/mac/mac_c/firmware/main.c

main.cAdd PRU UART loopback firmware +133/-0

Add PRU UART loopback firmware

• Inherited from main: configures PRU UART and exercises its internal loopback path.

academy/uart/uart_loopback/firmware/main.c

main.asmAdd PRU quadrature-encoder firmware +180/-0

Add PRU quadrature-encoder firmware

• Inherited from main: samples encoder inputs and records transitions and timing for position and speed diagnostics.

examples/pru_eqep/firmware/main.asm

macros.incDefine eQEP firmware macros +54/-0

Define eQEP firmware macros

• Inherited from main: supplies assembly macros used by the encoder firmware.

examples/pru_eqep/firmware/include/macros.inc

memory.incDefine eQEP firmware memory layout +177/-0

Define eQEP firmware memory layout

• Inherited from main: supplies register, memory, and channel definitions for the encoder firmware.

examples/pru_eqep/firmware/include/memory.inc

pru_eqep_example.cAdd R5F-side encoder diagnostics +564/-0

Add R5F-side encoder diagnostics

• Inherited from main: loads multiple PRU firmware images and reads their captured encoder data.

examples/pru_eqep/mcuplus/pru_eqep_example.c

eqep_diagnostic.hDefine encoder diagnostic interfaces +145/-0

Define encoder diagnostic interfaces

• Inherited from main: declares types and constants shared by the MCU-side diagnostics.

examples/pru_eqep/mcuplus/eqep_diagnostic.h

main.cAdd eQEP host application entry point +84/-0

Add eQEP host application entry point

• Inherited from main: initializes the AM243x R5F example and invokes its encoder demonstration.

examples/pru_eqep/mcuplus/am243x-lp/r5fss0-0_freertos/main.c

Bug fix (4) +17 / -22
makefileRetain eQEP and I2C in the aggregate build +1/-1

Retain eQEP and I2C in the aggregate build

• Resolves the overlapping SUBDIRS edit by placing 'pru_eqep' alongside the branch’s existing 'pru_i2c'. This is the merge-specific conflict resolution.

examples/makefile

example.syscfgCorrect AM261x interrupt-example configuration +14/-15

Correct AM261x interrupt-example configuration

• Inherited from main: changes PRU-ICSS pin and interrupt mappings to ICSS0 and updates the OpenPRU product pin.

academy/intc/intc_mcu/am261x-lp/r5fss0-0_freertos/example.syscfg

intc_mcu.cAdjust the MCU interrupt example +1/-5

Adjust the MCU interrupt example

• Inherited from main: aligns the example source with its updated interrupt configuration.

academy/intc/intc_mcu/intc_mcu.c

spi_pru_demo.cCorrect the SPI demonstration source +1/-1

Correct the SPI demonstration source

• Inherited from main: makes a small correction to the AM243x application.

examples/spi_loopback/spi_loopback_app/am243x-lp/spi_pru_demo.c

Documentation (17) +2070 / -19
AGENTS.mdAdd repository agent guidance +5/-0

Add repository agent guidance

• Inherited from main: adds instructions for automated contributors.

AGENTS.md

CLAUDE.mdReference repository agent guidance +1/-0

Reference repository agent guidance

• Inherited from main: adds a pointer to the shared agent instructions.

CLAUDE.md

README.mdDocument the MAC C lesson +51/-0

Document the MAC C lesson

• Inherited from main: explains the new PRU C multiply-accumulate lesson.

academy/mac/mac_c/README.md

README.mdDocument the PRU UART loopback lesson +46/-0

Document the PRU UART loopback lesson

• Inherited from main: provides setup and usage guidance for the new lesson.

academy/uart/uart_loopback/README.md

best_practices.mdDocument assembly include-path rules +16/-4

Document assembly include-path rules

• Inherited from main: clarifies portable PRU assembly include separators and related authoring practices.

best_practices.md

contributing.mdClarify contributor guidance +3/-0

Clarify contributor guidance

• Inherited from main: adds contributing documentation.

docs/contributing.md

release_notes.mdDocument the 2026.02.00 release +52/-2

Document the 2026.02.00 release

• Inherited from main: adds SDK compatibility, CI, and other release notes.

docs/release_notes.md

tagging_checklist.mdRevise release-tagging guidance +3/-2

Revise release-tagging guidance

• Inherited from main: adjusts the tagging checklist.

docs/tagging_checklist.md

using_older_sdks_with_open_pru.mdExplain older-SDK compatibility +31/-10

Explain older-SDK compatibility

• Inherited from main: expands guidance for adapting projects to earlier SDK releases.

docs/using_older_sdks_with_open_pru.md

README.mdIntroduce AI-facing project documentation +40/-0

Introduce AI-facing project documentation

• Inherited from main: provides an entry point to project-creation, porting, and reference material.

docs_ai/README.md

authoring_guide.mdAdd an AI documentation authoring guide +202/-0

Add an AI documentation authoring guide

• Inherited from main: establishes guidance for producing project documentation.

docs_ai/authoring_guide.md

task_create_project.mdDocument project creation +271/-0

Document project creation

• Inherited from main: adds a task guide for creating OpenPRU projects.

docs_ai/task_create_project.md

task_port_project.mdDocument project porting +257/-0

Document project porting

• Inherited from main: adds a task guide for porting OpenPRU projects.

docs_ai/task_port_project.md

pru_subsystem_features_comparison_g.mdAdd PRU subsystem feature reference +254/-0

Add PRU subsystem feature reference

• Inherited from main: documents differences between PRU subsystem variants.

docs_ai/reference/pru_subsystem_features_comparison_g/pru_subsystem_features_comparison_g.md

pru_subsystem_migration_guide.mdAdd PRU subsystem migration reference +647/-0

Add PRU subsystem migration reference

• Inherited from main: provides guidance for migration between PRU subsystem variants.

docs_ai/reference/pru_subsystem_migration_guide/pru_subsystem_migration_guide.md

readme.mdDocument the eQEP demonstration +190/-0

Document the eQEP demonstration

• Inherited from main: explains the encoder example and how to build and run it.

examples/pru_eqep/readme.md

pru_load_bin_copyright.hCorrect generated-firmware copyright text +1/-1

Correct generated-firmware copyright text

• Inherited from main: revises the firmware-loader copyright header.

source/firmware/pru_load_bin_copyright.h

Other (11) +712 / -60
ccs_build.ymlUse newer SDKs and SysConfig in CCS CI +32/-32

Use newer SDKs and SysConfig in CCS CI

• Inherited from main: updates SDK matrix versions and SysConfig installation and cache settings.

.github/workflows/ccs_build.yml

makefile.ymlUse newer SDKs and SysConfig in make CI +24/-24

Use newer SDKs and SysConfig in make CI

• Inherited from main: updates device SDK versions and SysConfig installation and cache settings.

.github/workflows/makefile.yml

package.tirex.jsonRefresh package version and description +2/-2

Refresh package version and description

• Inherited from main: identifies the 2026.02.00 package and describes its examples, training, tools, and supported devices.

.metadata/.tirex/package.tirex.json

product.jsonSet the OpenPRU product version +1/-1

Set the OpenPRU product version

• Inherited from main: changes the advertised product version to 2026.02.00.

.metadata/product.json

.pr_agent.tomlAdd PR agent settings +4/-0

Add PR agent settings

• Inherited from main: adds repository PR-agent configuration.

.pr_agent.toml

makefileBuild the MAC C lesson +106/-0

Build the MAC C lesson

• Inherited from main: adds aggregate build rules for the lesson’s supported PRU targets.

academy/mac/mac_c/makefile

makefileBuild the UART loopback lesson +100/-0

Build the UART loopback lesson

• Inherited from main: adds build rules for the new firmware project.

academy/uart/uart_loopback/makefile

pr_compliance_checklist.yamlCheck PRU assembly include separators +10/-0

Check PRU assembly include separators

• Inherited from main: adds compliance criteria requiring assembler-compatible backslashes in include paths.

pr_compliance_checklist.yaml

example.syscfgConfigure the AM243x eQEP host project +323/-0

Configure the AM243x eQEP host project

• Inherited from main: adds the MCU-side peripheral and platform configuration.

examples/pru_eqep/mcuplus/am243x-lp/r5fss0-0_freertos/example.syscfg

makefileBuild the eQEP demonstration +110/-0

Build the eQEP demonstration

• Inherited from main: orchestrates builds for the PRU firmware and MCU-side example.

examples/pru_eqep/makefile

makefileAdjust the Linux RPMsg example build +0/-1

Adjust the Linux RPMsg example build

• Inherited from main: removes an obsolete makefile line.

examples/rpmsg_echo_linux/makefile

@TexasInstruments TexasInstruments deleted a comment from qodo-code-review Bot Oct 16, 2026
@pratheesh-ti

Copy link
Copy Markdown
Collaborator

/agentic_review

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo


Action required

1. The new encoder project is absent from portability 📘
Description
The PR adds the examples/pru_eqep project and its build target, but examples/readme.md has no
corresponding row in Supported processors per-project. The project therefore has no declared
compatibility status for any processor column.
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 PR adds `pru_eqep` as a buildable example, but the section-level examples portability table does not contain a row for it.

## Fix Focus Areas
- examples/makefile[3-7]
- examples/readme.md[47-94]

## Recommended Fix
Add a `pru_eqep` row to `examples/readme.md` under `Supported processors per-project`, filling every processor column with an allowed status such as `Y`, `Yport`, `Npru`, `N-hw`, or `N-sw`.

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

Dismiss ↗ | View ↗

2. Three encoder positions cannot advance 🐞
Description
create_lut initializes the transition lookup table only in PRU1 DRAM, while firmware for channels
3–5 reads that table through C24 in PRU0 DRAM. Even after the host's channel pointers are corrected,
those cores read an uninitialized table entry instead of an increment or decrement for valid A/B
transitions.
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 PRU1-side firmware reads its transition lookup table from a DRAM bank that `create_lut` does not initialize.
## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[472-507]
- examples/pru_eqep/firmware/include/memory.inc[120-151]
## Recommended Fix
Populate the identical transition lookup table in both DRAM banks before enabling the six PRU cores.

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

Dismiss ↗ | View ↗

3. The new project has no tracked README.md 📘
Description
The new examples/pru_eqep project adds a lowercase readme.md rather than the required
case-sensitive README.md. Users opening the project directory cannot rely on the required
standalone project documentation being present under the mandated filename.
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 newly added project directory contains `readme.md`, but the compliance requirement mandates a tracked file named exactly `README.md` at the project root.

## Fix Focus Areas
- examples/pru_eqep/readme.md[1-5]

## Recommended Fix
Rename `examples/pru_eqep/readme.md` to `examples/pru_eqep/README.md` without changing its contents, and verify the renamed file is tracked.

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

Dismiss ↗ | View ↗

4. Three encoder channels read the wrong RAM 🐞
Description
pru_eqep_example_main derives both data and control pointers from the same DRAM bases for all six
channels, although firmware for channels 3–5 uses the opposite banks. When those channels produce
timestamps, write pointers, positions, or phase-error counts, the host reads addresses that the
corresponding firmware does not update.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Host pointers for channels 3–5 do not address the DRAM banks used by their PRU firmware.
## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[243-250]
- examples/pru_eqep/firmware/include/memory.inc[120-160]
## Recommended Fix
Select the data and control DRAM bases by channel so each host pointer resolves to the address used by that channel's firmware; retain the matching per-channel offsets.

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

Dismiss ↗ | View ↗

5. Long runs write past the position buffer 📘
Description
EQEP_Get_position_ABZ writes position_buffer[idx] and increments idx before checking whether
it has reached the 1000-element capacity. When idx is 999, the next call writes index 999 and
increments to 1000, but a later call can write index 1000 before the post-write reset executes.
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 position-history index is checked only after writing and incrementing, allowing an index of 1000 to be used against the 1000-element `position_buffer`.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[526-547]
- examples/pru_eqep/mcuplus/eqep_diagnostic.h[134-143]

## Recommended Fix
Check or wrap `idx` before the `position_buffer[idx]` assignment, use a named buffer-capacity constant, and ensure every write is guarded by `idx < capacity`.

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

Dismiss ↗ | View ↗

6. A zero timestamp interval stops the host 🐞
Description
EQEP_Get_Speed_ABZ divides by delta_t in both ring-buffer paths without checking whether the
masked timestamp difference is zero. If an interval spans an exact multiple of the 24-bit timestamp
period, speed processing reaches division by zero inside the host's continuous polling loop.
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 speed calculation can divide by a zero interval after timestamp masking.
## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[420-461]
## Recommended Fix
Handle zero before either division and use an elapsed-time representation that accounts for wraps when measurements can exceed the 24-bit timestamp period.

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

Dismiss ↗ | View ↗


View medium (26)
Remediation recommended
7. The firmware entry point lacks boundaries 📘
Description
The globally exported main routine begins at main: without a preceding .asmfunc and has no
matching .endasmfunc before the file ends. The assembler and tooling therefore cannot recognize
the function boundary required for this callable routine.
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 exported assembly routine is implemented as a bare label and instruction stream without `.asmfunc` and `.endasmfunc` markers.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[39-46]
- examples/pru_eqep/firmware/main.asm[176-180]

## Recommended Fix
Place `.asmfunc` immediately before the renamed function label and add `.endasmfunc` after the routine's final instruction.

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

Dismiss ↗ | View ↗

8. Bad channel values corrupt memory 📘
Description
EQEP_Get_Speed_ABZ, EQEP_PRU_clearPhaseErrorFlag, and EQEP_get_speed_RT use the channel
argument directly to index the six-element ABZHandle array without checking that it is in the
range 0 through 5. Any caller passing an invalid channel reaches shared-memory pointer calculations
or state writes through an out-of-range handle.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Several public functions use `channel` as an array index without defining or enforcing the valid six-channel range.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[413-418]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[548-551]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[554-560]

## Recommended Fix
Define a shared channel-count constant, validate `channel < 6` at each function boundary, and return an error or otherwise stop before dereferencing `ABZHandle[channel]`.

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

Dismiss ↗ | View ↗

9. Assembly source contains tab whitespace 📘
Description
The new PRU firmware uses literal tabs between opcodes, operands, and comments on instruction lines
including lbco, set, and sbco. When the source whitespace check runs on the changed .asm
file, it rejects those lines even though the assembler may accept them.
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 PRU assembly source contains literal tabs in instruction lines, violating the source whitespace requirement.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[70-74]

## Recommended Fix
Replace every tab in the `.asm` file with spaces, including tabs between opcodes, operands, and comments. Normalize the file to LF line endings, then run the repository whitespace check over all changed source files.

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

Dismiss ↗ | View ↗

10. UART FIFO setup clobbers itself 🐞
Description
The loopback firmware sets CT_UART.FCR_bit.FIFOEN, DMAMODE1, TXCLR and RXCLR as separate
bitfield writes, and each one compiles to a read-modify-write. FCR is write-only and shares its
address with the read-only IIR, so each write is built from IIR status bits. Once an interrupt is
pending (e.g. THR-empty, which INT_EN = 0x7 enables), IIR bit 0 reads 0 and the next write clears
FIFOEN. The IIR FIFO status bits 7:6 also get written back as RXFIFTL=3, so the FIFO and trigger
configuration ends up different from what the code and comments describe.
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 UART loopback firmware configures FCR through per-bit read-modify-write accesses. FCR is write-only and aliases the read-only IIR, so those reads return IIR status bits and corrupt the configuration that gets written back.

## Fix Focus Areas
- academy/uart/uart_loopback/firmware/main.c[61-74]

## Recommended Fix
Replace the bitfield assignments with full-register writes. First write `CT_UART.FCR = 0x1;` to enable the FIFO, then `CT_UART.FCR = 0x1 | 0x2 | 0x4 | 0x8;` (FIFOEN | RXCLR | TXCLR | DMAMODE1, RXFIFTL=0). Leave the alternative trigger-level option in the comment as a full-register value.

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

Dismiss ↗ | View ↗

11. Cycle-counter macros use capital names 📘
Description
macros.inc defines M_ENABLE_PRU_CYCLE_COUNTER, M_RESET_CYCLCNT, and M_READ_CYCLCNT with
uppercase names rather than lowercase underscore_case names beginning with m_. When main.asm
invokes these macros, its call sites use the same noncompliant spelling.
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 assembly macro definitions and their call sites use uppercase names instead of lowercase underscore_case names beginning with `m_`.

## Fix Focus Areas
- examples/pru_eqep/firmware/include/macros.inc[35-54]
- examples/pru_eqep/firmware/main.asm[64-87]

## Recommended Fix
Rename each macro definition to lowercase underscore_case with the exact `m_` prefix, and update every invocation to match. Do not leave unprefixed aliases behind.

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

Dismiss ↗ | View ↗

12. The firmware entry point breaks naming style 📘
Description
The assembly exports main and defines the same lowercase symbol as its entry point. Because the
symbol is globally visible and callable, it does not use the required FN_ prefix.
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 globally exported assembly entry point is named `main`, which does not follow the required `FN_` prefix convention.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[41-44]
- examples/pru_eqep/firmware/linker.cmd[1-90]

## Recommended Fix
Rename the entry point to an `FN_`-prefixed symbol and update linker, project, and any host-side references consistently.

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

Dismiss ↗ | View ↗

13. Host reads can miss PRU updates 📘
Description
ABZ_Config stores PRU data-memory addresses in ordinary uint32_t * fields such as
baseMemAddr0, position_base, and phase_err_base, and the new code passes those non-volatile
pointers to memory-read helpers. These aliases are used for values written by PRU firmware, so the
compiler-facing types do not preserve the required volatile qualification across the shared-memory
access path.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
PRU shared-memory fields in `ABZ_Config` are declared as ordinary `uint32_t *` pointers, allowing shared-memory aliases to lose volatile qualification.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/eqep_diagnostic.h[79-93]
- examples/pru_eqep/mcuplus/eqep_diagnostic.h[132-140]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[315-357]

## Recommended Fix
Declare all PRU shared-memory pointer members and derived aliases with a volatile-qualified pointee type, and ensure the read/write helper calls preserve that qualification rather than casting to non-volatile pointers.

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

Dismiss ↗ | View ↗

14. Startup leaves one register uncleared 📘
Description
The entry sequence clears 116 bytes from r0, which covers only 29 four-byte registers, before
using the register state. Register r29 is therefore not explicitly cleared as required for startup
initialization.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Startup clears only 116 bytes from `r0`, leaving the required final general-purpose register outside the explicit clear range.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[44-48]

## Recommended Fix
Extend the startup clear operation to cover registers `R0` through `R29`, or use an explicit sequence that writes zero to every required register before any register is read.

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

Dismiss ↗ | View ↗

15. Assembly labels use lowercase names 📘
Description
main.asm defines controlled assembly labels, including the exported entry point main, capture,
and capture_wrap, with lowercase or mixed-case spelling instead of uppercase underscore_case.
Because main is a global function symbol rather than a local label, renaming it also requires
updating its callers and any entry-point references.
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 assembly labels use lowercase or mixed-case spellings rather than uppercase underscore_case, including the exported entry point `main`.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[35-36]
- examples/pru_eqep/firmware/main.asm[41-44]
- examples/pru_eqep/firmware/main.asm[44-68]
- examples/pru_eqep/firmware/main.asm[91-180]

## Recommended Fix
Rename controlled labels, including the exported entry point, to uppercase underscore_case. Update every branch target, symbol reference, caller, and any linker or project configuration reference that identifies the entry point.

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

Dismiss ↗ | View ↗

16. The new project is missing root validation records 📘
Description
The PR introduces a new board-specific encoder example but does not update the root README with a
Validated HW & SW entry containing board revision, SDK version, and tool version. The root project
documentation therefore does not record the validation environment for the added hardware support.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A new board-specific example is added without a corresponding validated hardware and software entry in the root README.

## Fix Focus Areas
- examples/makefile[3-7]
- README.md[1-40]

## Recommended Fix
Add or update a root README `Validated HW & SW` section with the supported board model and revision, the exact SDK version, and the exact compiler or tool version used to validate the new example.

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

Dismiss ↗ | View ↗

17. Instruction spacing breaks assembler style 📘
Description
The zero instruction uses four spaces before its operand, and nearby instructions contain
tab-separated operands instead of the required mnemonic spacing. The modified assembly block
therefore does not follow the mandated fixed spacing for instruction mnemonics.
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 assembly instructions do not consistently use the required number of spaces after their mnemonics.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[46-46]
- examples/pru_eqep/firmware/main.asm[70-74]

## Recommended Fix
Use exactly five spaces after three-letter mnemonics and four spaces after four-letter mnemonics, replacing tabs in the same positions.

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

Dismiss ↗ | View ↗

18. Fresh host-only IDE builds lack firmware 🐞
Description
The MCU+ example.projectspec adds include paths for six firmware projects but does not generate or
declare dependencies on their firmware headers. A fresh import and build of the host project alone
encounters its unconditional *_load_bin.h includes before any PRU post-build step has produced
those files.
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 host IDE project consumes generated firmware headers without arranging for their producers to build first.
## Fix Focus Areas
- examples/pru_eqep/mcuplus/am243x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec[39-44]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[45-50]
## Recommended Fix
Add explicit firmware-project build dependencies or another reproducible header-generation step for fresh host IDE builds.

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

Dismiss ↗ | View ↗

19. Encoder source lacks its filename header 📘
Description
The new pru_eqep_example.c starts with a copyright block and then includes headers without a
comment containing the actual filename. A maintainer or automated source audit cannot identify the
file from the required first-line filename header.
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 C source file has no leading comment that explicitly contains its filename before the includes and declarations.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[1-3]

## Recommended Fix
Add a comment containing `pru_eqep_example.c` before the code and includes, while preserving the existing copyright block.

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

Dismiss ↗ | View ↗

20. Encoder speed is wrong for slow motion 🐞
Description
EQEP_Get_Speed_ABZ masks the PRU’s 32-bit edge timestamps to 24 bits, calculates wrapped intervals
one cycle short, and divides PRU_CLK_FREQ before multiplying by the edge count. When the four-edge
interval exceeds the 24-bit wrap period of about 56 ms, delta_t aliases and can produce an
inflated speed or a zero divisor; intervals crossing that boundary are also undercounted by one
cycle, while division-first arithmetic further truncates the result.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`EQEP_Get_Speed_ABZ` discards the upper eight bits of the PRU’s 32-bit timestamps, so intervals longer than about 56 ms alias. Its wrap calculation also undercounts by one cycle, a zero `delta_t` is not guarded against, and division before multiplication truncates the speed calculation.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[413-464]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[93-96]

## Recommended Fix
In both speed paths, read timestamps without masking and calculate `delta_t = cur_ts - prev_ts` using `uint32_t` arithmetic, which handles a 32-bit wrap without a separate branch or wrap-modulus expression. Skip the speed update or set speed to zero when `delta_t == 0`. Calculate speed as `(uint32_t)(((uint64_t)edges * PRU_CLK_FREQ) / delta_t)` to multiply before dividing. Remove `TIMESTAMP_MASK` if it has no remaining uses, and test intervals that straddle the timestamp boundary.

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

Dismiss ↗ | View ↗

21. The new encoder project lacks validated hardware records 📘
Description
The new encoder project documents test coverage and tool versions but does not provide the required
Validated HW & SW section with board revision, SDK version, and toolchain version entries.
Developers cannot identify the exact validated hardware and software baseline for this newly
introduced board-specific project.
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 board-specific project README lacks the required `Validated HW & SW` section and its exact board, revision, SDK, and toolchain records.

## Fix Focus Areas
- examples/pru_eqep/readme.md[1-16]

## Recommended Fix
Add a `Validated HW & SW` section documenting each validated board model and revision, the concrete SDK version, and the concrete compiler or IDE version used for validation.

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

Dismiss ↗ | View ↗

22. Assembly mnemonics use mixed casing 📘
Description
The new assembly file predominantly uses lowercase mnemonics but introduces uppercase SET and
LSL instructions. These changed instructions create a casing convention different from the
surrounding firmware.
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 assembly routine mixes lowercase instruction mnemonics with uppercase `SET` and `LSL`.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[46-180]

## Recommended Fix
Use lowercase spelling for the newly added `SET` and `LSL` instructions so all mnemonics follow the file's dominant casing convention.

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

Dismiss ↗ | View ↗

23. The new example lacks impact checks 📘
Description
The PR modifies source/firmware/pru_load_bin_copyright.h but the description only explains a merge
conflict and lists no consuming projects or build and test checks. Projects that include this shared
header therefore have no recorded validation in the PR.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A file under `source/` is modified, but the PR description does not identify affected projects or provide build and test evidence.

## Fix Focus Areas
- source/firmware/pru_load_bin_copyright.h[1-5]

## Recommended Fix
Identify all projects and binaries that include or link the modified header, list them in the PR impact analysis, and record the corresponding build or test commands and verifiable CI or test evidence.

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

Dismiss ↗ | View ↗

24. Assembly headers use disallowed extensions 📘
Description
The firmware includes memory.inc and macros.inc as PRU assembly headers. These included header
files use .inc extensions instead of the required .h or .hp extensions, so the new firmware
depends on non-compliant header names.
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 PRU firmware includes `memory.inc` and `macros.inc`, but PASM headers must use `.h` or `.hp` extensions.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[35-36]
- examples/pru_eqep/firmware/include/memory.inc[1-177]
- examples/pru_eqep/firmware/include/macros.inc[1-54]

## Recommended Fix
Rename the included PASM headers to `.h` or `.hp` files and update every include, makefile, and project reference to the new names.

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

Dismiss ↗ | View ↗

25. The clock constant lacks value rationale 📘
Description
PRU_CLK_FREQ defines 300000000 without documenting its units, source, or why that clock value is
valid for the target devices. A later maintainer changing the supported processor or clock
configuration cannot determine whether the value is a measured frequency, a hardware limit, or an
assumption.
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 `PRU_CLK_FREQ` constant has a domain-specific numeric value but only a generic macro comment, with no units or rationale for `300000000`.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[111-113]

## Recommended Fix
Add an adjacent comment stating that the value is the PRU clock frequency in hertz, identify the target-device or SDK source that establishes 300 MHz, and explain any assumptions made by the speed calculation.

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

Dismiss ↗ | View ↗

26. The encoder loop can run forever 📘
Description
EQEP_diagnostic_main uses while (1) around the channel polling work without an iteration limit,
timeout, or documented cancellation marker. Once the task starts, it continues polling indefinitely
unless the surrounding runtime forcibly stops it.
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 main polling loop is intentionally long-running but has no explicit cancellation signal or `INTENTIONALLY_UNBOUNDED_LOOP` marker, so its termination behavior is undocumented.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[311-313]

## Recommended Fix
Add and check a clear task-stop or shutdown flag inside the loop, or add the required intentional-unbounded-loop marker if indefinite execution is the design. Ensure the loop checks the signal on every iteration and exits cleanly.

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

Dismiss ↗ | View ↗

27. Register aliases bypass structured access 📘
Description
The new memory header binds PRU registers directly with .asg, including r0, r1, r17, and
other raw register names. Every firmware instruction including this header can use those aliases
outside a .struct and .sassign layout, bypassing the required structured register access model.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`memory.inc` introduces direct `.asg` aliases from symbolic names to PRU registers, which the compliance rule prohibits for register access.

## Fix Focus Areas
- examples/pru_eqep/firmware/include/memory.inc[33-49]
- examples/pru_eqep/firmware/main.asm[44-180]

## Recommended Fix
Define the register layout in a `.struct` block, bind it with `.sassign`, and update all firmware references to use the resulting struct-based symbols instead of direct `.asg` register aliases.

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

Dismiss ↗ | View ↗

28. Buffer limits can change silently 📘
Description
memory.inc defines MAX_BUFFER and the firmware loads it into buffer_size without an assembler
assertion that the buffer fits the selected data-memory region. A future constant or memory-layout
change can therefore assemble successfully while making the wrap and write logic operate outside the
intended region.
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 encoder buffer size is defined as a compile-time constant, but no `.if` and `.emsg` check verifies that it fits the selected data-memory region.

## Fix Focus Areas
- examples/pru_eqep/firmware/include/memory.inc[64-73]
- examples/pru_eqep/firmware/main.asm[46-49]
- examples/pru_eqep/firmware/main.asm[103-112]

## Recommended Fix
Define the applicable data-memory base and size constants, then add assembler-time `.if` checks with clear `.emsg` diagnostics proving that `MAX_BUFFER` and each configured offset remain within the available region.

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

Dismiss ↗ | View ↗

29. PRU register usage is undocumented 📘
Description
The new assembly entry point main writes and reads multiple registers without a nearby
register-usage block listing inputs, outputs, clobbers, or preserved registers. Future callers or
maintainers cannot determine which register state this firmware entry point is allowed to modify.
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 PRU assembly entry point uses many registers but does not document its register contract.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[44-48]

## Recommended Fix
Add an immediately preceding register-usage comment block listing input registers, output registers, scratch/clobbered registers, and preserved registers or explicitly stating that none are preserved.

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

Dismiss ↗ | View ↗

30. Encoder timing has no worst-case budget 📘
Description
main.asm describes the firmware as an incremental encoder interface with a maximum frequency but
provides no WCET or peak-cycle documentation for capture and its polling, counter, memory, and
branch paths. At the stated high-speed operating point, the absence of a numeric budget and path
assumptions leaves the timing requirement unverifiable and provides no update point when the
instruction sequence changes.
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 PRU assembly is described as supporting an encoder interface at up to 4 MHz, but its entry and capture paths have no explicit worst-case cycle documentation.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[31-35]
- examples/pru_eqep/firmware/main.asm[67-180]
- examples/pru_eqep/firmware/include/macros.inc[35-54]

## Recommended Fix
Add adjacent WCET or PEAK comments for the capture loop and each timing-critical block, including PRU clock frequency, worst-case branch and memory-access assumptions, counter-reset macro costs, and the maximum supported input rate.

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

Dismiss ↗ | View ↗

31. Assembly tabs violate source formatting 📘
Description
The new include file uses literal tab characters in register and constant definitions such as
PRU_CTRL_CONST and PRU_CYCLCNT. The source linter will reject this .inc file unless those
separators are converted to spaces.
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 include file contains literal tab characters in changed register and constant definitions, violating the repository's source indentation requirement.

## Fix Focus Areas
- examples/pru_eqep/firmware/include/memory.inc[67-71]

## Recommended Fix
Replace every tab character in the `.inc` file with spaces and run the repository whitespace check across all changed assembly sources.

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

Dismiss ↗ | View ↗

32. Firmware addresses lack a documented map 📘
Description
memory.inc introduces absolute data-memory bases, offsets, register constants, and per-core memory
regions without documenting start/end ranges and the purpose of each region. The comments identify
individual constants such as DMEM0_BASE and CH_POS_OFFSET, but they do not provide an
authoritative layout covering the regions used by main.asm.
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 PRU assembly memory definitions use absolute bases and offsets without a section-level address map describing each region's range and purpose.

## Fix Focus Areas
- examples/pru_eqep/firmware/include/memory.inc[31-50]
- examples/pru_eqep/firmware/include/memory.inc[64-161]
- examples/pru_eqep/firmware/main.asm[47-50]

## Recommended Fix
Add an authoritative memory-layout comment block or link to a documented linker layout, listing each per-core data-memory range, LUT, write-pointer area, position counter, phase-error counter, and ring buffer with its start, size/end, and purpose.

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

Dismiss ↗ | View ↗


View low (3)
Informational
33. Unused real-time speed helper is wrong 🐞
Description
EQEP_get_speed_RT reads one absolute ring-buffer timestamp into delta_t and computes
PRU_CLK_FREQ / delta_t as if it were an interval. It never subtracts a previous timestamp, and it
divides by zero when that word is 0. Nothing calls it, and EQEP_Get_position_ABZ is also never
called, so anyone who later wires these declared, public-looking helpers in gets wrong speeds or a
fault.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`EQEP_get_speed_RT` treats an absolute timestamp as a time delta and does not guard against division by zero. Neither it nor `EQEP_Get_position_ABZ` is called anywhere.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[115-118]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[525-564]

## Recommended Fix
Delete both unused functions and their prototypes. If they need to stay, rewrite `EQEP_get_speed_RT` to subtract the previous edge's timestamp and to check for a zero delta.

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

Dismiss ↗ | View ↗

34. eQEP readme points to files that don't exist 🐞
Description
The new readme repeatedly sends readers to TESTING.md ('same folder as this readme') for the test
matrix and pending cases, and to eqep_diagnostic.c for the interrupt-mode variant and its ISR
pattern. Neither file is in examples/pru_eqep/, so anyone trying to check test status or move to
interrupt mode as instructed has nowhere to look.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
examples/pru_eqep/readme.md refers to TESTING.md and eqep_diagnostic.c, but neither file exists in the repository.

## Fix Focus Areas
- examples/pru_eqep/readme.md[5-16]
- examples/pru_eqep/readme.md[127-127]
- examples/pru_eqep/readme.md[158-181]

## Recommended Fix
Either commit TESTING.md and eqep_diagnostic.c into examples/pru_eqep/, or rewrite these sections so they no longer point to files that aren't shipped (for example, inline the test summary and describe the interrupt-mode approach without linking to a missing source file).

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

Dismiss ↗ | View ↗

35. Source comments retain forbidden abbreviation 📘
Description
The new C source comment uses e.g. while explaining the wraparound example in the position-count
logic. This modified first-party source text violates the requirement to spell the abbreviation as
for example.
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 added source comment contains the abbreviation `e.g.`.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[359-363]

## Recommended Fix
Replace `e.g.` with `for example` while preserving the explanation of the unsigned counter wraparound.

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

Dismiss ↗ | View ↗


Comment on lines +35 to +36
.include "memory.inc"
.include "macros.inc"

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

7. Assembly headers use disallowed extensions 📘 Rule violation § Compliance

The firmware includes memory.inc and macros.inc as PRU assembly headers. These included header
files use .inc extensions instead of the required .h or .hp extensions, so the new firmware
depends on non-compliant header names.
Agent Prompt
## Issue description
The PRU firmware includes `memory.inc` and `macros.inc`, but PASM headers must use `.h` or `.hp` extensions.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[35-36]
- examples/pru_eqep/firmware/include/memory.inc[1-177]
- examples/pru_eqep/firmware/include/macros.inc[1-54]

## Recommended Fix
Rename the included PASM headers to `.h` or `.hp` files and update every include, makefile, and project reference to the new names.

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

Dismiss ↗ | View ↗

Comment on lines +33 to +40
.asg r0, scratch
.asg r1, scratch2
.asg r17.b0, curr_gpi_sample ; Current GPI state after masking
.asg r17.b1, A_B_Z_edge ; Edge detection for A,B,Z signals
.asg r18, curr_ts ; Timestamp counter
.asg r19.b0, edge ; Edge detection
.asg r20.b0, prev_sample ; Previous state of A,B,Z signals
.asg r21, time_stamp ; Time stamp counter

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

25. Register aliases bypass structured access 📘 Rule violation ≡ Correctness

The new memory header binds PRU registers directly with .asg, including r0, r1, r17, and
other raw register names. Every firmware instruction including this header can use those aliases
outside a .struct and .sassign layout, bypassing the required structured register access model.
Agent Prompt
## Issue description
`memory.inc` introduces direct `.asg` aliases from symbolic names to PRU registers, which the compliance rule prohibits for register access.

## Fix Focus Areas
- examples/pru_eqep/firmware/include/memory.inc[33-49]
- examples/pru_eqep/firmware/main.asm[44-180]

## Recommended Fix
Define the register layout in a `.struct` block, bind it with `.sassign`, and update all firmware references to use the resulting struct-based symbols instead of direct `.asg` register aliases.

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

Dismiss ↗ | View ↗

Comment on lines +1 to +3
/*
* Copyright (C) 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.

Remediation recommended

8. Encoder source lacks its filename header 📘 Rule violation ✧ Quality

The new pru_eqep_example.c starts with a copyright block and then includes headers without a
comment containing the actual filename. A maintainer or automated source audit cannot identify the
file from the required first-line filename header.
Agent Prompt
## Issue description
The new C source file has no leading comment that explicitly contains its filename before the includes and declarations.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[1-3]

## Recommended Fix
Add a comment containing `pru_eqep_example.c` before the code and includes, while preserving the existing copyright block.

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

Dismiss ↗ | View ↗

Comment on lines +41 to +44
.global main
.sect ".text"

main:

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

9. The firmware entry point breaks naming style 📘 Rule violation ✧ Quality

The assembly exports main and defines the same lowercase symbol as its entry point. Because the
symbol is globally visible and callable, it does not use the required FN_ prefix.
Agent Prompt
## Issue description
The globally exported assembly entry point is named `main`, which does not follow the required `FN_` prefix convention.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[41-44]
- examples/pru_eqep/firmware/linker.cmd[1-90]

## Recommended Fix
Rename the entry point to an `FN_`-prefixed symbol and update linker, project, and any host-side references consistently.

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

Dismiss ↗ | View ↗

Comment on lines +39 to +46
.retain
.retainrefs
.global main
.sect ".text"

main:
; Initialize registers
zero &r0, 116 ; Clear registers

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

10. The firmware entry point lacks boundaries 📘 Rule violation ≡ Correctness

The globally exported main routine begins at main: without a preceding .asmfunc and has no
matching .endasmfunc before the file ends. The assembler and tooling therefore cannot recognize
the function boundary required for this callable routine.
Agent Prompt
## Issue description
The exported assembly routine is implemented as a bare label and instruction stream without `.asmfunc` and `.endasmfunc` markers.

## Fix Focus Areas
- examples/pru_eqep/firmware/main.asm[39-46]
- examples/pru_eqep/firmware/main.asm[176-180]

## Recommended Fix
Place `.asmfunc` immediately before the renamed function label and add `.endasmfunc` after the routine's final instruction.

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

Dismiss ↗ | View ↗

Comment on lines +39 to +42
-I${WORKSPACE_LOC}/pru_eqep_am243x-lp_icss_g0_pru0_fw_ti-pru-cgt
-I${WORKSPACE_LOC}/pru_eqep_am243x-lp_icss_g0_pru1_fw_ti-pru-cgt
-I${WORKSPACE_LOC}/pru_eqep_am243x-lp_icss_g0_rtu_pru0_fw_ti-pru-cgt
-I${WORKSPACE_LOC}/pru_eqep_am243x-lp_icss_g0_rtu_pru1_fw_ti-pru-cgt

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

22. Fresh host-only ide builds lack firmware 🐞 Bug ≡ Correctness

The MCU+ example.projectspec adds include paths for six firmware projects but does not generate or
declare dependencies on their firmware headers. A fresh import and build of the host project alone
encounters its unconditional *_load_bin.h includes before any PRU post-build step has produced
those files.
Agent Prompt
## Issue description
The host IDE project consumes generated firmware headers without arranging for their producers to build first.
## Fix Focus Areas
- examples/pru_eqep/mcuplus/am243x-lp/r5fss0-0_freertos/ti-arm-clang/example.projectspec[39-44]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[45-50]
## Recommended Fix
Add explicit firmware-project build dependencies or another reproducible header-generation step for fresh host IDE builds.

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

Dismiss ↗ | View ↗

Comment on lines +421 to +430
ABZHandle[channel]->prev_ts = HW_RD_REG32(ABZHandle[channel]->read_ptr) & TIMESTAMP_MASK;
ABZHandle[channel]->cur_ts = HW_RD_REG32(ABZHandle[channel]->write_ptr) & TIMESTAMP_MASK;

// Calculate speed and position
if (ABZHandle[channel]->read_ptr_offset > ABZHandle[channel]->write_ptr_offset)
{
// Calculate delta time and edges
if (ABZHandle[channel]->prev_ts > ABZHandle[channel]->cur_ts)
ABZHandle[channel]->delta_t = TIMESTAMP_MASK - ABZHandle[channel]->prev_ts + ABZHandle[channel]->cur_ts;
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.

Remediation recommended

23. Encoder speed is wrong for slow motion 🐞 Bug ≡ Correctness

EQEP_Get_Speed_ABZ masks the PRU’s 32-bit edge timestamps to 24 bits, calculates wrapped intervals
one cycle short, and divides PRU_CLK_FREQ before multiplying by the edge count. When the four-edge
interval exceeds the 24-bit wrap period of about 56 ms, delta_t aliases and can produce an
inflated speed or a zero divisor; intervals crossing that boundary are also undercounted by one
cycle, while division-first arithmetic further truncates the result.
Agent Prompt
## Issue description
`EQEP_Get_Speed_ABZ` discards the upper eight bits of the PRU’s 32-bit timestamps, so intervals longer than about 56 ms alias. Its wrap calculation also undercounts by one cycle, a zero `delta_t` is not guarded against, and division before multiplication truncates the speed calculation.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[413-464]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[93-96]

## Recommended Fix
In both speed paths, read timestamps without masking and calculate `delta_t = cur_ts - prev_ts` using `uint32_t` arithmetic, which handles a 32-bit wrap without a separate branch or wrap-modulus expression. Skip the speed update or set speed to zero when `delta_t == 0`. Calculate speed as `(uint32_t)(((uint64_t)edges * PRU_CLK_FREQ) / delta_t)` to multiply before dividing. Remove `TIMESTAMP_MASK` if it has no remaining uses, and test intervals that straddle the timestamp boundary.

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

Dismiss ↗ | View ↗

Comment on lines +64 to +74
CT_UART.FCR_bit.FIFOEN = 1;

/* Enable FIFOs */
CT_UART.FCR_bit.DMAMODE1 = 1;
/* RXFIFTL = 0x0 = 1-byte RX FIFO trigger */
/* Alternative: 8-byte RX FIFO trigger */
// CT_UART.FCR_bit.RXFIFTL = 0x2;

/* flush the FIFOs */
CT_UART.FCR_bit.TXCLR = 1;
CT_UART.FCR_bit.RXCLR = 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.

Remediation recommended

24. Uart fifo setup clobbers itself 🐞 Bug ≡ Correctness

The loopback firmware sets CT_UART.FCR_bit.FIFOEN, DMAMODE1, TXCLR and RXCLR as separate
bitfield writes, and each one compiles to a read-modify-write. FCR is write-only and shares its
address with the read-only IIR, so each write is built from IIR status bits. Once an interrupt is
pending (e.g. THR-empty, which INT_EN = 0x7 enables), IIR bit 0 reads 0 and the next write clears
FIFOEN. The IIR FIFO status bits 7:6 also get written back as RXFIFTL=3, so the FIFO and trigger
configuration ends up different from what the code and comments describe.
Agent Prompt
## Issue description
The UART loopback firmware configures FCR through per-bit read-modify-write accesses. FCR is write-only and aliases the read-only IIR, so those reads return IIR status bits and corrupt the configuration that gets written back.

## Fix Focus Areas
- academy/uart/uart_loopback/firmware/main.c[61-74]

## Recommended Fix
Replace the bitfield assignments with full-register writes. First write `CT_UART.FCR = 0x1;` to enable the FIFO, then `CT_UART.FCR = 0x1 | 0x2 | 0x4 | 0x8;` (FIFOEN | RXCLR | TXCLR | DMAMODE1, RXFIFTL=0). Leave the alternative trigger-level option in the comment as a full-register value.

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

Dismiss ↗ | View ↗


## 1. Testing Done

The PRU eQEP implementation has been bench-validated against a real hardware eQEP peripheral (AM263x-LP, `eqep_position_speed` example) and a physical incremental encoder. Full test matrix, pass/fail status, and raw findings are tracked in `TESTING.md` (same folder as this readme). Summary of what has been run:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Informational

33. Eqep readme points to files that don't exist 🐞 Bug ⚙ Maintainability

The new readme repeatedly sends readers to TESTING.md ('same folder as this readme') for the test
matrix and pending cases, and to eqep_diagnostic.c for the interrupt-mode variant and its ISR
pattern. Neither file is in examples/pru_eqep/, so anyone trying to check test status or move to
interrupt mode as instructed has nowhere to look.
Agent Prompt
## Issue description
examples/pru_eqep/readme.md refers to TESTING.md and eqep_diagnostic.c, but neither file exists in the repository.

## Fix Focus Areas
- examples/pru_eqep/readme.md[5-16]
- examples/pru_eqep/readme.md[127-127]
- examples/pru_eqep/readme.md[158-181]

## Recommended Fix
Either commit TESTING.md and eqep_diagnostic.c into examples/pru_eqep/, or rewrite these sections so they no longer point to files that aren't shipped (for example, inline the test summary and describe the interrupt-mode approach without linking to a missing source file).

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

Dismiss ↗ | View ↗

Comment on lines +558 to +561
ABZHandle[channel]->write_ptr_offset = HW_RD_REG32(ABZHandle[channel]->baseMemAddr1) & WRITE_PTR_OFFSET_MASK;
ABZHandle[channel]->write_ptr = (ABZHandle[channel]->baseMemAddr0) + (ABZHandle[channel]->write_ptr_offset) / 4;
ABZHandle[channel]->delta_t = HW_RD_REG32(ABZHandle[channel]->write_ptr) & TIMESTAMP_MASK;
ABZHandle[channel]->speed = ((PRU_CLK_FREQ) / (ABZHandle[channel]->delta_t));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Informational

34. Unused real-time speed helper is wrong 🐞 Bug ⚙ Maintainability

EQEP_get_speed_RT reads one absolute ring-buffer timestamp into delta_t and computes
PRU_CLK_FREQ / delta_t as if it were an interval. It never subtracts a previous timestamp, and it
divides by zero when that word is 0. Nothing calls it, and EQEP_Get_position_ABZ is also never
called, so anyone who later wires these declared, public-looking helpers in gets wrong speeds or a
fault.
Agent Prompt
## Issue description
`EQEP_get_speed_RT` treats an absolute timestamp as a time delta and does not guard against division by zero. Neither it nor `EQEP_Get_position_ABZ` is called anywhere.

## Fix Focus Areas
- examples/pru_eqep/mcuplus/pru_eqep_example.c[115-118]
- examples/pru_eqep/mcuplus/pru_eqep_example.c[525-564]

## Recommended Fix
Delete both unused functions and their prototypes. If they need to stay, rewrite `EQEP_get_speed_RT` to subtract the previous edge's timestamp and to check for a zero delta.

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

Dismiss ↗ | View ↗

@pratheesh

Copy link
Copy Markdown
Contributor Author

Triage of the Qodo review (34 findings): no changes on this PR.

This PR only merges main into a0502729_PRU_I2C. The one change of its own is the conflict resolution in examples/makefile, which keeps both pru_eqep (from main) and pru_i2c (from this branch) in SUBDIRS.

32 of the 34 findings are on files that arrive from main unchanged (git diff main-parent..d4ce10d8 is empty for them): examples/pru_eqep/ (29), academy/uart/uart_loopback/firmware/main.c and source/firmware/pru_load_bin_copyright.h. The other two anchor on examples/makefile line 6 but ask for pru_eqep readme and validation records, which is also main's content.

Fixing main's code here would bury those changes in a merge PR, so they belong in a separate PR against main if the eQEP example owners want them.

@pratheesh-ti
pratheesh-ti merged commit 533f890 into TexasInstruments:a0502729_PRU_I2C Nov 23, 2026
14 checks passed
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.

8 participants