fpgawars / apio Goto Github PK
View Code? Open in Web Editor NEW:seedling: Open source ecosystem for open FPGA boards
Home Page: https://github.com/FPGAwars/apio/wiki
License: GNU General Public License v2.0
:seedling: Open source ecosystem for open FPGA boards
Home Page: https://github.com/FPGAwars/apio/wiki
License: GNU General Public License v2.0
This apio command will list the USB devices
It invokes the listdevs binary, located in the packages tools-usb-ftdi (that is intalled by means of the apio debug install command)
Testing the pio install pio-fpga command from a native MAC machine
Follow this installation instructions:
https://github.com/FPGAwars/Platformio-FPGA/wiki/Platformio-FPGA-wiki-home
It would be great to test it both in platformio cli and ide
The "apio debug install" command will download and install the package tools-usb-ftdi
This package contains the binaries for the utilities listdevs and find_all. The first one is for listing all the USB devices. The second is for showing the boards with FTDI chips
These binaries are invoke using the apio commands:
The variable board will be used in the SConstruct file for building the verilog files for the specified board
Ex:
scons board=icestick
Current board values will be: icestick, icezum, go-board
If the variable board is set, it will override other fpga flags passed:
Ex:
scons board=icezum fpga_size=8k
It won't set the fpga_size to 8k, because it will use the one determined for the icezum board (1k)
Case:
apio examples -f Makefile
apio examples -d Makefile
or
apio examples -d Makefile
apio examples -f Makefile
Crashes because directory and file have the same name. New checks have to be included.
Add in iverilog -D VCD_OUTPUT=TARGET_SIM
Currently (apio version 0.1.0.2) only supports boards based on lattice ice40hx 1k and tq144 (ex. Icezum Alhambra, icestick). For supporting other boards, like nandland go, some flags should be passed to apio when synthesizing.
We should think about how to include this multiboard support. The approach can be similar to apio: use a command for creating a project which includes a project.json file that is read by apio for synthetizing to the target board
Ex:
apio project icezum
It will generate the project.json file in the current directory (aditionally some template files can also be added, like a icezum.pcf constraint file for example)
The algorithm for building could be something like:
$ apio build
Task to be done:
I will learn more about the flags needed. Initially I will create a generic makefile and integrate it into apio as an example: apio examples -f makefile). This is just a legacy example. It will let us compile easily examples that have already been created (like the ones in the verilog tutorials). Then I will create a generic SConstruct file, compatible with the current one, with the flags defined in the begining. Using apio init this file can be obtained and the user can set manually the building flags. Once it is working, we can integrate it with the new building system
It does not use the board parameter correctly.
If during the copying of the examples files there exist a file with the same name, apio ask the user if it can overwrite that file.
With the opcion --sayno the answer is always no, and no questions are asked. This is needed in apio-ide. In apio-ide we do not want the apio back-end to ask questions on the console
Install examples with:
apio install examples
Use same scons, system packages method to install pio-fpga. Using a separated repository with releases.
Then, PiofpgaInstaller must inherit from Installer.
Generic SConstruct file that includes flags for building for all the supported FPGAs in the icestorm project
$ apio examples -f icezum
It should copy the file icezum.pcf with all the constraints
The file icezum.pcf should be created
When I use "verify" o "build" or anything that uses scons, I get
➜ leds git:(master) ✗ apio build
Info: use apio.ini board: icezum
Using default SConstruct file
[Tue Nov 29 10:03:32 2016] Processing icezum
--------------------------------------------------------------------------------
scons: *** SCons version 2.4.1 does not run under Python version 3.5.2.
Python 3 is not yet supported.
In fact, it's not using the system-wide Scons, which is upgraded to 2.5.1, supposed to work with Python3. I have edited apio and simply changed it to "python" instead of Python3 and it does not work.
$ apio --version
apio, version 0.1.0.7
$ apio install examples
Installing examples package:
Download 0.0.1.zip
Package 0.0.1.zip is not found
This command will list all the already supported boards in apio
$ apio boards
icestick
icezum
go-board
The command:
$ apio init
creates the apio.ini file in the current directory. If the --project-dir flag is given, it will be generated in that directory. This option is needed for the project initialization in apio-ide
Implement the Makefile example:
apio examples -f Makefile (or -d)
This is a legacy example, for easily obtaining a working makefile and sythesizing in the old way:
(For example, for the verilog tutorials)
$ apio examples -f Makefile
make sint
make upload
Some users are very familiar with the make system
This is not the recomended way of building, but it is included as legacy
It can be considered an option for advanced users
The Makefile should include flags for building for all the supported FPGAs, described in the icestorm project
The apio examples command, by deault, copy the files to the current working directory. If the --project-dir dir option is specify, they are copied to that directory instead of the current
This option is neccessary for the apio-ide to open the examples (It will be used in the 0.4.0 release)
Ex. For starting a project with the icezum board, the steps will be:
apio init --board icezum
apio examples -f icezum-template
The template will include the files:
main.v
main_tb.v
icezum.pcf
It should be done for the icestick, icezum and go-board boards
This apio command will list the FTDI devices
It invokes the find_all binary, located in the package tools-usb-ftdi (that is intalled by means of the apio debug install command)
Give support to this:
$ apio build --board icezum
$ apio upload --board icezum
The command:
apio examples -l
Generates a list of all the examples available. It would be great if every example has a short description
Ex. Currentle the output is:
$ apio examples -l
Makefile
icestick
leds
wire
[..]
It would be great if the output were something like:
$ apio examples -l
Makefile Generic Makefile for building projects (legacy)
icestick Icestick board constraint file
leds Verilog example for Turning all the leds on (for the icestick / icezum boards)
wire Verilog example on how to describe a simple wire
The question is: Were can be this short string be stored?
Ex: apio build --pack vq100
It will build the current example seting the scons fpga vairable fpga_pack to vq100
(Internally it will call scons with: scons fpga_pack=vq100)
The supported build flags are: --pack, --size and --type, corresponding to the fpga_pack, fpga_size and fpga_type scons flags
This is an advanced feature. Normal user will create a proyect first indiating the board type and then build it using plain apio build. But allowing to change the flags directly is very usefull for easily testing new boards
"Click" colors (foreground and background) to make apio clearer
Ej.
$ apio examples -f leds
$ ls
leds.v leds.pcf leds_on_tb.v leds_on_tb.gtw
It will make it easier the use of apio with platformio as well as merging different verilog entities easily in the same project:
$ apio examples -f uart
$ apio examples -f servos
Apio has been installed in a virtualenv
The error message is:
$ apio install --system
Traceback (most recent call last):
File "/home/obijuan/venvs/pio1/bin/apio", line 11, in <module>
sys.exit(cli())
File "/home/obijuan/venvs/pio1/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/home/obijuan/venvs/pio1/local/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/home/obijuan/venvs/pio1/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/obijuan/venvs/pio1/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/obijuan/venvs/pio1/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/obijuan/venvs/pio1/local/lib/python2.7/site-packages/apio/__init__.py", line 64, in install
SystemInstaller().install()
File "/home/obijuan/venvs/pio1/local/lib/python2.7/site-packages/apio/packages/system.py", line 20, in __init__
self.version = self._get_version()
File "/home/obijuan/venvs/pio1/local/lib/python2.7/site-packages/apio/packages/system.py", line 54, in _get_version
version = releases['tag_name'].split('.')[1] # v0.X -> X
KeyError: 'tag_name'
Apio version:
$ apio --version
apio, version 0.0.5
Testing the pio install pio-fpga command from a native windows machine
Follow this installation instructions:
https://github.com/FPGAwars/Platformio-FPGA/wiki/Platformio-FPGA-wiki-home
It would be great to test it both in platformio cli and ide
When an example is not found, this error message is gotten:
$ apio examples -f wrongexample
Sorry, this example does not exist
It would be great if the error message was something like:
Sorry, this example does not exist
Use "apio examples -l" for listing all the available examples
libffi is not installed by default on MacOS Sierra:
dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib
Referenced from: /Users/sonium/.apio/packages/toolchain-icestorm/bin/yosys
Reason: image not found
scons: *** [hardware.blif] Error -6
This can however be fixed easily by 'brew install libffi'.
Kéfir is a openhardware board developed by Salvador Eduardo Tropea, with an ice40-4K FPGA
The parameters for working with icestorm are:
yosys -q -p "synth_ice40 -blif rot.blif" rot.v
arachne-pnr -d 8k -P tq144:4k -p rot.pcf rot.blif -o rot.asc
iceprog -I B rot.bin
$ apio examples -f nandland-go
File: nandland-go.pcf (should be created)
It seems the only thing preventing full Python 3 compatibility is SCons. Maybe it could be replaced by another Python build system (perhaps WAF?).
$ apio config
Usage: apio config [OPTIONS]
Apio configuration.
Options:
-l, --list List all configuration parameters.
-e, --exe [apio|native] Configure executables: apio
selects apio
packages, native
selects system binaries
--help Show this message and exit.
$ apio config --exe apio
Executable mode updated: apio
$ apio config --exe native
Executable mode updated: native
$ apio config --list
Executable mode: native
Native mode does not require packages. It executes native binaries instead. A variable is stored in the apio profile.json.
Which does not seem to be big right now :-)
I am testing Apio 0.1.6.4
When this command is issued:
$ apio examples -l
what is shown in windows 7 is:
Instead of the names, you see the full path
But in Linux, what is shown are the names of the examples (not the paths):
I am not sure if this is a bug in apio for windows. I think that the output should be similar in both systems
For example, on Ubuntu without sudo:
# apt-get update && apt-get install -y python python-pip \
&& pip install -U pip apio \
&& apio drivers --enable \
&& apio install --all
throws the following error:
Configure FTDI drivers for FPGA
Traceback (most recent call last):
File "./root/.local/bin/apio", line 11, in <module>
sys.exit(cli())
File "/root/.local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/root/.local/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/root/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/root/.local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/root/.local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/root/.local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/root/.local/lib/python2.7/site-packages/apio/commands/drivers.py", line 24, in cli
exit_code = Drivers().enable()
File "/root/.local/lib/python2.7/site-packages/apio/managers/drivers.py", line 52, in enable
return self._enable_linux()
File "/root/.local/lib/python2.7/site-packages/apio/managers/drivers.py", line 78, in _enable_linux
self.rules_local_path, self.rules_system_path])
File "/usr/lib/python2.7/subprocess.py", line 523, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
I think that the problem might be at managers/drivers.py
:
def _enable_linux(self):
click.secho('Configure FTDI drivers for FPGA')
if not isfile(self.rules_system_path):
subprocess.call(['sudo', 'cp',
self.rules_local_path, self.rules_system_path])
subprocess.call(['sudo', 'service', 'udev', 'restart'])
If apio drivers --enable
is run as root, sudo
is not required. Furthermore, shall it not be available, trying to use it throws an error. I'd expect apio to check whether sudo
is required, prior to using it.
On top of that, if Ubuntu is a docker container, restarting udev won't work. However, I have not looked in depth into this. So, I don't know which the best approach would be: whether not to run that command and show a message instead, or replace drivers --enable
as a whole and show a longer message. You can have a look at this question: http://stackoverflow.com/questions/36880565/why-dont-my-udev-rules-work-inside-of-a-running-docker-container
The apio init command generates the SConstruct, so that the user can change/modify it
For multiboard support, it is better to use the init comand for creating a new project, the same as platformio do:
apio init --board icestick
For that reason, the current apio init behaviour should be moved to apio scons:
apio scons --> It will generate the default SConstruct file
apio init --> It will create the apio.ini file, with the project configuration: board, name, and so on...
_____ _
/ ____| | |
| (___ _ _ ___ ___ ___ ___ ___| |
\___ \| | | |/ __/ __/ _ \/ __/ __| |
____) | |_| | (_| (_| __/\__ \__ \_|
|_____/ \__,_|\___\___\___||___/___(_)
We can use some of this funny ASCII messages in apio.
In this link there is a wonderful tool for converting text into ASCII art:
http://patorjk.com/software/taag/#p=display&f=Big&t=Success!
The priority of this issue is very low... but it can be fun :-)
Implement apio verify (using iverilog) and the iverilog installer.
In order for the atom build command to detect if the an apio build has succeed or not, apio should return error code (an error code diferent from 0 means no success)
It can be checked in the bash with the $? systema variable:
$ apio build
$ echo $?
0
Apio always return 0 (if does not matter if there was an error when building)
On the contrary, pio returns 0 when the build success, or any other code different than zero if the was an error
Ex:
$ pio run
Error: Not a PlatformIO project. platformio.ini
file has not been found in current working directory (/home/obijuan/develop/test/pio1/src). To initialize new project please use platformio init
command
$ echo $?
1
Just ignore the .pyc files when copying
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.