Upload
jamieayre
View
152
Download
0
Embed Size (px)
Citation preview
Jérôme Lambourg
Cross & BareBoard team Inside Out
GNAT Pro team co-lead
I can hear you think…
Theyshouldsaybarebored.
Ohmy…
Bareboard??
Ah!Aperfecttimeforagoodnap…
Hey,Iwokeupearlytoattendthismeeting!
I can hear you snor…
Even from outer space…
DammitJim!Thisisnotlogical.
Notanelectricalengineer!
I’m aprogrammer
ANYWAY, LET’S GIVE IT A TRYThislooksboring indeed…
Agenda
•What'snewinVxWorks 6533.x (Doug)• Binutils internals(Tristan)• GCC:configuration tipsandtricks(OlivierH)• Qemu:howtoimplementanewboard(Fabien)• GprBuild:howtoaddanewtoolchain (Joel)• CompletehistoryoftherelationshipbetweenAdaCore andWindRiver (EdF)
This is really about
OurDailyactivities
What makes us wake up in the morning
GNAT Pro for Cross & BB
DebuggingEmulatorsSimulatorsBoards
TestSuites
Production
GprBuild, tools
BinutilsIDEs
GCC/GNATRuntimes
GNAT Pro for Cross & BB
BinutilsCompilerRun-timeQemu
gprbuild
production
Debugger
GPSGnatBench
CPUscoprocessorsBoards ABI
certification
Real-time
OS(crossonly)
Making it work together
Sales
Strategy
Marketing
Roadmap
Certification
CROSS DEVELOPMENTPARTI
Example: Investigating Cross issues
"A Cross never, ever marks the spot"Indiana Jones
Thecrime
An aCATs test FAILS on e500v2-vx7
Blargh, I is DED on e500v2
Usercode
AdaRun-time+compiler
OS
Context
Board
Signal raised
Translated into exception
Exception handler
Theissue:exceptionhandlerisnever
calledToomuchmemory
used
JeromeL* WhyisitworkingonPPCandnotone500v2?Joel* Goodluck!CrossingfingersEdF* Thisremindsmeofsomegoodoldbug.Thosewerethe
days.Doug* SimilarissueherewithZCXonvx6forx86,willkeepyou
postedJeromeG* Guys,IneedtotakemyThursdayoffnextweek.
*Allcharactersappearinginthispresentationarefictional.Anyresemblancetorealpeopleispurelycoincidental.
Usercode
AdaRun-time+compiler
OS
Board
Signal raised
Translated into exception
Exception handler
Toomuchmemoryused
Wow!Thislooks
complex
Investigate the crime scene
Need help
• AfteracompleteexplanationfromOlivierH oftheexpectedmechanism,Icanresumethedebug.• Whenallocating theexceptionoccurrence,Itlookslikesomethingweirdhappensaroundafunctioncalled"AbortDefer"
Let'scheckthe(CRM)
A guess!
Someoldcase(e.g.TN)referstoissues aboutcallstoAbortDeferfromasignalhandler
Theruntimeistheculprit!!!!!!
Transmit to court (e.g. send an email)
Arno should never happen, allocating exception blah blah blah certification blah blah
OlivierH not an issue blah blah ZCX-specific blah blah
Arno what about BE SJLJ? blah blah
OlivierH indeed blah blahArno in case of tasking blah blah
JeromeL Ah! No tasking involved in this case
Arno then not the issue here, case dismissed, and transferred to the certification court
So let's continue the investigation!
More debugging
…Let’sdigfurtherandstepintoassembler instructions
Debugger log
ØAnunexpectednewsignalisraised (Ah!Ah!Recursivesignals!)
*Allinstructionsappearing inthispresentationarefictional.Anyresemblance torealinstructionsispurelycoincidental.
(gdb) disassemble $pcevaddsmiaaw* … …(gdb) siComputer says No: boom
(Show me the code)(Some code)(Execute it)(or any similar output)
Ø It's an E500v2-specific instruction (YES!)
Second guess
Somee500v2instructionisnotproperlyexecutedbyQEmu?
Qemu istheculprit!!!!!!
Transmit to court (Fabien, Qemu expert)
• DiscussingwithFabien,itturnsoutthatSPEsupportisOKinQemu…socasedismissed(again)
• However,duringthediscussion,headvisesmetocheckthe« MSR »
:MachineStateRegister. Ah!
: SPE instructions are available only when a specific bit is set on the MSR. Else a sigill signal is raised. Ah! Ah!
Google is my friend
:answersmanythings,abouttents,videogames,guns,etc.
MSR
MSRPowerPC
MSRe500v2SPE
Third guess
MaybeVxWorks isnotproperlysettingthebitwhencallingasignalhandler?
VxWorks istheculprit!!!!!!
Transmit to court: send a TSR to WindRiver
• WriteasmallCreproducerthatchecksthespecifiedbitintheregister.=>bitnotset wheninthehandler,setotherwise (youhou!Foundit,foundit!Youcannowsafelybragaboutitwithyourcolleagues)
• TransmitcasetoWindRiver• SolutiondiscussedwithWindRiver
I is OK now!
Thankz!
BARE METAL DEVELOPMENTPARTII
Bare metal* ?
• AboutrunningsoftwarewithoutanyOperatingSystem
• Thisgivesyoufullcontroloverwhatisrunning
* SameasBareBoard,butit’scool
Pros
Realtimeproperties
• Does notmean FAST…• Means ontime!
• Execution timeis predictable• Keyword:« Ravenscar »
Pros
Reliability,certification– Everything that is onboard is under control– Very small footprint– Nobugsfrom theOS
Cons
Softwaree.g.alotofmanual work
DIY
OK, YOU CONVINCED ME:
I BOUGHT THE BOARD XYZ FROMVENDOR ABC.
I WANT TO RUN ADA.
HOW DO I DO THAT?
Well, you can ask usHaveyoucheckedwithSalesfirst?
PatR. Fabien Tristan PatB. Jerome L.
You can also try it by yourself…
First,you need aboard:
Silicium PCB:fiber glass+copper Ceramics
Soldering Plastic Gold, silver, copper…USBportonyour
host
may come pre-assembled in variousshapes and colors
You’ll also need:
• Youwill need docs(such astheARMARM).• Andmoredocs(such astheMCUrefmanual)• Peopletohelpyou finding thedocsyou’remissing (such astheboard schematics)• Some updated docs• Internet&asearch engine (ifyou don’tknowone,letmegoogle that foryou…)
Major steps to move forward
1. Power-uptheboard2. Connect toit3. Create anAdaruntime fortheboard4. Create anexample5. Load theexample into theboard
I. Power up the board
Plugtheboard• See that it’s powered (at leastaLEDshould lightup)
• Ifnot, read thedoconhowtoplug andpoweruptheboard
II. Connect to the board
e.g.find away tocommunicate with thetargeted board
II. Connect to the board
Lookforaway toconnect toit• Lookat thedocthat comes with theboard• Youcan also search theinternet• Youmay ask Tristan*• OrFabien**• OrAnthony*** tocreate aGPSpluginforyou
* Maybe busy,orplaying fussball**Mayalso be busy,butdoes notplay fussball***plays fussball alot
III. Create an Ada runtime
Well,here’s atough one• Ifwe already haveasimilar board supported,theruntime may only needminor adjustments:• Memorymapping (e.g.read thedoc),interrupts (c.f.doc),clock speed(RTFM)• Ifyou’re interested,gosee:blog.adacore.com/porting-the-ada-runtime-to-a-new-arm-board
• Else,you can [email protected] ;)
At this point
• What you haveis:1. Aboard that is powered on(e.g.red led on)2. Some tool claiming itmay controltheboard3. Aruntime that you haven’t tried yet (e.g.aschrodinger runtime:it both works
anddoesn’t)
Iiz and iznota
runtime
Butpliz don’topenthebox
IV. So now is the time…
1. Turn aLEDON2. Wait abit3. Turn theLEDOFF4. Wait abit5. Goto1
…Forthefamousbaremetalhelloworld:“TheblinkingLED”
Scenariois very complex:
IV. The LED example
This« simple »example implies many readings• MCUreferencemanual (ordatasheet):initialization ofthe« GPIO »,theGeneralPurpose I/Osystem.• Board schematics,tofind outonwhich pinoftheGPIOtheled isconnected to.
Thisone?
V. Run all this on the board
Onceyou seem tohaveeverything setup:• Crossyour fingers• Load theexample onboard
Iiz bored.Pliz try again
– Either you endupwith what lookslike abrick
– Oryou can celebrate with ablinking LED(HEY!Comeonandlookatmy LED!Howfun!)
From there, fancy stuff coming!
You’re now ready tocreate aninfinity ofvery fancy stuff …
Fancy stuff (1)
Demos
Fancy stuff (2)
Candydispenser*
*Eat 5fruitsandvegetables aday tokeep healthy
Fancy stuff (3)Flightcontrollers fordrones
Ibelieve Icanfly…
… andlandsafely!
Fancy stuff (4)
Space stuff
Hey!Theauto-landingoftheCrazyflie
doesn’t work here!
Fancy stuff (5)
Ultimate LEDdemo*
*Children:don’t try this at home
WHAT’S NEW?
Some figures: cross & BB products
supported products
new products
Bare Metal: Improvements
• ExtendedRavenscar tasking• Better than state-of-the-art
• MoreCPUs supported• Inparticular Cortex-A
• Multicore (SMPsupport):• Leon,Cortex-A,PPC
Widening the Ada audience
LeverageonthebuzzaroundARMbaremetaldevelopment
Widening the Ada audience
Atwo stagesstrategy
1. Making GNATready-to-use forthose bare metal enthusiasts
2. Making sureeveryone knows aboutthis effort
Widening the Ada audience
Make GNATready-to-use onmany boards• Runtimes:moreboards supported (GPL+github)• SVD2Ada• AdaDriversLibrary
Thisis also meant tohelpyou,notjust newcomers!
Widening the Ada audience
Advertising GNATforARM• Make with Adablogposts• Howtoadapt theruntime blogpost• community.arm.com blogpostonAdaforBB• Make with Adacontest
That’s it!
Thank you foryour attention!
At leasthe didn’tmentioned IOT.
Fine…