element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
FPGA
  • Technologies
  • More
FPGA
Forum UltraScale+ use OCM as shared memory between PetaLinux on A53 and Bare metal on R5
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join FPGA to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 4 replies
  • Subscribers 529 subscribers
  • Views 3700 views
  • Users 0 members are here
  • fpga
  • ultrascale+
  • OCM
Related

UltraScale+ use OCM as shared memory between PetaLinux on A53 and Bare metal on R5

psd0
psd0 over 2 years ago

I am interested in using OCM, 0xFFFC0000-0xFFFFFFFF as a shared memory region between the A53 running Linux and a bare metal application on the R5.  This particular implementation does not require mutual exclusion.  On the bare metal side, I clear and invalidate the cache using Xilinx API calls, then read/write to/from OCM using Xil_In32 and Xil_Out32.  I can read back what I write, so I know the data (4-byte data chunks) is being written correctly.

On the Linux side I'm getting stale data or garbage when I try to read back what I wrote from the R5.  I was thinking perhaps something to do with caching on the Linux side, but handling that is much different than on bare metal.

I was interested in using OCM as its there and already mapped, and I thought it'd be an easier solution, for a very simplistic implementation, than messing around with device trees and shm settings.

  • Sign in to reply
  • Cancel

Top Replies

  • psd0
    psd0 over 2 years ago in reply to psd0 +1
    Replying to myself. I got it sorted out. Some API calls I was missing on the bare metal side.
  • dyessgg
    dyessgg over 2 years ago

    Make sure you marke the memory on A53 side as noncacheable. 

    Are you setting a flag on the R5 side and reading it on the A53 side?  If so, you've likely fallen into the "out of order execution" trap most V8-A bare metal newbies hit.  Make sure you put a DSB instruction/API call between reading your flag and accessing the shared memory.

    Make sure the OCM is correctly mapped in the MMU on the A53.  IIRC, there are some OCM regions that map to different PAs depending upon which processor.

    Greg

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • psd0
    psd0 over 2 years ago in reply to dyessgg

    Thank you for the response Greg.  I don't know how to do any of the above.  I've looked up the DSB instruction and I think I get what you mean by out of order execution.  Is there any sample code that does the above that you know of?  My searches have not been very successful in this area.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • psd0
    psd0 over 2 years ago in reply to psd0

    Replying to myself.  I got it sorted out.  Some API calls I was missing on the bare metal side.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • minimartian
    minimartian over 1 year ago in reply to psd0

    Hi, Please may you explain how your sorted it? I'm trying to do the same and I am in the same situation on the baremetal side. Thanks 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube