Repository navigation
examples: pru_i2c: fix PRU1/dual-core IEP use, read ACK and SDA control (for #137) #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
pratheesh
wants to merge
15
commits into
TexasInstruments:main
from
pratheesh:fix/pr137-pru-i2c-review
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9a16e00
am261x: pru i2c: Add PRU I2C Master firmware and R5F example
achala-ti d379500
examples: pru_i2c: wire firmware into top-level build (fixes am261x CI)
pratheesh 2feaaf1
examples: pru_i2c: fix per-core IEP/scratchpad use, read ACK and SDA …
pratheesh 56aa654
examples: pru_i2c: make IEP increments multiples of DEFAULT_INC
pratheesh 1a0ad13
examples: pru_i2c: regenerate pru0/pru1_load_bin.h
pratheesh b65a54e
examples: pru_i2c: answer every command, fix bus recovery, release id…
pratheesh 227de73
examples: pru_i2c: regenerate pru0/pru1_load_bin.h
pratheesh 146ccec
examples: pru_i2c: document IEP/context macros, mark scheduler wait
pratheesh 6e43662
examples: pru_i2c: align SDA direction macro spacing with best_practices
pratheesh a0ca016
examples: pru_i2c: leave SDA released after an address or data NACK
pratheesh 466c7af
examples: pru_i2c: derive the IEP compare increment from the frequenc…
pratheesh e161b91
examples: pru_i2c: document the shared-IEP start-up ordering constraint
pratheesh 766798b
examples: pru_i2c: regenerate pru0/pru1_load_bin.h
pratheesh 9b8099e
examples: pru_i2c: keep a host-written IEP compare increment
pratheesh e8f3a04
Merge main into fix/pr137-pru-i2c-review
pratheesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
examples/pru_i2c/firmware/am261x-lp/icss_m0_pru0_fw/ti-pru-cgt/example.projectspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| " | ||
|
|
||
| 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> |
43 changes: 43 additions & 0 deletions
43
examples/pru_i2c/firmware/am261x-lp/icss_m0_pru0_fw/ti-pru-cgt/linker.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
48 changes: 48 additions & 0 deletions
48
examples/pru_i2c/firmware/am261x-lp/icss_m0_pru0_fw/ti-pru-cgt/makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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_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 := -DPRU0 -DSLICE0 -DSOC_AM261X | ||
|
|
||
| # Libraries | ||
| # see --library in 'PRU Optimizing C/C++ Compiler User's Guide' | ||
| LIBS := | ||
|
|
||
81 changes: 81 additions & 0 deletions
81
examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/example.projectspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
43 changes: 43 additions & 0 deletions
43
examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/linker.cmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| 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 | ||
| } |
48 changes: 48 additions & 0 deletions
48
examples/pru_i2c/firmware/am261x-lp/icss_m0_pru1_fw/ti-pru-cgt/makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 := -DPRU1 -DSLICE1 -DSOC_AM261X | ||
|
|
||
| # Libraries | ||
| # see --library in 'PRU Optimizing C/C++ Compiler User's Guide' | ||
| LIBS := | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.