Hi Karl,
These constants allow the C compiler to produce more efficient code. Of
course you can also use them in assembly programs by explicitly using
lbco/sbco instructions.
Let me give you an example how pru-gcc uses the constant table. Consider
this C code snippet:
# define MYREG ( * (volatile uint32_t *)(0x4802A000 + 0x24))
MYREG = 42;
Normally pru-gcc would output the following:
ldi r14, %lo(1208131620)
ldi r14.w2, %hi_rlz(1208131620)
ldi r15, 42
sbbo r15, r14, 0, 4
But you can tell the compiler that this address base is special (btw,
already defined for you in <pru/io.h>):
#pragma ctable_entry 2 0x4802a000
Then the compiler can produce a much shorter instruction sequence:
ldi r14, 42
sbco r14, 2, 36, 4
TI's compiler uses a different syntax for the constants declarations, but
essentially does the same optimization.
Regards,
Dimitar
On Friday, July 15, 2016 at 11:41:06 AM UTC+3, Karl Karpfen wrote:
>
> Hi,
>
> the AM335x TRM specifies a constants table for PRU which can be used for
> easier access of memory addresses. As an example: for I2C1 registers which
> originally use base-address 0x4802A000 a constant 2 is defined.
>
> What I do not understand: how can one use these constants? How does the
> mapping from a constant to a base-address work where I have to add an
> offset in order to access desired registers?
>
> Or is this an assembler-thingy only which can't be used out of
> PRU-C-Software?
>
> Thanks!
>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/720f7e7d-d6ee-4498-851f-8cb5a2fa5087%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.