Other Parts Discussed in Thread: SYSCONFIG, TMDSCNCD263P
Tool/software:
I have a small project which uses an R5 core to initialize a PRU core. The code that generated for the PRU core is created from a CCS project written in c-code. When this generated code is sent to the PRU from the R5, it does not run properly. The issue preventing proper operation is that the code generated for the PRU never initializes the stack pointer held at R2.
Dependancies:
- ti-cgt-pru_2.3.3
- ti-cgt-armllvm_4.0.0.LTS
- mcu_plus_sdk_am263px_10_01_00_31
- sysconfig_1.22.0
- TMDSCNCD263P - Sitara AM263Px Control Card
Basic build flow: The system level project (includes both the R5 and PRU core) can be built from the attached project files. The PRU core is built first, and it creates a header file from the c code which contains the hex version of the build artifacts. An assembly file is also saved for reference. The created header file is included (as part of the project configuration) in the the R5 build. When the R5 core runs, it initializes the PRU core and then transfers the instructions that were included from the header file.
It is not required to be able to debug the program, although debugging configurations and instructions are included in the files on how to replicate the problem on hardware. What can be seen is that the main.asm file created by the build of the PRU core has no instructions to initialize the value of the stack pointer, which should be held in R2. The first instructions generated are to decrement the stack pointer (standard operation when entering the main function).
Please note that I have 2 other E2E posts regarding this with the current remedy being to add an inline assembly command at the start of the main loop to force R2 to a correct value. This is a fragile and temporary workaround. The generated code should be initializing the value of R2 prior to entering the main function, but that is not happening.