multigcs / riocore

riocore
GNU General Public License v2.0
19 stars 7 forks source link

LinuxCNC-RIO - rewrite

LinuxCNC-RIO

[![License](https://img.shields.io/badge/license-GPL2-blue.svg)](/LICENSE)

Realtime-IO for LinuxCNC

Table of Contents

About

LinuxCNC-RIO is a code generator for using FPGA boards as Realtime-IO for LinuxCNC.

Furthermore, the complete configuration and hal is generated. a json configuration file serves as the basis

DISCLAIMER

THE AUTHORS OF THIS SOFTWARE ACCEPT ABSOLUTELY NO LIABILITY FOR ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS EXTREMELY UNWISE TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of harming persons must have provisions for completely removing power from all motors, etc, before persons enter any danger area. All machinery must be designed to comply with local and national safety codes, and the authors of this software can not, and do not, take any responsibility for such compliance

Help

Boards

here is a small overview of the boards: BOARDS

Plugins/Drivers

here is a small overview of the plugins: PLUGINS

supported Toolchains

here is a small overview of the boards: TOOLCHAINS

Getting Started

There are 2 ways of getting started.

  1. Install riocore on the linux host.
  2. Use docker.

Install ricore on the host

make sure that the toolchain matching your fpga is in the path:

export PATH=$PATH:/opt/oss-cad-suite/bin/
export PATH=$PATH:/opt/Xilinx/Vivado/2023.1/bin/
export PATH=$PATH:/opt/gowin/IDE/bin/
export PATH=$PATH:/opt/intelFPGA_lite/22.1std/quartus/bin/
export PATH=$PATH:/opt/Xilinx/14.7/ISE_DS/ISE/bin/lin64/

than copy a config file that is near to your setup:

cp riocore/configs/Tangoboard/config-spi.json my_config.json

DOCKER

Using a TangNano9k or other board supported by the open-cad-suite? Check out the docker setup for an easy to use all in one way to run the riocore ui and generator, including flashing: DOCKER

Usage

you can edit your configuration file by hand (text-editor) or using the setup tool (rio-setup):

PYTHONPATH=. bin/rio-setup my_config.json

basic setup

after setup, you can save your configuration and generate the output-files in the setup-tool via buttons:

you can also do this things on your console:

generate:

PYTHONPATH=. bin/rio-generator my_config.json
loading: my_config.json
loading board setup: TangNano9K
writing gateware to: Output/Tangoboard/Gateware
!!! gateware changed: needs to be build and flash |||
loading toolchain gowin
writing linuxcnc files to: Output/Tangoboard/LinuxCNC

compile:

(
cd Output/BOARD_NAME/Gateware/
make clean all
)

flash:

(
cd Output/BOARD_NAME/Gateware/
make load
)

You can find all the LinuxCNC related files in 'Output/BOARD_NAME/LinuxCNC/',

to start LinuxCNC, you have to install the rio component first:

sudo halcompile --install riocore/files/rio.c

then you can start LinuxCNC with your new .ini file:

linuxcnc Output/BOARD_NAME/LinuxCNC/rio.ini

[!WARNING] all files will be overwritte by the generator tool

if you change the .ini file by hand, for example, you should make a copy of it

if you need an additional .hal file, you can incude it in the postgui_call_list.hal

rio will not overwrite this entry's

Prerequisites

you need the toolchain for your FPGA or in some cases the https://github.com/YosysHQ/oss-cad-suite-build

Flow

graph LR;
    BOARD.JSON--rio-setup-->CONFIG.JSON;
    CONFIG.JSON--rio-generator-->/Output;
    /Output-->/Gateware;
    /Gateware-->Makefile;
    /Gateware-->verilog-files;
    /Gateware-->pins.*;
    Makefile--make-->Bitfile;
    Bitfile--make load-->FPGA;
    /Output-->/LinuxCNC;
    /LinuxCNC-->riocomp.c;
    /LinuxCNC-->rio.ini
    /LinuxCNC-->rio-gui.xml
    /LinuxCNC-->*.hal;

Directory Structure

riocore
├── bin ················ user tools / gui's
├── doc ················ documentation
├── dockerfiles ········ files to run the docker container
├┬─ ricore ············· main directory 
|├── boards ············ board configurations
|├── chipdata ·········· pin-information about the different FPGAs
|├── configs ··········· some demo configurations
|├── files ············· helper scripts and files
|├┬── generator ········ the generators for the GateWare and LinuxCNC configuration
||├── addons ··········· generator addons for LinuxCNC (like joystick/mpg/...)
||├── pins ············· the different pin generators, used by the toolchains
||├── toolchains ······· location of the different toolchain generators
|├── modules ··········· break out board and external modules configuration
|├── plugins ··········· location of the plugins
├── tests ·············· unit tests