Hi folks,
right now I am trying to get the the PRU with the remoteproc-driver run. It ist working quite well, but there is one Problem which I dont now how to solve it.
I am trying to use the shared Memory between the ARM and PRU. 4a310000 startig adress. My Problem is that in my application I want to write data to the shared memory and afterward start the PRU-Core and read put the data. I am writing with a c-Programm with mmap. It works good and I can read out the data after I wrote it to the RAM. I am using the devmem2 -tool from Derick´s Exploring Beaglebone Book.
No my main problem. After I wrote my data to the shared RAM and start the PRU-Core (changing the state of the remoteproc-driver) all my data is gone and in the shared Memory just zeros exist. My question is, why is the driver writing just zeros to the shared memory when starting the PRU-Core. And is the any possibility to avoid this process of initilaizing all the shared memory?
Do you have any ideas? Why and how this happens?
Best Wishes
Maxim
Hi,
Are you sure it is the driver and not the PRU firmware?
Remoteproc host driver will load the PRU memories with contents from the ELF file.
If you have declared your shared buffer as “static char mybuffer[1024]”, then the compiler will allocate 1024 bytes into the BSS section, and the PRU firmware init (CRT library) will set it to zero on startup. You may try putting the array into “.noinit” section. Another thing to try is declaring “static char *mybuffer = (char *)0x1000;”, and ensuring that linker will not put any variables into the 12KB Shared DMEM.
Regards,
Dimitar
Haven´t thought about this. I will check it on Wednesdayan give a reply if it worked. Thanks
Okay I tried your advise. As you said it was the compiler not the driver who zero-initializied the RAM.
I had to declar my section to NOLOAD in the linkerfile which had the same effect as .noinit.
And in the c-programm I had to work with the attribute command.
C-Programm:
volatile uint32_t shared_mem_array[1024] arttribute((section“.my_pru_sec“)))
Linkerfile:
SECTIONS{
…
.my_pru_sec(NOLOAD) > PRU_SHAREDMEM,PAGE2
…
}
This link helped me with this problem:
https://mcuoneclipse.com/2014/04/19/gnu-linker-can-you-not-initialize-my-variable/
Thanks for your help