Controlling a Train Model with GNAT GPL for Raspberry Pi 2
Tristan GingoldPresented by
Agenda• GNAT GPL 2015
• Model train
• Demo
AdaCore FOSS contributions• AdaCore maintains the Ada front-end of GCC
• AdaCore also contributes patches to the GCC middle and backend
• Mainly bug fixes and contributions related to Ada
• All the software developed by AdaCore is Libre software
• Every year, AdaCore releases GNAT GPL
• A GPL version of AdaCore environment for some platforms
What is GNAT GPL ?• GNAT compiler, based on gcc sources + AdaCore patches
• + IDE (gps), builder, ASIS tools…
• Released every year (June-ish)
• Many add-ons available: AWS, ASIS, GNATbench, Aunit, GNATcoll, GtkAda, XML/Ada, Florist, SPARK
Targeted audience• Academics: members of the GAP program.
• Students
• Free Software / Open Source developers
The license of the GNAT GPL runtime is GPL. Software built with GNAT GPL and linked with its runtime must follow the GPL.
And some extras• We sometimes release GNAT GPL for a new platform
• Not sold (ie not a GNATPro product)
• Just for the community
• Or for a marketing purpose…
• In the past: GNAT-GPL for Lego Mindstorms
GNAT GPL 2015• New: GNAT GPL for Raspberry Pi 2
• Popular platform
• Now uses a modern core: Cortex-A
• Cross compiler, hosted on x86-linux, targeting armhf-linux
• Full runtime
Raspberry Pi Model B+ V1.2
USB port
USB port
Ethernet
HDMI
GPIO
ARM Cortex-A7 4 Cores
Railway safe signaling Demo
2015: STM32F429 board demo
Railway Signaling
Train
Absolute block
Permissive block
Spawn station
Free block
Touch to switch
Why ?• To prove the absence of collision using SPARK 2014
• To get closer to customer experience
• And mainly to play with our new Raspberry Pi 2 port !
Hardware• Electrical railway modelling kit
• On-off power relay to control trains
• Hall effect sensors to detect trains
• Turnout motors to control switches
• Raspberry Pi 2
Hardware Raspberry Pi 2On-off power FETs
Turnout motors to control switches
Hall effect sensors to detect trains
One way track model
Controlled section On/Off
Uncontrolled section
always on
Sensor
Slow train coming
Slow train going on
Slow train detected
Slow train still going
Slow train detected again
Slow train going away
Turnout the tricky part
Turnout the tricky part
Railway layout
Software designwith SPARK_Mode
Signaling Manager (protected object)
Sensor monitoring (Task)
SDL Graphical Interface (task)
Train Simulator (Task)
HW interface Raspberry Pi 2 GPIO
SPARK proof
Real life validation
Real life validation
Conclusion• It works!
• Ada 2012 mixed with SPARK 2014 are ready for the industry
• Easy to access and learn technology
• Demo sources will be available on GitHub
• Have a look at AdaCore University • http://university.adacore.com/