Greg, thanks a bunch. It seems like page 89 of the user guide does the 
trick! I am not yet sure how to debug both PRUs at the same time, but I can 
write to the scratch pad from one PRU and read it back. 

example code:

void testScratchPad(){
    static unsigned int test = 0;
    test++;
    unsigned int* testPtr = &test;
     __xout(10, // Scratch pad bank 0
                  0, // base register 0
                  0, // remapping false
                  testPtr // object
     );
     unsigned int test2;
     unsigned int* test2Ptr = &test2;
     __xin(10, 0, 0, test2Ptr); // value is now in test2
}

So maybe this works :) 

On Tuesday, February 9, 2016 at 2:13:51 PM UTC+1, Soapy Smith wrote:
>
> OK, I see they extended the C language for R30 and R31!
>
> I haven't found any good examples were C and assembler are mixed.  I have 
> seen statements which say there are multiple ways to accomplish it.
> It looks like the simplest is to inject assembler code directly into the C 
> code.  See page 76.  There is also a section on "Intrinsics" on page 89.  I 
> think that might be what you are looking for.
>
> On Tuesday, February 9, 2016 at 7:56:44 AM UTC-5, lucas wrote:
>>
>> Ah, thank you. These are excellent resources. I think I found the answer 
>> to my first question in the PRU Optimizing C/C++ Compiler v2.1 User Guide:
>>
>> Section: 5.7.2 Global Register Variables
>>
>> The C/C++ compiler extends the C language by adding a special convention 
>>> to the register storage class specifier to allow the allocation of global 
>>> registers. This special global declaration has the form: register type 
>>> regid The regid parameter can be __R30 and __R31. The identifiers _ _R30 
>>> and _ _R31 are each bound to their corresponding register R30 and R31, 
>>> respectively. These are control registers and should always be declared as 
>>> volatile. 
>>
>>
>> I am still a bit uncertain about the scratch pad. I have a value stored 
>> in a C variable, but how could I copy that value into inline assembler - so 
>> that I can write it to the scratch pad?
>>
>>
>>
>> On Tuesday, February 9, 2016 at 1:37:14 PM UTC+1, Soapy Smith wrote:
>>>
>>> There is a manual for the C compiler and the assembler:
>>>
>>> http://processors.wiki.ti.com/index.php/PRU-ICSS
>>>
>>> The links are on the right side of the page.
>>>
>>> Some of the PRU hardware specific registers are accessed via a large 
>>> union in a header file.  It uses structs with "bit fields" so you can 
>>> easily access individual bits in the register.
>>> Look for a header file called pru_cfg.h.  But specifically to your 
>>> question, I'm still trying to figure out how the PRU input and output 
>>> registers R30 and R31 are done in C, as I
>>> don't see those called out in the header file (in information overload 
>>> at this point!).
>>>
>>> Regarding the scratchpad, I believe it can't be accessed via C. 
>>>  However, you can embed assembler codes into C source code.
>>> If you go here:
>>>
>>>
>>> https://training.ti.com/sitara-processors-building-blocks-for-pru-development-summary
>>>
>>> Download the firmware development slides and look at page 8.
>>>
>>> Regards,
>>> Greg
>>>
>>>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to