This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PRU code

Hi this assembly doesn't really look like the stuff i've seen before, actually i used an old motorola for school and it was a bit different, two registers, 8bits,  very very basic, this seems to bit more complex,

first, you can use r1->r32, there are 32 different registers? whats it mean when they add the .b0 .w0...

and in the example

#define CONST_PRU1DRAM C4

well just don't get this, sort of, nothing specifies what PRU1DRAM is i mean the location, and i know c4 has something to do with tables but don't underst what it is, is it just an adress of a table?

 

  • Yes, each PRU has 32 different registers.  All instructions are performed on these registers.  The PRU can individually select bits, bytes, and half-words within individual registers.  Refer to the table below meanings of these suffixes.  The following link also shows illustrates this:  http://processors.wiki.ti.com/index.php/PRU_Assembly_Advanced_Topics#Register_Addressing_and_Spanning.

     

    Suffix
    Range of n
    Meaning
    .wn
    0 to 2
    16 bit field with a byte offset of
    n within the parent field
    .bn
    0 to 3
    8 bit field with a byte offset of n within the parent field
    .tn
    0 to 31
    1 bit field with a bit offset of n within the parent field

     

    The address of PRU1DRAM is stored into the 4th entry of the PRU's constant table.  See http://processors.wiki.ti.com/index.php/Programmable_Realtime_Unit#Constants_Table.  Loading and storing instructions on the PRU require that the destination/source base address be loaded into a register.  The constant table contains 32 commonly-used addresses that can be used in memory to load/store operations via special instructions (LBCO/SBCO).  So instead of first storing an address into a register and then using SBBO or LBBO to move data to or from that address, the constant table allows you to move data to or from an address in a single instruction. 

    You may also find these training slides helpful:  http://processors.wiki.ti.com/images/1/18/PRUSS_Training_Slides.pdf.

    Regards, Melissa