Adk Manual for Phyboard-wega-Am335x

download Adk Manual for Phyboard-wega-Am335x

of 15

Transcript of Adk Manual for Phyboard-wega-Am335x

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    1/33

    phyBOARD WEGA-AM335xSingle Board Computer

     Application Development User Manual

    Product No : PCL-051/PBA-CD-02SOM PCB No : 1397.0CB PCB No : 1405.0Edition : Feb 26, 2014

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    2/33

    In this manual cop!i"ht#$ p!o$ucts a!# not #%plicitl in$icat#$. &h# a's#nc# o( th#t!a$#ma!) *+, an$ cop!i"ht *, sm'ols $o#s not impl that a p!o$uct is not p!ot#ct#$. A$$itionall !#"ist#!#$ pat#nts an$ t!a$#ma!)s a!# simila!l not #%p!#ssl in$icat#$ in thismanual.

    &h# in(o!mation in this $ocum#nt has '##n ca!#(ull ch#c)#$ an$ is '#li##$ to '# #nti!#l!#lia'l#. o##! P&C m'#$$#$ Pt. Lt$. assum#s no !#sponsi'ilit (o! aninaccu!aci#s. P&C m'#$$#$ Pt. Lt$ n#ith#! "i#s an "ua!ant## no! acc#pts anlia'ilit hatso##! (o! cons#u#ntial $ama"#s !#sultin" (!om th# us# o( this manual o! itsassociat#$ p!o$uct. P&C m'#$$#$ Pt. Lt$ !#s#!#s th# !i"ht to alt#! th# in(o!mationcontain#$ h#!#in ithout p!io! noti(ication an$ acc#pts no !#sponsi'ilit (o! an $ama"#sthat mi"ht !#sult.

     A$$itionall P&C m'#$$#$ Pt. Lt$ o((#!s no "ua!ant## no! acc#pts an lia'ilit (o!$ama"#s a!isin" (!om th# imp!op#! usa"# o! imp!op#! installation o( th# ha!$a!# o!so(ta!#. P&C m'#$$#$ Pt. Lt$ (u!th#! !#s#!#s th# !i"ht to alt#! th# laout an$/o!

    $#si"n o( th# ha!$a!# ithout p!io! noti(ication an$ acc#pts no lia'ilit (o! $oin" so. Cop!i"ht 2014 P&C m'#$$#$ Pt. Lt$ o!aman"ala Ban"alo!#.

    6i"hts - inclu$in" thos# o( t!anslation !#p!int '!oa$cast photom#chanical o! simila!!#p!o$uction an$ sto!a"# o! p!oc#ssin" in comput#! sst#ms in hol# o! in pa!t - a!#!#s#!#$. o !#p!o$uction ma '# ma$# ithout th# #%plicit !itt#n cons#nt (!om P&Cm'#$$#$ Pt. Lt$.

    In$ia u!op# o!th Am#!ica

     A$$!#ss8 P&C m'#$$#$Pt. Lt$. 1:/9C 3!$ ;loo!3!$ pp8 Polic# ?tationo!aman"alaBan"alo!# -5:0095IDIA

    P&Cchnolo"i# ol$in" A@6o'#!t-och-?t!. 3955129

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    3/33

    Table of ContentsIntroduction..........................................................................................................................................4

    1. Application development using Eclipse IDE...............................................................................41.1. Eclipse IDE Installation.......................................................................................................4

    1.2. Eclipse IDE Coniguration or phy!"A#D$%E&A$A'(()*...........................................)1.2.1. +ost ,etup....................................................................................................................)

    -or inu*:.....................................................................................................................)

    -or %indows:................................................................................................................)1.2.2. arget ,etup..................................................................................................................0

    1.(. Creating a ew ro3ect in Eclipse.......................................................................................01.(.1. +ow to open eclipse.....................................................................................................0

    -or inu*:..........................................................................................................................0

    -or windows:$....................................................................................................................

    1.(.2 Creating a ew ro3ect..................................................................................................51.(.(. "pen new C source ile..............................................................................................161.(.4. %rite simple +ello Application..................................................................................11

    1.(.). !uild the pro3ect.........................................................................................................1(

    1.4. Changing the Demo Application........................................................................................141.4.1. "pen arget !oard using 'inicom............................................................................10

    1.). #emote ,ystem Access using Eclipse................................................................................10-or %indows :..................................................................................................................10

    -or inu* :.......................................................................................................................10

    1.).1. Create ew Connection or #emote ,ystem login....................................................151.).2. ,et the +ost ame and I...........................................................................................15

    1.0. De7ugging an e*ample pro3ect...........................................................................................2(1.0.1. ,tarting the &D! server on the target........................................................................2(

    1.0.2. Coniguring and starting the de7ugger in Eclipse......................................................24

    1.0.(. ,etting a !rea8point ..................................................................................................21.0.4. ,tepping and %atching 9aria7le Contents.................................................................25

    1.0.). ,tepping and %atching 9aria7le Contents.................................................................(61.0.0. sing the 'emory 'onitor........................................................................................(1

    P&C m'#$$#$ Pt. Lt$ 2014

    (

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    4/33

    Introduction

    This Reference Manual describes the phyBOARD-WEGA-AM335x fr applicatinde!elp"ent# $irst chapter describes the installatin f eclipse and h% t de!elp anapplicatin n phyBOARD-WEGA-AM335x usin& Eclipse 'DE# (ecnd chapter describesabut h% t %rite an applicatin usin& cnsle ter"inal# After c"pletin& this "anual yu %ill c"e t )n% h% t use the Eclipse#

    1. Application development using Eclipse IDE

    Durin& this chapter yu %ill learn h% t build yur %n *+*,, applicatins fr the tar&et %ith the help f Eclipse# We %ill start de!elpin& ur %n applicatins %ith the help fEclipse# $irst %e %ill ta)e a l) n the * pr&ra""in& lan&ua&e# At the end f thischapter %e %ill explain h% t execute yur %ritten pr&ra"s aut"atically %hen btin&the tar&et#

    1.1. Eclipse IDE Installation

    Download the Eclipse IDE from the below links (Note: According to your systemconfiguration) and install.

    For Linux:

    Install a!a using below command:

    " sudo apt#get install opendk#$#dk opendk#$#re Download eclipse from below link:

    http:%%www.eclipse.org%downloads%packages%eclipse#ide#cc#de!elopers%unosr&

    For windows:

    Download and install the java for windows using below link: 

    http:%%www.oracle.com%technetwork%a!a%a!ase%downloads%re$#downloads#'&*'.html

    Download eclipse from below link:

     http:%%www.eclipse.org%downloads%packages%eclipse#ide#cc#de!elopers%unosr&

    P&C m'#$$#$ Pt. Lt$ 2014

    4

    http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/junosr2http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.htmlhttp://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/junosr2http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/junosr2http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.htmlhttp://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/junosr2

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    5/33

    1.2. Eclipse IDE Configuration for phyB!"D#$E%!#!&''(x

    1.2.1. Host Setup

    Toolchain: -or Compiling the Application we need the toolchain which you can easilydownload rom the 7elow lin8.

    For Linux:

    ftp:%%ftp.phytec.de%pub%+roducts%India%phy,-AD /E0A#A12234%5inu4%+D'6..%tools%toolchain%arm#corte4a#linu4#gnueabihf.tar.b7&

    8et ip Address

    " ifconfig eth '9&.'*.'.'& up

    8et the gateway

    route add default gw '9&.'*.'.'

    For indo!s:

    http:%%sourcery.mentor.com%public%gnu;toolchain%arm#none#linu4#gnueabi%arm#

    &'&.9#*6#arm#none#linu4#gnueabi.e4e

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    6/33

    1.2.2. Target Setup

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    7/33

    For windows:#

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    8/33

    ow you can see the Eclipse %or87ench as 7elow:

    1.3.2 Creating a New Project 

    In this section we will learn how to create a new proect with Eclipse and how toconfigure the proect for use with the 0NB #

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    9/33

    Enter the proect name myCello/orld and ?oolchain as

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    10/33

      Set Toolchain Prefix & Path and Clic* Finish

      8elect the

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    11/33

    In 8ource file write myCello/orld.c and click on >inish.

    K

    1.3.4. Write simple Hello pplication

      /rite a simple Cello Application in

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    12/33

     ?o compile your proect for the phyBOARD-WEGA-AM335x instead@ you will ha!eto use the 0NB #

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    13/33

      Note  First login manually using ssh as shown in snapshot below. Otherwise we will not be able to  login in target because it reuires secure connection.

     Note

     If you are using windows so you have to use Winscp (or) directly copy thebinary into target board using pen-drive or sd-card.

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    14/33

     Note 

    If you are using Window machine then you need the make utils using the

    below link.

     ftp:%%ftp.eMuation.com%make%2&%make.e4e

    1.3. Changing the De,o !pplication

    Now we will e4tend the myHelloWorld application. ?he e4tended myHelloWorldapplication will write an output to the first serial interface as well as to thestandard output.

    -pen Eclipse if it is not opened yet

    Double#click myCello/orld.c in the myCello/orld proect

    >irst include the following two additional header files:

    4include unistd.hJ4include fcntl.hJ

     ?hen add the function write;tty()@ which writes n bytes to the first serial

    interface (which@ on the phyBOARD-WEGA-AM335x@ is connected to the systemconsole %de!%console):

    5oid write6tty (char buffer@ int count)O

    int outPout Q open (H%de!%consoleH@ ***)Pwrite(out@ buffer@ count)Pclose(out)P

    R

    Enter the following two lines in the main() function to declare the buffer andcall the write;tty() function.

    char buf ST Q O H/elcome to the /orld of the phy,-AD /E0A#A12234U (serial)VnH RPwrite;tty(buf@ si7eof  (buf) # ')P

    In the screenshot ne4t page@ you can see the complete program.

    P&C m'#$$#$ Pt. Lt$ 2014

    14

    ftp://ftp.equation.com/make/32/make.exeftp://ftp.equation.com/make/32/make.exe

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    15/33

    8a!e your program after changing the code. 8elect +roect = ,uild proect from the menu bar.

      The project will be build...

      ?he application will be compiled@ build@ copied to the target and e4ecuted.

    P&C m'#$$#$ Pt. Lt$ 2014

    1)

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    16/33

    1.4.1. Open Target "oar# using %inicom

    -pen the terminal using minicom.

     Enter user name as root and press Enter then type ls to see all the file.

      ls

      ?ype .%myCello/orld to start the application

       .%myCello/orld

    Cello /orld

      /elcome to the /orld of the phy,-AD /E0A#A12234U (serial)

    close minicom.

    In this section we had changed an e4isting application. /e also learned how toaccess the serial interface.

    >irst@ we called the function open() on the de!ice %de!%console. ?he return !alue of this function was a file descriptor@ with the file descriptoryou called the function write() to send n bytes to the de!ice %de!%console.

    After that@ the file descriptor was closed with the function close().

    1.(. "e,ote 8yste, !ccess using Eclipse

    For indo!s :

     Fou ha!e to set the address manually

    connect ethernet cable

    0o to network connections

    right click on H5ocal area connectionH = properties = under general tab

    double click on HInternet +rotocol(?or abo!e settings@ refer section '.&.'

    For Linux :

     Fou ha!e to set the address manually@ for this refer section '.&.'

    5eft#click the /indow tab

    8how !iew  = other  = emote 8ystems and ok

    P&C m'#$$#$ Pt. Lt$ 2014

    10

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    17/33

     

    Now you are able to see the remote system page.

    P&C m'#$$#$ Pt. Lt$ 2014

    1

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    18/33

    1.!.1. Create New Connection for &emote S'stem login

    ight

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    19/33

    8elect ssh.files

    select processes.shell.linu4 and ne4t

    P&C m'#$$#$ Pt. Lt$ 2014

    1;

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    20/33

    select ssh.shells and ne4t

    select ssh.terminals and finish

    P&C m'#$$#$ Pt. Lt$ 2014

    26

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    21/33

    Now we successfully create the connection.

    iles = 1y Come

     ?ype Bser ID as root lea!e password 9lan* . ?hen press -G .

     ?hen a secure 8torage tab is opened ust cancel it.

    P&C m'#$$#$ Pt. Lt$ 2014

    21

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    22/33

     !.".#. $aunch the %emote Terminal

    ight click ssh ?erminal  = 5aunch ?erminal

      Now we can see all the contents of phyBOARD-WEGA-AM335x.

    P&C m'#$$#$ Pt. Lt$ 2014

    22

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    23/33

    1.0. De9ugging an exa,ple proect

    In this section@ we will learn how to use the 0NB debugger i.e.@ 0D, onthe host for remote debugging in conunction with the 0D, ser!er on thetarget.

    >irst@ you will start the 0D, ser!er on the target. ?hen you will configurethe Eclipse platform and start the 0NB debugger out of Eclipse using theDebug !iew.

     ?he Debug !iew allows you to manage the debugging and running of aprogram in the workbench. Bsing the Debug !iew you will be able to setbreakpoints%watchpoints in the code and trace !ariables and registers.

     ?he 0D, client is running on the host and is used to control the 0D,ser!er on the target@ which in turn controls the application running on thetarget.

    0D, client and 0D, ser!er can communicate o!er a ?

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    24/33

     Fou ha!e started the 0D, ser!er on the target. ?he 0D, ser!er is now waitingfor connections on ?

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    25/33

    8elect the Debugger tab

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    26/33

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    27/33

     ?he hostZs 0D, is now connected to the 0D, ser!er on the target.

    /e ha!e configured our proect for emote#Debugging@ 0NB debugger inEclipse and connected the hostZs 0D, with the targetZs 0D, ser!er.

    Now we can debug the proect.

    1.).3. Setting a "rea/point 

    Now we will set a breakpoint in our program. ?his breakpoint will be set on thelast line of the function main(). If you resume the application@ the debugger willstop on this line.

    P&C m'#$$#$ Pt. Lt$ 2014

    2

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    28/33

    8elect the last line in main(). ight#click into the small grey border on the left#hand side and select ?oggle ,reakpoint to set a new breakpoint

    1.).4. Stepping an# Watc$ing 0aria-le Contents

    In this part we will step through the e4ample proect with the debugger. we willalso learn how to check the content of a !ariable. E4pand buf in the ariableswindow

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    29/33

    we will see the content of the buf !ariable in the ariables window.

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    30/33

    /e will probably see a different address on the buffer pointer. ememberwhat address is shown in our caseP we will need this address later.

    1.).!. Stepping an# Watc$ing 0aria-le Contents

    In this section we will change the !alue of a !ariable. At the end of this part wewill see the effect of this change.

    8elect the count !ariable in the ariables window

    Double click on !alue and

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    31/33

    1.).). sing t$e %emor' %onitor 

    In the last section of this chapter you will use the memory monitor tocontrol the content at a memory address.

    8elect the 1emory tab

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    32/33

     Fou will see follwing output on your screen.

     Fou can see the contents of the !ariable buffer at the address ;x9ee9

  • 8/20/2019 Adk Manual for Phyboard-wega-Am335x

    33/33

    Get the dialo oin !!!!!! and "ta# in touch

    $ndia

    P%&'EC E(bedded P)t! *td!+ 16-C, .rd Floor,.rd Main, /th Bloc,O: Police Station,

    ora(anala,Banalore 3600-

    555!h#tec!in

    Ger(an#

    P%&'EC Me""techni G(b%obert3och3Stra7e .-

    8312- Main9'el!: 4- 61.1 -2213.2Fa;: 4- 61.1 -2213..

    555!h#tec!de

    555!h#tec!eu

    e are looin =or5ard to hearin =ro( #ouA..................................

    http://www.phytec.in/http://www.phytec.de/http://www.phytec.eu/http://www.phytec.com/http://www.phytec.fr/http://www.phytec.in/http://www.phytec.de/http://www.phytec.eu/http://www.phytec.com/http://www.phytec.fr/