GithubHelp home page GithubHelp logo

reznikmm / esp32-gnat-rts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simonjwright/freertos-ada

17.0 3.0 3.0 2.81 MB

This project contains various GNAT Ada Run Time Systems (RTSs) targeted at Cortex boards: so far, the Arduino Due, the STM32F4-series evaluation boards from STMicroelectronics, and the BBC micro:bit

License: GNU General Public License v3.0

Ada 98.56% C 1.24% Python 0.15% CMake 0.05%

esp32-gnat-rts's Introduction

esp32-gnat-rts

A GNAT Ada Runtime library for ESP32 microcontrollers

This package includes GNAT Ada Run Time Systems (RTSs) based on FreeRTOS and targeted at boards with ESP32 MCUs (tested on Wireless Stick (Gecko Board) by Heltec). For discussions, visit Telegram Ada Group or the dedicated Google Group for the parent cortex-gnat-rts project.

The RTSs are all Ravenscar-based, with additional restrictions No_Exception_Propagation and No_Finalization. No_Exception_Propagation means that exceptions can't be caught except in their immediate scope; instead, a Last_Chance_Handler is called.

In each case, the board support for the RTS (configuration for size and location of Flash, RAM; clock initialization; interrupt naming) is in $RTS/adainclude.

The Ada source is either original or based on FSF GCC (mainly 4.9.1, some later releases too).

Any board with ESP32 should work. We have tested with

  • Wireless Stick (Gecko Board) by Heltec
  • TTGO T-Display ESP32 (Make sure to change LED pin to 2).

The package is based on Cortex-GNAT-RTS by Simon Wright.

Install

Espressif provides a Espressif IoT Development Framework (ESP-IDF). This package uses the SDK to build an Ada project with FreeRTOS. So you need

  • ESP-IDF
  • Custom ESP32 toolchain with Ada enabled
  • gprbuild project manager
  • This package for GNAT Runtime Library and examples

Install ESP-IDF

Follow Get Started to install ESP-IDF.

Install Custom ESP32 toolchain with Ada enabled

Download a toolchain from Releases and unpack and replace toolchain (look into $HOME/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0)

Alternatively, build it from sources as described here and here.

Install gprbuild project manager

Use GNAT Community Edition or install a native package:

apt install gprbuild

Install esp32-gnat-rts

Clone the repository:

git clone https://github.com/reznikmm/esp32-gnat-rts.git

Docker alternative

You can use Docker image to simplify installation. We provide IDF Docker Image with replaced the toolchain.

Here is the example how to clone ESP GNAT Runtime and build the example:

git clone https://github.com/reznikmm/esp32-gnat-rts.git
cd esp32-gnat-rts
docker run --rm -v $PWD:/esp32-gnat-rts -w /esp32-gnat-rts/examples/hello_world/ reznik/gnat:idf-v4.3.1 idf.py build

Usage

ESP-IDF provides an advanced build system (developed on top of CMake) to build a project. An ESP-IDF project can be seen as an amalgamation of a number of components.

The esp32-gnat-rts is a component for ESP-IDF. It should be used to link Ada code into ESP-IDF application.

Build hello_world

  1. Setup ESP-IDF environment:

    . <esp_path>/esp-idf/export.sh
    
  2. Build ESP-IDF application

    cd esp32-gnat-rts/examples/hello_world
    idf.py app
    
  3. Flash it

    cd esp32-gnat-rts/examples/hello_world
    idf.py -p /dev/ttyUSB0 app-flash
    
  4. See "Hello Ada!" output

    idf.py monitor
    I (0) cpu_start: Starting scheduler on APP CPU.
    Hello from Ada!
    

The hello_world application is an ESP-IDF project. It requires esp32-gnat-rts component as dependency. The app_main subprogram called by FreeRTOS is declared in environment_task.adb. It creates an environment task that calls main function (created by gnatbind). In turn main calls Hello_Ada procedure. The Hello_Ada outputs "Hello Ada!" with puts provided by FreeRTOS.

ESP32 peripherals

The esp32 directory contains a draft implementation for peripherals access library. The examples/gpio has a blinking LED demo.

Maintainer

Max Reznik.

Contribute

Feel free to dive in! Open an issue or submit PRs.

License

The runtime license is GPL3 with GCC RunTime Exception.

esp32-gnat-rts's People

Contributors

simonjwright avatar reznikmm avatar gnlnops avatar rree avatar ekoeppen avatar

Stargazers

Martin Moene avatar  avatar Micha Hoiting avatar  avatar Ham, Yeongtaek avatar clausqr avatar Tim Becker avatar Jeremy Grosser avatar jiaojinxing avatar Simon Buist avatar  avatar Pavel Zhukov avatar  avatar Artem Paraev avatar Patrice Freydiere avatar JK avatar Aaron Bieber avatar

Watchers

James Cloos avatar clausqr avatar  avatar

esp32-gnat-rts's Issues

Update toolchain archive

  • Use Ubuntu 18.04 as a build environment to be compatible with IDF docker
  • Add bin/xtensa-esp32-elf-gnatgcc symlink to fix Ubuntu/Debian gprbuild issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.