3

As a hobby project, I'd like to learn development on "bare metal" with Ada. It seems GNAT compiler has support for various development boards and provides a few different runtimes - zfp, ravenscar-sfp, ravenscar-full.

I'm not quite sure which MCU has better support and nicer to work with. I've been looking at:

TI "TMS570LC43x Hercules Development Kit". This has Cortex-R5F CPU, which looks quite interesting for learning hardware features required for hard real-time applications. But the board is somewhat expensive and there aren't any tutorials on how to use GNAT with this board.

ST "STM32F7 discovery kit". This has Cortex-M7 CPU. The board is much cheaper and there are quite a few tutorials that use STM32F boards with GNAT.

Both of these boards seem to be supported by GNAT bb-runtimes. Has anyone worked with either of them and could provide recommendations? How well do they work with GNAT runtimes and which one has better debug support or development features?

  • Haven’t used the TI board because (a) expensive (b) complex. See [Ada Drivers Library](https://github.com/AdaCore/Ada_Drivers_Library/tree/master/boards) for AdaCore support for boards: the TI one doesn’t feature, probably because of lack of demand. – Simon Wright Nov 04 '20 at 10:10
  • The problem with the security chip from TI is...the security. Venturing off the beaten path, you have to worry about bricking it or have good tools within or outside ti. Where the ST parts are pretty easy to recover. I would go for a nucleo over a discovery, easier to use and in this case costs less. if you can get GNAT to build for a cortex-m then any cortex-m will do. The link you provided supports the luminary micro lm3s which you can use qemu for and do this for free. Plus a number of other stm32 chips, etc that you can get boards for $10... – old_timer Nov 04 '20 at 11:59
  • 1
    question really is what do you mean by bare metal? do you mean calling libraries or actually touching hardware, touching hardware you extract the bootstrap, etc and any other ada to baremetal layers needed, then do your own thing and can support any board/chip. – old_timer Nov 04 '20 at 12:00
  • When I say "bare metal" I refer to running Ada programs without support of some RTOS. I'd like to get started with a small Ada runtime environment like Ravenscar and as I get more experience, start using AdaCore drivers library or write a few of my own drivers, that access different parts of hardware. –  Nov 04 '20 at 15:48
  • Thanks to this question I revisited ada/gnat. I have not put it all together but it looks pretty straight forward to use this linked repo as a reference and just do your own thing for whatever target, no need for full libraries for specific boards/chips...piece together just what you need. Have you done bare metal before in C/asm? – old_timer Nov 05 '20 at 01:00
  • Professionally I've been doing low-level C programming on Unix for many years, but not bare metal. It's very similar, just different set of interfaces, but I'd like to focus on Ada as it is a completely different experience. Ada with a Ravenscar runtime is a bit like a mini RTOS, it has native support for tasking and various other features [link](https://blog.adacore.com/theres-a-mini-rtos-in-my-language) –  Nov 05 '20 at 08:11
  • the example led blinker that is part of the adacore tool install is trivial to modify to blink an led on a NUCLEO-F446RE, peripherals are the same address for these parts. Not too difficult to figure out how to roll your own adb/ads files to do the same thing. – old_timer Nov 09 '20 at 02:41
  • adacores example is ravenscar-full based and I had no issues with it blinking the led I was after something thinner like ravenscar-sfp or better zfp-stm32f4 or zfp-cortex-mX for any of them...so I may circle around when motivated to try those again... – old_timer Nov 10 '20 at 15:18

3 Answers3

0

Based on the comments to my question, it seems that MCUs from STMicroelectronics would be easier to work with and have better support from GNAT Ada compiler. Most of their MCUs are based on ARM Cortex-M cores, which are more common than Cortex-R cores. There are also more resources (books, tutorials) on how to work with Cortex-M cores. MCUs bases on Cortex-R cores are probably more suited to people working with safety-critical systems.

  • the cortex-r adds problems that you dont want to get into if this is your first time or dont have tons of time and experience and willingness to perhaps brick some cores or build your own pcb with your own backdoor to unlock a bricked chip...walk before you run, you want something less brickable when taking on unknowns like these. – old_timer Nov 05 '20 at 14:37
  • Features like DCLS (Dual-Core Lock Step) on Cortex-R cores look quite interesting, but agree with you about the complexity and potential for errors. –  Nov 05 '20 at 15:57
0

I also just started to do bare metal programming with Ada. My board will probably be the STM32F4 discovery, which are much cheeper than the F7 boards I have seen. Second reason is, that for the F3 Dicovery board there is very good tutorial for bare metal programming with Rust on the Rust homepage which I tried with my F3 board. For Ada, I have only checked the tool chain from AdaCore for that board so far, cross compilation seems to work very well. Unfortunately, the Ada Drivers Library doesn"t support the F3...

-1

I have been using GNAT Ada on ST ARM boards for the last 6 years and use it on about 40 different boards. They have excellent support for the boards they directly support and I have added many others over the years to my collection. I would say go with the 429, 469 or 769 discovery board. I prefer the small footprint (sfp) versions and have fun. I just finished doing some casino games that run on the 429 Discovery board. I mostly use the 2017 version of GNAT ARM because that was their last year of support for win32 which I needed for other things but their new Aug 2020 free download has very nice support for many boards in addition to the ST boards.