You are on page 1of 58

EmbeddedLinuxsystemdevelopment

EmbeddedLinux application development

.S

MichaelOpdenacker ThomasPetazzoni FreeElectrons

make

.h

.c++

.c

Copyright20042009,FreeElectrons. CreativeCommonsBYSA3.0license Latestupdate:Sep28,2010, Documentsources,updatesandtranslations: http://freeelectrons.com/docs/appdev Corrections,suggestions,contributionsandtranslationsarewelcome!

1
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Contents
Applicationdevelopment DevelopingapplicationsonembeddedLinux Buildingyourapplications Sourcemanagement Integrateddevelopmentenvironments(IDEs) Versioncontrolsystems Debuggingandanalysistools Debuggers Staticcodecheckers Memorycheckers Systemanalysis Developmentenvironments DevelopingonWindows
2

FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Applicationdevelopment

DevelopingapplicationsonembeddedLinux

3
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Applicationdevelopment
AnembeddedLinuxsystemisjustanormalLinuxsystem,with usuallyasmallerselectionofcomponents Intermsofapplicationdevelopment,developingonembedded LinuxisexactlythesameasdevelopingonadesktopLinux system Allexistingskillscanbereused,withoutanyparticular adaptation Allexistinglibraries,eitherthirdpartyorinhouse,canbe integratedintotheembeddedLinuxsystem
Takingintoaccount,ofcourse,thelimitationoftheembedded systemsintermsofperformance,storageandmemory

4
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Programminglanguage
Thedefaultprogramminglanguageforsystemlevelapplicationin LinuxisusuallyC
TheClibraryisalreadypresentonyoursystem,nothingtoadd

C++canbeusedforlargerapplications
TheC++librarymustbeaddedtothesystem Somelibraries,includingQt,aredevelopedinC++sotheyneedthe C++libraryonthesystemanyway

Scriptinglanguagescanalsobeusefulforquickapplication development,webapplicationsorscripts
Buttheyrequireaninterpreterontheembeddedsystemandhave usuallyhighermemoryconsumptionandslightlylower performances

Languages:Python,Perl,Lua,Ada,Fortran,etc.
5
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Clibraryorhigherlevellibraries?
Formanyapplications,theClibraryalreadyprovidesarelatively largesetoffeatures
fileanddeviceI/O,networking,threadsandsynchronization,inter processcommunication Thoroughlydescribedintheglibcmanual,orinanyLinuxsystem programmingbook However,theAPIcarriesalotofhistoryandisnotnecessarilyeasy tograspfornewcomers

Therefore,usingahigherlevelframework,suchasQtortheGtk stack,mightbeagoodidea
Theseframeworksarenotonlygraphicallibraries,theircoreis separatefromthegraphicalpart Butofcourse,theselibrarieshavesomememoryandstorage footprint,intheorderofafewmegabytes
6
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Buildingyourapplications
Forsimpleapplicationsthatdonotneedtobereallyportableor providecompiletimeconfigurationoptions,asimpleMakefilewill besufficient Formorecomplicatedapplications,orifyouwanttobeableto runyourapplicationonadesktopLinuxPCandonthetarget device,usingabuildsystemisrecommended
Lookattheautotools(ancient,complicatedbutverywidelyused)or CMake(modern,simpler,smallerbutgrowinguserbase)

TheQTlibraryisaspecialcase,sinceitcomeswithitsownbuild systemforapplications,calledqmake

7
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

SimpleMakefile(1)
CaseofanapplicationthatonlyusestheClibrary,containstwo sourcefilesandgeneratesasinglebinary CROSS_COMPILE?=armlinux CC=$(CROSS_COMPILE)gcc OBJS=foo.obar.o all:foobar foobar:$(OBJS) $(CC)o$@$^ clean: $(RM)ffoobar$(OBJS)
8
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

SimpleMakefile(2)
CaseofanapplicationthatusestheGlibandtheGPSlibraries CROSS_COMPILE?=armlinux LIBS=libgpsglib2.0 OBJS=foo.obar.o CC=$(CROSS_COMPILE)gcc CFLAGS=$(shellpkgconfigcflags$(LIBS)) LDFLAGS=$(shellpkgconfiglibs$(LIBS)) all:foobar foobar:$(OBJS) $(CC)o$@$^$(LDFLAGS) clean: $(RM)ffoobar$(OBJS)

FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Applicationdevelopment

Sourcemanagement
IntegratedDevelopmentEnvironments(IDE)

10
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Sourcebrowsers
LXR:LinuxCrossReference Allowstobrowsecodethroughawebbrowser. cscope Consolemodesourcebrowsingtool. Integrateswitheditorslikeviandemacs. KScope Agraphicalinterfacetocscope. SeeourLinuxkernelanddriverdevelopmenttrainingmaterials (http://freeelectrons.com/docs/kernel)formoredetails.

11
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

KDevelop
http://kdevelop.org AfullfeaturedIDE! License:GPL Supportsmanylanguages: Ada,C,C++,Database,Java,Perl,PHP,Python,Ruby,Shell Supportsmanykindsofprojects: KDE,butalsoGTK,Gnome,kerneldrivers,embedded(Opie)... Manyfeatures:editor,syntaxhighlighting,codecompletion, compilerinterface,debuggerinterface,filemanager,class browser... Niceoverview:http://en.wikipedia.org/wiki/Kdevelop
12
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

KDevelopscreenshot
Ruby debugger

13
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

AnjutaDevStudio
http://www.anjuta.org/ Gnome'sIDE LessfeaturesthanKDevelopsofar. License:GPL Supportedlanguages:CandC++ Supportedprojecttypes:commandline,GTK,Gnome, wxWindows,Xlib. Features:integratededitor,syntaxhighlighting,code completion,compileranddebuggerinterface,tagbrowser.

14
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Anjutascreenshot

Anjuta'sclass inheritancegraph andterminal

15
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Eclipse(1)
http://www.eclipse.org/ Anextensible,pluginbased softwaredevelopmentkit,typicallyusedforcreatingIDEs. SupportedbytheEclipsefoundation,anonprofit consortiumofmajorsoftwareindustryvendors(IBM,Intel, Borland,Nokia,WindRiver,Zend,ComputerAssociates...). FreeSoftwarelicense(EclipsePublicLicense). IncompatiblewiththeGPL. Supportedplatforms:GNU/Linux,Unix,Windows Extremelypopular:createdalotofattraction.

16
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Eclipse(2)
Eclipseisactuallyaplatformcomposedofmanyprojects: http://www.eclipse.org/projects/
SomeprojectsarededicatedatintegratingintoEclipsefeatures usefulforembeddeddevelopers(crosscompilation,remote development,remotedebugging,etc.)

TheplatformisusedbymajorembeddedLinuxsoftwarevendors fortheir(proprietary)systemdevelopmentkits: MontaVistaDevRocket,TimeSysTimeStorm,Windriver Workbench,SysgoELinOS. Eclipseisahugeproject. Itwouldrequireanentiretrainingsession!

17
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Applicationdevelopment

Sourcemanagement
Versioncontrolsystems

18
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Versioncontrolsystems
Realprojectscan'tdowithoutthem Allowmultipledeveloperstocontributeonthesameproject.Each developercanseethelatestchangesfromtheothers,orchoose tostickwitholderversionsofsomecomponents. Allowtokeeptrackofchanges,andrevertthemifneeded. Allowdeveloperstohavetheirowndevelopmentbranch (branching) Supposedtohelpdevelopersresolvingconflictswithdifferent branches(merging)

19
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Traditionalversioncontrolsystems
Relyonacentralrepository Onlymentioningthemostpopularones CVSConcurrentVersionsSystem Stillquitepopular http://en.wikipedia.org/wiki/Concurrent_Versions_System Subversion CreatedasareplacementofCVS,removingmanyofits limitations.Theuserinterfaceisverysimilar. http://en.wikipedia.org/wiki/Subversion_(software)

20
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Distributedsourcecontrolsystems(1)
Nolongerhaveacentralrepository MoreadaptedtothewaytheFreeSoftwarecommunitydevelops softwareandorganizes Peoplegetworkingcopiesfromotherpeople'sworkingcopies, andexchangechangesbetweenthemselves.Branchingand mergingismadeeasier. Makeiteasierfornewdeveloperstojoin,makingtheirown experimentswithouthavingtoapplyforrepositoryaccess.

21
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Distributedsourcecontrolsystems(2)
Onlymentioningthemostpopular Git InitiallydesignedanddevelopedbyLinusTorvalds forLinuxkerneldevelopment. Extremelypopularinthecommunity, andusedbymoreandmoreprojects. Outstandingperformance,inparticularinbigprojects. http://en.wikipedia.org/wiki/Git_(software) Mercurial Anothersystem,createdwiththesamegoalsasGit. Usedbybigprojectstoo. http://en.wikipedia.org/wiki/Git_(software)
http://en.wikipedia.org/wiki/Version_control_systems#Distributed_revision_control
22
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Softwaredevelopmenttools

Debuggingandanalysistools
Debuggers

23
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

GDB
TheGNUProjectDebugger http://www.gnu.org/software/gdb/ ThedebuggeronGNU/Linux, availableformostembeddedarchitectures. Supportedlanguages:C,C++,Pascal,ObjectiveC,Fortran, Ada... Consoleinterface(usefulforremotedebugging). Graphicalfrontendsavailable. Canbeusedtocontroltheexecutionofaprogram,set breakpointsorchangeinternalvariables.Youcanalsouseitto seewhataprogramwasdoingwhenitcrashed(byloadingits memoryimage,dumpedintoacorefile). Seealsohttp://en.wikipedia.org/wiki/Gdb
24
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

GDBcrashcourse
AfewusefulGDBcommands
breakfoobar putsabreakpointattheentryoffunctionfoobar() breakfoobar.c:42 putsabreakpointinfoobar.c,line42 printvarorprinttask>files[0].fd printsthevariablevar,oramorecomplicatedreference.GDBcan alsonicelydisplaystructureswithalltheirmembers continue continuetheexecution next continuetothenextline,steppingoverfunctioncalls step continuetothenextline,enteringintosubfunctions
25
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

GDBgraphicalfrontends
DDDDataDisplayDebugger http://www.gnu.org/software/ddd/ Themostpopulargraphicalfrontend, withadvanceddataplottingcapabilities. GDB/Insight http://sources.redhat.com/insight/ FromtheGDBmaintainers(RedHat). KDbg http://www.kdbg.org/ Anotherfrontend,fortheKDisplayEnvironment.

26
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Introductiontosoftwaredevelopmenttools

Debuggingandanalysistools
Remotedebugging

27
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Remotedebugging
Inanonembeddedenvironment,debuggingtakesplaceusinggdbor oneofitsfrontend. gdbhasdirectaccesstothebinaryandlibrariescompiledwith debuggingsymbols. However,inanembeddedcontext,thetargetplatformenvironmentis oftentoolimitedtoallowdirectdebuggingwithgdb(2.4MBonx86). Remotedebuggingispreferred gdbisusedonthedevelopmentworkstation,offeringallitsfeatures. gdbserverisusedonthetargetsystem(only100KBonarm).

gdb

gdbserver

28
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Remotedebugging:architecture
Host Target gdbserver Serialor Ethernet connection
Binariesandlibraries withdebugging symbolsnotstripped Runningprogram withbinariesand librariesthat canbestripped

ARCHlinuxgdb

29
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Remotedebugging:usage
Onthetarget,runaprogramthroughgdbserver. Programexecutionwillnotstartimmediately. gdbserverlocalhost:<port><executable><args> gdbserver/dev/ttyS0<executable><args> Otherwise,attachgdbservertoanalreadyrunningprogram: gdbserverattachlocalhost:<port><pid> Then,onthehost,runARCHlinuxgdbprogram, andusethefollowinggdbcommands: Toconnecttothetarget: gdb>targetremote<target>:<port> gdb>targetremote/dev/ttyS0 Totellgdbwheresharedlibrariesare: gdb>setsysroot<librarypath> (networking) (seriallink) (withoutlib/)
30
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Postmortemanalysis
Whenanapplicationcrashesduetoasegmentationfaultandthe applicationwasnotundercontrolofadebugger,wegetno informationsaboutthecrash Fortunately,Linuxcangenerateacorefilethatcontainsthe imageoftheapplicationmemoryatthemomentofthecrash,and gdbcanusethiscorefiletoletusanalyzethestateofthe crashedapplication Onthetarget
Useulimitcunlimitedtoenablethegenerationofacore filewhenacrashoccurs

Onthehost
Afterthecrash,transferthecorefilefromthetargettothehost,and runARCHlinuxgdbccorefileapplicationbinary
31
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Softwaredevelopmenttools

Debuggingandanalysistools
Staticcodecheckersandmemorycheckers

32
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Splint
http://splint.org/,fromtheUniversityofVirginia GPLtoolforstaticallycheckingCprogramsforsecurity vulnerabilitiesandcodingmistakes Today'slintprogramforGNU/Linux. ThesuccessorofLClint. Verycompletemanualanddocumentation Doesn'tsupportC++

33
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

memcheck
http://hald.dnsalias.net/projects/memcheck/ GNUGPLtoolfordynamicmemorychecking Worksbyreplacingglibc'smemorymanagementfunctions byitsown. SupportsmostusefulCPUarchitectures.

34
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

DUMA
DetectUnintendedMemoryAccess http://duma.sourceforge.net/ ForkandreplacementforElectricFence Stopsyourprogramontheexactinstructionthatoverrunsor underrunsamalloc()memorybuffer. GDBwillthendisplaythesourcecodelinethatcausesthe bug. Worksbyusingthevirtualmemoryhardwaretocreatea redzoneattheborderofeachbuffertouchthat,andyour programstops. WorksonanyplatformsupportedbyLinux,whateverthe CPU(providedvirtualmemorysupportisavailable).
35
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Valgrind(1)
http://valgrind.org/ GNUGPLSoftwaresuitefordebugging andprofilingprograms. Supportedplatforms:Linuxonx86,x86_64,ppc32,ppc64 Others:compileyourprogramtotheseplatformstouseValgrind. Candetectmanymemorymanagementandthreadingbugs. Profiler:providesinformationhelpfultospeedupyourprogram andreduceitsmemoryusage. Themostpopulartoolforthisusage. Evenusedbyprojectswithhundredsofprogrammers.

36
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Valgrind(2)
Canbeusedtorunanyprogram,withouttheneedto recompileit. Exampleusage valgrindleakcheck=yeslsla Worksbyaddingitsowninstrumentationtoyourcodeand thenrunninginonitsownvirtualx86(orppc)core. Significantlyslowsdownexecution,butstillfinefortesting! Moredetailsonhttp://valgrind.org/info/and http://valgrind.org/docs/manual/coregrind_core.html#howworks

37
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Valgrindonotherplatforms
Tocheckprogramsonnonx86ornonppcCPUarchitectures Writeportablecode(alwaysuseful), andcompileitforx86orppc Then,debugyourapplicationwithValgrind. Oncebugsarefoundandfixed, youcangetbacktoyouroriginalplatform. ThisisparticularlyusefulwithuClinux, inwhichmemoryerrorsareverydifficulttofind.

38
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Softwaredevelopmenttools

Debuggingandanalysistools
Systemanalysis

39
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

strace
Systemcalltracer http://sourceforge.net/projects/strace/ AvailableonallGNU/Linuxsystems Canbebuiltbyyourcrosscompilingtoolchaingenerator. Allowstoseewhatanyofyourprocessesisdoing: accessingfiles,allocatingmemory... Oftensufficienttofindsimplebugs. Usage: strace<command> stracep<pid> Seemanstracefordetails. (startinganewprocess) (tracinganexistingprocess)

40
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

straceexampleoutput
>stracecatMakefile execve("/bin/cat",["cat","Makefile"],[/*38vars*/])=0 brk(0)=0x98b4000 access("/etc/ld.so.nohwcap",F_OK)=1ENOENT(Nosuchfileordirectory) mmap2(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,1,0)= 0xb7f85000 access("/etc/ld.so.preload",R_OK)=1ENOENT(Nosuchfileordirectory) open("/etc/ld.so.cache",O_RDONLY)=3 fstat64(3,{st_mode=S_IFREG|0644,st_size=111585,...})=0 mmap2(NULL,111585,PROT_READ,MAP_PRIVATE,3,0)=0xb7f69000 close(3)=0 access("/etc/ld.so.nohwcap",F_OK)=1ENOENT(Nosuchfileordirectory) open("/lib/tls/i686/cmov/libc.so.6",O_RDONLY)=3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320h\1\0004\0\0\0\344"...,512) =512 fstat64(3,{st_mode=S_IFREG|0755,st_size=1442180,...})=0 mmap2(NULL,1451632,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_DENYWRITE,3,0)= 0xb7e06000 mprotect(0xb7f62000,4096,PROT_NONE)=0 mmap2(0xb7f63000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED| MAP_DENYWRITE,3,0x15c)=0xb7f63000 mmap2(0xb7f66000,9840,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED| MAP_ANONYMOUS,1,0)=0xb7f66000 close(3)=0

41
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

ltrace
Atooltotracelibrarycallsusedbyaprogram andallthesignalsitreceives Veryusefulcomplementtostrace, whichshowsonlysystemcalls. Ofcourse,worksevenifyoudon'thavethesources Allowstofilterlibrarycallswithregularexpressions, orjustbyalistoffunctionnames. Manualpage:http://linux.die.net/man/1/ltrace Seehttp://en.wikipedia.org/wiki/Ltracefordetails

42
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

ltraceexampleoutput
ltraceneditindex.html sscanf(0x8274af1,0x8132618,0x8248640,0xbfaadfe8,0)=1 sprintf("const0","const%d",0)=7 strcmp("startScan","const0")=1 strcmp("ScanDistance","const0")=1 strcmp("const200","const0")=1 strcmp("$list_dialog_button","const0")=1 strcmp("$shell_cmd_status","const0")=1 strcmp("$read_status","const0")=1 strcmp("$search_end","const0")=1 strcmp("$string_dialog_button","const0")=1 strcmp("$rangeset_list","const0")=1 strcmp("$calltip_ID","const0")=1 ...

43
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

ltracesummary
Examplesummaryattheendoftheltraceoutput(coption)
Process17019detached %timesecondsusecs/callcallserrorssyscall 100.000.000050501set_thread_area 0.000.000000048read 0.000.000000044write 0.000.00000008063open 0.000.000000019close 0.000.00000001execve 0.000.000000022access 0.000.00000003brk 0.000.00000001munmap 0.000.00000001uname 0.000.00000001mprotect 0.000.000000019mmap2 0.000.00000005046stat64 0.000.000000018fstat64 100.000.000050288111total

44
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Oprofile
http://oprofile.sourceforge.net Asystemwideprofilingtool CancollectstatisticslikethetopusersoftheCPU. Workswithouthavingthesources. Requiresakernelpatchtoaccessallfeatures, butisalreadyavailableinastandardkernel. Requiresmoreinvestigationtoseehowitworks. Ubuntu/Debianpackages: oprofile,oprofilegui

45
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Callgrind/KCachegrind
Cachegrind/Callgrind:partoftheValgrindtoolsuite Collectsfunctioncallstatisticsandcallgraphs. Usefultoknowinwhichfunctionsmosttimeisspent. KCachegrind:http://kcachegrind.sourceforge.net/ AnamazingvisualizerforCachegrind/Callgrinddata. KCachegrindcanalsoimportdatafromotherprofilers (suchasOProfile),andfromprofilingoutputfromPython,Perl andPHP.

46
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

KCachegrindscreenshot

47
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

PracticallabRemotedebugging

TimetostartLab! Setupremotedebuggingtools onthetarget:strace,ltrace andgdbserver. Debugasimpleapplication runningonthetargetusing remotedebugging

48
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Softwaredevelopmenttools

DevelopingonWindows

49
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

DevelopingonWindows!?
UsingaGNU/Linuxworkstationistheeasiestwaytocreate softwareforGNU/LinuxorembeddedLinux Youusethesametoolsandenvironmentasallcommunity developersdo.Muchfewerissuesyouaretheonlyoneto face. Yougetfamiliarwiththesystem. Essentialforunderstandingissues. However,somedevelopershavenochoice: WindowsistheonlydesktopOSallowedintheircompany.

50
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Cygwin
http://cygwin.com/ Linux(POSIX)likeenvironmentforWindows 2components: LinuxAPIemulationlayer:cygwin1.dll AcollectionoftoolsoriginallyfoundinGNU/Linux AllowstocompileandrunmanyGNU/LinuxprogramsonWindows: shells,compiler,httpservers,XWindow,GTK... Veryeasytoinstall.Canchoosewhichtoolstodownloadandinstall. ForembeddedLinuxsystemdevelopers: makesitpossibletouseGNUtoolchains(compiledforWindows) requiredtobuildLinuxbinaries(kernel,librariesorapplications).

51
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Cygwinscreenshot

52
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Cygwinlimitations
CygwinisnotacompletesubstituteforarealGNU/Linuxsystem. AlmostalldevelopersworkonGNU/LinuxoronanotherUnix platform(typicallyBSD).Don'texpectthemtotestthattheir toolsbuildonWindowswithCygwin. ThenumberofCygwinusersisquitesmall. Youmaybethefirsttofaceorreportbuildingissuesonthis platformforagivencompilerortoolversion. So,thebestsolutionistorunLinuxinsideWindows!

53
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

VMware
http://en.wikipedia.org/wiki/VMware License:proprietary CanrunaGNU/LinuxPCfromWindows, almostatthehostspeed. VMwarePlayerisnowavailablefreeofcharge. ManyFreeSoftwaresystemimagesavailablefordownload. Themostpopularsolutioninthecorporateworld.

54
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

VirtualBox
http://virtualbox.orgfromSunMicrosystems PCemulationsolutionavailable onbothWindowsandGNU/Linux 2licenses:
Proprietary:freeofcostforpersonaluseandevaluation. BinariesavailableforWindows.Fullfeatures. OpenSourceEdition(OSE):GPLlicense. Mostfeatures(exceptinparticularUSBsupport). NobinariesreleasedforWindowssofar(butpossible).

BasedonQEMU'scoreengine. PerformancesimilartothatofVMware. Seehttp://en.wikipedia.org/wiki/VirtualBox


55
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Relateddocuments

Allourtechnicalpresentations onhttp://freeelectrons.com/docs Linuxkernel Devicedrivers Architecturespecifics EmbeddedLinuxsystemdevelopment


FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Howtohelp
Youcanhelpustoimproveandmaintainthisdocument... Bysendingcorrections,suggestions,contributionsand translations Byaskingyourorganizationtoorderdevelopment,consulting andtrainingservicesperformedbytheauthorsofthese documents(seehttp://freeelectrons.com/). Bysharingthisdocumentwithyourfriends,colleagues andwiththelocalFreeSoftwarecommunity. Byaddinglinksonyourwebsitetoouronlinematerials, toincreasetheirvisibilityinsearchengineresults.

FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com

Linuxkernel Linuxdevicedrivers Boardsupportcode Mainstreamingkernelcode Kerneldebugging EmbeddedLinuxTraining Allmaterialsreleasedwithafreelicense! UnixandGNU/Linuxbasics Linuxkernelanddriversdevelopment RealtimeLinux,uClinux Developmentandprofilingtools Lightweighttoolsforembeddedsystems Rootfilesystemcreation Audioandmultimedia Systemoptimization

FreeElectrons
Ourservices
CustomDevelopment Systemintegration EmbeddedLinuxdemosandprototypes Systemoptimization Applicationandinterfacedevelopment Consultingandtechnicalsupport Helpindecisionmaking Systemarchitecture Systemdesignandperformancereview Developmenttoolandapplicationsupport Investigatingissuesandfixingtoolbugs

You might also like