cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant
Participant
253 Views
Registered: ‎02-05-2019

[ZU7CG] Use of OCM from Linux

Jump to solution

Hi,

I am trying to access the OCM from Linux, and encountering "bus error".  I've traced this to the fact that there are unaligned accesses being performed by both the standard library as well as OpenSSL.  Even a simple "memcpy()" call will fail with "bus error".  I cannot change the libraries.

I saw this forum thread that alluded to a solution using "reserved-memory":

But my attempts to apply the advice have not worked.  I'd like to know more details.  In particular, ritakur mentioned setting the OCM memory range as "reserved-memory" in the device tree.  Is there an example DTS file snippet showing such a configuration?

Also, if the OCM memory range (0xfffc0000 to 0xffffffff) is configured as "reserved-memory", would we still then access the OCM via /dev/mem and mmap()'ing it?

Thanks!

Regards,
Yu Fei

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Moderator
Moderator
164 Views
Registered: ‎12-04-2016

Re: [ZU7CG] Use of OCM from Linux

Jump to solution

Hi Yu Fei

You can take this BRAM wiki page as a reference and start adapting the changes similarly for the accessing OCM from Linux.

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842412/Accessing+BRAM+In+Linux

 

Best Regards

Shabbir

View solution in original post

3 Replies
Highlighted
Moderator
Moderator
165 Views
Registered: ‎12-04-2016

Re: [ZU7CG] Use of OCM from Linux

Jump to solution

Hi Yu Fei

You can take this BRAM wiki page as a reference and start adapting the changes similarly for the accessing OCM from Linux.

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842412/Accessing+BRAM+In+Linux

 

Best Regards

Shabbir

View solution in original post

Participant
Participant
140 Views
Registered: ‎02-05-2019

Re: [ZU7CG] Use of OCM from Linux

Jump to solution

Hi shabbirk,

Thanks for pointing me in that direction.  However, I still can't seem to get it working from within Linux.  So, I went back to try to make sure that I could get u-boot to display that memory range, as instructed in:

 

I modified the DTS file I'm using with u-boot.  I'm using u-boot with the configuration file and DTS file from:

 

I added exactly what I saw in the example DTS file snippet, adding this portion to my DTS file just under the "memory" node:

  • reserved-memory {
        ranges;
        reserved {
            reg = <0x0 0xa0000000 0x0 0x8000>;
        };
    };

 

However, when I boot-up u-boot, I don't see that range listed as one of the DRAM banks when I run the `bdinfo` command:

  • arch_number = 0x00000000
    boot_params = 0x00000000
    DRAM bank = 0x00000000
    -> start = 0x00000000
    -> size = 0x80000000
    baudrate = 115200 bps
    TLB addr = 0x7FFE0000
    relocaddr = 0x7FED8000
    reloc off = 0x77ED8000
    irq_sp = 0x7DEC7DE0
    sp start = 0x7DEC7DE0
    ARM frequency = 100 MHz
    DSP frequency = 0 MHz
    DDR frequency = 0 MHz
    Early malloc usage: c78 / 8000
    fdt_blob = 000000007ff800e0

 

Any clues you can provide me?  Thanks!

Regards,
Yu Fei

 

0 Kudos
Highlighted
Participant
Participant
125 Views
Registered: ‎02-05-2019

Re: [ZU7CG] Use of OCM from Linux

Jump to solution

Nevermind, I figured it out.  I needed to also add the same range to the reg parameter of the memory node:

  • ... <0x0 0xA0000000 0x0 0x8000> ...

Thanks again!

0 Kudos