PRU memory layout and linker command file

I am trying to understand the memory layout of the PRU. I am following the instructions of Derek Molley’s book “Exploring the BB” and he uses the following linker command file (exploringBB/chp13/prussC/AM3359_PRU.cmd at master · derekmolloy/exploringBB · GitHub):

`
-cr
-stack 0x100
-heap 0x100

MEMORY
{
PAGE 0:
PRUIMEM: o = 0x00000000 l = 0x00001000 /* 8kB PRU0 Instruction RAM /
PAGE 1:
PRUDMEM: o = 0x00000000 l = 0x00001000 /
8kB PRU Data RAM 0 */
}

SECTIONS
{
/* Thanks to Jakub for the next line! /
.text:_c_int00
> 0x0, PAGE 0
.stack > PRUDMEM, PAGE 1
.bss > PRUDMEM, PAGE 1
.cio > PRUDMEM, PAGE 1
.const > PRUDMEM, PAGE 1
.data > PRUDMEM, PAGE 1
.switch > PRUDMEM, PAGE 1
.sysmem > PRUDMEM, PAGE 1
.cinit > PRUDMEM, PAGE 1
}

`


|

  • |

Is there a good way to reserve a portion of the data ram so I can safely write from my host application with the pruss driver into it? It seems like that I can for example write to address 0x0 on page 1 from linux and retrieve the value, but at some point I interfere with other memory, ostensibly the stack.

What’s the best way to handle this?
Is there a comprehensive description of the linker command file?

It depends a lot on what you are using. Are you programming in C or assembly? I’ll assume you are using TI’s compiler (since pasm doesn’t really use linker files).

If you are programming in assembly, then you don’t really care about most of the stack and other constructs the compiler will create. What this memory map is saying is that you have 8kB of instructions and 8kB of data RAM. The ARM core can access that data RAM and write on that. I’ve only programmed the PRU in asm, so I don’t really know how it would go for C.

BTW, the information you are looking for is in TI’s compiler manual (http://www.ti.com/lit/ug/spruhv7a/spruhv7a.pdf). You might find the assembly language description from http://www.ti.com/lit/ug/spruhv6a/spruhv6a.pdf useful.

Cheers,