How does the OpenVINO toolkit program the FPGA? - neural-network

So, I've been meaning to find an answer to this question for about 3 months now. I'm just a beginner to the world of FPGA and hardware programming in general. I've only built the NIOS and tried a few things using quartus and a DE10 standard FPGA (which I don't have access to anymore). So, all I know is that a bitstream or netlist is created to program an FPGA, which I can do from the programmer feature in quartus after the design is complete.
My problem here is, how does OpenVINO manage to program the FPGA while the code is written in python and may use several libraries. I've already ordered OpenVINO starter platform FPGA.. but I need to know how this works. I've only seen like 1 python to HDL synthesizer, which is MyHDL and it looked quite complicated.

OpenVINO FPGA depends on dlaplugin, Intel DLA architecture follows set of configuration methods, can be configured with Deep Learning Suite which is not provided as open source.
Intel FPGA runtime stack need to be installed to program an Intel FPGA.
aocl program device bitstream.aocx
after, dlaplugin helps to run application on FPGA

Related

How to create a bootable x86_64 program?

Some background:
I am a Computer Engineering major attending school right now, and I just completed a project that created a microprocessor with a super simple instruction set that ran on an FPGA. I chose to implement a simple file storage scheme, a VGA text only display output, and a PS/2 keyboard input. I wrote two main programs, a firmware that was in ROM in the processor and a kernel that provided a bunch of library type functions, and was capable of loading and executing files from the filesystem. This project was challenging and overall a lot of fun.
My Question:
I want to do some super low level programming on a modern computer, but I can't seem to find any resources or documentation that help me get started. To be clear, I want to find the proper documentation that would help me to write a program in C, x86, or x86-64 assembly that I could compile, and format into some form of bootable data. I know this is a daunting task, and typically not something a hobbyist would take on, but I know that it's possible (Terry Davis's TempleOS).
Are there any websites or books that I can read that will contain the specifics needed to make something like this?
Look out, you might just catch the bug. OS Development, though having a very small demographic, is still quite a thriving hobby. Once you start, you may not ever give it up.
Since your subject line states 64-bit and you use the term modern hardware, be advised that modern hardware no longer has the older style BIOS, where the developer wrote the boot process which included the video out, file system in, and other standard routines. Modern hardware now uses an EFI firmware which does all of the booting for you, including the reading from the file system(s). For modern hardware, OS development really starts with the OS Loader, the part that loads the OS, and this is done in a high level language such as C/C++. Very little if any assembly at all, in fact that is its point/purpose.
Don't get too discouraged, currently a lot of computers still allow the old style boot. However, the old style boot starts in 16-bit mode, moves to 32-bit mode, then if desired, moves to long mode (64-bit). There also are emulators that you can use so you don't have to have a separate system, just to test your development. I prefer Bochs myself, but I am a little bias since I wrote some of the code for it, namely most of the (original) USB emulation.
If you wish to dip your toes into this hobby, there are numerous places to start. I personally wrote a few books on the subject. They show you how to start from when the time the POST gives up control to your boot code, up to the point of a minimal Round Robin style task/thread switching OS, with all the necessary hardware and software basics to do so. There is a forum to OS Development, along with its wiki.
Again, a project like this is not for the faint at heart, though it is an enjoyable hobby most have found to be a very good learning experience.

porting pintOS to Raspberry-pi

For a 6 months long project, i was thinking to write PintOS like OS for raspberry-pi. Since i am a beginner, having no practical knowledge of operating system, i thought of start with porting (PintOS) rather than writing OS of my own. My questions are:
How to proceed , i.e. what are the things i should know before starting porting. (I have knowledge of assembly, theoretical concepts of OS, boot sequence overview, etc).
Will cross-compiling the source code is enough?.
How far is this project worth doing for 6 months(answer depends on 1st question :p)?
Here are some similar work i have found :
Porting the Embedded Xinu
Operating System to the Raspberry Pi
P.S. I am an undergraduate student.
I worked on PintOS in my time at grad school, so I speak from experience.
I can probably answer your questions but it might be too late since I just came across Pintos section of stackoverflow.
You will need to know ARM instruction set since you will be translating all X86 machine instructions to equivalent ARM machine instructions in the vanilla PintOS source code.
My guess is no, you can't just cross compile the code because of 1.
Also depends how much you know ARM instructions.
Hope it helps!

what should i study to get an indepth understanding of operating systems

I have been programming in java for 3 years but I have no experience with other languages. I want to know what I need to study in order to be able to make an operating system. Am most likely going to make my operating system based on Linux kernel. What programming languages should I be familiar with and what aspects of the pc hardware should I study. if you know any online tutorials or good books please mention them.
The answer depends on how far you want to go and how much you want to write yourself vs using existing code.
The most straightforward way is to have a look at Arch Linux or Gentoo and build your own, custom Linux setup. Approximate time needed to create a minimal working system: ~2 hours
You could, otherwise, compile the Linux kernel, build some software packages and put it all together yourself and create your own Linux distro - i.e your own operating system in a sense. Linux From Scratch will be an invaluable resource if this is what you decide to do. Approximate time needed to create a minimal working system: ~2-5 days
Say that's too easy for you but you're not ready to delve into the nitty-gritty of kernel development. You can write your own applications that run on top of the Linux kernel. Typically, you'd need to know C/C++ but any language that supports running on Linux/compiling to a Linux executable will work. Heck, you could chuck a (or write your own) Java runtime on and write your whole 'operating system'/user-space in Java. Approximate time needed to create a minimal working system: ~6-12 months
What about if you want to get down to programming your own kernel from scratch? Heck, Linux is overrated and you want to write your own kernel and it's going to be the next best thing! You would want to learn a bit about the platform you're developing on. At the very least, you'll need to know the assembly instructions of some special operations for your platform that can't be done natively in C like switching CPU modes. You'll definitely need to read up on the OS dev wiki for this and you should have a fair decent computer science background.
At this point, you shouldn't need too much other than a good tutorial, C, a little assembly, reference manuals for the hardware you're hoping to support and 3+ years of computer science background to get you started. Your boot loader that's booting your kernel should handle most of the hardware initialisation. Bootloaders like GRUB (I'm assuming you're developing on a x86 system) does so much for you that it can probably just jump to your kernel main function straight away without you having to do too much. Again, if you wanted, you could port or write your own Java runtime in C and write the rest of your kernel in Java! Approximate time needed to create a minimal working system: ~3-5 years
But, let's just say you're screaming for more pain and you want to write an operating system really from scratch and you don't want no bootloader doing a lot of the legwork. What do you need? Firstly, you'll need a lot more reference manuals. And you'll need to read up on a lot more assembly. Especially for Intel processors, there's a lot of work involved bringing the system up from 16bit mode to 32/64bit protected mode with paging (which is what I assume you want). You'll also want to know about every tiny quirk and weirdness of your platform that will affect your OS (these are often not documented; hooray!). Plus, all of the above. In short, you will need to study everything. Approximate time needed to create a minimal working system: 5+ years
Of course, this post is just scraping the surface of what is needed to even bring up a basic operating system capable of say, opening a web browser. The approximates roughly assumes a minimal working system is something capable of running a graphical web browser and will vary depending on how much you want to write.
I don't mean to be condescending but this is the kind of reality you'll be facing if you decide to write your own operating system. Nevertheless, it is a valuable learning experience if you can break the initial barrier or even just trying to set up your own Linux system.
First, I would say that you install any Linux OS on your system and get accustomed with it.
Second, for OS development you have to know C language. As for the Assembly language, it depends from where you start the OS development. If you will be using available bootloaders, then I don't think that you will be requiring to learn assembly language.
This is a website on OS development: http://wiki.osdev.org/Main_Page
There you will find all the stuff you need to know for the OS development. And also how to develop OS step-by-step.
Now-a-days, a "Eudyptula Challenge" is going on. It is a series of programming exercise for the linux kernel. You can find more info here: http://eudyptula-challenge.org/

Recommendation for a simple x86 emulator and operating system

As a personal learning project, I want to port an existing x86 emulator library to JavaScript and then run a very simple operating system on top of it.
My only requirement for the library is that it should be written in C\C++, as I want to use emscripten and asm.js to compile the source files to JavaScript. The library should at least be able to interpret x86 opcodes; the specific environment details for JavaScript (memory, GUI, interrupts etc.) I can implement myself. The operating system doesn't have any requirement, as long as it is simple enough and can run on the emulator.
So far in my research, Softx86 seems like the most viable solution, as it seems simple enough to port to JavaScript (it only does CPU emulation). The simplest 16 bit real-mode operating system I can find is MikeOS, the only problem being that it requires a 386 processor, which Softx86 cannot emulate and I am not sure if they are completely compatible.
My question is if anyone knows an alternate combination of emulator-OS that is simple enough to be ported to JavaScript.
For anyone who will come across this thread in the future, I've decided to port Fake86 to JavaScript, and use MS-DOS as the operating system.
You can see a live demo here
It runs very, very slowly, and currently only runs on Firefox, but it works nonetheless.
You can see the full source code here

Linux kernel device driver programming [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to learn linux kernel device driver programming. So can anyone please post good tutorials pages or links here. I am new to linux kernel environment. I have searched for it but I don't know how to start and which one to read for easy understanding basics. Thanks in advance.
Depends on your current skills. If you're really new to Linux, perhaps you should start with user space system programming with Advanced Linux Programming. You'll get good knowledge of Unix system calls and other concepts such as signals, processes/threads and so on with this free resource. This is a must (understanding the user space API) if you're developing on the kernel side since the role of a kernel is providing services to users in a secure way.
Otherwise one often cited book is Linux Device Drivers, Third Edition (LDD3). Keep in mind that this edition was written at the time of Linux 2.6.10 and some things changed since then. This article shows the differences as 2.6 evolved (until 2.6.31, that is, so not very useful). I should mention martinezjavier/ldd3, which contains example drivers of LDD3 updated for more recent kernels (thanks to 42n4 for pointing that out).
Another interesting book that's not as often cited is Essential Linux Device Drivers. You won't find a free version of this one, but it still features an interesting approach. What I like about this one is it covers lots of different device types and is up-to-date as of 2.6.24, which is a bit better than LDD.
Finally, one great book about the kernel itself (not specifically for drivers) is Understanding the Linux Kernel, 3rd Edition. This covers in-depth kernel facilities and internal mechanisms. It's up-to-date as of 2.6.11.
As for online tutorials, I found this post on Pete's Blog is a really great example. Not only does it show how to create a character device (the most easy kernel driver type, i.e. the one you should start with), it uses modern Linux kernel features in an easy to understand fashion, including:
use of udev
use of a kernel data structure (FIFO)
use of kernel synchronization (mutex)
use of Sysfs with custom attributes
module options for insmod
Plus: it's aimed at Linux 3.0, which means it's more up-to-date compared to other resources.
You might also like this post about how to create Sysfs entries manually, although the Linux device model will take care of registering your device as a Sysfs entry if you don't need additional nodes or attributes.
Edit: I should add that the best way to learn real Linux device driver programming is to look at actual drivers. There are thousands of drivers in drivers. Start reading and understanding the concept of simple ones like drivers/leds and you will see how rewarding this is.
The site with very important links:
http://elinux.org/Device_drivers
Great tutorial with real examples (ends with an usbpen formatted with our own file system - search for author further articles):
http://www.linuxforu.com/tag/linux-device-drivers-series/
http://sysplay.in/index.php?pagefile=lfy_articles
Source code of famous LDD3 book ported to newest kernels:
https://github.com/martinezjavier/ldd3/
Videos:
https://www.youtube.com/playlist?list=PL16941B715F5507C5
Maybe other cources:
http://www.skilledup.com/courses?keyword=linux+kernel&price_filter=0..0
Some examples:
http://www.staerk.de/thorsten/index.php/My_Tutorials/Writing_Linux_kernel_modules
http://www.freesoftwaremagazine.com/articles/drivers_linux
http://techblog.aasisvinayak.com/kernel-module-programming-tutorial/
http://www.linuxforu.com/2009/05/a-voyage-to-the-kernel-day-11/
Books (without mentioned in this thread LDD3):
http://www.coopj.com/ with an updated source code http://www.coopj.com/LPD/
KernelHacking:
http://kernelnewbies.org/KernelHacking
Visual map of the linux kernel: http://www.makelinux.net/kernel_map/
Linux and kernel books for beginners:
http://www.kroah.com/lkn/
http://swift.siphos.be/linux_sea/
You might be interested in the newly released Linux Driver Templates. As the name suggests, it provides templates and demonstrates frequently used Linux facilities to get started quickly.
I understand it is a delayed response !!
You can pick any book, those are really great books suggested above.
But you need to really work practically. Try to be involved into Kernel as much as possible.
Mostly you need to look into kernel source code itself.
And the most interesting document you can find in Documentation folder under Kernel tree.
best book for learning device driver programming is
"LDD"
Professional Linux Kernel Architecture is a good read also.
The best source is the linux man pages but they are somewhat critical to understand for a beginner, Directly programming device drivers is not a easy task. I recommend you to go through pointers and structures through following books
Basic C Books 1. Programming C - Byron gottfried 2. The C Programming Language - Dennis Ritchie
Intermediate Books 1. Pointers on C Kenneth Reek 2. Expert C Programming Deep Secrets - Linden
Coming to device Drivers I have uploaded the Kernel Source documentation in pdf format https://drive.google.com/folderview?id=0B7iRyndFhHldR3hjOHpOZTdKTjA&usp=sharing Youcan download from this link.
Device Drivers Basics (User mode Programming)
Linux Programming interface - Michael Kerrisk
Beginning Linux Programming Wrox Publishers
Device Drivers (Kernel Deleopment) 1. Linux Kernel Development - Robert Love 2. Linux Kernel Internals - m beck
Device Drivers (Driver Programming) 1. Linux Device Drivers - Third Edition (Free Download is available for 2.6 Kernel) 2. Essential Linux Device Drivers - Venkateswaran
For Basic Driver Knowledge Follow this site http://www.tldp.org/LDP/khg/HyperNews/get/devices/devices.html
My Experience is First of all we must gain a sound knowledge on C Programming, mainly Structures and Pointers before going through Driver Programming otherwise it will be bit cumbersome to understand driver programming.
Comming to Startup :-
User space programming
Basics of gcc generating proprocessed, assembler and object files using gcc commands analysis of object files using different object tools, Basic programming in linux, threads(locks, synchronization techniques), signals, processes(fork, exec), timers(Posix). This will help you lot in understanding kernel concepts.
Kernel Programming
Understanding the kernel source tree, different branches and their importance, using ctags and cscope to browse kernel source code, this will help you in kernel source browsing.
Driver Programming
First of all Learn different driver classes, char, block etc.,
Next learn the device protocols, transmission and reception, the product manual is the best source for going through this.
Then start writing the simple char driver for example RTC (a port mapped device), IOAPIC (A memory mapped device), then go to USB, PCI, Network, I2C, SPI etc., if you want the help you can find the skeleton code for all this in kernel source tree.