gnat pro user day: ada 2012, ravenscar and spark running on an atmel arm m4 (tetris example)

31

Upload: adacore

Post on 27-Nov-2014

741 views

Category:

Technology


2 download

DESCRIPTION

From a presentation given at GNAT Pro User Day on Ada 2012, Ravenscar and SPARK running on an Atmel ARM M4 with a Tetris example.

TRANSCRIPT

  • 1. Ada 2012, Ravenscar and SPARKrunning on an Atmel ARM M4Presented byQuentin Ochem

2. GNAT Bare Board for ARM Targets ARM Cortex M and ARM Cortex R Several flavors of run-time (ZFP, Ravenscar) Comes with default BSP for some specific boards Additional BSP may be provided by third parties or implemented bythe user 3. Atmel ARM + AdaCore GNAT Kit Standard Board Atmel SAM4S Xplained Pro GNAT GPL Windows / Linux + Ravenscar SFP for SAM4S SPARK GPL Windows / Linux OpenOCD for Windows 4. Move RightRotate ResetMove LeftDropDemonstrator 5. D:>cd examplesD:examples>cd tetrisD:examplestetris>buildD:examplestetris>flash 6. Tetris SW ArchitectureBSP + DriversMainLeds Oleds Fonts Tetris 7. Tetris SW ArchitectureBSP + DriversMainInterrupt using aRavenscar protected object(writing spots on screen)Leds Oleds Fonts Tetris 8. Tetris SW ArchitectureBSP + DriversMainFormally proven game logicLeds Oleds Fonts Tetrisusing SPARK 2014 9. Programming by Contractsan Ada 2012 (r)evolution 10. What is a contract? Contracts are assertions specified around program entities They can define domain, behavior, guarantees They complete the specification and serve as the basis of variousverifications activities 11. Subprogram Contracts Pre / Post condition define domain,guarantees or behaviorprocedure Double (I : in out Integer)with Pre => I in -50 .. 50,Post => I in -100 .. 100;type Arr is array (Integer range ) of Integer;procedure Double (I : in out My_Range)with Post => I = I'Old * 2;procedure Sort (V : in out Arr)with Post =>(for all I in V'Range =>I = V'First or else V (I 1) Even mod 2 = 0;subtype Composite is Positivewith Dynamic_Predicate =>(for some I in 2 .. Sqrt (Composite) => Composite mod I = 0);type Ordered_Array is array (Integer range ) of Integerwith Dynamic_Predicate =>(for all I in Ordered_Array'Range =>I = Ordered_Array'Firstor else Ordered_Array (I 1)