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 Communication between Linux and FPGA
  • 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 6 replies
  • Subscribers 328 subscribers
  • Views 561 views
  • Users 0 members are here
Related

Communication between Linux and FPGA

Former Member
Former Member over 12 years ago

Hello everybody! I followed zynqgeek's useful tutorial on how to create custom peripheral using PL and to communicate using a bare metal application. Now I'm trying to do something more, like creating a linux application to read/write the registers in the peripheral. My questions are:

1) I'd like to use mmap to map the device into user space, such that is possible to read and write data. Is this correct?

2) Assuming point 1 is ok, is possible to send an interrupt from FPGA to Linux application to inform that some data are available?

3) Do I have to create a Bare Metal application able to communicate to Linux app? If yes, how can the communication be established? If no, I think that can be used mmap + interrupt..

4) Finally I'd like to run the application after the kernel has been loaded. Should I include u-boot.elf during the creation of BOOT.BIN? I tried to include "system.bit", "my_application.elf" and "zynq_fsbl_0.elf", but it seems that Linux is not loaded..

Waiting for your answers!!

Thank you,

sticken

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    0 Former Member over 12 years ago

    Hi

    1. It is OK to use mmap, but the recommended procedure is to write a device driver for your peripheral.  Chapter 9 of UG873 (link below) has a basic example of how to do this.  Whilst this does not go into a tutorial on how to write a driver, they do provide an example.

    2. I haven't tried this myself, but in the same guide (Chapter 6) Xilinx give an example of a CDMA which generates an interrupt after it has finished transferring data which may be similar to what you need to do.  I am not sure what other steps you would need to do to make your own interrupt.

    3. You do not need to create a Bare Metal application to talk to Linux.

    4. The easiest way to run a program immediately after the kernel has been fully loaded and configured is to add a call to your program in the startup script.  ZynqGeek has a blog post on how to do this (link below).
    If you are booting from SD Card this requires a new BOOT.bin file with the FSBL, system.bit and u-boot.elf in that order.

    UG873:
    http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_3/ug873-zynq-ctt.pdf

    ZynqGeek's blog post:
    http://zedboard.org/content/zedboard-modifying-your-ram-disk-image

    Hope that helps
    Matthew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 12 years ago in reply to Former Member

    Hi Matthew,

    thank you for your answer. I'll read those documents as soon as possible.
    I found this: http://forums.xilinx.com/t5/7-Series-FPGAs/Problems-configuring-PL-generated-interrupts-in-Zynq-running/m-p/267044/highlight/false#M598

    and I'm trying to follow those steps to manage interrupts. Non I'm able to add an external port which is used to raise an interrupt request and to interconnect my custom component to a interrupt controller which is connected to processing_system. Next step will be the implementation of interrupt handler using Linux.

    Point 4: Do I have to add "my_application.elf" to generate BOOT.BIN? I think so..

    Thank you,

    sticken

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 12 years ago in reply to Former Member

    Hi Matthew,

    thank you for your answer. I'll read those documents as soon as possible.
    I found this: http://forums.xilinx.com/t5/7-Series-FPGAs/Problems-configuring-PL-generated-interrupts-in-Zynq-running/m-p/267044/highlight/false#M598

    and I'm trying to follow those steps to manage interrupts. Non I'm able to add an external port which is used to raise an interrupt request and to interconnect my custom component to a interrupt controller which is connected to processing_system. Next step will be the implementation of interrupt handler using Linux.

    Point 4: Do I have to add "my_application.elf" to generate BOOT.BIN? I think so..

    Thank you,

    sticken

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Former Member
    0 Former Member over 12 years ago in reply to Former Member

    Hi again

    I'm glad you found something useful about the interrupts.  u-boot.elf is used to boot Linux, so this should be the last item in BOOT.bin.  The only reason you would want to add your application to BOOT.bin instead of u-boot would be if you didn't want Linux.  Once Linux boots it runs the startup script which you can edit to launch one of your own programs, like ZynqGeek does in the blog.

    Matthew

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