Difference between revisions of "BeagleBoard/GSoC/BeagleWire software support"

From eLinux.org
Jump to: navigation, search
(add category)
(add new information)
Line 16: Line 16:
 
Upstream Repository: N/A <br>
 
Upstream Repository: N/A <br>
 
References: [http://www.clifford.at/icestorm/ icestorm project][https://github.com/torvalds/linux/blob/master/Documentation/fpga/fpga-mgr.txt linux fpga subsystem documentation]
 
References: [http://www.clifford.at/icestorm/ icestorm project][https://github.com/torvalds/linux/blob/master/Documentation/fpga/fpga-mgr.txt linux fpga subsystem documentation]
[http://phytec.com/wiki/images/7/72/AM335x_techincal_reference_manual.pdf AM335x techincal reference manual]
+
[http://phytec.com/wiki/images/7/72/AM335x_techincal_reference_manual.pdf AM335x techincal reference manual] [http://events.linuxfoundation.org/sites/events/files/slides/lcj-2016.pdf Open-Source tools for FPGA development]
 
 
  
 
==About me==
 
==About me==
Line 71: Line 70:
 
==Project implementation==
 
==Project implementation==
 
<big>'''Main Goals:'''</big>
 
<big>'''Main Goals:'''</big>
#Create the lowest layer of bridge driver
+
#Create the lowest layer of bridge driver,
#Create Verilog bridge module allowing to connect user's Verilog module with ARM processor.
+
#Create Verilog bridge module allowing to connect user's Verilog module with ARM processor,
 
#Support for IRQ signals in both directions (from and to FPGA),
 
#Support for IRQ signals in both directions (from and to FPGA),
#Integration open source programming tools (iCE40 programming driver) with BeagleBone linux images (BeagleBone automatically loaded required DTS, EEPROM Cape, porting the icestorm toolchain to the BeagleBone Black),
+
#Integration of open source programming tools (iCE40 programming driver) with BeagleBone linux images (BeagleBone automatically loaded required DTS, EEPROM Cape, porting the icestorm toolchain to the BeagleBone Black),
 +
#Create a TestBench files for bridge module using IceTime,  
 
#Python Extension and C Library which allows easy to develop application using the FPGA (copying memory blocks, capture interrupts, etc),
 
#Python Extension and C Library which allows easy to develop application using the FPGA (copying memory blocks, capture interrupts, etc),
#Verilog examples,
+
#Verilog examples with testbenches,
 
#Extensive documentation,
 
#Extensive documentation,
 +
 +
 
<big>'''Detailed description of each goal:'''</big><br>
 
<big>'''Detailed description of each goal:'''</big><br>
 
'''1. Create the lowest layer of bridge driver'''<br>
 
'''1. Create the lowest layer of bridge driver'''<br>
Line 94: Line 96:
 
The task is to create a module which is able to read GPMC interface signals, providing an easy way to the exchange of data with user's logic. I intended to create two different solutions. Unfortunately, the amount of logic in iCE40 is not too big, as in the largest version it is only 8000 LUTs. Solutions should be as optimal as possible, because I would not like to create a bridge module that would take up more than 10% of the FPGA logic.
 
The task is to create a module which is able to read GPMC interface signals, providing an easy way to the exchange of data with user's logic. I intended to create two different solutions. Unfortunately, the amount of logic in iCE40 is not too big, as in the largest version it is only 8000 LUTs. Solutions should be as optimal as possible, because I would not like to create a bridge module that would take up more than 10% of the FPGA logic.
  
'''First solution:'''
+
'''First solution:'''<br>
 +
The first solution involves mapping the external memory (SRAM or SDRAM) to ARM processor's memory. Bridge module receives signals from the GPMC interfaces and writes or reads data to external memory. User logic is given access to signals which enable reading and writing to external memory.
 
[[File:BeagleWire sol1.png|500x700px|none|left]]
 
[[File:BeagleWire sol1.png|500x700px|none|left]]
  
Line 100: Line 103:
 
The second solution uses much less logic than the previous solution. It consists of exchanging data directly from the GPMC bus. In this solution, we bypass the address. Coupled with the interrupt, this solution can work efficiently.  
 
The second solution uses much less logic than the previous solution. It consists of exchanging data directly from the GPMC bus. In this solution, we bypass the address. Coupled with the interrupt, this solution can work efficiently.  
 
[[File:BeagleWire sol2.png|350x450px|none|left]]
 
[[File:BeagleWire sol2.png|350x450px|none|left]]
 +
<br>
 +
The choice of solution depends on the user. They state it in DTS.<br>
 +
<br>
 +
'''3.Support for IRQ signals in both directions (from and to FPGA)'''<br>
 +
Two GPIOs from BeagleBone are intended for interrupts. Interrupts are receiving or generating from the userspace on ARM.
 +
IRQ signals will be connected directly to the user's logic and are reserved exclusively for user. During GSoC I do not plan to create additional modules generating interrupts, except if necessary.
 +
 +
'''4.Integration of open source programming tools (iCE40 programming driver) with BeagleBone linux images (BeagleBone automatically loads required DTS, EEPROM Cape, porting the IceStorm toolchain to the BeagleBone Black)'''<br>
 +
All tools needed in order to work with iCE40 are Open Source, which is a great advantage. The process of generating a binary file for iCE40 consists of several steps.
 +
One stage is called RTL synthesis - with the use of [http://www.clifford.at/yosys/ Yosys], a blif file is generated from Verilog code.
 +
 +
[https://github.com/cseed/arachne-pnr Arachne-pnr] implements the place and route step of the hardware compilation process for FPGAs. Project [http://www.clifford.at/icestorm/ IceStorm] provides simple tools for analyzing and creating bitstream files. In this part of the project I intend to write a script which will help in the installation and use of the above mentioned tools. I think that the synthesis will be also possible on the ARM processor. BeagleWire has EEPROM memory which stores identification data. One of the integration steps is to create binary file for [https://learn.sparkfun.com/tutorials/beaglebone-black-proto-cape-hookup-guide EEPROM]. The cape EEPROM is being read by the BeagleBone Black during boot. This registration allows them to upload your settings to the latest operating system available. This removes the need for users to setup their board to use the cape.

Revision as of 13:09, 28 March 2017


Proposal template

Beagle Wire (FPGA cape) software support

The Lattice iCE40 is a family of FPGAs with a minimalistic architecture and very regular structure, designed for low-cost, high-volume consumer and system applications. The significance of FPGAs is continuously increasing, as they are more frequently used for supporting work of ARM processors. iCE40 doesn’t require external tools(JTAG) and the whole software is Open Source. iCE40 is an energy saving device thereby allowing to work with small batteries. FPGA cape allows easy and low cost start for beginners who would like to take their first steps regarding FPGAs. The developed software would be an easy and, at the same time, efficient tool for communication with FPGA. At this point FPGA would be able to meet the requirements of even more advanced applications. The BeagleWire cape with iCE40 device will be created soon with Michael Welling and the BeagleBoard.org community.
Hardware Skills: Datasheet, Basic knowledge about FPGA devices,
Software Skills: C programming/Linux Kernel Programming, HDL language(Verilog or VHDL)
Possible Mentors: Michael Welling
Upstream Repository: N/A
References: icestorm projectlinux fpga subsystem documentation AM335x techincal reference manual Open-Source tools for FPGA development

About me

First name: Patryk
Surname: Mężydło
E-Mail: mezydlo.p@gmail.com
IRC nickname: pmezydlo
Programming Languages: C, C++, Python, Verilog, Assembler
Interests and hobbies: Electronic, Embedded systems, FPGA, Judo, Walking
Native language: Polish
Other languages: English
Timezone: CET
GitHub: My Github profile
Linkedin: My LinkedIn profile
Work hours: 10:00-22:00 (CET)
Previous GSoC participation: SPI slave driver implementation
Currently I am in my third year of engineering studies at Gdańsk University of Technology in Poland. This is the second edition of GSoC in which I am participating. The first edition gave me the opportunity to gain a lot of valuable experience. I would like to continue my cooperation with BeagleBoard.org community. During the first edition I have been developing SPI_slave_driver_implementation project, which gave me a lot experience in the subject of linux drivers. I hope that this knowledge will prove to be helpful this year.

BeagleWire (FPGA cape)

The BeagleWire is an FPGA development platform that has been designed for use with BeagleBone boards. BeagleWire is a cape on which there is FPGA device - Lattice iCE40HX. The Lattice iCE40 is a family of FPGAs with a minimalistic architecture and very regular structure, designed for low-cost, high-volume consumer and system applications. The significance of FPGAs is continuously increasing, as they are more and more often used for supporting work of ARM processors. BeagleWire does not require external tools (JTAG) and the whole software is Open Source. iCE40 is an energy saving device, allowing to work with small batteries. FPGA cape allows easy and low cost start for beginners who would like to take their first steps in working with FPGAs. The developed software will be an easy and, at the same time, efficient tool for communication with FPGA. At this point FPGA will be able to meet the requirements of even more advanced applications. The BeagleWire creates a powerful and versatile digital cape for users to create their imaginative digital designs.

BeagleWire features:

  • FPGA: Lattice iCE40HX4K - TQFP 144 Package,
  • 32 MB SDRAM,
  • BeagleBoard optimized,
  • GPIO,
  • 8x Leds,
  • 50Mhz external clock,
  • 4 layer PCB optimized design to support maximum performance for high bandwidth applications,
  • compatible with BeagleBone Black, BeagleBone Black Wireless, SeeedStudio BeagleBone Green, SeeedStudio BeagleBone Green Wireless, SanCloud BeagleBone Enhanced, element14 BeagleBone Black Industrial,
  • does not require external tools (JTAG),
  • minimalistic architecture and very regular structure,
  • energy saving device allows to work with small batteries,
  • lower application costs,
  • fully open-source toolchain,
  • SPI and GPMC port access from the Beaglebone,

BeagleWire software support

The task is to create software support for FPGA cape (based on iCE40 device). The completed project will provide the BeagleBoard.org community with easy to implement and powerful tools for realization of projects based on Programmable Logic Device(FPGA), which will surely increase the number of applications based on it. Although there already is a cape for BeagleBone involving FPGA device(LOGIBONE), LOGIBONE has several weaknesses which are not the case in FPGA cape based on iCE40 device.

BeagleWire stack.png

BeagleWire software support project advantages:

  • fully open source software(synthesis HDL language),
  • easy to implement software,
  • many simple and more advanced examples,
  • extensive and comprehensive documentation on how to create application,
  • support for Python scripts (Python extension),
  • support for C application (C library),

Project implementation

Main Goals:

  1. Create the lowest layer of bridge driver,
  2. Create Verilog bridge module allowing to connect user's Verilog module with ARM processor,
  3. Support for IRQ signals in both directions (from and to FPGA),
  4. Integration of open source programming tools (iCE40 programming driver) with BeagleBone linux images (BeagleBone automatically loaded required DTS, EEPROM Cape, porting the icestorm toolchain to the BeagleBone Black),
  5. Create a TestBench files for bridge module using IceTime,
  6. Python Extension and C Library which allows easy to develop application using the FPGA (copying memory blocks, capture interrupts, etc),
  7. Verilog examples with testbenches,
  8. Extensive documentation,


Detailed description of each goal:
1. Create the lowest layer of bridge driver
For communication between FPGA and ARM, I plan to use the GPMC. GPMC controller is configured from the DTS file. This is an easy and efficient solution. Gpmc pins are brought out to BeagleBone P8/P9 headers.

AM335x datasheets: The general-purpose memory controller (GPMC)[1] is a unified memory controller dedicated to interfacing external memory devices: SRAM-like memories and application-specific integrated circuit (ASIC) devices, asynchronous, synchronous, and page mode (only available in non-multiplexed mode) burst NOR flash devices, NAND Flash, Pseudo-SRAM devices.

Connecting BeagleWire with BeagleBone:

BeagleWire conn.png

Communication is going to be mapped in processor’s memory, thus allowing an easy access using simple read and write operations. Bridge device will be described in DTS file. The next task is to write kernel driver which will be connected to FPGA kernel subsystem(FPGA subsystem). After compiling an image with added modules (config file) and loading DTS, communication with FPGA is like a typical operation on a file (/dev/FPGA).

2.Create Verilog bridge module allowing to connect user's Verilog module with ARM processor
The task is to create a module which is able to read GPMC interface signals, providing an easy way to the exchange of data with user's logic. I intended to create two different solutions. Unfortunately, the amount of logic in iCE40 is not too big, as in the largest version it is only 8000 LUTs. Solutions should be as optimal as possible, because I would not like to create a bridge module that would take up more than 10% of the FPGA logic.

First solution:
The first solution involves mapping the external memory (SRAM or SDRAM) to ARM processor's memory. Bridge module receives signals from the GPMC interfaces and writes or reads data to external memory. User logic is given access to signals which enable reading and writing to external memory.

BeagleWire sol1.png

Second solution:
The second solution uses much less logic than the previous solution. It consists of exchanging data directly from the GPMC bus. In this solution, we bypass the address. Coupled with the interrupt, this solution can work efficiently.

BeagleWire sol2.png


The choice of solution depends on the user. They state it in DTS.

3.Support for IRQ signals in both directions (from and to FPGA)
Two GPIOs from BeagleBone are intended for interrupts. Interrupts are receiving or generating from the userspace on ARM. IRQ signals will be connected directly to the user's logic and are reserved exclusively for user. During GSoC I do not plan to create additional modules generating interrupts, except if necessary.

4.Integration of open source programming tools (iCE40 programming driver) with BeagleBone linux images (BeagleBone automatically loads required DTS, EEPROM Cape, porting the IceStorm toolchain to the BeagleBone Black)
All tools needed in order to work with iCE40 are Open Source, which is a great advantage. The process of generating a binary file for iCE40 consists of several steps. One stage is called RTL synthesis - with the use of Yosys, a blif file is generated from Verilog code.

Arachne-pnr implements the place and route step of the hardware compilation process for FPGAs. Project IceStorm provides simple tools for analyzing and creating bitstream files. In this part of the project I intend to write a script which will help in the installation and use of the above mentioned tools. I think that the synthesis will be also possible on the ARM processor. BeagleWire has EEPROM memory which stores identification data. One of the integration steps is to create binary file for EEPROM. The cape EEPROM is being read by the BeagleBone Black during boot. This registration allows them to upload your settings to the latest operating system available. This removes the need for users to setup their board to use the cape.