FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
6266 Discussions

How to use on chip memory by HPS baremetal

CAlex
New Contributor II
1,917 Views

Hi, 

it's based on CycloneV soc dev kit,

the on chip memory was linked to H2F AXI(128bit wide). So I set the OCMemory as 128 bit and writeable RAM.

In the HPS code I setup the FPGA image, openned the AXI bridge and set MPU 0x0 at bootROM and NONMPU 0x0 at OCRAM.

I mapped the OCMemory as 0xC0000000 + ip offset based on hps_0.h

And then I use "memcpy(buffer, on-chip-memory, lenth)." to write the buffer to the OCM.

So 

1. what else do I need to do to let HPS communicate with OCM? 

2. The QSYS mentioned the HEX file, do I need to use that? 

3. If so, is there any guide?

4. Whether can FPGA read the OCM at the same time?

5. How?

 

Thank you.

Reguards.

Alex

0 Kudos
16 Replies
EBERLAZARE_I_Intel
1,863 Views

Hi,


Can you check this out first?:

https://www.intel.com/content/www/us/en/docs/programmable/683211/current/simple-bare-metal-project-using-on-chip-ram.html


Also, what do you mean by no 4? Do you want to have for example, in FPGA user mode and access the OCRAM while it is being accessed by the HPS?


0 Kudos
CAlex
New Contributor II
1,855 Views

Hi,

this OCRAM meant to be the GHRD On Chip Memory II IP.

So basically it is a FPGA IP, my object is let HPS send in a buffer and meanwhlie FPGA continue reading from this Memory.

Reguards.

0 Kudos
EBERLAZARE_I_Intel
1,807 Views

Hi,


I see, is the example not fit on what you want for your design?


0 Kudos
CAlex
New Contributor II
1,797 Views

Year, 

1. I dont know whether OCRAM and OCMemory(RAM or ROM) FPGA IP are the same thing.

2. The example just scatter the code file to OCR(0xFFFF0000). But my FPGA IP address is 0xC0000000 + offset. I wonder whether can I just use memcpy(buffer,OCmemory,sizeof(buffer)) to send the buffer to this IP.

 

0 Kudos
EBERLAZARE_I_Intel
1,764 Views

Hi,


Let me check again, are you familiar with NIOS II?


0 Kudos
CAlex
New Contributor II
1,731 Views
0 Kudos
EBERLAZARE_I_Intel
1,686 Views

Hi,


I need some more time to work on your issue.


0 Kudos
CAlex
New Contributor II
1,675 Views
0 Kudos
EBERLAZARE_I_Intel
1,641 Views

Hi,


If you involve the FPGA side, in that case you can use this design, and enable the HPS2FPGA bridge:

https://github.com/altera-opensource/intel-socfpga-hwlib/tree/master/examples/CVAV/Altera-SoCFPGA-HardwareLib-FPGA-CV-GNU


0 Kudos
EBERLAZARE_I_Intel
1,581 Views

Hi,


Do you have any update?


0 Kudos
CAlex
New Contributor II
1,570 Views

Hi,

I followed the FPGA example you gave me, and just used the alt_write_words and alt_read_words.

Now Im thinking of how to get these data out of the memory.

I noticed that there is a SDMMC example on writing the data on a SDcard.

But I dont know how to "read" the SDcard data I wrote in from my computer(not through debug but actually read from my laptop in order to do some mathematical analysis).

 

Do you have any ideas?

 

0 Kudos
EBERLAZARE_I_Intel
1,531 Views

Hi,


For that we do not have that examples, will need to check resources from third party.


I can provide some help on that.


0 Kudos
EBERLAZARE_I_Intel
1,521 Views

Hi,


We do not have the examples, from our side.


You need to check out the available functions for your SDMMC and experiment it:

https://github.com/altera-opensource/intel-socfpga-hwlib/blob/master/armv7a/hwlib/include/alt_sdmmc.h


For e.g usage for (line 1589):

ALT_STATUS_CODE alt_sdmmc_read(ALT_SDMMC_CARD_INFO_t *card_info, void *dest, void *src, const size_t size);

ALT_STATUS_CODE alt_sdmmc_write(ALT_SDMMC_CARD_INFO_t *card_info, void *dest, void *src, const size_t size);


I am not familiar with these functions, but you may try it, other than that I hope I have provided enough help on this.


0 Kudos
CAlex
New Contributor II
1,515 Views

Hi,

Yes, Im working on that function, but the function is to read/write from the HPS,

now my problem is how to read the sdcard from host computer.(assume that I already wrote the data into a sd card). 

 

Do you have any ideas?

 

Reguards.

0 Kudos
EBERLAZARE_I_Intel
1,462 Views

Hi,


We do not have the examples for that. You can check the other functions available and try them:

https://github.com/altera-opensource/intel-socfpga-hwlib/blob/master/armv7a/hwlib/include/alt_sdmmc.h


Other than that, we are unable to support further. Do you have any other related questions?


0 Kudos
EBERLAZARE_I_Intel
1,418 Views

Hi,


I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.



p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.



0 Kudos
Reply