Forum Discussion

CAlex's avatar
CAlex
Icon for Contributor rankContributor
2 years ago

How to use on chip memory by HPS baremetal

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

16 Replies

    • CAlex's avatar
      CAlex
      Icon for Contributor rankContributor

      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.

    • CAlex's avatar
      CAlex
      Icon for Contributor rankContributor

      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.

    • CAlex's avatar
      CAlex
      Icon for Contributor rankContributor

      No, and I dont intend to use it,sorry.

    • CAlex's avatar
      CAlex
      Icon for Contributor rankContributor

      Hi,

      Sure, please take your time

    • CAlex's avatar
      CAlex
      Icon for Contributor rankContributor

      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?

  • Hi,


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


    I can provide some help on that.


  • 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.


    • CAlex's avatar
      CAlex
      Icon for Contributor rankContributor

      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.

  • 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.