multigcs / riocore

riocore
GNU General Public License v2.0
8 stars 3 forks source link

LinuxCNC-RIO - rewrite

in progress but ready for testing


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

Help

Plugins/Drivers

here is a small overview of the plugins: PLUGINS

supported Toolchains

Chips/Boards

RIO is largely platform independent and portable to most FPGAs.

some examples

Getting Started

installing via git:

git clone https://github.com/multigcs/riocore.git
git clone https://github.com/multigcs/riogui.git
cd riocore

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

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 new component first:

halcompile --install Output/BOARD_NAME/LinuxCNC/rio.c

this step is necessary after every configuration change !

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

Prerequisites

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

Flow

graph LR;
    JSON--rio-generator-->Output;
    Output-->Gateware;
    Gateware-->Makefile;
    Gateware-->verilog-files;
    Gateware-->pins.*;
    Makefile--make-->Bitfile;
    Output-->LinuxCNC;
    LinuxCNC-->rio.c;
    LinuxCNC-->rio.ini
    LinuxCNC-->rio-gui.xml
    LinuxCNC-->*.hal;
    rio.c--halcompile-->hal-component;