element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development Writing to OCM through the Xilinx OCM driver
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 5 replies
  • Subscribers 329 subscribers
  • Views 2420 views
  • Users 0 members are here
Related

Writing to OCM through the Xilinx OCM driver

henry10210
henry10210 over 10 years ago

Hello everyone, thanks in advance for reading my question on how to access OCM in a userspace Linux app.  Please excuse any ignorance derived questions.  I am having problem writing to OCM.

My kernel creates the OCM driver during bootup, as I see this line in dmesg:

zynq-ocm f800c000.ps7-ocmc: ZYNQ OCM pool: 256 KiB @ 0xe0880000

The OCM controller registers are at f800c000, but the OCM itself will be either at either 0x0 or 0xFFFC0000 (physical address mapping) depending on whether OCM_CFG[RAM_HI] is 0 or 1 (0 on PoR according to Zynq TRM chapter 29 and OCM_CFG register detail).  The Xilinx driver dmesg output is a bit confusing because 0xe0880000 is the kernel virtual address (result of ioremap).  I am opening /dev/mem and then mmap() the whole 256 KB, but I don't know what address I should pass to mmap.

I tried 0x0: program hangs.  I would guess that I have overwritten ISR vectors!?

I tried 0xe0880000, and the program prints:

Unhandled fault: external abort on non-linefetch (0x818) at 0xb6c06000
Bus error

I tried 0xFFFC0000, and the program usually succeeds (what I read matches what I wrote).

I somehow doubt that the OCM is at 0xFFFC000 (but I can check tomorrow by modifying the OCM driver verbosity).  But even if it is at that address, how can I actually check that what I wrote wound up at the OCM?  I was thinking about reading the memory in the JTAG debugger, but how do I really know that it is the OCM?

  • Sign in to reply
  • Cancel
Parents
  • henry10210
    0 henry10210 over 10 years ago

    Thank you for the quick reply Kevin!  I found out that the OCM is indeed at 0xFFFC0000 (the upper mapping).

    For some reason, I have a problem at address 0xFFFFF3C8 into the OCM.  At that address, I wrote 0xFCF2, but I read some garbage in the 2 MSB.

    Is 0xFFFFF3C8 a special address?  I posted my program at henryomd.blogspot.com/2014/10/using-zynq-ocm-linux-device-driver.html

    I guess I can just use smaller address range...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • henry10210
    0 henry10210 over 10 years ago

    Thank you for the quick reply Kevin!  I found out that the OCM is indeed at 0xFFFC0000 (the upper mapping).

    For some reason, I have a problem at address 0xFFFFF3C8 into the OCM.  At that address, I wrote 0xFCF2, but I read some garbage in the 2 MSB.

    Is 0xFFFFF3C8 a special address?  I posted my program at henryomd.blogspot.com/2014/10/using-zynq-ocm-linux-device-driver.html

    I guess I can just use smaller address range...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
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