Library and tools for embedded boards
Copyright 2015-2018 (c), epsilonRT
SysIo is an open source under CeCILL Free Software License Version 2.1 that aims to provide a C, C ++ and Python library to access system hardware resources through a standardized interface.
The specific part of a hardware architecture has been separated to allow porting to different platforms.
This project is in development, for the moment on Linux/Unix platform, it provides the modules:
- Delay delay
- Timers timer
- Serial link serial
- XBee xbee
- ERDF customer information tinfo
- IO memory access iomap
- Ax25 links ax25
- Log management log
- Doubly linked list dlist
- Vector vector
- String string
- Terminals term
- Gps with gpsd gps
on Raspberry Pi platforms (A/B/B+/Pi2/Pi3/Zero) and NanoPi (Neo/NeoAir/M1), it also provides the modules
- Raspberry Pi rpi
- NanoPi rpi
- GPIO gpio
- PWM pins pwm
- I2C Bus i2c
- SPI Bus spi
- IAQ I2C sensor iaq
- HIH6130/ChipCap2 I2C sensor hih6130
- Blyss™ modules blyss
- UHF RFM69 modules rf69
- RGB Leds ledrgb
For each module, one or more examples are provided.
You can get the latest version of development with git :
$ git clone http://github.com/epsilonrt/sysio.git
Its complete documentation is available on the site: http://www.epsilonrt.fr/sysio
To compile, it is necessary to install gcc, g ++, cmake, pkg-config and optionally libgps
-
Install dependencies:
$ sudo apt-get install build-essential cmake libgps-dev
-
Generate the Makefile with cmake:
$ cd sysio $ mkdir build-release && cd build-release $ cmake ..
-
Compile and install sysio:
$ make $ sudo make install $ sudo ldconfig
We can uninstall with a sudo make uninstall
in the same directory.
If you prefer, instead of direct compilation, you can create packages and install them:
$ cmake -DSYSIO_WITH_DOXYGEN_DOC=1 -DCMAKE_INSTALL_PREFIX=/usr ..
$ make package
$ sudo dpkg -i *.deb
If you want to build the documentation it will be necessary to pass the option -DSYSIO_WITH_DOXYGEN_DOC=1 to cmake:
$ cmake -DSYSIO_WITH_DOXYGEN_DOC=1 ..
$ make doc
To create a SysIo project, it is necessary to install the Dev module which
contains the header files '* .h' and the utilities necessary for the compilation.
This is the case if you have installed "manually" with sudo make install
or
if you have installed the libsysio-dev
package.
Sysio provides a pkg-config file that allows you to simply compile a program that uses it:
$ gcc -o myapp main.c $(pkg-config --cflags --libs)
To make things easier, you can use the sysio-prj
utility, for example, to create a C project:
$ sysio-prj -s myCproject
or to create a C ++ project:
$ sysio-prj -s -p myCXXproject
For help with the program:
$ sysio-prj -h
You should open the project file with Codelite then:
- right click on the project
Run CMake
, then - right click on the project
Build
.
That's all !
SysIo uses cmake
, so you can integrate SysIo into CMakeLists.txt
files, just add:
$ find_package(sysio)
With the line above, sysio_FOUND was defined and the variables below are accessible:
SYSIO_INCLUDE_DIRS
: include directories for sysioSYSIO_LIBRARY_DIRS
: where to find librariesSYSIO_LIBRARIES
: libraries to link againstSYSIO_CFLAGS
: all required cflagsSYSIO_WITH_GPIO
: Boolean that indicates that SysIo has been compiled with GPIO supportSYSIO_WITH_I2C
: Boolean that indicates that SysIo has been compiled with I2C bus supportSYSIO_WITH_SPI
: Boolean that indicates that SysIo has been compiled with SPI bus supportSYSIO_WITH_SERIAL
: Boolean that indicates that SysIo has been compiled with serial link supportSYSIO_WITH_GPS
: Boolean that indicates that SysIo has been compiled with GPS support
Here is an example of a CMakeLists.txt
file for SysIo:
cmake_minimum_required(VERSION 3.5)
project(template)
find_package(sysio QUIET)
if (sysio_FOUND)
message (STATUS "SysIo found !")
link_directories(${SYSIO_LIBRARY_DIRS})
add_definitions(${SYSIO_CFLAGS})
include_directories(${SYSIO_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} ${SYSIO_LIBRARIES})
include (PiBoardInfo)
if (NOT PIBOARD_ID)
message (STATUS "Check the target platform, you can use PIBOARD_ID to force the target...")
GetPiBoardInfo()
endif (NOT PIBOARD_ID)
else (sysio_FOUND)
message (STATUS "<WARNING> SysIo not found !")
endif (sysio_FOUND)
file(GLOB SRC *.cpp)
add_executable(${CMAKE_PROJECT_NAME} ${SRC})
target_link_libraries(${CMAKE_PROJECT_NAME} ${SYSIO_LIBRARIES})
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC ${SYSIO_INCLUDE_DIRS})
target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC ${SYSIO_CFLAGS})
install(TARGETS ${CMAKE_PROJECT_NAME} RUNTIME DESTINATION bin)
After you can create the make file and compile the project:
- Create a folder to build:
$ mkdir build-release - Go to this folder:
$ cd build-release - Run CMake:
$ cmake .. - Compile your project:
$ make