Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include ../imports.mak
SUBDIRS := \
custom_frequency_generator empty empty_c \
fft/split_radix_fft_4k_single_core fft/split_radix_fft_post_processing \
LCD_interface logic_scope pru_emif pru_eqep spi_loopback \
LCD_interface logic_scope pru_emif pru_eqep pru_i2c spi_loopback \

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

31. Examples index misses the new pru i2c project 📘 Rule violation § Compliance

The ## Projects list in examples/readme.md has no pru_i2c entry, although this PR adds the
examples/pru_i2c project directory and wires it into examples/makefile. Users browsing the
examples index will not discover the project, and the required one-to-two-sentence description is
absent.
Agent Prompt
Issue description
The new `pru_i2c` example project is not listed under `## Projects` in `examples/readme.md`, so the section-level index is incomplete.

Fix Focus Areas
- examples/readme.md[1-40]
- examples/makefile[6-6]

Recommended Fix
Add a `pru_i2c` list item under `## Projects` in `examples/readme.md`, following the existing format (project name on one line, then a `*` bullet with a one-to-two sentence description of the PRU I2C master firmware and R5F example).

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

Dismiss ↗ | View ↗

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

32. Portability table omits the new project 📘 Rule violation § Compliance

The Supported processors per-project table in examples/readme.md has no row for pru_i2c, even
though this PR adds the project and targets am261x. The table is the only place that tells readers
which processors the project was validated or ported to, and it stays silent for this project.
Agent Prompt
Issue description
The `Supported processors per-project` table in `examples/readme.md` lacks a row for the new `pru_i2c` project, so its per-processor status is undocumented.

Fix Focus Areas
- examples/readme.md[40-94]
- examples/makefile[6-6]

Recommended Fix
Add a `pru_i2c` row to the table with allowed status values for each processor column (for example `Y` for am261x and `Yport` or `Npru` for others as validated), and add `<!-- FIXME: ... -->` comments next to any cell whose compatibility is not yet verified.

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

Dismiss ↗ | View ↗

fir multicore_scheduler rpmsg_echo_linux

# "make" or "make all" builds projects that match $(DEVICE) set in imports.mak
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This example.projectspec file is for PRU projects written in assembly -->
<projectSpec>
<applicability>
<when>
<context
deviceFamily="PRU"
deviceId="AM261x"
/>
</when>
</applicability>

<project
title="PRU I2C"
name = "pru_i2c_am261x-lp_icss_m0_pru0_fw_ti-pru-cgt"
products="com.ti.OPEN_PRU"
configurations="
Release,
Debug,
"
connection="TIXDS110_Connection.xml"
toolChain="TI"
cgtVersion="2.3.3"
device="AM261x"
deviceCore="ICSS_M0_PRU_0"
ignoreDefaultDeviceSettings="true"
ignoreDefaultCCSSettings="true"
endianness="little"
outputFormat="ELF"
outputType="executable"

compilerBuildOptions="
-I${CG_TOOL_ROOT}/include
-I${OPEN_PRU_PATH}/source
-I${OPEN_PRU_PATH}/source/firmware/common
-I${OPEN_PRU_PATH}/source/include
-I${OPEN_PRU_PATH}/source/include/am261x
-I${OPEN_PRU_PATH}/examples/pru_i2c/firmware
-DPRU0
-DSLICE0
-v3
-DSOC_AM261X
-O2
"
linkerBuildOptions="
-m=pru_i2c.${ConfigName}.map
--disable_auto_rts
--entry_point=main
--diag_suppress=10063-D
--warn_sections
--reread_libs
--diag_warning=225
--ram_model
"

postBuildStep="
$(CG_TOOL_ROOT)/bin/hexpru --diag_wrap=off --array --array:name_prefix=PRU0Firmware -o ../pru0_load_bin.h ${BuildArtifactFileBaseName}.out;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. postbuildstep line not wrapped 📘 Rule violation ⚙ Maintainability

The postBuildStep command is added as a single long line rather than being wrapped/split using a
supported continuation mechanism. This reduces readability and violates the project configuration
line-wrapping requirement.
Agent Prompt
## Issue description
A very long `postBuildStep` command is written on a single line in the project configuration instead of being wrapped/split using a supported continuation mechanism.

## Issue Context
PR Compliance ID 22 expects long command attributes (such as post-build steps) to be wrapped/split to meet repository line-length expectations and keep project specs readable.

## Fix Focus Areas
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru0_fw/ti-pru-cgt/example.projectspec[56-58]
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/example.projectspec[56-58]

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

"

description="A PRU I2C Master firmware project for AM261x PRU0">

<configuration name="Debug"
compilerBuildOptions="
-D_DEBUG_=1
"
linkerBuildOptions="
"
></configuration>
<configuration name="Release"
compilerBuildOptions="
"
linkerBuildOptions="
"
></configuration>
<pathVariable name="OPEN_PRU_PATH" path="${COM_TI_OPEN_PRU_INSTALL_DIR}" scope="project" />
<file path="../../../pru_i2c_main.asm" openOnCreation="false" excludeFromBuild="false" action="copy">
</file>
<file path="./linker.cmd" openOnCreation="false" excludeFromBuild="false" action="copy">
</file>
</project>
</projectSpec>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* AM261x_PRU0.cmd
*
* Example Linker command file for linking assembly programs built with the TI-PRU-CGT
* on AM261x PRU0 cores
*/

/* Specify the System Memory Map */
MEMORY
{
PAGE 0:
/* 16 KB PRU Instruction RAM */
PRU_IMEM : org = 0x00000000 len = 0x00004000

PAGE 1:
/* Data RAMs */
/* 8 KB PRU Data RAM 0 */
PRU0_DMEM_0 : org = 0x00000000 len = 0x00002000
/* 8 KB PRU Data RAM 1 */
PRU1_DMEM_1 : org = 0x00002000 len = 0x00002000

PAGE 2:
/* C28 needs to be programmed to point to SHAREDMEM, default is 0 */
/* 32 KB PRU Shared RAM */
PRU_SHAREDMEM : org = 0x00010000 len = 0x00008000
}

/* Specify the sections allocation into memory */
SECTIONS {

.text > PRU_IMEM, PAGE 0
.stack > PRU0_DMEM_0, PAGE 1
.bss > PRU0_DMEM_0, PAGE 1
.cio > PRU0_DMEM_0, PAGE 1
.data > PRU0_DMEM_0, PAGE 1
.switch > PRU0_DMEM_0, PAGE 1
.sysmem > PRU0_DMEM_0, PAGE 1
.cinit > PRU0_DMEM_0, PAGE 1
.rodata > PRU0_DMEM_0, PAGE 1
.rofardata > PRU0_DMEM_0, PAGE 1
.farbss > PRU0_DMEM_0, PAGE 1
.fardata > PRU0_DMEM_0, PAGE 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export OPEN_PRU_PATH?=$(abspath ../../../../../..)
include $(OPEN_PRU_PATH)/imports.mak
Comment on lines +1 to +2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. open_pru_path uses fixed abspath 📘 Rule violation ☼ Reliability

The new makefiles compute OPEN_PRU_PATH using a fixed relative $(abspath ../../../../../..)
which can break when invoked from a different working directory. This violates the requirement to
derive the repo root from the current makefile location for reliable includes.
Agent Prompt
## Issue description
Makefiles set `OPEN_PRU_PATH` using `$(abspath ../../../../../..)` which depends on the directory `make` is invoked from, causing fragile includes.

## Issue Context
The compliance requirement asks to derive the repository root relative to the current makefile path (e.g., using `$(dir $(lastword $(MAKEFILE_LIST)))`).

## Fix Focus Areas
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru0_fw/ti-pru-cgt/makefile[1-2]
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/makefile[1-2]
- examples/pru_i2c/example/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile[5-7]

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


# Define build outputs
OUTPUT_NAME := pru_i2c_am261x-lp_icss_m0_pru0_fw

# MCU+ projects: rename & move hex array output
MCU_HEX_NAME := pru0_load_bin.h
HEX_ARRAY_PREFIX := PRU0Firmware
MCU_HEX_PATH := $(OPEN_PRU_PATH)/examples/pru_i2c/firmware/am261x-lp/$(MCU_HEX_NAME)

# which directories to search for assembly & C source files?
FILES_PATH := .. ../../.. .

# Linker command file
COMMAND_FILES := linker.cmd

# Silicon version (3: PRUSS, PRU-ICSS; 4: PRU_ICSSG)
PRU_VERSION := 3
EXPECTED_DEVICE := am261x

# Default values are defined in pru_rules.mak:
# - include paths (INCLUDE)
# - compiler flags (CFLAGS)
# - linker flags (LFLAGS)

# Optional:
# Pre-define here to override default value
# OPT_LEVEL, STACK_SIZE, HEAP_SIZE, or ENTRY_POINT

# pru_rules.mak has shared settings for all PRU/RTU/TX_PRU core makefiles
include $(OPEN_PRU_PATH)/pru_rules.mak

# Optional:
# Append values to INCLUDE, CFLAGS, or LFLAGS here.
# Values can be appended like this:
# INCLUDE += --include_path=<value>

# Defines (pass instance specific definitions to the program)
# see --define or -D in 'PRU Optimizing C/C++ Compiler User's Guide'
# For example, to define PRU0, ICSSG1, SOC_AM243X, and set _DEBUG_=1:
# -DPRU0 -DICSSG1 --define=SOC_AM243X -D_DEBUG_=1
DFLAGS :=

Comment on lines +39 to +44

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Makefiles omit pru defines 🐞 Bug ≡ Correctness

The new ti-pru-cgt makefiles leave DFLAGS empty even though the firmware uses
$defined("PRU0")/$defined("PRU1") to select core-specific behavior, so make builds will not set
these symbols unless the caller injects them externally.
Agent Prompt
### Issue description
The PRU I2C firmware uses `$defined("PRU0")` / `$defined("PRU1")` conditionals to choose PRU-core-specific behavior (IEP status bits, compare registers, interrupt bits). However, both new makefiles set `DFLAGS :=` empty, and the shared build rules only pass whatever `DFLAGS` contains to `clpru`.

### Issue Context
- CCS projects pass `-DPRU0`/`-DPRU1`, but the provided makefiles currently do not.
- `pru_rules.mak` compiles with `$(DFLAGS)` as provided by the core makefile.

### Fix Focus Areas
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru0_fw/ti-pru-cgt/makefile[39-44]
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/makefile[39-44]
- pru_rules.mak[126-130]

### Suggested change
- In the PRU0 makefile, set:
  - `DFLAGS := -DPRU0 -DSLICE0`
- In the PRU1 makefile, set:
  - `DFLAGS := -DPRU1 -DSLICE1`
- If other symbols are required to match CCS builds, add them here as well, but at minimum the PRU0/PRU1 defines should be present so the firmware compiles with the intended core-specific branches.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Make-built firmware never starts i²c work 🐞 Bug ≡ Correctness

Both firmware makefiles leave DFLAGS empty, so assembly guarded by PRU0 or PRU1 omits the IEP
compare-event enable code. An AM261x make build produces firmware images, but neither image enables
the periodic event that advances its I²C state machine.
Agent Prompt
## Issue description
Make-built images omit the core-specific scheduler code because both `DFLAGS` values are empty.
## Fix Focus Areas
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru0_fw/ti-pru-cgt/makefile[44-44]
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/makefile[44-44]
## Recommended Fix
Set `-DPRU0` and `-DPRU1` respectively, consistent with the two CCS projects, and verify both make-built images.

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

Dismiss ↗ | View ↗

# Libraries
# see --library in 'PRU Optimizing C/C++ Compiler User's Guide'
LIBS :=

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This example.projectspec file is for PRU projects written in assembly -->
<projectSpec>
<applicability>
<when>
<context
deviceFamily="PRU"
deviceId="AM261x"
/>
</when>
</applicability>

<project
title="PRU I2C"
name = "pru_i2c_am261x-lp_icss_m0_pru1_fw_ti-pru-cgt"
products="com.ti.OPEN_PRU"
configurations="
Release,
Debug,
"
connection="TIXDS110_Connection.xml"
toolChain="TI"
cgtVersion="2.3.3"
device="AM261x"
deviceCore="ICSS_M0_PRU_1"
ignoreDefaultDeviceSettings="true"
ignoreDefaultCCSSettings="true"
endianness="little"
outputFormat="ELF"
outputType="executable"

compilerBuildOptions="
-I${CG_TOOL_ROOT}/include
-I${OPEN_PRU_PATH}/source
-I${OPEN_PRU_PATH}/source/firmware/common
-I${OPEN_PRU_PATH}/source/include
-I${OPEN_PRU_PATH}/source/include/am261x
-I${OPEN_PRU_PATH}/examples/pru_i2c/firmware
-DPRU1
-DSLICE1
-v3
-DSOC_AM261X
-O2
"
linkerBuildOptions="
-m=pru_i2c.${ConfigName}.map
--disable_auto_rts
--entry_point=main
--diag_suppress=10063-D
--warn_sections
--reread_libs
--diag_warning=225
--ram_model
"

postBuildStep="
$(CG_TOOL_ROOT)/bin/hexpru --diag_wrap=off --array --array:name_prefix=PRU1Firmware -o ../pru1_load_bin.h ${BuildArtifactFileBaseName}.out;
"

description="A PRU I2C Master firmware project for AM261x PRU1">

<configuration name="Debug"
compilerBuildOptions="
-D_DEBUG_=1
"
linkerBuildOptions="
"
></configuration>
<configuration name="Release"
compilerBuildOptions="
"
linkerBuildOptions="
"
></configuration>
<pathVariable name="OPEN_PRU_PATH" path="${COM_TI_OPEN_PRU_INSTALL_DIR}" scope="project" />
<file path="../../../pru_i2c_main.asm" openOnCreation="false" excludeFromBuild="false" action="copy">
</file>
<file path="./linker.cmd" openOnCreation="false" excludeFromBuild="false" action="copy">
</file>
</project>
</projectSpec>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* AM261x_PRU1.cmd
*
* Example Linker command file for linking assembly programs built with the TI-PRU-CGT
* on AM261x PRU1 cores
*/

/* Specify the System Memory Map */
MEMORY
{
PAGE 0:
/* 16 KB PRU Instruction RAM */
PRU_IMEM : org = 0x00000000 len = 0x00004000

PAGE 1:
/* Data RAMs */
/* 8 KB PRU Data RAM 0 */
PRU0_DMEM_0 : org = 0x00000000 len = 0x00002000
/* 8 KB PRU Data RAM 1 */
PRU1_DMEM_1 : org = 0x00002000 len = 0x00002000
Comment on lines +15 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Pru1 linker dmem swapped 🐞 Bug ≡ Correctness

The PRU1 linker.cmd maps PRU0_DMEM_0 at 0x0 and PRU1_DMEM_1 at 0x2000, but PRU1 sections are
allocated into PRU1_DMEM_1, so PRU1 stack/BSS can end up in the wrong local RAM alias. This differs
from other AM261x PRU1 linker scripts in the repo (which place PRU1_DMEM_1 at 0x0), and can lead to
PRU1 firmware malfunction or memory corruption.
Agent Prompt
## Issue description
`examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/linker.cmd` uses the same DMEM origin layout as PRU0 (DMEM0 at 0x0, DMEM1 at 0x2000). For PRU1 builds, the repo’s existing AM261x PRU1 linker scripts map PRU1’s local DMEM (PRU1_DMEM_1) at 0x0 and PRU0_DMEM_0 at 0x2000.

This mismatch can cause PRU1 `.stack/.bss/.data/...` (allocated to `PRU1_DMEM_1`) to land in the wrong address range.

## Issue Context
The same-repo reference implementation for AM261x PRU1 (e.g., CRC firmware) shows the expected mapping.

## Fix Focus Areas
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/linker.cmd[15-21]

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


Comment on lines +20 to +21

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

37. The second core links data to wrong ram 🐞 Bug ≡ Correctness

The PRU1 linker script puts PRU1_DMEM_1 at 0x2000 and assigns its data and stack sections there.
Existing AM261x PRU1 linker scripts put local PRU1 data RAM at 0x0000, so sections linked by this
project use the other RAM window instead.
Agent Prompt
## Issue description
The PRU1 linker script reverses local and remote data-RAM addresses.
## Fix Focus Areas
- examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/linker.cmd[15-42]
## Recommended Fix
Map PRU1 local DMEM to zero and PRU0 remote DMEM to `0x2000`, as in the sibling AM261x PRU1 scripts, then inspect linked section addresses.

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

Dismiss ↗ | View ↗

PAGE 2:
/* C28 needs to be programmed to point to SHAREDMEM, default is 0 */
/* 32 KB PRU Shared RAM */
PRU_SHAREDMEM : org = 0x00010000 len = 0x00008000
}

/* Specify the sections allocation into memory */
SECTIONS {

.text > PRU_IMEM, PAGE 0
.stack > PRU1_DMEM_1, PAGE 1
.bss > PRU1_DMEM_1, PAGE 1
.cio > PRU1_DMEM_1, PAGE 1
.data > PRU1_DMEM_1, PAGE 1
.switch > PRU1_DMEM_1, PAGE 1
.sysmem > PRU1_DMEM_1, PAGE 1
.cinit > PRU1_DMEM_1, PAGE 1
.rodata > PRU1_DMEM_1, PAGE 1
.rofardata > PRU1_DMEM_1, PAGE 1
.farbss > PRU1_DMEM_1, PAGE 1
.fardata > PRU1_DMEM_1, PAGE 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export OPEN_PRU_PATH?=$(abspath ../../../../../..)
include $(OPEN_PRU_PATH)/imports.mak

# Define build outputs
OUTPUT_NAME := pru_i2c_am261x-lp_icss_m0_pru1_fw

# MCU+ projects: rename & move hex array output
MCU_HEX_NAME := pru1_load_bin.h
HEX_ARRAY_PREFIX := PRU1Firmware
MCU_HEX_PATH := $(OPEN_PRU_PATH)/examples/pru_i2c/firmware/am261x-lp/$(MCU_HEX_NAME)

# which directories to search for assembly & C source files?
FILES_PATH := .. ../../.. .

# Linker command file
COMMAND_FILES := linker.cmd

# Silicon version (3: PRUSS, PRU-ICSS; 4: PRU_ICSSG)
PRU_VERSION := 3
EXPECTED_DEVICE := am261x

# Default values are defined in pru_rules.mak:
# - include paths (INCLUDE)
# - compiler flags (CFLAGS)
# - linker flags (LFLAGS)

# Optional:
# Pre-define here to override default value
# OPT_LEVEL, STACK_SIZE, HEAP_SIZE, or ENTRY_POINT

# pru_rules.mak has shared settings for all PRU/RTU/TX_PRU core makefiles
include $(OPEN_PRU_PATH)/pru_rules.mak

# Optional:
# Append values to INCLUDE, CFLAGS, or LFLAGS here.
# Values can be appended like this:
# INCLUDE += --include_path=<value>

# Defines (pass instance specific definitions to the program)
# see --define or -D in 'PRU Optimizing C/C++ Compiler User's Guide'
# For example, to define PRU0, ICSSG1, SOC_AM243X, and set _DEBUG_=1:
# -DPRU0 -DICSSG1 --define=SOC_AM243X -D_DEBUG_=1
DFLAGS :=

# Libraries
# see --library in 'PRU Optimizing C/C++ Compiler User's Guide'
LIBS :=

Loading