Hello everyone,
I’m playing around with my redpitaya board for a while now.
I tried to create my own module using verilog to write some data into ram and that works.
For example, I made a counter on fpga side which writes its values into ram via hp-port, starting at 0x00100000 and ending at 0x001000cc, and on the OS side I wrote a small c-program which reads this data out and prints it on the console.
This all works fine, but by now I’m sure I’m not doing this the right way, because till now the processing system doesn’t know, that I’m using this amount of memory. If I write much more data to ram, for example 0x001000000 to 0x001003e8 (what should be 1000byte), I get a nasty segmentation fault error.
Maybe I just wrote into the memory of another process and/or the OS detects that there is an unauthorized access to memory.
My question is, what is the right way to allocate memory in this case?! Is there a way to tell the OS from fpga side, that I need memory, or is there a way to write a program which allocates memory for me.
Any help/ideas would be appreciated.
How to allocate memory for/from FPGA (side)
-
- Posts: 799
- Joined: Sat May 23, 2015 5:22 pm
Re: How to allocate memory for/from FPGA (side)
I don't think that you can control the OS configuration from the FPGA.
As far as I know, all the currently available SD card images for Red Pitaya are configured to reduce the amount of DDR3 RAM accessible to Linux and to use a memory block at the end of the DDR3 RAM address range as a buffer for DMA. In some images the size of this buffer is 32 MB, in some other images it's 64 MB or even more. So, it should be safe to write to the last 32 MB (0x1E000000-0x20000000) with all the currently available SD card images for Red Pitaya.
The DDR3 RAM accessible to Linux is configured via devicetree.
I do it by directly patching devicetree.dts:
https://github.com/pavel-demin/red-pita ... ch#L26-L27
I think that the Red Pitaya developers do it differently but I can't find how. I'd expect it to be done by one of the .dtsi files in the fpga/dts directory:
https://github.com/RedPitaya/RedPitaya/ ... 8/fpga/dts
Suggested reading:
http://blog.fakultaet-technik.de/develo ... boot-files
https://static.lwn.net/images/pdf/LDD3/ch15.pdf
https://forum.redpitaya.com/viewtopic.php?f=14&t=551
-
- Posts: 2
- Joined: Thu Dec 14, 2017 2:00 pm
Re: How to allocate memory for/from FPGA (side)
Thank You very much Pavel, that helped me a lot!
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie
Who is online
Users browsing this forum: No registered users and 84 guests