Home

ARM Cross Development with Eclipse version 2

image

Contents

1. O gt eclipse Send To d E Compressed zipped Folder C3 configuration E E Cy Features E 3 plugins Mail Recipient Ej readme Create Shortcut A Musicmatch Burner Plus E foo Delete B My Documents Ca gnu docs Rename is ARMLIB F Properties td Eclipse 3 1 Now is a good time to test that Eclipse will actually run Click on the desktop icon to start the Eclipse IDE If the Eclipse Splash Screen appears we have succeeded If not chances are that the Java Run Time Environment is not in place Review and repeat the instructions on installing Java on your computer related trademarks and logos are trademarks ar registered trademarks of Sun Microsystems Inc in the U S other countries or both Eclipse is a trademark of the Eclipse Foundation Inc The first order of business is to specify the location of the Workspace choose to place the workspace within the Eclipse directory You are free to place this anywhere you can have multiple workspaces here is where you make that choice Workspace Launcher Select a workspace Eclipse Platform stores your projects in a directory called a workspace Select the workspace directory to use For this session Browse When you click OK the Eclipse main screen will start up Java Eclipse SDK File Edit Navigate Search Project Run Window Help Welcome to Eclipse 3 1 If you made it this far you now have a complet
2. Problems El Console 3 Properties 4 console is not available Jdemo2106 blink ram Now using the File Import procedure described earlier fetch the source files for the project demo2106 flash ram included in the zip distribution for this tutorial File system Import resources From Ehe local File system From directory C source codeidemozi 6 blink ram Browse demoz106_blink_ram O E cdtproject L project O E cre lst L crt o 8 crt s Al demazi 6 blink ram cmd Ipc210x h main c D E main dmp O E main hex O E main map O E main o D E main aut K makefile Filter Types Select All Deselect All Into Folder demoz108 blink ram Browse Options Overwrite existing resources Without warning Create complete Folder structure Create selected Folders only ca The files we import are crt s demo2106 blink ram cmd Ipc210x h main c makefile mak Now if you Clean and Build you should see a completed project with all the resultant files as shown below C C demo2106 blink ram cmd Eclipse Platform File Edit Navigate Search Project Run Window Help ri E amp ej x o Q ti eee eS 4n outline is not available E demos il blink ram cid LINEKER SCRIPT Br e demo2106_blink_ram p B Q Binaries po 8H Includes pe The Linker Script defines how the code and data emitted by the GNU C cc ih Ipc
3. Back Finish Cancel You should see the New Project dialog box and enter the project name demo2106 blink flash in the box as shown below Click on Next to continue New Project L Make Project Create a Mew C Project using make to build it Project name demoz1 6 blink Flash Project contents W Use default ne S The New Project dialog box appears next If you click on the Make Builder tab you ll notice that Eclipse build command is make Make is provided by the Cygwin GNU tools New Project E L Make Project Settings ELI Define the project and make builder settings C Make builder settings i Projects Make Builder Error Parsers Binary Parser Discovery Options C C Indexer Build command Iv Use default Build command Build Setting Stop on First build error Workbench Build Behavior Workbench build type Make build target Build on resource save Auto Build e o Mote See Workbench automatic build preference W Build Incremental Build all Rebuild Full Build clean all Iv Clean clean Cancel Let s remind ourselves that we installed the Cygwin GNU tools earlier in the tutorial and the Windows Explorer will show that the make exe file is indeed in the directory c cygwin bin as shown below File Edit Viel DER Favorites Tools Help ae pack leg d Jo Search E ie Hab X A E B Folders X Mam
4. Just like all the other downloads we ve done we direct this one to our empty download directory on the hard drive Here we click Save and then specify the download destination File Download Security Warning Do you want to run or save this file Mame bu 2 15 gcc 4 0 0 c c _n1 1 13 0_gi 6 1 exe Type Application 23 0 MB From VA QU Com ET While files from the Internet can be useful this File type car potentially harm pour computer IF veu do not trust the source do nat run or save this software What s the risk Once again our c scratch directory will suffice Save As Save in gt scratch hy Recent Documents hy Documents as hy Computer File name bu 2 15 good 0 0 c c nl 1 13 U My Network Save as hype Application v As you can see this download has a very long name This download is a 18 megabyte file and takes 30 seconds on a cable modem 32 of bu 7 15 gcc 4 0 0 c c nl 1 13 0 m E Saving OCC nl 1 13 0 gi 6 1 exe from wi gnuarm cam Estimated time left 2 min 3 sec 7 25 MB of 23 0 MB copied Download Eo Abu 2 15 gec 4 0 0 c c 4 nl 1 13 0 gi 6 1 exe Transfer rate 131 KBfSec Close this dialog bos when download completes Oper Open Folder The download directory now has the following setup application with the following unintelligible filename bu 2 15_gcc 3 4 1 c c java_nl 1 12 0_gi 6 0 exe Click on that filename to start the installer
5. Convert to Adobe PDF oS Extract to Open With Cal Extract to here 3 Extract to here using File names for Folders Send To 3 Extract to Folder Cut Cl zip and E Mail scratch zip Copy Cl zip and E Mail Plus ce Encrypt Create Shortcut 5 Configure Delete Rename WinZip Extract 3 a Local Disk C A Desktop AE cygwin Gy DELL aS Documents and Settings Ey download My Documents j BE DRIVERS Ei eclipse PE E 1386 My Computer Files Use Zip file names for folder b Selected files folders Overurite existing files a 9 All files folders in archive l Cancel Fi Skip older files My Network ui Heb edi Use folder names Places To verify that Eclipse had the CDT installed properly start Eclipse by clicking on the desktop icon Eclipse 3 1 When Eclipse starts click on File New Project Resource Eclipse SDK alx AGS Edit Refactor Navigate Search Project Run Window Mer Al t ShiFE M d L7 Project m ES Resource gt Open File a ON 98 te 8 Close CErl F4 Eis Close All hrl Shift F4 F Untitled Text File El Save Chris El Save As Fey Other Ctrl lg Save all CtrH Shift 5 Revert Move Rename F2 Refresh F5 Convert Line Delimiters To j E Print Ctrl P Switch Workspace pss Import Resource In Folder Loc pA Export Properties Alt Enter liil gt When the Ne
6. Import File system y system downloads E WINDOWS 7 zclipse e From directory C scratch Browse Folder scratch s crt s Make New Folder v demoz106 cmd d IpcziUx h d main c 4 makefile Now we have to indicate the Folder B Ps destination for our source REQUE romse files Click on Browse on Options the line to the right that Says z Overwribe existing resources without warning i i Create complete Folder structure Into Folder Create selected Folders only lt Back Cancel The proper destination folder appears in the Import Into Folder window below Click on the folder name demo2106 blink flash and click OK The directory name demo2106 blink flash should appear in the text box lt Import Into Folder Select a Folder to import into demo2106_blink_Flash demoz2106_blink_Flash conce Now the Import dialog is completely filled out we can click on finish to actually import the source files into our project File system Import resources From Ehe local File system From directory Cuscratch Browse scratch S crt s HE demoz106 cmd d Ipcz1 x h d main c kA makefile Filter Types Select All Deselect All Into folder demoz106 blink Flash Options Overwrite existing resources without warning Create complete folder structure le Create selected Folders only Cancel
7. Notes When you resume execution by clicking on the Run Continue button many of the buttons are grayed out Click on Thread 0 to highlight it and the buttons will re appear This is due to the possibility of multiple threads running simultaneously and you must choose which thread to pause or step In our ARM development system we only have one thread All of these views such as the Debug Control view above can be maximized to full screen minimized or returned to co i multi pane by the maximize and minimize buttons at the CI upper right corner l Run and Stop with the Right Click Menu The easiest method of running is to employ the right click menu In the example below the blue arrowhead cursor indicates where the program is currently stopped To go to the IOCLR z 0x00000080 statement several lines away click on the line where you want to go this should highlight the line and place the cursor there Now right click on that line Notice that the rather large pop up menu has a Run to Line option A Le Ipcz1 0x h amp makefile G mainc X Jun d Ctrl F static int Lg Revert File static long x Ema YE Ho dn g static char Ox04 static int 73 Cut uae const char sess Ane Baim Ai Saed Copy Cbr Paste Ctrl y ff Initialize the system Initialize Shift Right Shift Left set io pins
8. Select Packages Select packages to download C Keep C Prev Cur C Exp View Category All amp Default Admin amp Default Archive amp Default Base 4 Default Database amp Default Devel amp Default Doc amp Default Editors 4 Default Games amp Default Gnome amp Default Al mes Back Cancel The screen above allows you to specify what GNU packages you wish to install Basically we want an installation that will allow us to compile for the Windows XP Intel platform This will allow us to use Eclipse to build Windows applications not covered in this document Remember that we ll be installing the GNUARM suite of compilers linkers etc for the ARM processor family shortly If you look at the Cygwin Select Packages screen below you ll see the following line Devel Default You must click on the little circle with the two arrowheads until the line changes to this y Devel 4 Install This will force installation of the default GNU compiler suite for Windows Intel targets Here s the Select Packages screen before clicking on the circle with arrowheads The following four packages must be selected and changed from default to install Archive Default Devel Default Libs O Default Web O Default Archive Install Devel Q Install Libs O Install Web Q Install Click on the little circle with the arrowheads until you change the four
9. To download the Zylin version of the CDT plug in click on the following link http www zylin com embeddedcat html The Zylin website page devoted to the CDT plug in will have a link to the latest snapshot This snapshot is two zip files that you will extract to the c eclipse folder Hardware Embedded software eCos Open source Eclipse CDT eCos and libstdc Mailinglist Contact Zylin has made some modifications in Eclipse CDT for Windows a plugin to improve support for GDB embedded debugging in CDT for eCos applications Eclipse CDT plugin Eclipse CDT has excellent GDB support However there are a few stumbling blocks when trying to debug embedded applications Zylin would like to extend a special thanks to Alain Magloire of the CDT team for making this possible Download al Latest snapshot Y Ir AO Is the plugin specific to eCos A No Q Is the plugin specific to ARM A No In principle it can be used with any CPU that GDB supports Q Does the plugin work under Linux A Yes You can even debug native applications that do not live inside CDT projects Q Does the plugin work under Windows A Yes Q Source A See inside the zylincdt 200xmmdd zip archive Install e These plugins require the latest Eclipse 3 1 release e Both plugins must be installed together e Delete previous CDT and Zylin Embedded CDT directories from eclipseMeatures and eclipseiplugins directory e un
10. static initialized variable static int zZz TY ff static initialized variable const char oText The Pain in Spain struct EntryLock Long key int naccesses i char n me 16 H Access 114705 O Spiderman ff Initialize the system Initializeli ff set io pins for led PO IODIR OxOO0O0008O ff pin PO 7 is an output everything else is input after reset IOSET OxOO0000080 ff led off IOCLE OxOO0000080 ff led on ff endless loop to toggle the red LED PO while 11 for 3 O 3 5000000 j wait 500 msec IOSET x DO 0OOSD ff red led off for 3 O 3 5000000 j 7 ff wait 500 msec IOCLE x DO 0OOSD red led on x xXx 1s The simple way to inspect variables is to just park the cursor over the variable name in the source window the current value will pop up in a tiny text box Execution must be stopped for this to work either by breakpoint or pause static char v Jx 3 static int f 7 const char z pt The Rain in Spain struct EntryLock i long key int n ccesses char name 1i8 ccess 14705 O Spiderman For a structured variable parking the cursor over the variable name will show the values of all the internal component parts aL ol EL LIiLdl Y uU XL if SLaALLE LILL LALLU YAL LAs Le static int z YT ff static initialized variable const char tpText The Bain in spain struct EntryLock 4 long
11. Code Execution Fill salue FF sH40000200 Selected Range Start feH 40000000 Hun fram Address SHADUBBZDO Thumb ARM t Entire Buffer End amp H4000043F LPC2000 Flash Utility Buffer Upload Successfully Completed You do NOT have to remove the BSL jumper Click on the Run from Address button to execute the program gt LPC2000 Flash Utility RAM Buffer amp H 4000 0000 amp H4000 0010 amp H 4000 00 20 amp H4000 0030 amp H4000 0040 amp H 4000 0050 amp H4000 0060 amp H 4000 000 amp H4000 0080 amp H 4000 0090 H4000 006 0 amp H 4000 0080 amp H4000 DOCO amp H 4000 DOD amp H4000 O0E0 amp H 4000 OOFO amp H4000 0100 amp H 4000 0110 amp H4000 0120 amp H4000 0130 amp H 4000 0140 amp H4000 0150 amp H 4000 0760 amp H4000 0170 amp H 4000 0180 amp H 4000 0190 amp H 4000 01 50 amp H 4000 0180 amp H 4000 01 CU amp H4000 0100 amp H 4000 O1E0 H4000 01F0 Uuuuuuyuuguuuuuuuy r Load Hex File Upload to RAM Download RAM i Fill Buffer Code Exscubian Address Range Fill value FF M4c000200 f Selected Range Start eH 40000000 Run from Address J Thumb ARM Entire Buffer End amp H40D0FFFF LPC2000 Flash Utility Your application should blink just like the Flash EPROM version did Time for the Bigfoot picture 2E TT eee ee DEL Lii aw wd al am wl Ml D d dal AQ OE M Ras RC LII Dm ai al uz ws mu oma dm dw S c e m e Ue In n un n n ua
12. Install Cygwin DLLs below We already have the Cygwin DLLs installed from our Cygwin environment installation In fact the ARM message boards have had recent comments suggesting that the Cygwin DLL installation from within GNUARM has some problems Since all operations are called from within Eclipse we don t need a desktop icon either Click Next to continue is Setup GNUARM Select Additional Tasks Which additional tasks should be performed Select the additional tasks you would like Setup to perform while installing GNUARM then click Next Additional icons Create a desktop icon Cygwin options Install Cygwin DLLs EICTGNTHN R Click on Install to start the GNUARM installation e Setup GNUARM Heady to Install Setup is now ready to begin installing GNUARM on your computer Click Install to continue with the installation or click Back if you want to review or change any settings Destination location D Program Filessi NLISRM Setup type Full installation Selected components Little Endian LE Libraries Ma Fast Multiplier ARM THUME Interworking THUMB Sit back and watch the GNUARM compiler suite install itself an Setup GNUARM Installing Please wait while Setup installs GHUSAM on your computer Extracting files C Program Files GNUSAM Sinclude c 44 D O backward heap Cancel When it completes the following screen is presented Make sure that Add the execut
13. O j lt 5000000 j f wait 500 msec IOSET OxO0000080 red led off for 3 0 j lt 5000000 j ff wait 500 msec IOCLR OxXDODODOSO red led on E 7 r3 Problems EJ console 3 Cw Properties a Ex r4 E E bs C Build demo2106_blink_ram writable Smart Insert The Philips LPC2106 has 32 I O pins labeled P0 0 through P0 31 Most of these pins have two or three possible uses For example pin P0 7 has three possible uses digital I O port SPI Slave Select and PWM output 2 Normally you select which function to use with the Pin Connect Block The Pin Connect Block is composed of two 32 bit registers PINSELO and PINSEL1 Each Pin Select register has two bits for each I O pin allowing at least three functions for each pin to be specified For example pin PO 7 is controlled by PINSELO bits 14 15 The following specification would select PWM 2 output PINSELO 0x00008000 set PINSELO bits 14 15 to 01 Fortunately the Pin Connect Block resets to zero meaning that all port pins are General Purpose I O bits So we don t have to set the Pin Select registers in this example We do have to set the I O Direction for port PO 7 this can be done in this way IODIR 0x00000080 set IO Direction register P0 7 as output 1 output 0 input The ARM I O ports are manipulated by register IOSET and register IOCLR You never directly write to the I O Port You set a bit in the IOSET register
14. collect all sections that should go into FLASH after startup all text sections cade all radata sections iconstants strings etc w all rodata sections constants strings etc w all glue 7 sections no idea what these are all glue Yt sections no idea what these are define a global symbol etext just after the last code byte put all the above into FLASH collect all initialized data sections that go into RAM create a global symbol marking the start of the data section all data sections define a global symbol marking the end of the data section put all the above into RAM but load the LMA copy into FLASH collect all uninitialized bss sections that go into RAM define a global symbol marking the start of the bss section all bss sections put all the above in RAM it will be cleared in the startup code advance location counter to the next 32 bit boundary define a global symbol marking the end of the bss section define a global symbol marking the end of application RAM k ol fe E r Ej writable Insert 1 1 Above is the final part of the Linker Command Script Notice that everything is loaded into RAM You might ask Do we still copy the data section initializers left the copy operation intact in file CRT S but it now essentially copies over itself wasteful wanted to keep things very similar You could delete the data initializer cop
15. demo2106 blink ram cmd Eclipse Platform File Edit Wavigate Search Project Run Window Help J ri E amp lm 6 G 3 O Q 4 6 E specify the LPC2106 memory areas MEMORY i flash ORIGIN OxO00000000 LENGTH free FLASH EPROM area rat ORIGIN Ox40000000 LENGTH free RAM area define a global symbol stack end Stack end Ox4000FEDC writable Above defined two memory areas for flash and RAM consistent with the LPC2106 memory map Of course we re going to load everything code and variables into RAM Note that also created a global symbol stack end that is used in the startup routine to build the various stacks The address is positioned just after the stacks and variables used by the Philips ISP Flash Utility C C demo2106 blink ram cmd Eclipse Platform AE File Edit Mavigate Search Project Run Window Help Sla 6 6 4 G 1 0 Q 18 7 tp gt ES Bcc di Im CENTER Ga Bes Rec Wee o now define the output sections SECTIONS i startup startup ram text cvodatal rodata Glue 7 Glue t Btext ram data i data i dataj Bdata ram ss s 1 _bs3 Start hs2 ram ALIGN 43 bss end zu end 0 1 Problems E Console 5 gt Properties lt cherminated gt LPC2000 Flash Utility Program C Program FilesLPC2106 TSPALPCZ10x ISP exe the startup code goes into FLASH
16. where it will be loaded in Flash memory the exact copy with the initial values The GNU Linker will sort this out for us 14 Description of the Main Program main c Now let s look at the main program Resource main c Eclipse Platform File Edit Navigate Search Project Run Window Help a Sll Josj BS Navigator EON E q Be v ES Navigator 38 N 2 15 demo2106 blink flash cdtproject project crt Ist crt o S crt s demo2106 blink Flash cmd C Ipc210x h C main c main dmp main hex main map main o main out kK makefile E demo2106_blink_ram cdtproject project ert Ist crt o S crt s ee 4 demo2106 blink Flash cmd s crt s G mainc X La x E 3 Function declarations C a a a a a void Initialize void void feed void void IRQ Routine void _ attribute _ void FIO Routine void _ attribute void SWVI Routine void _ attribute void UNDEF Routine void attribute interrupt IRQ interrupt FIQ interrupt SWI i interrupt UNDEF FERRAN ARENA Header kiles AAA Hinclude LPC210x h JOWCRCNCECRCNCACh ChONCh Ch AONCh Ch ATA HATA HATHA TAKARA KATH Ch AONCh Ch A OK Ch A ON Ch Ch AUN CR NUN UN Global Variables WONChCh Ch ch A NON THAT Ch KAKA TAHA HAKATA AHHH hh h A NON NON Ch Ch h ho h A A RON A A 8 8 8 8 FS demo2106 blink ram cmd int a global uninitialized variable Ipc210x h int globa
17. A A ES Resource E E e Ex ERAS 5 15 demo2106 blink flash demo2106 blink flash cmd LINKER SCRIPT cdtproject de project rt 5 crt lst The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are crt o to be loaded into memory code goes into FLASH variables go into RAM crt s demo2106 blink flash cmd Any symbols defined in the Linker Script are automatically global and available to the rest of the Ipc210x h program main c ft main dmp To force the linker to use this LINKER SCRIPT just add the T demo2106 blink flash cmd directive main hex qe to the linker flags in the makefile main map pa n Map main map nostartfiles emo in ash cm E main o pa LFLAGS M fil T demo2106 blink flash cmd main out j na K makefile c E demo2106 blink ram ON pe The Philips boot loader supports the ISP In System Programming via the serial port and the IAP In Application Programming for flash programming from within your application The boot loader uses RAM memory and we MUST NOT load variables or code in these areas RAM used by boot loader Ox40000120 Ox400001FF 223 bytes for ISP variables Ox40D00FFEO Ox4000FFFF 32 bytes for ISP and IAP variables qe 0x4000FEE0 Ox4000FFDF 256 bytes stack for ISP and IAP ft 5 Ex GE et E riena terminated Insight Program C Program Files GNUARM bin arm elF insight exe W
18. Donate Contact amp bout Sun News amp Events Employment Privacy Terms of Use Trademarks powered by Ro Sun Copyright 1994 2005 Sun Microsystems Inc misere Select the latest and greatest Java runtime system by clicking on J2SE 5 0 Sun Developer Network Products and Technologies Technical Topics Developers Home Products amp Technologies Java Technology J25E J2SE Downloads E Downloads The links below will take you to the download sites for the versions ofthe J25E platform that are curren Early Access download the Java 2 SDK Java 2 Runtime Environment documentation and other products related to Reference API Specifications Documentation J25E 1 3 1 FAQS Code Samples amp Apps Download Archived Releases BluePrints Technical Articles amp Tips White Papers Third Party Compatibility Sun maintains a download site for previously released versions ofthe 125 platform and related prodi and are na langer covered by standard support contracts These downloads are made available as ac resolution Specifically we need only the Java Runtime Environment JRE Click on Download JRE 5 0 Update 3 3 Download Java 2 Platform Standard Edition 5 0 Microsoft Internet Explorer File Edit View Favorites Tools Help Q sack bi O x E A Dp Search p Favorites g A ES ki y 3 Address gl http fiava sun com jzse 1 5 0 download jsp Sun Developer Network J
19. E main hex set UND STACK SIZE Ox00000004 undefined instruction interrupts is 4 bytes B nest nee set ABT STACK SIZE OxODO00004 abort interrupts is 4 bytes B mano set FIQ STACK SIZE OxOO0000004 FIQ interrupts is 4 bytes r Bi meno set IRQ STACK SIZE OXO0000004 IRQ normal interrupts is 4 bytes A makefile ES m nom set 3SVC STACK SIZE Ox00000400 SVC supervisor mode is 1024 bytes Standard definitions of Mode bits and Interrupt I amp F flags in PSRs program status registers set MODE USR Ox10 Normal User Mode j set MODE FIQ 0x11 FIQ Processing Fast Interrupts Mode set MODE IRQ 0x12 IRQ Processing Standard Interrupts Mode set MODE SVC 0x13 Supervisor Processing Software Interrupts Mode set MODE ABT 0x17 Abort Processing memory Faults Mode j set MODE UND Ox1B Undefined Processing Undefined Instructions Mode j set MODE SYS Ox1F System Running Priviledged Operating System Tasks Mode set I BIT 0x80 when I bit is set IRQ is disabled program status registers set F BIT 0x40 when F bit is set FIQ is disabled program status registers M gt e B EK r Q T3 H C Build demo2106 blink Flash This part of the crt s file sets up the interrupt vectors C C crt s Eclipse Platform PEE File Edit Navigate Search Run Project Window Help Ira Jj 6 d Q 5 O Q 2 0 5 ww Ff ES Edcicee i c iie 53 we m A ic main c demo21
20. M Watch Expressions The Expressions view can display the results of expressions any legal C Language expression Since it can pick any local or global variable it forms the basis of a customizable variable display showing only the information you want For example to display the 6 character of the name in the structured variable Access bring up the right click menu and select Add Watch Expression Run As d EN Add Watch Expression Expression to watch Access name 6 amp cea Note that it now appears in the Expressions view e q 8 channel 28 Arcess name 6 m You can type in very complicated expressions Here we defined the expression i z h viens g ol 2 channel pu EY Access name 6 m M fi ZA 25 Outline MEE am N Assembly Language Debugging The Debug perspective includes an Assembly Language view i gt If you click on the Instruction Stepping Mode toggle button in the Debug view the assembly language window becomes active and the single step buttons apply to the assembler window The single step buttons will advance the program by a single assembler instruction Note that the Disassembly tab lights up when the assembler view has control Note that the debugger is currently stopped at the assembler line at address 0x400003f0 Ox400003 06 Ox400003 dc Ox400003e0 Ox400003e4 Ox400003e6 Ox400003 ec zInitialize cr 5 zInitiali
21. Now the C C perspective main screen will reappear Click on the in the navigator pane to see if our files have been transferred C C Eclipse Platform File Edit Navigate Search Project Run Window Help Ci i E C C Projects E3 E A SER b ad sy demo2106 blink flash Problems A Console X Properties Search IC Build demo2106_blink_Flash expand symbol Ban E Edicic Ef Resource ES gt lAn outline is not glue ouccess is at hand the expanded Projects view in the Navigator pane on the left shows our imported files C C Eclipse Platform File Edit Navigate Search Project Run Window Help ta m 8 d G gt it a Sy coe E Es ey Includes El h Ipc210x h sl S erts re B Deere B e mme Eromen Console Properties Search S demo2106 cmd Build demo2106_blink_flash Ed makefile fdemozi 8 blink Flash Sees Ej ecic Resource ENS n outline is not available This is a good place to identify the imported source files Description of Project Files Ipc210x h Standard LPC2106 header file Startup assembler file Main C program GNU makefile demo2106 blink flash cmd GNU Linker script file crt s makefile 12 Description of the LPC210X H Include File Let s look at the lpc210x h header file Double click on it in the Project pane on the left ARM peri
22. O 69 Variables 52 JETA Breakpoints Expressions E ss x X v OM n Ipc210x h makefile D mainc X Outline Disassembly 33 int main void unsigned int qs fla static int static un static char static un static int Ww static in static long x 5 Static initia static char y 0x04 static in static int z 7 static in const char pText The Rain in Spain Initialize the system Initializei f f set io pins for led P0 7 IODIR OxOO0000080 pin PO 7 is an output everything Y TIT gt E Console 23 Tasks C Build demo2106 blink ram writable Smart Insert 4 1 D Start the OCDRemote utility The Macraigor OCDRemote utility must be started before the Debugger is launched Hemember that we set up the OCDRemote as an External Tool It s easily started by clicking on the pull down arrow of the External Tool button Note the little red toolbox on that button Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help Ti gt i amp fs O ES Debug HM Q External Tools Organize Favorites The well known problem of the Wiggler OCDRemote combination is that it doesn t always start Below is an example of where it does start properly Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help Iri Bl 0 Q i 9 H H ES Ggcict
23. W scratch File Edit View Favorites Tools Help AN Q Bek d po Search Ep roto Bee X ag Folders X Mame 3 pictures ES bu 2 15 gcc 4 D 0 c c nl 1 13 0 gi 6 1 9 Program Files 9 scratch L Lm TT i T The GNUARM installer will now start Click Next to continue am Setup GNUARM Welcome to the GNUARM Setup Wizard This will install GHUARM 4 0 0 an your computer It is recommended that you close all other applications before continuing Click Next to continue or Cancel to exit Setup m Accept the GNU license agreement don t worry it s still free Click Next to continue te Setup GNUARM License Agreement Please read the following important information before continuing Please read the following License Agreement You must accept the terms of this agreement before continuing with the installation GNU GENERAL PUBLIC LICENSE Version 2 June 1991 Copyright E 1989 1991 Free Software Foundation Inc 59 Temple Place Suite 330 Boston MA 02111 1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document but changing itis not allowed Preamble The licenses for most software are designed to take away your accept the agreement do not accept the agreement p o tm lt Back Lone tarea We ll take the default and let it install into the Program Files direc
24. computer On my Dell Dimension Desktop PC the CMOS setup can be entered if you hit the F2 key as the machine boots up By maneuvering around the CMOS setup you can find the Parallel Port setup and see what mode it is set up as If it s ECP mode change it to EPP mode as did in the screen photograph below oave the CMOS setup and exit twork Inter face Controller On ase POLL avs came SII 11 7 Un SB Emulation SB Controller Serial Port 1 1 0 Address Parallel Port Diskette Interfa Primary Video Controller Onboard Video Buffer 1 MB Report My printer is a USB device so this action didn t effect my printer operation Its disappointing to report that the Wiggler cannot set a breakpoint in FLASH The OCDremote application cannot deal with GDB z commands which refer to hardware breakpoints the LPC2106 has two hardware breakpoints This is the reason that debugging with this simple device is limited to applications configured to run from RAM exclusively Obviously the 64K limitation of the Philips LPC2106 limits the size of an application you can fit into RAM However it s better than nothing Let s review the hardware setup one more time Doesn t matter if the BSL jumper is installed or not nana 7121212121217 1 12 1 fu E sped Igagg P a alalalelelelale spepejo epo o quad de E epepejejejeje e gadadaaa agagagogo oaoaaaagag spepejejojajejojole e aogoa agaa
25. demo2106 blink ram Embedded debug launch Debugger Process 9 9 05 12 38 AM gdb load sections text section sizes 1208 total sizes 2515 section data section size 24 total size 2515 j gdb Launching 70 When downloading completes the Debugger is in idle mode with the executable code loaded into RAM Debug main c Eclipse SDK PES File Edit Refactor Navigate Search Project Run Window Help ta gt ln O Q e rl H F Ho o ES Gacic Debug Debug X E ko OCDRemote Program R Cicvgwintiusrilacallbinjacdremate exe FG demo2106_blink_ram Embedded debug launch dE Embedded GDB 9 9 05 12 38 AM Suspended BE of Thread o Suspended lt 1 lt symbolis not available gt E outline s Disassembly EZ gt WK x7fffe2zdc streg x7fffez5 strvsda ra x7fffez543 ldrleb ro x fffez58 suhbvss rZ x 7fffez5c streg reo x frffeze60 strvsda ra xTfffez523 ldrleb rd x frffez 68 ldmvsia ro x7fffezb6c andny rZ x fffez andes pc int main ivoid fl ES fo static un static unm unsigned int j a d static int W 1 fo static in 5 Y z static int static char static long x static initia static char OxO4 fo static in Te fo static in const char pText The Rain in Spain static int Ox TEET andny ES Initialize the system x fffe278 andes pey x 7fffez c stene O
26. immediately Windows Offline Installation Multi language jre 1 5 0 z windows I585 p exe 15 45 ME Es Windows Online Installation Multi language ijre 1 5 0 z windaws i585 p iftw exe 271 27 KB Finally the file download window appears Click on Run to download and run the installation File Download Security Warning Din you want En run or save this file Mame jre 1 5 0 02 windows i586 p exe Type Application 15 2 MB From sumsdici 11 vhosti sun cam Aun Save Cancel While files from the Internet can be useful this file type can potentially harm pour computer IF vou do not trust the source do not ran or save this software What s the risk Now the downloading will start Saving 15 0 z windaws ibB6 p exe From sunsdici 11 vhost1 sun com Estimated time left 45 sec 3 09 MB of 15 2 MB copied Download Eo Po ire 1_5 0 02 windows i566 p exe Transfer rate 276 KB Sec Close this dialog bos when download completes Open Open Folder After downloading the installation will proceed automatically ix J2SE Runtime Environment 5 0 Update 3 Progress Installing The program Features vau selected are being installed Please wait while the Install Wizard installs J25E Runtime Environment 5 0 Update 3 This may bake several minutes Status Downloading Files InstallShield When the Java Runtime Environment installation completes you will see this display Click on F
27. main hex main map Tasks EZ console 33 J 8 Es m E r3 H main o C Build demo2106 blink flash main out K makefile The data section contains all the initialized static and global variables The GNU linker will create a exact copy of the variables in flash with the correct initial values loaded The onus is on the programmer to copy this initialized flash copy of the data to RAM The location of the start of the data section in flash is defined by symbol etext defined in the linker command script demo2106 cmd Likewise the location of the start and end of the data section in destination RAM is given by the symbols data and _edata Both of these symbols are defined in the linker command script The bss section contains all the uninitialized static and global variables All we have to do here is clear this area Likewise the location of the start and end of the bss section in destination RAM is given by the symbols bss start and bss end Both of these symbols are defined in the linker command script Two simple assembly language loops load the data section in RAM with the initializers in flash and clear out the bss section in RAM The GNU linker specifies two addresses for sections the Virtual Memory Address VMA and the Load memory Address LMA The VMA is the final destination for the section for the data section this is the RAM address where it will reside The LMA is
28. At this point we have all the GNU tools needed to compile and link software for Windows Intel computers It is possible to use all this to build a custom GNU compiler suite for the ARM processor family The very informative book Embedded System Design on a Shoestring by Lewin A R W Edwards 2003 describes how to do this and it is rather involved Fortunately Pablo Bleyer Kocik and the people at gnuarm com have come to the rescue with pre built GNU compiler suite for the ARM processors Just download it with the included installer and you re ready to go Click on the following link to download the GNUARM package WWW qnuarmm com The GNUARM web site will display and you should click on the Files tab Steve is one of the brightest guys I ve ever worked with brilliant but when we decided to do a microprocessor on our own I made two great decisions I gave them Steve Puma and Sophie Wilson two things which National Inte and Motorola had never given their design teams the first was no money the second was no people The only way they could do it was to keep it really simple Hermann Hauser Last update 2004 07 05 18 01 GNU ARM toolchain for Cygwin Linux and MacOS Welcome In this page you will find a pre compiled binary distribution for the hopefully latest GNU ARM Newlib toolchain for Cygwin Linux and MacOS The toolchain consists of the GNU binutils compiler set GCC and debugger Insight for Windows and
29. CPUs Tools etc Partners Ne E Flash Programmer GNU Tools Batch Flash Programmer Target Access DLL J SCAN JTAG Debugger JTAG Commander alidator OCD Commander If you scroll the above screen down a bit you should see the download for OCDRemote Click on the link DOWNLOAD Windows OCDRemote v2 12 For Linux Click on Run so it will download and immediately install OCDRemote File Download Security Warning Do you want En run or save this file Mame hwsupport 2 12 exe Type Application 2 95 MB From wanw acdeman cam Cancel While files from the Internet can be useful this File type can potentially harm your computer IF you do not trust the source do nat run or save this software What s the risk The download phase is quick since the OCDRemote is only a couple of megabytes Opening hiwsupport 2 12 exe From www ocdenon cor Estimated time left 24 sec 728 KB of 2 95 MB copied Download to Temporary Folder Transfer rate 97 6 KB 5ec Close this dialog bos when download completes Oper Open Folder The Macraigor installer should start up just click Next to continue Macraigor 5ystems Hardware Support Package 2 12 InstallShield Wizard E Welcome to the InstallShield Wizard for Macraigor Systems Hardware Support Package 212 The Install5 hield amp Wizard will install Macraigor Systems Hardware Support Package 2 12 on pour computer To conti
30. Debugger combination works only for RAM based applications and thus limits software to less than 64K It s extremely slow and a bit unreliable Professional USB or Ethernet based debuggers are very expensive and out of the price range of hobbyists The world will beat a path to the first vendor that markets an inexpensive USB based debugger for the ARM microprocessor The new Philips LPC2148 ARM chip with onboard USB looks like the perfect vehicle for such an application The ARM JTAG circuits allow two hardware breakpoints and this should be adequate for a student or hobbyist who wishes to debug flash based applications The student version of a ARM USB based debugger could be just a little circuit board with a cheap wall wart power supply Olimex has a USB based JTAG debugger project in the works so we can all keep our collective fingers crossed that they will be successful I m not finished writing tutorials My next tutorial will involve using ARM interrupts and how to design and implement I2C port expanders to interface to LCD displays and keypads Later tutorials will go into motion control free real time operating systems and other hardware projects Stay tuned just like you I m just getting started 24 About the Author Jim Lynch lives in Grand Island New York and is a Project Manager for Control Techniques a subsidiary of Emerson Electric He develops embedded software for the company s industrial drives high power motor contro
31. END CEN ERES 400004FO DO 68 400004FD o 0 DUE e R a i n 40000500 53 7O 61 63 bE oo oo oo Oz 40000500 5 p a i n O O O O O O O 40000510 05 Oo nu Oo 15 5 nu 40 46 40000510 LI O O O O O O E F a a t 40000520 65 61 bE 20 61 0 73 7O 65 40000520 h a n a 3 p e e d i 40000530 TS Bc Bc 65 T4 nu nu nu NN S0000530 u l l e b O O O O O O O 40000540 os oo oo ao ol oo oo oo oo 40000540 O O O O O O O O O O O O 40000550 au nu nu ag Oo Oo nu nad ag Y 40000550 O O O O O O O O O O L1 ra 40000560 oo oo oo ao EU El FF TF as F 40000560 O O O O a Y O O a Y LIE 40000570 au nu n ag Ta EL FF TF 8 S0000570 O O O O x i b O x i b O 400005850 oo oo oo oo EU El FF TF as 40000550 O O O O a Y O O a Y O 40000520 au nu nu Oo 8 EC FF TF 8 40000590 O O O O x i Y O x i Y O 40000540 oo oo oo ao EU El FF TF as 40000540 O O O O a Y O O a Y O 40000580 au nu nd ag 8 EC FF TF 8 S0000580 O O O O x i Y O x i Y O 40000520 oo oo oo ao EU El FF TF as 40000520 O O O O a Y O O a Y O annoosnn oan oan nna A anaanenn n n on nmn vw i nov i s n TT E x i EI Personally think this Eclipse memory display is a bit complex However it allows you to define many memory monitors and clicking on any one of them pops up the renderings instantly It s like so many things in life once you learn how to do it it seems easy 23 The Author Sounds Off This tutorial was designed for students and hobbyists those with limited funds It described in great detail how to download and
32. External Tools part of the Run pull down menu Select RUN External Tools External Tools C C Eclipse Platform File Edit Navigate Search Project MA window Help le gt E amp amp G Run Last Launched CirH Fil x WES E Debug Last Launched F11 E Run History Run As RUF C C Projects BREITE USE Debug History Debug As Debug FL External Tools Q External Tools Organize Favorites We want to add a new program to the External Tools list so click on Program and then New External Tools Create manage and run configurations Create a configuration that will run an Ant buildfile Configurations Lu rm Ci A Program EH Perspectives These settings associate a perspective with Ant Build launch configurations A different perspective may be associated with each supported launch mode and can optionally be activated when a configuration is launched or when a breakpoint is encountered via the Debug preferences To indicate that a perspective switch should not occur select None RUM None Restore Defaults Q Note below that there s a new program under the program tree with the name New configuration and there s no specifications as to what it is In the Name text box replace New configuration with LPC2000 Flash Utility In the Location text box use the Browse File System tool to find the Philips LPC2000 Flash Utility in the Program F
33. LPC2106 RAM memory You will see a progress bar at the bottom of the screen and it will indicate that the operation has completed LPC2000 Flash Utility RAM Buffer PRISES amp H4000 0000 18 FO OF ES 18 FO OF ES 18 FO OF ES 18 FO SF EB B3 N3 B3 N3 H4000 007 0 18 FO 8F ES O00 00 AO El 14 FO OF E5 14 FO SF E5 BN3 4 084 808 amp H4000 0020 00 2 OO 40 CO 2 00 40 BC 02 00 40 CO 2 OO 40 4A A a H4000 0030 Co 2 OO 40 B4 02 OO 40 BS Of OO 40 OO OO OO OO A B amp H 4000 0040 00 00 OO OO o0 do 00 00 A 00 00 00 D D0 D0 H4000 0050 o0 OO 00 00 OO OO OO 00 o0 OO OO D OO OO DD LL Le eee eee ee H4000 0060 00 OO o OO 50 00 00 00 00 00 00 H 00 amp H 4000 0070 00 OO o OO OO 00 00 00 00 00 00 00 00 00 D0 H4000 0080 Oo OO 00 00 DO OO OO 00 oo OO OO OU 00 DD DO DD LL ee ee eee ee H4000 0090 00 OO OO OO OO OO OO OO OO OO OO 00 OO DO OO OO _ 22 H4000 0040 00 OO OO OO OO OO OO 00 O 00 GG OO 00 D0 H4000 006 0 Dy 00 00 OW OOo o0 OO 00 o0 OO OO 00 OO OO We LL Le ee eee ee ee H4000 OOCO 00 OO OO OO OO OO OO OO A 00 BG 00 D0 D0 H4000 00010 Oo OO 00 00 OOo OO OO 00 o0 OO OO 00 D OO DO Q LL Le ee ee eee ee H4000 00 0 00 0 4 00 00 o 00 00 00 00 00 D0 DD ee eee amp H 4000 OOFO 00 OO OO O
34. Linux GDB only for MacOS Newlib is used for the C library The toolchain includes the C and C compilers Details of the build process appear here The Windows installer executable files are generated with Inno Setup The MacOS toolchain is bundled with Apple s PackageMaker If you have any problems using these files please contact us using our mailing list Please note Some people have been asking us for permission to re distribute the GNUARM installer and associated files along with their commercial products This is totally encouraged provided that the software licenses are fulfilled and that there are no charges except for possibly a small fee for the media and handling In this way you wil be helping both the GNUARM project and your customers Also note that we have ri purely comrmercial pointers in our projects section at our resc s page To be fair with everyone we wil be only adding links to projects that provide useful unbiased technical information online Contact us if you wish your site to be listed there The correct package to download is Binaries Cygwin GCC 4 0 toolchain Binaries 6CC 3 3 toolchain Mac OS x binutils 2 14 gcc 3 3 2 c c newlib 1 12 0 gdb 6 0 PEG TGZ 35 2 MB GCC 3 4 toolchain Cygwin binutils 2 15 goc 3 4 5 c c jayva newlib 1 12 0 insight 6 1 setup exe 17 0MB GNU Linux x86 binutils 2 15 gec 3 4 3 c co T ava newlib 1 12 0 insight 6 1 TAR B22 56 0MB GCC 4 0 toolchain
35. Modules Registers Signals 5 tt E E X 7A bo Variable display Breakpoint summary Hegister display etc E Ipc210x h amp makefile Le main c 23 gt E outine 51 Disassembly 23 LE Ez ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee int main void 1 Function declarations Ox40000274 lt main gt mow ri2 sp LEE eee ee ee ee ee ee ee eee ee ee ee ee eee ee ee ee ee ee ee ee ee ee ee ed Ox40000278 lt maint 4 gt stmdb sp ril riz lr pe Ox4000027c lt main 8 gt sub rii r12 4 Ox4 I E ERE void P Ox40000280 lt main 12 gt sub sp sp 8 0x8 void feedivoid unsigned int j void IRQ Routine void attribute interrupt IRO static int a void FIQ Routine void attribute _ interrupt FIOQ static char d Assembler void SWI Routine void attribute X interrupt S30611 static int wW Di void UNDEF Routine void attribute _ interrupt UNDEF static long x 5 ISP ay ff Static char y PERRERA hh hh oh oh ho ho hh Ch ho C Ch Ch Ch ch Ch Ch A Ch Ch Ch Ch Ch CK CK A AAA a static int z Header files const char pText The Rain in Spain a a a a 2 0x40000284 lt main 16 gt ldr I EDES 196 L Ox40t Hinclude LPC210x h C Code Display 0x40000288 lt main 20 gt str r3 r11 16 Initialize the system fONCRCNCCNON CA Ch RE RARA RARA RARA AAA T Initializel Global Variables Ox4000028c lt main 24 gt bl Ox40000354 lt Initia
36. RAM data tells linker to collect all data sections together _edata global symbol locates the end of data section in RAM gt ram AT gt flash load data section into RAM load copy of data section into FLASH for copying during startup Note first that we created two global symbols data and edata that locate the beginning and end of the data section in RAM This helps us create a copy loop in the crt s assembler file to load the initial values into the data section in RAM The command ram specifies the Virtual Memory Address that the data section is to be placed into RAM think of it as the final destination in RAM and all code references to any variables will use the RAM address The command AT flash specifies the load memory address essentially an exact copy of the RAM memory area with every variable initialized placed in flash for copying at startup You might say why not let the Philips boot loader load the initial values of the data section in RAM directly from the hex file The answer is that would work once and only once When you power off and reboot your embedded application the RAM values are lost The copy of the data area loaded into flash for copying during startup is placed by the GNU linker at the next available flash location This is conveniently right after the last byte of the prog section containing all our executable code The bss section is all variables that are not initialized It
37. Reset_Handler defined in this module below Includes Undef Addr UNDEF Routine defined in main wf n Ipc210x h SWI Addr SWI Routine defined in main s crt s PAbt Addr UNDEF Routine defined in main E main c DAbt Addr UNDEF Routine defined in main i d crt o armle IRQ Addr IRQ Routine defined in main c main o armle FIQ Addr FIQ Routine defined in main c F main out armle k o rounds the vectors and ISR addresses to 64 bytes total F FF crt lst Ec w skip past Philips ISP ram usage all the way to Ox40000200 main dmp a main hex main map K makefile demo2106 blink ram Binaries m j 12 Includes Setup a stack for each mode note that this only sets up a usable stack hj Ipc210x h for User mode lso each mode is setup with interrupts initially disabled s crt s i E main c 7 crt o armle E console 33 N Properties m 5g Ex BB r4 E F3 2 main o armle lt terminated gt LPC2000 Flash Utility Program C Program FilesLPC2106 ISPALPC210x ISP exe E main out armle ert lst ill ua H Reset Handler Rese t Handle r E EE EE EE EE EE E xq Hemember that the entire project code and variables will be loaded into RAM starting at address 0x40000000 The location counter is advanced by the directive 0x1C0
38. Window Help F3 7 E amp 8 G GS Run Last Launched Ctr F11 L h Debug Last Launched Fil C C Projects amp Mavigator 2 5 5 d Doe T Run History Run As Run Debug History Debug As Debug X External Tools Run As Q Externa Organize Favorites We re now going to put the Philips PLC2000 Flash Utility into the favorites list Click on Add in the window below Organize External x Favor ites cm Click the selection box for LPC2000 Flash Utility This will add it to the favorites list Selection Needed Select Launch Configurations G LPC2000 Flash Utility Select All Deselect All Now when we click on the Run pull down menu and select External Tools we see the LPC2000 Flash Utility at the top of the list aok ES Acc gt XA Ee Outline 3 An outline is not available C C Eclipse Platform File Edit Navigate Search Project AA Window Help Ia He g 3 58 Run Last Launched CtrHF11 CAC Projects Ta Navigator d le till rd Run History d Run As Run Debug History Debug As Debug F External Tools F 1 LPC2000 Flash Utility Run AS Q External Tools Organize Favorites D errors O warnings O infos Desrpton Ree Click on LPC2000 Flash Utility to verify that it runs C C Eclipse Pla
39. X An outline is not available Problems i console Properties RH UB D errors O warnings O infos In Folder In a procedure similar to installing the Philips Flash Utility as an External Tool click on Run External Tools External Tools This will bring up the External Tools dialog C C Eclipse Platform PEE File Edit Navigate Search Project BENE window Help F3 E E 6 ej A Run Last Launched Ctrl Fii P 4 ES Be Cice c E UNE Sf Debug Last Launched Fil fae CIC Run As Run Debug History Debug s Debug F External Tools d O 1 LPC2000 Flash Utility E External Tools Organize Favorites D errors O warnings 0 infos In Folder Click on New and replace the name with OCDremote Use the browse file system to find it It should be in the directory c cygwin usr local bin The arguments needed to properly start the OCDremote are as follows CARM7TDMI S specifies the CPU being accessed p8888 specifies the pseudo TCP IP port being used dWIGGLER specifies the JTAG hardware being used a1 specifies LPT1 for the Wiggler S7 specifies next to slowest speed It s a good idea to not tamper with these values Click on Apply to finish the setup t External Tools Create manage and run configurations Run a program V O N Configurations Mame OCDremote pun 2 Ant Build E Program ZEN LPC2000 Flash Uilit E Main f Refresh P
40. added two dummy memory areas that will prevent the linker from loading code or variables into the RAM areas used by the Philips ISP Flash Utility sometimes called a boot loader See page 180 in the Philips LPC2106 User Manual for a description of the Boot Loader s RAM usage As you ll see in a minute we ll be moving various sections text section data section etc into flash and ram Note that we created a global symbol all symbols created in the linker command script are global called stack end It s just located after the stack variable area used by the Philips ISP Flash Utility boot loader as mentioned above stack end 0x4000FEDC Now that the memory areas have been defined we can start putting things into them We do that by creating output sections and then putting bits and pieces of our code and data into them We define below four output sections startup this output section holds the code in the startup function defined in crt s lext this output section holds all other executable code generated by the compiler data this output section contains all initialized data generated by the compiler bss this output section contains all uninitialized data generated by the compiler The next part of the Linker Command Script defines the sections and where they go in memory Resource demo2106 blink flash cmd Eclipse Platform File Edit Navigate Search Project Run Window Help n BaelabJaQ 9 9 e gt g
41. breakpoint A Ipc210x h amp makefile a E main c x T a int main roid i unsigned int j ff loop counter stack variable static int a C static uninitialized variables static char d static uninitialized variables static int w 1 f static initialized variable static long x 5 static initialized variable static char y 0x04 static initialized variable z Te static initialized variable pText The Rain in Spain static int const char ff Initialize the system Initialirze l set io pins for led PO IODIR OxO0000080 pin PO is an output everything else is input after reset IOSET OxO0000080 led off IOCLER OxOOO000080 yg led on f endless loop to toggle the red LED FO 7 while 1 for ij O j 5000000 j 1 wait SOO msec IOSET OXDODODOSO red led off for ij O j 5000000 j 1 wait 500 msec R Ox000000680 red led on Right click on the breakpoint symbol and select Breakpoint Properties In the Breakpoint Properties window set the condition text box to x 9 Properties for C C breakpoint type filter text Common ee common Filtering Type C C line breakpoint File Cileclipsemworkspaceldemoz 106_ blink_ramimain c Line number 64 Iv Enabled Condition x 9 Ignore count T A nice feature of Eclipse debugging is that you can edit the source file within the debugger and rebuild the applicati
42. bytes 0x4000FEEO bottom of Philips ISP Undefined mode stack 4 bytes Ox4000FEDC UND stack pointer Abort mode stack 4 bytes Ox4000FED8 ABT stack pointer FIQ mode stack 4 bytes 0Ox4000FED4 FIQ stack pointer IRQ mode stack 4bytes 0x4000FEDO IRQ stack pointer SVC mode 4bytes 0x4000FECC SVC stack pointer Ox4000FEC8 USR SYS stack USR mode SYS mode stack Stack grows downward until it collides with RAM The next part of the startup file crt s to investigate is the setup of the data and bss sections as shown below Resource crt s Eclipse Platform File Edit Navigate Search Project Run Window Help HOlm Pleo 85 Navigator 28 N main dmp demo2106 blink Flash cmd S crt s 2 15 demo2106 blink flash copy data section Copy from ROM to RAM cdtproject ldr etext 3 project ldr data crt lst ldr edatal B crt o cmp R3 I crt s ldrlo R1 4 FS demo2106 blink Flash cmd strlo R2 4 C Ipc210x h His C main c gt main dmp Clear bss section Zero init tr E main hex v RO 0 NEMORE ldr R1 bss start main o m ldr R2 bss end z main out R1 R2 kK makefile cmp 7 e demo2106 blink ram strlo RO R1 4 3 cdtproject blo 2b y P 5 project crt lst Enter the C code crt o b main S crt s 5 demo2106_blink_ram cmd endfunc C Ipc210x h end E main c E main dmp lt 5
43. com he L ancel Always ask before opening this type of file harm your computer IF you do nat trust the source da not open ar 9 While Files fram the Internet can be useful some files can potentially save this file What s the risk Select the temporary c scratch directory as the target of the download and click Open Save int amp w Local Disk E Og e E C ARM Cross Development with Eclipse Tini amp RIM dL 4 Cj capture C wINDOWS My Recent cygwin E 2zdownload Documents C DELL C Documents and Settings My Computer File name embeddededt 2005081 0 v My Network Save as hype Winzip File w The first Zylin CDT zip file will download into the c scratch folder This file is an 11 Mb download 22 of embeddedcdt 20050810 zip Completed fa 5 X Saving embeddedcdt 20050810 zip From www zylin com Estimated time left 1 min 38 sec 2 41 MB of 11 2 MB copied Download to Ciscratchiembeddedcdt 20050810 zip Transfer rate 97 9 KB 5ec C Close this dialog bos when download completes Open Open Fold Next click on http www zylin com zylincdt 20050810 zip to download Then click on Save in the File Download window File Download Do you want to open or save this file 2 Name z2ylincdt 20050810 zip Type Winzip File 173 KB From Www 2 lin com EIN BIN TN Always ask before opening this type of file While files from the Internet can be useful some files can po
44. defined in the Linker Script are automatically global and available to the rest of the program ir To force the linker to use this LINKER SCRIPT just add the T demo2106 blink ram cmd directive to the linker flags in the makefile pa LFLAGS Map main map nostartfiles T demozi06 blink _ram cmd The Philips boot loader supports the ISP In System Programming via the serial port and the IAP In Application Programming for flash programming from within your application The boot loader uses RAM memory and we MUST NOT load variables or code in these areas pe RAM used by boot loader Ox40000120 Ox400001FF 223 bytes for ISP variables Ox4000FFEO Ox4000FFFF 32 bytes for ISP and IAP variables Ox4000FEEO Ox4000FFDF 256 bytes stack for ISP and IAP S Writable Insert C C demo2106 blink ram cmd Eclipse Platform File Edit Navigate Search Project Run Window Help pate i eae na 1 0 Q 184 lve Ox40010000 Ox4000FFFF variables and stack for Philips boot loader 288 bytes Do not put anything here Ox4000FEEO Ox4000FEDC Stack end Ox4000FEDS Ox4000FED4 Ox4000FEDO Ox4000FECC Ox4000FECS writable Insert C C demo2106 blink ram cmd Eclipse Platform File Edit Navigate Search Project Run Window Help JM 2 To nG data initialized variables C C demo2106 blink ram cmd Eclipse Platform File Edit N
45. fitted it from the LPT1 printer port to the ARM JTAG Wiggler The Wiggler was then fitted to the 20 pin JTAG header on the Olimex LPC P2106 board The red stripe on the ribbon cable is pin 1 and should be nearest the power plug The Debug JTAG jumper should be fitted It doesn t matter if the BSL jumper is installed or not Make all these connections with the power off A Blunt Talk About the Wiggler Let s talk bluntly about the Wiggler The Wiggler is one of many products from the Canadian company Macraigor It connects the parallel port of your PC to the 20 pin JTAG header on the Olimex LPC P2106 board It is just a simple level shifter and a transistor Macraigor charges 150 for it the Olimex clone is about 19 There are several schematic diagrams on the web for the Wiggler notably Leon Heller has one on the LPC2000 message board on Yahoo You could build your own but doubt you d save that much money after paying the shipping from Digikey and the gas to drive to Radio Shack The Olimex version is a fair deal Obviously the Macraigor Company is not happy about all these clones running about so recently they slipped an impediment into the works The latest version of OCDremote their free JTAG server for the Wiggler and other products is expecting a connection short circuit between pins 8 and 15 of the LPT1 printer port This has made a lot of people fail Olimex has said that they would revise their design and modify their st
46. for led PD 7 Comment Chr IODIR OxX00000080 pin PO is an of Uncomment Ctrl 4 IOSET OxOO0000080 led off Add Black Comment iCkria ShiFE roche Ox00000080 ff led on Remove Block Comment CEriH ShiFE H Content Assist CtrHsSpace Add Include Ctrl ShiFE hM Format Ctrl ShiFk F Show in C C Projects ff endless loop to toggle the red LED PO 7 while 1 for j Of j 5000000 j i IOSET OxQO000080 if for j Of j 5000000 j i IOCLE OxOOOo00080 d Refactor Open Declaration C Ctrl ShiFk Down Ctri Shift Up Open Definition Go to next member Go bo previous membe All Declarations py All References demo 106_blink_rarn an debug launch Debugger Process omm Tm TA Resume At Line igpcCLiGB Lexb ect LofA SenL 2 LO eel 1500 5128 Pra x Add Watch Expression Kl isecLion texbE specLtioabh Sent B3B dgection slise alb section text section sent iz 8 section size Run As l Ee z5 isection data section size 24 total size 25 Debug 4s d gdb Team Compare With d Replace with j writable Preferences 139 Sec 1 139 171 At 1 Ln 3 Col 62 REC TRE Ex Create Make Target start cul ARM Cross Developm IET Ty Build Make Target When you click on the Run to line choice the program will execute to the line the cursor resides on and then stop N B it will not
47. forget to check out the Eclipse Project FAG and online documentation You can find out about eclipse related events projects plug ins and websites on the Community page For software licensing website terms of use and legal FAQs please see our legal stuff page Eclipse logos and graphics are found on our logos page And our thanks to HP IGM Intel Magma and Novell for generous donations to our website Infrastructure August 29 Eclipse Foundation and sybase Announce Approval of Eclipse Data Tools Platform Project August 22 Eclipse Foundation Announces CDT 3 0 August 22 Download COT 3 0 Read the New and Noteworthy Click on downloads to get the latest versions of Eclipse eclipse org pibe neum Welcome Welcome to eclipse org Eclipse is a kind of universal tool E technical articles visit the newsgri can find out about eclipse related e wih ats n erms For software licensing website ter The Eclipse download window will appear Eclipse is constantly being improved and new releases come several times a year Usually the safest thing to download is the official latest release When this tutorial was created the latest release was Eclipse SDK 3 1 Click on Downloads to get things started eclipse eclipse org home eclipse downloads If youre new to Eclipse start by downloading the Eclipse SDK then browse the various project pages to find the useful tools and plugi
48. hardware arrangement P0 7 1 turn off LED P0 7 0 turnon LED C C main c Eclipse Platform File Edit Navigate Search Project Run Window Help 3 amp l amp g amp amp amp ai G 135 Q Q 9 5 5 ES facic d C C Pr x Ay EI dema2106 blink ram cmd iS crt s El main c Y El mainc makefile da E E ERE RARA RRA Ch ch ch hc RARA RARA AR ARA A RARA ch ch h ch EEA CK CK CKCKCKCKCHCKCKCh Ch hh ch ho MAIN ak Ck ACH K ch hoch TERT koh oh hok oh oh ck ck ch h Ch h ck koh Hh hchchohokhokoh A H 6 demoz1i 6 blink Flash pe Binaries j Ea Includes E h Ipc210x h int main void i EE ats E d main c int qu loop counter stack variable E E crt o armle static int Bp Static uninitialized variables g Ri main o armle static char static uninitialized variables m main aut armle static int 1 static initialized variable j m crt st static long x 5 static initialized variable static char 0x04 Static initialized variable static int UM Static initialized variable const char pText The Rain in Spain main hex main map KA makefile Initialize th t 61 125 demo2106_blink_rarn ff Initialize Seen Initializeil set io pins for led FO 7 IODIR x n00050 pin PO is an output everything else is input after reset IGSET OxOOo0o00060 fo led off IOCLR ux angagaggasuo led on endless loop to toggle the red LED P 7 while 11 for 3
49. install all the component parts of a complete ARM software development system and gave two simple code examples to try out Of course the beauty of this is that it s completely free If you are a professional engineer attempting to build an ARM development system with these techniques you have a fool for a chief engineer The professional compilers such as IAR Rowley and Keil etc are more efficient generally bug free and interface seamlessly with debuggers They allow debugging with either ram or flash executables and flash programming is usually accomplished with a single click You also have telephone support with these systems These professional packages save your company time and money in the long run This tutorial was written for students and grown up kids at heart its purpose is to foster their interest in computer science and electrical engineering It s a shame that the big players like Microsoft Kiel Borland and others don t develop a student hobbyist version of their software development packages priced at a give away point that a third world high school student could afford Bill Gates has criticized my country s school system for not developing enough computer scientists and engineers why not provide a non commercial version of his Visual Studio for students and provide code targeting for every popular microprocessor being sold today am not happy with the debugger described in the tutorial The Wiggler Eclipse CDT
50. is loaded into RAM and we create two global symbols bss start and bss end to locate the beginning and end for clearing by a loop in the startup code bss _bss_start bss gt ram ALIGN 4 _bss end end Now let s diagram just where everything is in RAM and FLASH memory 0x40010000 0x4000FEEO 0x4000FFFC stacks RAM 0x40000234 bss uninitialized variables 0x40000218 data variables 0x40000200 0x40000000 0x020000 copy of data variables 0x000268 Constants strings etc FLASH Initialize Main otartup Code 0x000020 Vector Table 0x000000 16 Description of the Makefile The makefile is the last source file we need to look at built the makefile to comply with the GNU make utility and be as simple as possible Resource makefile Eclipse Platform Sele File Edit Navigate Search Project Run Window Help r 8 E amp ilmim j4 o o liB FY Resource TS Navigator ES b mm demo2106_blink_flash crad Elmanma Gets Eletit E mainam ff makefile ha EA H T ANE demozi 06 blink flash Elle demo2106_blink_flash A E cdtpraject arm elf gcc na project arm elf ld v j m crt st arm elf ar e crko arm elf as ben crk s arm elf objcopy P demoazi 6 amp blink Flash cmd arm elf objdump ve e Ipc210x h von C main c CFLAGS I fno common 03 g mn main dmp AFLAGS ahla mapcs 32 0 CELO i main hex LFLAGS Map ma
51. key int niccesses char ame 16 cdess 14705 0 3piderman 14705 nAccesses 0 name Spi ff Initialize the system Initializeil fo set io pins for led PO 7 IODIR OxOO00008O fo pin PO 7 is an output everything else is input after rese Another way to look at the local variables is to inspect the Variables view This will automatically display all automatic variables in the current stack frame It can also display any global variables that you choose For simple scalar variables the value is printed next to the variable name If you click on a variable its value appears in the summary area at the bottom This is handy for a structured variable or a pointer wherein the debugger will expand the variable in the summary area j E f xc lm pText Ox400004f4 M ES Access Ox400004f4 The Rain in Spain The Variables view can also expand structures Just click on any signs you see to expand the structure and view its contents BB soars ere vos tis ra 2 j 5000000 A b 0 amp a Variables x X 70 sts E W pText 04000044 E Access J key 14705 9 de name 1 p name 2 i name 3 d name 4 e key 9 ole 9 name 14 name 5 r name 6 m name 7 a namel n name 9 name 10 name 11 name 12 name 13 39 name 15 14705 n ccesses Spiderman 000 0004 000 00
52. lst crE o demo2106_blink_flash copy of data area 0x00000284 lt 0x00000104 Ox00000103 Ox00000040 OXDODODOSF ES demo2106_blink_ram Interrupt Vector Table Ox00000000 The easy way to prevent the linker from loading anything into a memory area is to define a MEMORY region for it and then avoid assigning any text data or bss sections into it The first order of business in the linker command script is to identify the memory available this is easy in a Philips LPC2106 the RAM and FLASH memory are on chip and at fixed locations Page 29 of the Philips LPC2106 User Manual shows the physical memory layout 4 0 GB OxFFFF FFFF AHB Peripherals 375 GB OxF000 0000 VPB Peripherals 35GB OxE000 0000 30GB 0xC000 0000 Reserved for External Memory 20GB 0x8000 0000 Boot Block ire mapped from On Chip Flash memory Reserved for On Chip Memory 0x4000 FFFF LPC2106 64 kB 0x4000 7FFF LPC2105 32 kB 0x4000 3FFF LPC2104 16 kB On Chip Static RAM 0x4000 0000 1 0 GB 0x0002 0000 l 0x0001 FFFF 128 kB On Chip Non Volatile Memory 0 0 GB 0x0000 0000 Resource demo2106 blink flash cmd Eclipse Platform File Edit Navigate Search Project Run Window Help Ir3 Gl amp Q E IDO gt 5 Navigator 58 Hi S at s Bi demo2106 blink Flash cmd X S crt s C main c main map demo2106 blink ram cmd Se E B v mo2106 blink
53. mn fps 0 MM cpsr 536871120 he Enable Disable x Display As Arrav ut Cast To Type Restore Original Type Find Variable Ctrl F Change value Add Register Group Restore Def aulbieaister oes Set Value Enter a new value Far r7 EY watch Dx1F8 Now the value for r7 has been changed to Ox1F8 m m 110 1010 pj 0 Mm r2 85 1010 p3 1 M r4 OxFFFFFFFFennzcon lOO r5 2147482932 100 r amp 1073742120 100 r7 Ox1f8 oof r8 1656272053 mol Registers 2 Signals It goes without saying that you had better use this feature with great care Make sure you know what you are doing before tampering with the ARM registers P Inspecting Memory Viewing memory is a bit complex in Eclipse First the memory view is not part of the default debug launch configuration You can add it by clicking Window Show View Memory as shown below DINEM Help New Window Mew Editor Open Perspective Shor View E unch Customize Perspective 9g Breakpoints Alt 5Shift B E i uspende Save Perspective 4s El console Alt shift o C lj Reset Perspective GF Debu Close Perspective a Close All Perspectives Disassembly Navigation El Display e Error Lag Preferences Gd Expressions Dir lir lr lir lr lir lr rr rr lir nr rrr rrr
54. on the File pull down menu and then click on Import Then in the Import window click on File System C C Eclipse Platform mim Edit Navigate Search Project Run Window Help Mew Alt Shift M Import Select Import resources From the local File system po 10 BO Select an import source mF Checkout Projects From Cv5 Existing Ant Buildfile Li Existing Project into Workspace 1 Print LrHEF Li External Features Switch Workspace Open External File eam Project Set E zip File ms lw 13 Export d demo2106_ bli 1 pc210x h demo2106 z main c demaz106 3 main map demoz106 4 demazi amp cmd demo2106 Exit When the Import File System window appears click on the Browse button Hunt for the sample project which is stored in the c scratch directory Click on the directory scratch and hit the OK button in the Import from directory window on the left below Import from directory El E Select a directory to import From B S Local Disk C Ez armlib E i ATI 5 capture l l E C3 cygwin Click on Select All in the Import window below right to E DELL get the source files selected for import into our project C Documents and Settings O download E 5 DRIVERS 5 eagle components E Easy Screen 3 eclipse E E foo 1386 O memo ca My Music 5 pictures 5 Program Files SEFSEER Please specify Folder
55. on the web www yahoo com GNUARM group LPC2000 group www sparkfun com tech support forum www newmicros com tech support forum www eclipse org C C Development Tools User Forum HAVE FUN EVERYBODY
56. packages listed above from default to install You should see the screen displayed directly below Note that the Archive Devel Libs and Web components are selected for Install Everything else is left as default Cygwin Setup Select Packages Select Packages Select packages to install E ax E C Keep Prev Category Curent All amp Default Admin 4 Default Archive de Install Base 4 Default Database 4 Default Devel e Install Doc 4 Default Editors 4 Default Games amp Default Graphics 4 Default Interpreters amp Default Libs amp nstall Mail amp Default Math de Detautt Ming dde Default Net dr Default Publishing de Default Shells amp Default System dd Default Test amp Default Utils dde Default Web de Install 011 4 Default HemovedPackages amp Default Postinstalllast amp Default Click Next to start the download C Exp View Category Bi Sr x Back a Cancel Now the Cygwin will start downloading This creates a huge 700 Megabyte directory on your hard drive and takes 30 minutes to download and install using a cable modem 99 Cygwin Setup Progress This page displays the progress of the download or installation Downloading Package Total HE Disk Cancel When the installation completes Cygwin will ask you if you want any d
57. plugins File Folder 6 19 2005 7 00 PM S capture readme File Folder 6 19 2005 7 00 PM 5 cygwin eclipsepraduct ECLIPSEPRODUCT File 3 11 2005 9 15 AM DELL cpl vi0 HTML Document 3 11 2005 9 15 AM S Documents and Settings eclipse Application 3 11 2005 9 15 AM EX download natice HTML Document 3111 2005 9 15 AM E DRIVERS startup Executable Jar File 3 11 2005 9 15 AM 5 eagle components C EasyScreen 9 configuration 5 Features 5 plugins 9 readme 5 eclipse download Ey Foo You can create a desktop icon for conveniently starting Eclipse by right clicking on the Eclipse application above and sending it to the desk top BITES File Edit View Favorites Tools Help Hi Q rex 2 pers Es roe Hab X ae E Folders x Name 4 Size Type E Y My Computer configuration File Folds El amp Local Disk C features elder E 3 armlib plugins File Folder m E E ATI readme File Folder 5 23 2005 10 59 P Ic capture 1 aclipsepraduct 1 KB ECLIPSEPRODLICT File 5 13 2005 2 55 P E i3 DELL 3 az KB Application 513 2005 2 55 P E D Documents and Settings 1KB Configuration Settings 5 13 2005 2 55 P ic download 17 KB HTML Document 5 13 2005 2 55 P E ic DRIVERS KB HTML Document 513 2005 2 55 P Pin to Stark menu E eagle components 31KB Executable Jar File 5 13 2005 2 55 P Scan For Viruses O EasyScreen
58. ram Embedded debug launch e Embedded GOB 9 9 05 12 38 AM Suspended gi Thread 0 Suspended 3 1 lt symbol is not available gt E wal Debugger Process 9 9 05 12 38 AM J The application will start run all of our ARM initialization code and stop at the start of main Note that in the Debug view the Thread 0 is suspended at line 46 of main With embedded cross development we only have one execution thread Code targeted for the PC platform can have multiple threads of execution Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window w m O Q c9 se Debug Xx Ea OCDRemote Program oH Cicygwinlusrtlacalibinkocdremote exe El 3 demo 106_blink_ram Embedded debug launch Bee Embedded SDB 9 9 05 12 38 AM Suspended E EE Thread 0 Suspended 3 1 maint at main c 46 ea Debugger Process 9 9 05 12 38 AM A l outline fe Disassembly 2 int main void i makefile Le main c oN int main void e unsigned int static int static char F by n ff Li static un fo static un Ox400002 74 Ox400002e76 Ox400002 7c Ox40000260 xmain lt madn 4 gt cmaint lt main 12 gt l static in E fo static initia 0x04 static in e static in Spr MIS psi static long x unsigned int static char static int j a d static int W 5 Y z static int Static char const char static int static long x s
59. rn i Memory rations phck ck ck kb kb hk hk AAA AAA AAA AAA AAA ES Modules js a pe Outline os wai Registers eu The memory view appears in the Console view at the bottom of the Debug perspective At this point nothing has been defined Memory is displayed as one or more memory monitors To create a memory monitor click on the symbol Enter the address 0x400004f4 address of the string The Rain in Spain in the dialog box aE aE Sa EE eS Monitor Memory Enter address or expression to monitor The memory monitor is created although it defaults to 4 byte display mode The display of the address columns and the associated memory contents is called a Rendering The address 0x400004F4 is called the Base Address there s a right click menu option Reset to Base Address that will automatically return you to this address if you scroll the memory display Console Memory X Memory Monitors c et let 818 YO e Ox400004F4 Ox400004F4 Ox400004F4 zHex O Memory Renderings d ox al 400004F d00000000 52b1696 O6B9SbBEZO 40000500 53706169 amp kEODDDODU O2000300 06000000 40000510 sd 19050040 46617374 657220774 40000520 66616E20 612075370 65656469 6E6TZ 6z 40000530 75605055 4000000 av7aaaooaou 04000000 40000540 05000000 01000000 augadgaaaau 00000000 40000550 o00000000 ooo0c0000 ooo000000 OoO000000 40000560 do0000000 EQEIFF F 3ESFF 7F OEOOOOO0 4000
60. s editor compilers and debugger sufficient to design build and debug ARM applications You can download Eclipse for free at the following web site www eclipse org The following Eclipse welcome page will display Expect some differences from my example below since the Eclipse web site is very dynamic 3 Eclipse org Main Page Microsoft Internet Explorer Sele File Edit View Favorites Tools Help gt Q sack x Q ix i2 JO search SL Favorites e A m v LJ y e 3 TEO gt EA teclipse eclipse org eclipse org wh ats eclipse in featured eclipse available now ri eu the nems comer articles Welcome to eclipse org Eclipse is an open source community whose projects are focused on providing an extensible development platform and application frameworks for building software Eclipse provides extensible tools and frameworks that span the software development lifecycle including support for modeling language development environments for Java C C and others testing and performance business intelligence rich client applications and embedded development A large vibrant ecosystem of major technology vendors Innovative start ups universities and research institutions and individuals extend complement and support the Eclipse Platform Find aut what eclipse is all about check out the Eclipse Roadmap white paper read some technical articles visit the newsgroups take a look at the projects and pick up the latest downloads Dont
61. that point we are off and running The first part of the startup code above sets up the stacks and the mode bits The symbol stack end will be defined in the linker command script file demo2106 cmd Here is how it will be defined Knowing that the Philips ISP Flash Loader will use the very top 288 bytes of RAM for its internal stack and variables we ll start our application stacks at Ox4000FEEO Note 0x40010000 0x120 0x4000FEEO0 define a global symbol stack end placed at the very end of RAM minus 4 bytes stack end 0x4000FEEO 4 Working that out with the Windows calculator the stack end is placed at 4000FEDC The code snippet that sets up the stacks and modes is a bit complex so let s explain it a bit First we load RO with the address of the end of the stack as described above Idr r0 stack end Now we put the ARM into Undefined Instruction mode by setting the MODE UND bit in the Current Program Status Register CPSR The four modes undefined irq abort and svc all have their own private copies of R13 sp and r14 link return The FIQ mode has private copies of registers R8 R14 Thus by writing RO into the stack pointer sp R13 it will use Ox4000FEDC as the initial stack pointer if we ever have processing of an undefined instruction By subtracting the undefined stack size 4 bytes from RO we re limiting the stack for UND mode to just 4 bytes msr CPSR c ZMODE UNDII BIT F BIT This puts the
62. this type of File While files from the Internet can be useful some files can potentially harm your computer IF you do nat trust the source do not open or save this file V hat s the risk Now browse to the c scratch directory that you created previously My Documents hy Computer File name eclipse 5 DK 3 win32 wv hi Network Dave as type Compressed zipped Folder hal Click on Save to start the download Now the download will start Eclipse is delivered as a ZIP file It s 103 megabytes in length and takes 9 minutes to download with my broadband cable modem If you have a dialup internet connection this will be excruciating If you don t have a cable modem high speed internet connection suggest you find somebody who does and go over there with a blank CDROM and a gift 7 of eclipse SDK 3 1 win32 zip Completed fa 9 Saving ecipse SDk 3 1 win3z zip From ftp cse buffalo edu Estimated time left 7 min 33 sec 7 41 MB of 103 MB copied Download to Ci downloadieclipse 5DK 3 1 win3z zip Transfer rate 216 KB 5ec _ Close this dialog bos when download completes Oper Open Folder When the Eclipse download completes you should see the following zip file in your scratch directory scratch File Edit View Favorites Tools Help Q Od Ds i rovers E X e 5 Folders X Mame Size Type Date Modified E E DRIVERS eclipse SDK 3 1 win32 105 476 KB Compressed zipped Folder 9 3 2005 10 5
63. to push the Reset Handler to address 0x40000200 This leaves a hole where the Philips ISP Flash Utility will use the low RAM There are other ways to do this File MAIN C There is just one extra line of C code in the main program It directs the LPC2106 to re map the interrupt vectors to RAM at 0x40000000 t C C main c Eclipse Platform File Edit Navigate Search Project Run Window Help lm HSlm G O Q vV eo o By sf de CIC B ai x Es mL demozi amp blink ram cmd C main c Ej mainc x f P a dex a uw o c EEE demo2106_blink Flash Wait for the PLL to lock to set frequency Initialize Ses demo2106 blink ram while PLLSTAT amp PLOCE om feed H Binaries IRQ Routine ER Includes Connect the PLL as the clock source FIQ Routine W h Ipcz10x h PLLCON Ox3 SWI Routine amp S ert s feed UNDEF_Routine l main c 7 LPC210x h E e crto armle Enabling MAM and setting number of clocks used for Flash memory fetch q fl E main o armle MAMCR xZ HRF main out armle MAMTIM 0x4 r crt st 2 n E demaz1 6 blink ram cmd El main dmp MEMMAP Ox02 main hex j main main map o PELIE Initialize MEMAP re map vector table to RAM ff Setting peripheral Clock pelk to System Clock cclk VPBDIV x1 E makefile Initialize feed IRQ Routine FIG Routine a i T Problems E Console EN Prop
64. to set the port bit and you set a bit in the IOCLR register to clear the port bit This little nuance will trip up novice and experienced programmers alike Alert readers will ask What if both bits are set in IOSET and IOCLR The answer is Last one wins The last IOSET or IOCLR instruction will prevail To turn the LED P0 7 off we can write IOSET 0x00000080 turn PO 7 red LED off Likewise to turn the LED PO0 7 on we can write IOCLR 0x00000080 turn PO 7 red LED on As you can see it s fairly simple to manipulate I O bits on the ARM processor To blink the LED a simple FOREVER loop will do the job selected the loop counter values to get a one half second blink on off time endless loop to toggle the red LED P0 7 while 1 for j 0 j lt 5000000 j wait 500 msec IOSET 0x00000080 red led off for j 0 j lt 5000000 j wait 500 msec IOCLR 0x00000080 red led on This scheme is very inefficient in that it hog ties the CPU while the wait loops are counting up The Initialize function requires some explanation C C main c Eclipse Platform File Edit Navigate Search Project Run Window Help IS ESlae G B G G F O Q PWVW lBleo o F ES Recicer z g cic Pr 232 Ol E Ipezt x h S crt s E main map E demo2106 cmd main c X E main lst E ert lst m j gem gt AS ur di id El Initialize l
65. with the serial device being a internet socket called localhost 8888 the default specification for the Macraigor OCDremote driver Target Remote supports the GDB load command the specific download file main out was specified above in the main tab The source tab can be left at its default settings Likewise the common tab can be left at its default setting Click on apply and then Close to complete specification of the debug launch configuration D Switch to Debug Perspective What you see on the screen when using Eclipse is called a perspective and up to now we have been using the C C perspective Once the application has been built we must switch to the Debug perspective to debug it One way is to change the perspective in the Window pull down menu as shown below Project Pum UNIES amp G Mew Window Mew Editor Open Perspective Le main c X Shaw View g0 Team Synchronizing Customize Perspective Save Perspective As Other Reset Perspective Close Perspective Close All Perspectives Mavigation Preferences It s also convenient to click on the Debug Perspective button on the upper right of the Eclipse screen Below is the Debug perspective Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help Jri uH amp imit O Q icc49 9 3 w o o ES E jcic X Debug F Debug xJ
66. you re not sure use the pull down arrow to see exactly what configuration will be started Eclipse SDK E Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run windi wi Debug s ne Debug Organize Favorites The Debugger will start up and execute the two commands specified earlier It will connect to the target via JTAG and start a download of the application You can watch the progress bars at the lower right of the screen Debug main c Eclipse SDK AE File Edit Refactor Navigate Search Project Run Window Help EDE 0 Q 109 15 5 4 ES Bacc X Debug ii Debug X 00 variables 23 Breakpoints Expressions a sts ii xo X v c E i gt m KS x9 EQ OCDRemote Program pal CUcygwinlusrllocalibiniocdremote exe 1 36 demo2106 blink ram Embedded debug launch E e Embedded GDB 9 9 05 12 38 AM Suspended 5 Ipc210x h makefile Le main c 23 i Outline Disassembly 93 int main void Pending unsigned int 13 d 1l static int b C static un static char static un 2 static int E static in static long x static initia static char static in static int static in const char ext The Rain in Spain Initialize the system Initialize t f f set io pins for led PO 7 IODIR OxO00000080 pin PO 7 is an output everything Y lt lii gt El Console 23 Tasks B xb r E r3 7H
67. 0 Flash utili zip From wiew semiconductors philips com Would you like to open the file ar save it to your computer Saving Ipc2000 Flash_utilitye zip From vns semiconductors philips corn Estimated time left 26 sec 628 KB of 2 00 MB copied Download Ea Crscratchilpce000_Flash_ utility zip Transfer rate 54 8 KB Sec Close this dialog box when download completes Oper Open Folder We ll use WinZip to unzip this into the c scratch directory File Actions Options Help RS ew Open Favor ites e Wizard Extract Encrvp View Install Mame Tvpe Modified Size Ratio Packed Path Bj setup exe Install Applic 7 15 2000 12 00 AM 138 775 I2 57 174 CU PC210x ISP CAB Winzip File 3417 2004 11 21 AM 2 041 048 199 2 022 E setup Ist LST File 3 17 2004 11 22 AM 4001 79 B2 Selected 0 files O bytes Total 3 files 2 135KB Now you can see that the download directory has a setup utility and another zip file containing the LPC2000 Hex Utility Click on the setup exe application to start the installer scratch Fie Edit view Favorites Tools Help Q sack d JO search Folders EBk x a Folders BEI oc2000 Flash utility E ee Local Disk C z E es E a Click on setup to capture start the installer E DELL 4 Documents and Setti w lii B The LPC2000 Flash Utility setup now starts Click on OK to proceed LPC2000 Flash Utility Setup LPC2000 Flash Utility
68. 050005 000 If you click on the Show Type Names button each variable name will be displayed with its type as shown below tjs El 3 3 unsigned int j 3301707 int a 0 int b 0 ink c t char d j ink w 1 long int x 5 xj char y sintz char pText 0x400004F4 m m struct EntryLock Access Check the variables you want to display and then click OK add them to the Variables view Selection Needed Select Variables Select All Deselect all You can easily change the value of a variable at any time Assuming that the debugger has stopped click on the variable you wish to change and right click In the right click menu select Change Value and enter the new value into the pop up window as shown below In this example we change the variable c to 52 pu j j 3301707 ate x a 0 saari x h f exi x m Media Select All Ctrl A 2 en j w 1 Copy Variables Cho Lo I Enable x y C Disable o x Display As Arrav Set Value Enter a new value For c T Cast To Type Restore Original Type Find variable Ctrl F A Change Value sa Ud Add Global variables 3 Remove Global variables de Remove Al Global variables Format d Watch Now the Variables view should show the new value for the variable c Note that it has been colored red to indicate that it has been changed 4 1004
69. 0570 do0000000 TOECFF TYF TBECFF F ECO010040 A 40000580 do0000000 EQEIFF F OS ESFFUVF OFOOO0O0 400005930 adadad TOECF FTF JTOECFF F BCO10040 40000540 o00000000 EDE1FF F OSESFF RF OEQOOOO0 40000580 do0000000 TOECKF UF TROECFF F Bocnoi10040 4nunduscu agadaaa EUEIFF F S3ESFF F Ecdada 4O00005DO o00000000 TDECFF F TDECFF F Ec010040 Ziiim rine FIFiFF7F ee FFYF rmn There s also a Go to Address right click menu option that will jump all over memory for you By right clicking anywhere within the memory rendering display area you can select Column Size 1 unit Console MIE i ra sti T CU emory Monitors Box de Memory Renderings i 04000044 04000044 Ox400004F4 Hex 4n00004F0 40000500 40000510 40000520 40000530 40000540 40000550 40000560 40000570 40000550 400005290 400005140 40000580 400005C0 40000500 annnnsren oo000000 53706169 o5000000 66616E20 FSGCHCHS o5000000 ooo000000 ooo000000 oo000000 ooo000000 ooo000000 oo000000 ooo000000 ooo000000 OOOOO000 nnnnnnnn Ok Reset to Base Address Go to Address Column Size Reformat Hide Address Column 5 Copy Ta Clipboard E Print Properties PnriFF UE ee e units w units 8 units 16 units Set as Default PRI This will repaint the memory rendering in Byte format Console T Memory X i ee st T MEL emarv Monitors Bo de Memory Renderings d 4 Ox400004F4 Ox400004F4 Ox400004F4 lt H
70. 06_blink_ram cmd demo2106_blink_flash cmd main map main map l gt A uj alB v An outline is not available 2 15 demo2106 blink Flash Binaries Includes h Ipc210x h global Reset Handler s crt s global startup main c func Startup 2 crt o armle main o armle startup te main out armle i E crt st Exception Vectors demo2106_blink_flash main dmp vectors ldr Reset Addr ldr Undef Addr ldr SWI Addr ldr P bt Addr ldr D bt Addr nop Reserved Vector holds Philips ISP checksum ldr PC OxFFO0 see page 71 of Insiders Guide toj the Philips ARM Base ldr FIQ Addr 2 in h E main hex 2 E main map K makefile eS demo2106_blink_ram Reset Addr vord Reset Handler defined in this module below Undef Addr Word UNDEF Routine defined in main c SWI Addr Word SWI Routine defined in main c PAbt Addr word UNDEF Routine defined in main c DAbt Addr word UNDEF Routine defined in main c IRQ Addr word IRQ Routine defined in main c FIQ Addr word FIQ Routine defined in main c Word o rounds the vectors and ISR addresses to 64 bytes total v lt gt Problems El console i i Properties Z A E Al lt terminated gt LPC2000 Flash Utility Program C Program Files LPC2106 ISP LPC210x_ISP exe Note that all of the code and data that follows goes into the text section I
71. 2 AM EU eclipse E C3 I386 E My Music El C3 Program Files E C3 source Files lii Eclipse is delivered as a ZIP file eclipse SDK 3 1 win32 zip You can use WinZip to decompress this file and load its constituent parts on your hard drive If you don t have WinZip you can get a free evaluation version from this address http www winzip com There s a decent Help file supplied by WinZip Therefore we re going to assume that the reader is able to use a tool such as WinZip to extract from zip files In my computer with WinZip installed double clicking on the zip file name eclipse SDK 3 1 win32 zip in the Windows Explorer display above will automatically start up WinZip Click on Extract to start the Eclipse file decompression WinZip Evaluation Version eclipse SDK 3 1 win3 zip File Actions Options Help View Checkout Wizard Modified Ratio Packed Path 6 27 2005 3 13PM 1 402 943 5 1 328 eclipselplug Executable 6 27 2005 3 13 PM 428 451 1195 380 715 ecipseilug pdebuild jar Executable J 6 27 2005 3 06 PM 230 330 6 217 015 eclipseiplug pdebuild ant jar Executable J 6 27 2005 3 06 PM 27 816 10 24 982 ecipsetplug Fragment xml MIL Document 6 27 2005 3 06 PM 325 36 207 edlipselplua plugin xml MIL Document 6 27 2005 3 06 PM 257 3095 180 eclipseiplua Manifest mf MF File 6 27 2005 3 06 PM 243 33 162 ecipseiplug Fragment xml ML Document 6 27 2005 3 06 PM 106 28 134 eclipselpl
72. 4 Ox400004F4 Hex gt 3 Ox400004F4 Ox400004F4 lt 45CIT gt l o 400004F0 DO 68 400004F0 o o ap e R 40000500 53 70 61 69 bE oo oo 40000500 3 p a i n O O O O 40000510 0S oo oo oo 16 as ad 40000510 O O O O O O O E F 40000520 68 61 bE 20 61 0 73 40000520 h a n a 8 p e 40000530 75 Bc Bc 65 74 oo oo 40000530 u 1 1 e t O O O O 40000540 05 oo oo oo 01 ad oo 40000540 O O O O O O O O O 40000554 oOo ad oo oo n oo ad 3 40000550 rn O O O O O O O O 7 40000564 oO oo oo oo EU E1 FF ua 40000560 O O O O y O Oo 4000054 OO au oo od 78 EC FF 40000570 O O O O x i V O x 40000550 oO oo oo oo EU E1 FF 40000580 O O O O b O O 40000594 oO oo oo oo 75 EC FF 40000590 rn O O O x i Y O x 400005140 oO oo au od EU E1 FF 40000580 O O O O y O O 40000580 0 oo oo od 78 EC FF 40000580 O O O O x i y O x 4o0000s5co oO oo oo oo EU E1 FF 400005 coO O O O O b O O 4nnnnsnn nn nnn nn nn 7A rr FF Jas 4nnnnsnn m r1 r1 ni v i m y uM 4 ii gt 4 m gt Click on the Link Memory Rendering Panes TER button This means that scrolling one memory rendering will automatically scroll the other one in synchronism Click on the Toggle Memory Monitors Pane gt button This will expand the display erasing the memory monitors list on the left Console BUG STET i r1 ile sti E A poser emarvy Renderings Bx Memory Renderings Ox400004F4 Ox400004F4 zHex Ox400004F4 Ox400004F4 ASCII gt i EEE ENS E EA E
73. 919 co 10738 un lr 107374 Wu pe 10737 su FO 0 nu Fl O nu fe 0 tit Fa O nu P4 0 til fo O iu Fo 0 nu P7 0 tial fps 0 191 cosr 536871120 x Display As Arrav Restore Original Type Find Variable Ctrl F e Change value Add Register Group Restore Default Register Groups Format i Watch ES Debug S Resource Hj cic a w Natural Hexadecimal Now the register display shows r4 in hexadecimal format por rO 110 EE 1010 0 ju 1010 p gt 85 ae 1010 F3 a r4 UxFFFFFFFFeDO2cODO sopal ro 2147482932 Mui 16 1073742120 ae HH FF U spa r8 1658272053 Mui r9 1109953485 7 Of course the right click menu lets you change the value of any register For example to change r7 from zero to Ox1F8 just select the register right click and select Change Value Ei 35 Debug Resource Hi ci c 4 Variables Breakpoints Expressions Modules MM Registers Di sianals Em Main Wu FO 110 l EM HHH ri i c 4 F2 85 i TEMA H r3 1 Wu r4 OxfffffffFenn2coon Wu r5 2147482932 MM r amp 1073742120 TID ET MM r8 1656272053 MM r9 1109953485 JM rio 2105601601 MM p11 1073805976 MI p12 1073805964 MM sp 1073805964 00 Ir 1073742792 AMM pc 1073742832 e 1010 FE Gj iu 1010 Fy Gj d 1010 Fo 0 bel 1010 fg 0 2 1010 Fa 9 1010 F5 Eu lola F 0 1010 FF 0
74. ARM Cross Development with Eclipse Version 2 By James P Lynch oeptember 10 2005 Preface to Version 2 When developed this tutorial in June 2005 Eclipse was at release 3 0 2 and the CDT C Development Toolkit was at version 2 1 1 Preview versions of the next releases of these components were available at that time but prefer to stick with official releases in my tutorials for beginners Also the Eclipse debugger worked well when the application was targeted for a PC platform but it was nearly useless in a remote debugging environment where the target is for example an ARM microprocessor connected through a JTAG interface A Norwegian company Zylin developed a custom version of CDT that modified the debugger for proper operation in a remote debugging environment found the Zylin version that downloaded in June 2005 to be a bit unreliable and fairly easy to lock up For that reason wrote the original tutorial with the classic Redhat Insight debugger as the principal debugging agent it s simple and reliable In just two months Eclipse has released Version 3 1 and CDT released Version 3 0 as a companion edition to the new Eclipse release Zylin also updated their custom version of CDT 3 0 an effort done with the cooperation of the Eclipse CDT team tested the new Zylin CDT 3 0 release and found that the remote debugging feature now works fairly well Therefore it seemed to be a good idea to republish the A
75. CPU in undefined mode mov sp r0 stack pointer for UND mode is 0x40000FEDC sub r0 r0 ZUND STACK SIZE Register RO is now Ox4000FED8 Now we put the ARM into Abort mode by setting the MODE ABT bit in the CPSR As mentioned above abort mode has its own private copies of R13 and R14 We now set the abort mode stack pointer to Ox4000FED8 Again by subtracting the abort stack size from RO we re limiting the stack for ABT mode to just 4 bytes msr CPSR c ZMODE ABT BIT F BIT this puts CPU in Abort mode mov sp r0 stack pointer for ABT mode is 0x4000FED8 sub r0 r0 ZABT STACK SIZE Register RO is now 0x4000FEDA Now we put the ARM into FIQ fast interrupt mode by setting the MODE FIQ bit in the CPSR As mentioned above FIQ mode has its own private copies of R14 through R8 We now set the abort mode stack pointer to Ox4000FED4 Again by subtracting the abort stack size from RO we re limiting the stack for FIQ mode to just 4 bytes We re not planning to support FIQ interrupts in this example msr CPSR c ZMODE FIQ L BIT F BIT this puts CPU in FIQ mode mov sp rd stack pointer for FIQ mode is 0x4000FED4 sub r0 r0 FIQ STACK SIZE Register RO is now 0x4000FEDO Now we put the ARM into IRQ normal interrupt mode by setting the MODE_IRQ bit in the CPSR As mentioned above IRQ mode has its own private copies of R13 and R14 We now set the IRQ mode stack pointer to 0Ox4000FDEO Again by subtracting the IRQ s
76. Click on Project Clean and fill out the Clean dialog window BEE B Y A ES Resource Resource main c cclipse Plau vm File Edit Navigate N Project Window Help ei x E rr cient Close Project Uum ts Navigator El b md S crt s makefile main c 3 h a n NL iui Build All Ctrl B e arm E A a m E zl l By 9 v Function declarations y EFE AAA AAA a E demo2106_blink_Flash 3 edtpraject E project Clean n s crk s oid F 3 demoz106_blink_Fl E an Ipc210xh a Clean will discard all build problems and built states The next time a build E main c void IRQ Routine void att V occurs the projects will be rebuilt From scratch E makefile void FIO Routine void att M IH U a E Et demo2106 blink ram void SUI Routine void atg Clean all projects Clean prajects selected below void UNDEF Routine void att C li E ml demo2106_ blink Flash KONCRONCKCACECKCHCHCKCECKCKCKCKCHCKCKCHCHCKCHCACAKCKCA ON OW Header files i demotie Di nk ram woche c v a Hinclude LPC lt 10x h KORCKCACKChCh ARA kh h hok ch ch h ch hc h ch h ho ho ho Global Varia wc c a a C C TTT PTT a int aq i gloy int Es ff glog int z f glog short h 23 ff glog short i 3 fo lok char j 6 fo glog Start a build immediately Build demaz106 blink Flash make k clean rm crt lst main
77. Debug a Debug x Afi variables 23 S Breakpoints tj E 0 xXx a Try Ipcz 10x h La makefile Le main c s Y int main roid i unsigned int static int static char static int ef di bets static un static un 1 static in fo static initia 0x04 static in Yr fo static in pText The Rain in Spain static long x static char static int const char Moo 13 A dg n ff Initialize the system Initialize tl set io pins for led FO 7 IODIR Ox00000060 ff pin PO Y is a output everything Ml lll E Console xm Tasks EL E A mEE rmrm E OCDRemote Program C ycygwin usrilocalbinjocdremote exe When everything works the GDB Debugger communicates using the GDB Serial Protocol to an internet socket called localhost 8888 we specified this in our Embedded Debug Launch Configuration the command tab The Macraigor OCDRemote DLL intercepts the GDB Serial Protocol via the internet Socket and converts it into JTAG signals on the LPT1 printer port connector The Wiggler device merely translates the JTAG signals to 3 3 volts for use with the Philips LPC2106 microprocessor Here is an example of OCDRemote failing Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help c lm _w O Q S elh B ee o on ESS dl e b E a Variables 53 s Breakpoints t sts E g E de vmm B Ipc210x h L makefile 8 main c 2 Y
78. E TO THE PHILIPS ARM 7 BASED MICROCONTROLLERS An Engineers Introduction To The LPCz100 Series Trevor Martin BSc hons CEng MIEE www hitex co uk arm You can download this e book for free from the Hitex web site http www hitex co uk arm lpc2000book index html There is a controversial section in Chapter 2 with benchmarks showing that the GNU toolset is 4 times slower in execution performance and 3 5 times larger in code size than other professional compiler suites for the ARM microprocessors Already Mr Martin has been challenged about these benchmarks on the internet message boards see The Dhrystone benchmark the LPC2106 and GNU GCC at this web address http www compuphase com dhrystone htm Well we can t fault Trevor Martin for tooting his own horn In any case Martin s book is a magnificent work and it would behoove you to download and spend a couple hours reading it I ve used Hitex tools professionally and can vouch for their quality and value Read his book Better yet it s required reading 2 Installing the Necessary Components To set up an ARM cross development environment using Eclipse you need to download and install several components The required parts of the Eclipse ARM cross development system are 1 2 SUN Java Runtime Eclipse IDE Eclipse CDT Plug in for C C Development Zylin custom version CYGWIN GNU C C Compiler and Toolset for Windows GNUARM GNU C C Compiler for ARM Targ
79. El outline fe Disassembly 8 5 int main void 5 unsigned int static int static char e li DE ff static un f static un ial static long x static char Static int static initia x 4 static in UN static in pText The Rain in Spain j a d static int W 1 fo static in 5 Y z const char ff Initialize the system Initializei l set io pins for led PO0 7 IOPIR Oxooooo08o ff pin PO is an output everything EN 4 TIT gt E Console Pi Tasks dg Ex EE pE rj GU zterminatedz OCDRemote Program CE cvgwintustilocalbinocdremote exe DOCcDemon InitializetTarget Error Cable Disconnected If you have trouble getting OCDremote to start try these remedies e You may have accidentally started multiple copies of OCDremote Bring up the Windows Task Manager ctrl alt del and search the list of running tasks If there are multiples of ocdremote exe terminate all of them and start over e Keep trying I ve clicked it ten times before it started this is simply Voodoo e Goto bed let it win tonight E Start the Debugger Our Debug Configuration has been defined and we ve switched to the Debug perspective We started the OCDRemote utility and verified that it s working Now is the time to start the debugger Since the Embedded Debug Launch configuration demo2106 blink ram was the last configuration accessed above clicking on the Bug button will suffice If
80. Environment E Common Q Mew configuration Location ge IE qi Cicvgwiniusrilocalbinacdremate exe eO Browse File System variables Working Directory Browse Workspace Browse File System variables CORMYTOMI S paa888 dwIGGLER al 57 variables Note Enclose an argument containing spaces using double quotes ii gt S Lm Run Just like the Philips LPC2000 Flash Utility we d like to include the OCDremote application in our list of favorite External Tools This allows us to quickly start the OCDremote JTAG server from within Eclipse Click on Run External Tools Organize Favorites C C C Eclipse Platform SE File Edit Mavigate Search Pr Run Windpw Help ry E i BN CYP ast Launched Ctrl F 11 i ES 2 ES Fey cic Au B Mis Debug Last Launched F11 CONS DA E e Run History Run s demaozin6 amp blink Flash n outline is not available H S demoz2106 blink ram Fun Debug History Debug s Denia D aM E ri B lt terminated gt C Program Files SNUGRM Bina Now click on Add in the Organize External Tools window and follow that by checking OCDremote in the Add External Tools Configurations window Click on OK to add the OCDremote to the list of favorites Add External Tools Favorites Organize External Tools Select Launch Configurations a New configuratio
81. FFFFF134 xFFFFFi38 gt gt BxFFFFF13C BxFFFFF2B8H xFFFFF204 gt gt BxFFFFF2B8 gt gt xFFFFF20C gt gt BxFFFFF21H BxFFFFFE214 gt hd La w 9 v TN idt db dk db dE db dk db dk db dk db dk dp dk dE dk dp dk dp dk dE dk dp db dE db 4E dE dX ESE _LPC210xH EXTINT 3 EXTWAKE IPC I2ADR IPC I2CONCLR IPC I2CONSET IPC I DAT IPC I 5CLH IPC I25CLL IPC I 5TAT IOCLR IODIR IOPIM IOSET MAMER MAMMAP MAMTIM T r a POMP PINSELO PIMSEL1 PLLCFts PLLCONM PLLFEED PLLSTAT Pw COR Pw CRO PW CRI PWwM CR PWwM CR3 Pw EIPMP Pw IR F4 13 Description of the Startup File CRT S Now let s look on the startup assembler file crt s Double click on it This part of the crt s file has some symbols set to the various stack sizes and mode bits Resource crt s Eclipse Platform File Edit Navigate Search Project Run Window Help r iG 8 Q 1 S S Navigator 23 E ye dotokokok ck ck ck oko ok koh koh ok ok ok ok ok ok ko ko book ko d d n ko o o d o o d d ok d o d d d d n oo o d o n d n n d d t t d e kk n n d d t t d d d n n RE n d t t t RA 2 15 demo2106 blink Flash B cdtproject crt s STARTUP ASSEMBLY CODE x project 2 crt lst B crt o s crt s Module includes the interrupt vectors and start up code F demo2106 blink Flash cmd e Ipc210x h LLL f c c c c f c c df f f f ff RA f f ff fff f f f RANA dc C main c main dmp Stack Sizes
82. G Solving Fcco 53236800 2 P P 2 trial value Fcco 53236800 2 2 FccO 212947200 hz good choice for P since it s within the 156 mhz to 320 mhz range From Table 19 page 48 of Philips LPC2106 manual P z 2 PLLCFG bits 5 6 1 assign 1 to these bits Finally PLLCFG 20 01 00011 0x23 Final note to load PLLCFG register we must use the 0xAA followed 0x55 write sequence to the PLLFEED register this is done in the short function feed below With the math completed we can set the Phase Locked Loop Configuration Register PLLCFG Setting Multiplier and Divider values PLLCFG 0x23 feed To set values into the PLLCON and PLLCFG registers you have to write a two byte sequence to the PLLFEED register PLLFEED OxAA PLLFEED 0x55 This sequence is coded in a short function feed The net effect of the above setup is to run the ARM CPU at 53 2 Mhz Next we fully enable the Memory Accelerator module and set the Flash memory to run at 1 4 the clock speed Now you see why some people prefer to execute out of RAM where it s much faster Enabling MAM and setting number of clocks used for Flash memory fetch 4 cclks in this case MAMCR 0x2 MAMTIM 0x4 The clock speed of the peripherals is also run at 53 2 Mhz which is the full clock speed Setting peripheral Clock pclk to System Clock cclk VPBDIV 0x1 In the final snippet of the main code you can see the dummy interrupt service rou
83. Google E E HP EE E MSI E G InstallShield Installatioi EE A Internet Explorer EE E iPod E lO iTunes E IC Java C3 LPC2106 ISP i Meccenner Now that the Philips LPC2000 Flash Utility is properly installed on our computer we d like to install it into Eclipse so that it can be invoked from the RUN pull down menu under the external tools option Start Eclipse by clicking on the desktop icon Eclipse 3 1 The layout of the Eclipse screen is called a perspective The default perspective is the resource perspective as shown below Resource Eclipse Platform File Edit Navigate Search Project Run Window Help lIm Hel ar l e s D r BUTTER SO We need to change it into the C C perspective In the Window pull down menu select Window Open Perspective Other C C and then click OK Select Perspective x Be C C BE C C Browsing CVS Repository Exploring F Debug amp Java iJ Java Browsing fel Java Type Hierarchy Plug in Development Resource default amp Team Synchronizing Eclipse will now switch to the C C perspective shown below and will remember it when you exit C C Eclipse Platform File Edit Navigate Search Project Run Window ie r uo e dBIe 0 l PULS An outline is not available El Problems 8 Console Propertes KH 7H 0 errors O warnings D infos Description Resource Now we want to add the Philips LPC2000 Flash Utility to the
84. O OO OO 00 00 00 00 00 00 OO H4000 0100 o0 00 00 OO OO OO 00 00 OO OO 00 DO OO DO DU LLL ee ee eee ee amp H4000 0110 00 OO 00 OO OO 00 00 00 00 00 00 H 00 H4000 01 20 DO 00 00 OW OO OO OO 00 00 OO OO 00 00 OO 00 00 LL ee ee ee eee H4000 0730 Oo OO 00 OW OO OO 00 00 o0 OO OO 00 00 HE DE no cee ee ew re vo amp H 4000 0140 00 OO OO OO OO OO OO 00 OO OO 00 OO DD OO amp H 4000 0150 00 OO OO OO OO OO OO 00 00 00 00 00 0 00 DD H4000 0760 Oo 00 00 OW OO OO OO 00 00 00 OO 00 D OO OO DU LL Lee eee eee eee amp H 4000 0170 00 OO OO OO OO OO OO 00 00 00 00 00 00 H4000 0180 Oo 00 OO OW OOo OO OO 00 00 OO OO 00 D DD OO DD LL Le eee eee ee eee amp H 4000 0190 00 o0 o OO 50 00 00 00 00 00 00 H 00 44000 0140 00 OO OO OO OO OO OO 00 A 00 BG 00 0 D0 D0 H4000 0160 o0 00 OO OW OOo OO OO 00 00 00 OO 00 00 OO OO DD LL Lee eee ee ee eee H4000 OICO 0 0 4 00 00 00 00 00 00 00 00 00 OD H4000 0160 OO OO OO OO OO OO OO 00 O 00 GG OQ 00 D0 H4000 TET Dy 00 00 OW OO OO OO 00 o0 00 OO OU 00 DD OO DU LL Lee eee ee ee eee amp H 4000 01FO 00 OO OO OO OO OO OO OO 00 00 00 00 Load Hes File Download HM Save Hex File Fill Buffer
85. RM Cross Development with Eclipse tutorial with the new Eclipse and Zylin CDT components The original tutorial is still usable Eclipse and CDT will always have their legacy versions archived You will have to browse their web sites to find them 1 Introduction credit my interest in science and electronics to science fiction movies in the fifties Robbie the Robot in the movie Forbidden Planet especially enthralled me and watched every episode of Rocky Jones Space Ranger on television In high school built a robot and even received a ham radio operator license at age 13 Electronic kits were popular then and built many Heath kits and Knight kits everything from ham radio gear to televisions personal computers and robots These kits not only saved money at the time but the extensive instruction manuals taught the basics of electronics Unfortunately surface mount technology and pick and place machines obliterated any cost advantage to building it yourself and Heath and Allied Radio all dropped out of the kit business What of our children today They have home computers to play with don t they Do you learn anything by playing a Star Wars game or downloading music think not while these pastimes may be fun they are certainly not intellectually creative A couple years ago there were 5 billion microcomputer chips manufactured planet wide Only 300 million of these went into desktop computers The rest went into t
86. Rowley CrossWorks recommended by Olimex is 904 00 clearly out of the range for the student or hobby experimenter l ve seen other packages going up as high as 3000 A professional would not bat an eyelash about paying this time is money There is a low cost alternative to the high priced professional software development packages the GNU toolset GNU is the cornerstone of the open source software movement It was used to build the LINUX operating system The GNU Toolset includes compilers linkers utilities for all the major microprocessor platforms including the ARM architecture The GNU toolset is free The editor of choice these days is the Eclipse open source Integrated Development Environment IDE By adding the CDT plugin C C Development Toolkit you can edit and build C programs using the GNU compiler toolkit Eclipse is also free Philips provides a Windows flash programming utility that allows you to transfer the hex file created by the GNU compiler linker into the onboard flash EPROM on the LPC2106 microprocessor chip The Philips tool is also free Macraigor has made available a free Windows utility called OCDremote that allows the Eclipse GDB GNU Debugger to access the Philips LPC2106 microprocessor via the JTAG port using an expensive device called the wiggler The Norwegian company Zylin has created a custom version of CDT that enables the debugger to work better with cross development applications however it s o
87. Setup x m Welcome to the LPC2O00 Flash Utility installation program ia Setup cannot install system Files or update shared Files if they are in use Before proceeding we recommend that you close any applications you may be running Take the default on this screen below and let it install the LPC2000 Flash Utility into the Program Files directory 2 LPC2000 Flash Utility Setup Begin the installation fw clicking the button below C Program Files LPC2106 ISP Change Directory Exit Setup In a very few seconds the installer will complete and you should see this screen LPC2000 Flash Utility Setup E LPE2000 Flash Utility Setup was completed successfully Here we see the utility residing in the Program Files directory just as promised LPC2106 ISP File Edit View Favorites Tools Help pack l d JO Search Wey Folders BERN X 3 X Address D Program Files LPC2106 ISP Folders x Name 4 Size Type Date Modified girc2ins ISP 515 KB Application 3 17 2004 10 28 AM Program Files Lad E c Prag Sl E ST amp UNST SEB TextDocument 7 11 2004 1 55 AM EE 5 321Studios IC Adaptec E lO Adobe E E Almas el America Online 7 0 Bl America Online 8 0 El America Online 8 0a EE E 40D E i amp OL Companion e lO Applied Insights E lA ATI Multimedia e E ATI Technologies E Ej Autodesk EE c AWS e i Common Files 9 ComPlus Applications 9 Futuris Imager E L3 Gemstar EE Ez GNUARM
88. TS for Heset and p 85 m LPE2106 Read Part D r ga Device ID Boot Loader ID Selection Now click on Upload to Flash to start the download The Philips ISP Flash Utility will now ask you to reset the target system This is the tiny RST button near the CPU chip LPC2000 Flash Utility Reset Message Ed Please reset your LPC2000 board now and then press OK The download will now proceed youll see a blue progress bar at the bottom and then the status line will say File Upload Successfully Completed E LPC2000 Flash Utility File Buffer Help DHILIDS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Fart Jworkspace demo2106_blink_flash main hex AN f Entire Device com Selected Sectors Use Baud Rate F Execute Code id F after Upload Start Sector Em 13200 Erase E Manual Reset tee zie See i Time Out sec z Use DTR RTS Device for Reset and LPC21 DE Read Fart ip E pace ATAL Freg kHz 14746 Device ID Boot Loader ip selection File Upload Successfully Completed Remove the BSL boot strap loader jumper and hit the RST button r B OLIMEX LTD MOE eje COPYRIGHT C 2883 Your application should start up and the LED will start blinking To prove that am as honest as the sky is blue here it is blinking away terr lll Him Ih I A a D D D I a FI Torn ee o de fe n pe Bo De I DP a magumuUUOUUUDDDD
89. The list offers files for different platforms please be sure to select the proper file s for your platform Carefully review the files listed below to selectthe ones you want then click the link s to download If you don t complete your download you may return to the Download Center anytime sign in then click the Download Order History link on the left to continue How long will it take t1 Download problems or Questions See the Sun Download Center FAQ J2SE TM Runtime Environment 5 0 Update 2 Click below to download Offline Lies Multi nee jre 1 5 0 IE ee Lees p exe 15 25 MB amp Linux Platform Linux self extracting file jre 1 5 0 02 linux i585 bin 15 78 MB E Solaris SPARC Platform Solaris SPARC 32 bit self extracting file jre 1 5 0 02 solaris sparc sh 19 45 MB amp amp Solaris SPARC 64 bit self extracting file jre 1_5_0_02 solaris sparcv9 sh 8 33 MB amp Solaris x86 self extracting file jre 1_5_0_02 solaris i586 sh 14 44 MB Solaris AMD64 self extracting file jre 1 5 0 02 solaris amd64 sh 4 72 MB E Linux AMD64 RPM in self extracting file jre 1 5 0 02 linux amdB4 rpm bin 14 91 MB 3 Linux AMD64 self extracting file jre 1 5 0 02 linx amdB4 bin 15 41 MB amp Linux RPM in self extracting file jre 1 5 0 02 linux i586 rpm bin 15 27 MB amp For Customer Service e mail SDLC EXT sun com Here s a blow up of the line we must click on We select online so we can install
90. U toolset properly you can forget that the GNU compiler system is Linux based Normally the Cygwin installation gives you a compiler toolset whose target architecture is the Windows Intel PC It does not include a compiler toolset for the ARM microprocessors the MIPS microprocessors and so forth It is possible to build a compiler toolset for the ARM processors using the generic Cygwin GNU toolkit In his book Embedded System Design on a Shoestring Lewin A R W Edwards gives detailed instructions on just how to do that Fortunately there are quite a few pre built tool chains on the internet that simplify the process One such tool chain is GNUARM which gives you a complete set of ARM compilers assemblers and linkers This will be done in the next section of this tutorial It s worth mentioning that the GNUARM tool chain doesn t include the crucial MAKE utility it s in the Cygwin tool kit we re about to install This is why you have to add two path specifications to your Windows environment one for the c cygwin bin folder and one for the c programfiles gnuarm bin The Cygwin site that has the GNU toolset for Windows is www cyqwin com The Cygwin web site opens as follows A Cygwin Information and Installation Microsoft Internet Explorer File Edit View Favorites Tools Help Q ax E e x i2 P Search p Favorites E A x Lg y e t Address Es uec Cygwin Home Cymgwin X Home Red Hat Cygwin Product Commuti
91. UI B SD D ECL 03 03 0202 DE E DP DE E3 T II De pepe o o oe eo Im LEFT p gp pepelege oo pegeo qe De Ho Dodo yl Nello HORNN j 0000 j Haai I oO oa e e ee LE E E E 1 Lada a eae E et a se ee ee IE E y Ej TT M Y i E A i a E E T i a ap e OR d d a a UA ES ETE T715 OK admit it this photo has the reliability of a Bigfoot video 20 Create a New Project to Run the Code in RAM Now we will create a new project that will run the blinker code in RAM Only minor modifications to three files are required We will show how to run the application using the Philips ISP flash utility Later we ll show how to use this very same RAM based application with the Eclipse CDT debugger and a Wiggler JTAG interface Using the techniques previously discussed create a new project named demo2106_ blink ram New Project C Make Project Create a New C Project using make to build it Project name demo 106_blink_ ram Project contents jw Use default Directory Ci eclipse workspace demo 106_blink_rarm switch to the C C Perspective and you will see that there are now two projects although the new one contains no files C C Eclipse Platform File Edit Navigate Search Project Run Window Help Te B je 635 d G 3 O Q i 9 re ES Rdcice Of FRA os E amp 4n outline is nol available 1 15 demo2106 blink Flash us demo2106 blink ram
92. ables directory to the PATH variable is checked This is crucial a Setup GNUARM Completing the GNUARM Setup Wizard Setup has finished installing GNUAR M on your computer The application may be launched by selecting the installed icons Click Finish to exit Setup Add the executables directory to the PATH variable a CET This completes the installation of the compiler suites Since Eclipse will call these components via the make file you won t have to think about it again It s worth mentioning that the GNUARM web site has a nice Yahoo user group with other users posing and answering questions about GNUARM Pay them a visit The GNUARM web site also has links to all the ARM documentation you ll ever need 8 Installing the Philips LPC2000 Flash Utility into Eclipse The Philips LPC2000 Flash Utility allows downloading of hex files from the COM port of the desktop computer to the Olimex LPC P2106 board s flash or RAM memory We need to download the latest version of this program from the Philips web site and unzip and install it into the program files directory Then we will start Eclipse and add the LPC2000 Flash Utility as an external tool to be invoked Click on the following link to access the Philips LPC2106 web page www semiconductors philips com pip LPC2106 html The following web page for the LPC2106 should open PHILIPS YOUR COUNTRY T P PHILIPS SEMICONDUCTORS News Center Markets Key Techno
93. aguag sirinjejejatejejepere a 1 ms T a No need to unplug the serial cable mE D UDDDDDDPpopbppbDbp E BDBDDDDDDDODr ESA a SPL A Sa E e ejajejejejererv anano i cii wIerejerejejejeje wIepejejejojereie mierejejejejere e eiejejeajere g ddan jejejejejeje eJofojefejaje ejojojefefjefej elelefelerere dungdug s efe e er i a a T Sos Tas Wm We meom o m 4 me i te P m iy LAS Power plug from 9 volt wall wart ga GRO SE wi power supply LUE A ee EEEE erejejelejelelele ODOC ORC Re Red stripe on ribbon cable must be next to Debug JTAG jumper and the power plug The Debug JTAG jumper MUST be installed Power up the Olimex LPC P2106 board and press the RST button for good luck B Final Preparations Before Starting Eclipse Debugger Before we start the Eclipse Graphical Debugger should mention that debuggers absolutely hate compiler optimization This one is no different We have been compiling with O3 and you will find some strange things happening when you single step at that optimization level Just to be sure let s turn off optimization Go to the makefile and change the setting to OO0 and rebuild File makefile mak NAME demozi Ub5 blink ram CU arm elt qee LD arm elf ld w AR arm elf ar AS arm eli as CP arm elf objcopy OD arm elf objdump CFLAGS I c n0 c
94. akefile Le maine 33 E static int z ts ff static initialized variable EN const char tpText The Rain in Spain ff Initialize the system Initializeli fo set io pins for led PU IODIR OxOO000080 ff pin PO 7 is an output everything else is input atte IOSET OxO0000080 led aff y IOCLR x 000080 f led on E endless loop to toggle the red LED PO 7 while i1 for 3 0 3 lt 5000000 j wait 500 msec da IOSET OxoO0000080 ff red led off for 3 O 3 lt 5000000 j 1 wait 500 msec IOCLR oOxoo000080 red led on h I PERRA NARRAR EERE EERE ATER EATER EERE EATER EEA EEA EEA EEA EERE A WoW yt jili gt Since this is a RAM application and breakpoints are software breakpoints there can be a nearly unlimited number of breakpoints set The breakpoints can be more complex For example to ignore the breakpoint 5 times and then stop right click on the breakpoint symbol on the far left This brings up the pop up menu below and click on Breakpoint Properties for 13 0 3 lt 5000000 j Toggle Breakpoint Disable Breakpoint Breakpoint Properties 0000 j Run As Debug As Team Compare With Replace With r wc F F F rrr irr rcr rrr rcr r n Add Bookmark r Add Task EON wv Show Quick DiFF CEri 5hiFE In the Properties for C C breakpoint windo
95. anguage BDE Administrator Intel R Extrem Network Connections id System System Restore Automatic Updates General Computer Name Hardware System Microsoft Windows lt P Home Edition Version 2002 Service Pack 2 A a 0 Registered to Jim Lynch Manufactured and supported by DAL Dell Dimension DIM3000 Intel R Pentium R 4 CPU 2 80G Hz 2 79 GHz 512 MB of RAM Support Information 76477 DEM 0011903 00102 Apply Now click on the Environment Variables button System Properties System Restore Automatic Updates General Computer Mame Hardware Advanced rou must be logged on as an Administrator to make most of these changes Performance Visual effects processor scheduling memory usage and virtual memory Settings User Profiles Desktop settings related to pour logon Settings Startup and Recovery System startup system Failure and debugging information Settings Environment Variables Error Reporting Apply In the Environment Variables window find the line for Path in the System Variables box on the bottom click to select and highlight it and then click on Edit Environment Variables User variables Far Jim Lynch Variable Value TEMP Ci Documents and Settings Jim Lynch TMF C Documents and Settings Jim Lynch System variables variable PUMBER_ OF P ccyqwinibinic program Filesanua
96. appears next is a list of download mirror sites that host the Eclipse components selected the University of Buffalo in my home town and where got my Master s degree eclipse eclipse downloads Your preferred mirror appears to have this file eclipse SDK 3 0 2 winsz zip United States United States University of Buffalo CSE Department Please select a mirror for this file eclipse S0K 3 0 2 wins zip Africa south Africa University of Stellenbosch Asia Japan Japan Advanced Institute of Science and Technology Korea Republic Of Areum Australia Oceania Australia Pacific Internet North America Canada Groupe d utilisateurs de Linux de lides Canada Reachable ca United States Calvin College ftp states University of Buffalo CSE Department Em mA INDE United States VVWIVy VVEB inc South America Brazil EclipsegiRio PUC Rio Main Download Site Canada Main eclipse org downloads area When the mirror site starts the download process you have to select a destination directory to place the Eclipse zip file In my case created an empty C scratch directory on one of my hard drives you could use any other drive as well First click on Save below File Download Do you want to open or save this file Mame ecipse 5Dk 3 1 win32 zip Type Compressed zipped Folder 103 MB From Fkp cse buffalo edu EUN NEIN 8 773 Always ask before opening
97. ard with the LPC2000 microcontroller chips placed on modern surface mount boards ready to use Olimex and New Micros have a nice catalog of inexpensive boards using the Philips ARM family wrote a similar tutorial for the New Micros TiniARM nine months ago and you can see it on their web site WWW newmicros com Olimex an up and coming electronics company in Bulgaria offers a family of Philips LPC2100 boards Specifically they offer three versions with the LPC2106 CPU You can buy these from Spark Fun Electronics in Colorado their web site is www sparkfun com The Olimex boards are also carried by Microcontroller Pros in California their web site is www microcontrollershop com This is the Olimex LPC H2106 header board You can literally solder this tiny board onto Radio Shack perfboard attach a power supply and serial cable and start programming It costs about 49 95 Obviously it requires some soldering to get started This is the Olimex LPC P2106 prototype board Everything is done for you There s a power connector for a wall wart power supply a DB 9 serial connector and a JTAG port It costs about 59 95 plus 2 95 for the wall wart power supply This is the Olimex LPT MT development board it has everything the prototype board above includes plus a LCD display and four pushbuttons to experiment with It costs about 79 95 plus 2 95 for the wall wart power supply For starting out would recommend the LPC P2106 prototy
98. ava Products and Technologies Technical Topics Developers Home gt Products amp Technologies Java Technology J25E Core Java J25E 5 0 JZSE 5 0 Download Java 2 Platform Standard Edition 5 0 E Downloads Confused or having trouble downloading or installing See the download help page Reference Supported System Configurations API Specifications Documentation Compatibility NetBeans IDE JDK 5 0 Update 3 Community I cx netBeans Farums This distribution af the J25SE Development Kit JOK includes NetBeans IDE which is a powerful integrated development envirar Learning platform tore infa Tutorials amp Code Camps Download JDK 5 0 Update 3 with NetBeans 4 1 Bundle Online Sessions amp Courses Instructor Led Courses Course Certification JDK 5 0 Update 3 The JZ5E Development Kit JDK supports creating J25E applications Mare info Download JDK 5 0 Update 3 Installation Instructions ReadMe ReleaseNotes sun License Third Party Licenses JRE 5 0 Update 3 The JZ5E Runtime Environment JRE allows end users to run ava Installation Tf Ba sun poss Third Party Licenses JASE 5 0 Documentation The Sun Terms of Use screen appears first You have to accept the Sun binary code license to proceed If you develop a commercial product using the oun JAVA tools you will have to pay royalties to them developers sun com search tips Search in Developers Site v n Th
99. avigate Search Project Run Window Help 0x40000464 lt 0x40000445 lt 0x40000430 lt 0x40000344 0x400002 ca writable E 3 c 1 Pii Mi ME dc Sohal text C Code 408 bytes Ox400002c 0 Ox40000ehbe Ox 400002hb6 Ox400002h4 O0x400002 985 Text Startup Code fassembler 116 bytes Variables used hy Philips boot loader 23 bytes Do not put anything here Text Interrupt Vectors re mapped Problems El Console 3 Properties lt terminated gt LPC2000 Flash Utility Program C Program Files LPC2106 ISPAEPCZ10x ISP exe Ox 40000200 Ox400001FF Ox 40000040 Ox 40000000 writable _edata Mata Wain Initialize Insert UNDEF Routine WI Routine FIO Routine IRQ Routine feed C C demo2106 blink ram cmd Eclipse Platform File Edit Navigate Search Project Run Window Help If HSlm G E G 0 Q aVleo nf d E i Ed OxOO01FFFF oe iw i unused flash epror ES i 65472 bytes d E 0x00000040 FU Interrupt Vector Table flash Ed jt E 0x00000000 it ES it it Author James P Lynch if Ez ERE RARA ARA RARA RARA E RARA RARA RARA RARA RAR RARE RARA RARA E RARA RARA a RARA RA RARA RARA ARA aa identify the Entry Point ENTRY Reset Handler writable Insert added quite a bit of annotation above to make it very clear how the memory flash and ram is organized C C
100. button to go to that breakpoint h Ipcz10x h i makefile Boman X LL A f Wait for the PLL to lock to set frequency while PLLSTaT amp PLOCK ff Connect the PLL as the clock source PLLECOMN 0x3 3 feedi l Enabling MAM and setting number of clocks used for Flash memory fetch 4 celks in this c HA MCE xZz HA MTIM x4i Click the Step Over button c The debugger will execute one instruction h Ipez10x h amp makefile e main c 2 Y f Wait for the PLL to lack to set frequency whilei PLLST T amp PLOCE ff Connect the PLL as the clock source PLLCOON Ox3 a 4 Enabling MAM and setting number of clocks used for Flash memory fetch 4 cclks in this c MAMCR Ox 2 MiMTIM 0x4 Click the Step Into button The debugger will enter the feed function void feed voidi i PLLFEED xAA PLLFEED 0x55 ME 4 Ill Notice that the Step Out Of button is illuminated Click the Step Out Of button A The debugger will execute the remaining instructions in feed and return to just after the function call Connect the PLL as the clock source ea PLLCON x3 feed Enabling MAM and setting number of clocks used for Flash memory fetch 4 celks in this c MAMCR xZ MANTIN Ox4 L Inspecting and Modifying Variables Before proceeding on this topic let s add a couple of structured variables to the simple blinker test program After rebuilding the appl
101. cre Oxv fffe2z250 ldezl o cri5 Oxvfffez5 ldczl 0 Cris xfffezaoag cmpeas reo x frrffezSc andny EI Oxvfffez20 stcne 14 lIx 7fffe amp 529345 andr r1 Hl Initializei l fo set io pins for led PO 7 IOPDIR x 000080 pin PO is an output everything IOSET OxOO000080 ff led off IOCLE OxOO000080 led on ii E Console 32 N Tasks Memory Xx Ex Eb ae Gl Pi 7 demoz106_blink_ram Embedded debug launch Debugger Process 9 9 05 12 38 AM igdb target remote localhost 8888 qgdb load isections kezE section 1 e 1 080 total siie 2ala section data section size 24 total size 2 lt 515 ga You can see above in the console view that the debugger executed our two commands specified in the launch configuration earlier It followed that with the download of the text and data sections The downloading is very slow We specified the next to slowest speed 7 Attempting a faster speed with the Olimex wiggler will probably prove futile The debugger is idle waiting for you to issue a command F Run to Main The first move is to start the application It will stop at the main program we specified this earlier in our launch configuration setup In the Debug view click on the green arrow to start execution of the application Lr m OcCDRemote Program wal Cicyguin usr localibinocdremote exe E 3 demaozi s amp blink
102. e roid H n Ipczt x h void feed void fe 8 crt s m e main c void IRQ Routine void _ attribute iinterrupt IRQ Cel m crt o armle void FIO Routine void attribute interrupt FIQ j E main o armle void SUI Routine void attribute interrupt SWI 6 5 main out armle void UNDEF Routine void attribute interrupt UNDEF a crt Ist m LI m A demoz106_blink_ram cmd Faai a i a a a i a a ACH ACA CH CN RANA RANA RANA RARA RARA a a Ch a a ACH Ch h hok ko 7 manan Header files joie main hex main map Le makefile Problems El console ES oS Properties 4 console is not available In the Debug Launch Configuration screen below you can see the Zylin modification Note that one of the possible debug configuration types is now Embedded debug launch You will tend to create a separate Embedded debug launch configuration for every project you create it s very convenient for people who have multiple projects going on at the same time Click on the Zylin Embedded debug launch configuration and then New to get started Debug Create manage and run configurations Configurations per c C C Attach to Local Application e C C Local Application EH Perspectives T c C C Postmortem debugger 8 Eclipse Application These settings associate a perspective with Embedded debug launch launch 36 Embedded debug launch confi
103. e C project called demo2106 blink flash that will blink the board s red LED J which is I O port PO 7 This demo uses no interrupts and runs totally out of onboard flash memory It has been intentionally designed to be as simple and as straightforward as possible Click on our Eclipse desktop icon to start Eclipse Eclipse 3 0 2 Eclipse should start and present the C C perspective as shown below If not select Window Open Perspective Other C C to change to the C perspective C C Eclipse Platform Seles Fie Edit Navigate Search Project Run Window Help r1 hd lard ES F 6 l T si T Fr r O T FN r y P 7 E E Y E Hie C C Du gt mr 52 2 SL An outline iz nat available Problems E console 22 Properties Search Console To create a project select File New New Project Standard Make C Project from the File pull down menu and click Next to continue C C Eclipse Platform ie Edit Navigate Search Project Run Window Help Al shift N P Mew Praject Select a wizard Create a new C Project which uses a simple makefile Wizards a5 Java Project med Plug in Project M Managed Make C Project a Standard Make C Project H E C H E cS H E Java 3 Import H B Plug in Development 14 Export H E Simple SwiEch Workspace Open External File 1 Ipc210x h derno 106 2 main c demo2106 3 main map demoz106 4 demo2106 cmd demoz106 Exil
104. e Eclipse system capable of developing JAVA programs for the PC There are a large number of JAVA books and some really good ones showing how to develop Windows applications with JAVA using the Eclipse toolkit Eclipse itself was written entirely in JAVA and this shows you just how sophisticated a program can be developed with the Eclipse JAVA IDE However the point of this tutorial is to show how the Eclipse platform with the CDT plug ins can be used to develop embedded software in C language for the ARM microcomputers 5 Eclipse CDT Eclipse just by itself is designed to edit and debug JAVA programs To equip it to handle C and C programs you need to download the CDT C Development Toolkit plug in The CDT plug in is simply zip files that are unzipped into the Eclipse directory Unfortunately the CDT plug in from the Eclipse web site has some problems debugging applications in a cross development environment e g where the target is a circuit board with an ARM microprocessor and a JTAG interface To the rescue is the Norwegian engineering company Zylin who have developed a special custom version of CDT that properly interfaces the GDB debugger to a remote target The Zylin version of CDT was developed with the cooperation of the CDT Development Team and is essentially a copy of the latest version of CDT with the special debug modifications The open source community owes a debt of thanks to yvind Harboe and his associates at Zylin
105. e Size Tvpe Date Modified 5 capture E lsdiff 1 KB System File 5 7 2005 11 45 E 3 cygwin nx 1 279 KB Application 6 28 2004 4 45 E 3 bin Tm S4KB Application 4 5 2005 8 28 glui examples mail files 2KB File 8 15 2003 6 25 E etc mailshar SKB File a 15 2003 6 26 El lib E make 145 EB Application 5 21 2003 1 3 Ca B ll us makeinfo 190 KB Application 4 11 2005 9 45 4 E 1 var E Emp P makegeo amp KB Application 10 10 2004 7 5 This is a good time to point out the differences between Build All Build Project and Clean Build All Will execute the command make clean all It will first clean delete all object list and output files Then it will rebuild everything whether needed or not Build Project Will execute the command make all This will not clean delete anything It will only compile those source files that are out of date Clean Will execute the command make clean Will clean delete all object list and output files lt C C Eclipse Platform Fie Edit Mavigate Search Aya Run Window Help LS m 5 Ej Becc Close Project 0 Q ta i Resource m Fr Build All Ha 2 C Projects X imd 57 Build Project Build Working Set n outline is mot ramen 3 available Peg demo2106_blink_Flash Clean Build Automatically Properties Search a O Create Make Target Build Make Target Properties Idemazi amp blink Flash This is no dif
106. e Source for Java Developers Terms of Use Please indicate whether you accept or do not accept the following software license agreementis by choosing either Accept or Decline and clicking the Continue button NOTE If you do not acceptthe license agreement for a product you have chosen you will not be able to purchase or download that product LICENSE AGREEMENT J2SE TM Runtime Environment 5 0 Update 2 Download In order to obtain J2SE TM Runtime Environment 5 0 Update 2 you must agree to the software license below a Printer Friendly Page Sun Microsystems Inc Binary Code License Agreement for the JAVA 2 PLATFORM STANDARD EDITION RUNTIME ENVIRONMENT 5 0 SUN MICROSYSTEMS INC SUN IS WILLING TO LICENSE THE SOFTWARE IDENTIFIED BELOW TO YOU ONLY UPON THE CONDITION ITHAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS BINARY CODE LICENSE AGREEMENT AND SUPPLEMENTAL LICENSE TERMS COLLECTIVELY AGREEMENT PLEASE READ THE AGREEMENT CAREFULLY BY DOWNLOADING OR INSTALLING THIS SOFTWARE YoU ACCEPT THE TERMS OF THE AGREEMENT INDICATE ACCEPTANCE BY SELECTING THE ACCEPT BUTTON AT THE BOTTOM OF THE w Accept Decline One more choice to decide on we want the online installation for Windows developers sun com The Source for Java Developers Java gt search tips Search in Developers Site v m Download J2SE TM Runtime Environment 5 0 Update 2 NOTE
107. e demo2106 blink Flash a sf Ai Edefine PLOCK 0x400 15 Includes h Ipc210x h void Initialize lt void gt lt 3 feed s EEX 3 Initialize main c Setting the Phased Lock Loop lt PLL gt PLOCK a crt o armle a LPC210 main o armle we Oo feed Se main cut ermie Olimex LPC P21806 has a 14 7456 mhz crystal Initialize crt lst We d like the LPC2106 to run at 53 2368 mhz Chas to be an even multiple of crystal 9 main E demo2106 cmd According to the Philips LPC2186 manual M cclk Fosc where M PLL multiplier bits 0 4 of PLLCFG gt main hex cclk 53236888 hz main lst Fosc 14745688 hz BeBe Ap Solving M 53236888 14745688 3 6103515625 j makefile M 4 Cround up Note M 1 must be entered into bits 8 4 of PLLCFG Cassign 3 to these bits The Current Controlled Oscilator CCO gt must operate in the range 156 mhz to 328 mhz According to the Philips LPC2186 manual Fcco cclk 2 P where CCO frequency 53236866 hz PLL divisor bits 5 6 of PLLCFG gt Solving Fcco 53236888 2 P P trial value Feco 5323688080 2 2 FccA 212947266 hz good choice for P since it s within the 156 mhz to 320 mhz range From Table 19 page 48 gt of Philips LPC2166 manual P 2 PLLCFG bits 5 6 1 C assign 1 to these bits Finally PLLCFG 6 801 88811 x23 Final note to load PLLCFG register we must use the xAA followed 8x55 write sequence to the PLLFEED register this
108. e is one final and very crucial step to make before we complete our tool building We have to ensure that the Windows PATH environment variable has entries for the Cygwin toolset the GNUARM toolset and the OCDremote JTAG server These are the three paths that must be present in the Windows environment c cygwin bin c program files gnuarm bin c cygwin usr local bin To verify that these paths are present in Windows and to make changes if required start the Windows Control Panel by clicking Start Control Panel Control Panel File Edit View Favorites Tools Help Back gt JO search y Folders EEE X X eS 15 Add or emoy vi Control Panel Accessibility Add Hardware Options KR y Display Folder Options Y Intermet Keyboard Options b amp amp Phone and Portable Media Power Options Printers and Modem Devices Faxes 3 5D Scannersand Scheduled Security Sounds and Cameras Tasks Center Audio Devices User Accounts Windows Firewall G Switch to Category View Tools See Also Fonts Game Intel YY windows Update 9 Help and Support Java Mail _ b Wireless Network Set Now click on the Advanced tab below System Properties w 9 Administrative Automatic Updates ow Controllers Modem on zs Y D Mouse QuickTime wv Speech mak Lj Date and Time Intel R PROSet Wired Network Setup Wizard E Regional and
109. eakpoint Summary view shown directly below you can see all the breakpoints you have created and the right click menu lets you change the properties remove or disable any of the breakpoints etc The example below shows one conditional breakpoint that will stop on source line 64 only if the variable x is equal to 9 Se Breakpoints El os Expressions X Reo eles a Le Cuecdipseworkspaceydemozi1 6 blink ramimain c line 64 if x 9 K Single Stepping oingle stepping is the single most useful feature in any debugging environment The debug view has three buttons to support this EL E e Step Into Step Over Step Out Of Step Into Step Out Of If the cursor is at a function call this will step into the function It will stop at the first instruction inside the function If cursor is on any other line this will execute one instruction If the cursor is at a function call this will step over the function It will execute the entire function and stop on the next instruction after the function call If cursor is on any other line this will execute one instruction If the cursor is within a function this will execute the remaining instructions in the function and stop on the next instruction after the function call This button will be grayed out if cursor is not within a function As a simple example restart the debugger and set a breakpoint on a line in the Initialize function Hit the Start
110. erties E E A FEL V NES LJ lt berminated gt LPC2000 Flash Utility Program C Program FilesLPCz106 ISPALPCZ10x ISP exe writable Smart Insert Since we are not using any interrupts in this example this addition does not really matter l ve just added it for completeness you should always do this when devising a project to run in RAM After you follow the next steps and get the application to execute out of RAM you can run a little experiment and comment out the MEMMAP 0x02 line It will still run OK The reason for that is two fold First we don t use interrupts in this example Second we use the Philips ISP Flash Loader to force the CPU to start at the address of Reset Handler which is at 0x40000200 This bypasses using the HESET vector at 0x4000000 to start the application File DEMO2106 BLINK RAM CMD The entire project both code and variables is going to be loaded into RAM Therefore there are a few changes in the Linker Command Script file demo2106 blink ram cmd C C demo2106 blink ram cmd Eclipse Platform SE File Edit Navigate Search Project Run Window Help Ira TIE JL EE La M MI diua Wo WoW oW NN NU NUN NUN uwuwuwuwuwuwuwuuuuwuuuWuuuwuwuuusustnttstttn4 pe demoz2106_blink_ram cmd LINKER SCRIPT The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are to be loaded into memory code goes into FLASH variables go into RAM Any symbols
111. esktop icons and start menu entries set up Say No to both These icons allow you to bring up the BASH shell emulator like the command prompt window in Windows XP This would allow you do some Linux operations but this capability is not necessary for our purposes here Click on Finish to complete the installation Cygwin Setup Create Icons Create Icons Tell setup if you want it to create a Few icons for convenient access to the Cygwin environment Create icon on Desktop Addicon to Start Menu Now the Cygwin installation manager completes and shows the following result Cygwin Setup E Installation Complete OIE The directory c cygwin bin must be added to the Windows XP path environment variable This allows Eclipse to easily find the Make utility etc Using the Start Menu go to the Control Panel and click on the System icon Then click on the Advanced tab and select the Environment Variables icon Highlight the Path line and hit the Edit button Add the addition to the path as shown in the dialog box shown below don t forget the semicolon separator The Cygwin FAQ advises putting this path specification before all the others Edit System Variable variable value ccvgwinibin c icygwinusracalbin ye We are now finished with the CYGWIN installation It runs silently in the background and you should never have to think about it again 7 Downloading the GNUARM Compiler Suite
112. ets Philips Flash Programmer for LPC2100 Family CPUs Macraigor OCDremote for JTAG debugging 3 JAVA Runtime The Eclipse IDE was written entirely in JAVA Therefore you must have the JAVA runtime installed on your Windows computer to run Eclipse Most people already have JAVA set up in their Windows system but just in case you don t have JAVA installed here s how to do it The JAVA runtime is available free at www sun com The following screen will appear Click on Downloads Java 2 Standard Edition to continue gt amp Sun microsystems STORA G ETEK THE LEADER IN DATA MANAGEMENT Sun Microsystems Completes Acquisition of StorageTek to deliver excellent Sun s mobile service and value to our shared customers and a broad portfolio of open workstation lets products to meet your data management needs Read More you hit the road Sy 4 SUN Products Downloads Services amp Solutions Support Training Research microsystems What s New Korean NEIS SEAM Eee I Solaris 10 OS for Schools More News Shop for Products Java 2 Standard Edition Communities Solaris Service Software WERTE RE Developers Help the Servers Solaris 10 SECURE IRE System Administrators Victims of a TEA Top Downloads T x64 Products StarOffice Partners ES E Hurricane UltraSPARC IV Storage New Downloads Investors Red Cross Katrina Patches amp Updates Education Sun Store See All Take me to Communities
113. ex gt a 400004FO 40000500 40000510 40000520 40000530 40000540 40000550 40000560 40000570 40000560 40000590 40000540 40000580 400005c0 anonnsnn Now we will add a second rendering that will display the memory monitor in ASCII Click on the Toggle Split Pane button to create a second rendering pane Pick ASCII display for the new rendering Click on the Add Rendering s button to create an additional ASCII memory display ilet st i Memory X A lee 76 wg emory d die Memory Renderings da f Memory Renderings i nniFarz ee 04000044 Ox400004F4 Ox400004F4 zHex Ox400004F4 lt 0x400004F4 gt ED POR E EME 71 Memory Monitor Ox400004F4 lt 0x400004F4 gt 400004F0 oo MEA Select rendering s to create 20000500 53 70 61 63 SE 00 00 Be C nc Renderina s 40000510 05 oo oo oo 18 os oo Cl Emi 40000520 68 81 6E 20 61 20 73 igned Integer Unsigned Integer 40000530 75 6c 6C 65 74 OO o 40000540 05 ao oo oo oi oo o 40000550 oo oo oo oo 00 oo o 40000560 oo 00 oo O00 ED Ei FF 40000570 oo oo oo 00 78 EC FF 40000580 oo 00 oo oo ED Ei FF 40000590 oo oo oo oo 78 EC FF 40000540 oo 00 oo oo ED Ei FF 40000560 oo 00 oo oo 78 EC FF 40000520 OO OOo OO OO EQ El FF 4nnnnsnn nn nn nn nn 78 F FF ka O gt Console i Memory X r F3 r4 st GE E Ss f Memory A x e Memory Renderings Bx Memory Renderings x nniFnarz ie d 0x 00004f4 Ox400004F
114. execute the line You can right click the Hesume at Line choice to continue execution from that point If there are no other breakpoints set then the Blink application will start blinking continuously Le Ipc210x h La makefile Es main c x static int 1 static initialized variable EN static long x 5 ff static initialized variable static char 0x04 static initialized variable static int Te static initialized variable const char tpText The Bain in Spain ff Initialize the system Inirtializeil ff Bet io pins for led PO IODIR OxOO000080 ff pin PO is an output everything else is input atte IOSET OxOO000080 led off IOCLR OxOO000080 led on ff endless loop to toggle the red LED PO T while 1 for j Of j 5000000 j 1 wait SOO msec IOSET Ox00000080 red led off for j O0 j 5000000 j 1 wait 500 msec IOCLE OxOO0000080 red led on J Setting a Breakpoint setting a breakpoint is very simple just double click on the far left edge of the line Double clicking on the same spot will remove it for ij 0 3 lt 5000000 j 1 wait 500 msec IOSET OXO0000080 ff red led off for ij O 3 5000000 j 1 fo wait SOO msec IOCLR x a OOOOSDO0 red led on Now click on the Run Continue button in the Debug view Assuming that this is the only breakpoint set the program will execute to the breakpoint line and stop Le Ipcz10x h L m
115. fer Code Execution Address Range Fill value FF sH40000200 Selected Range Start eH 40000000 Run from Address H40000200 C Thumb ARM Entire Buffer End EH 4000FFFF LPC2000 Flash Utility Notice that the button titled Run from Address has the value amp H40000200 in it This is thanks to the ENTRY Reset Handler directive in the linker command script file The Philips boot loader will simply load 0x40000200 into the PC register and let her rip When you click on the Load Hex File button the following dialog will be presented hy Recent Documents E Desktop Mu Documents hu Computer My Network File name main Places Files of type Hes Files hex Cancel E Browse for the main hex file in the project directory and click Open The following warning is presented Since advanced the location counter past the low RAM area used by Philips it still thinks that there s code in there If had elected to make the interrupt vectors a separate section could have avoided this warning LPC2000 Flash Utility WARMING AN Code in Boot Loader RAM Area 2H40000120 amp H40O001FF or Boot Loader Stack Area Top 288 Bytes of RAM will be Ignored It will still execute OK of course since the hex file has no bytes defined for the area where we advanced the program counter past the Philips ISP low RAM usage Now click on the Upload to RAM button to load the hex file into the
116. ferent from opening up a DOS command window and typing the command in directly such as gt make clean all If you click Finish on the New Project dialog Eclipse will return to the C C Perspective Now the C C perspective shows a bona fide project in the C C projects box on the left As of now there are no source files created C C Eclipse Platform File Edit Navigate Search Project Run Window Help fdemoz106_blink_Flash Problems El Console 3 Properties Search Console ES meai m F 4n outline is nat available We can now use Eclipse CDT s import feature to copy the source files into the project Assuming that you successfully unzipped the demo2106 blink flash zip project files associated with this tutorial to an empty directory such as c scratch you should have the following source and make files in that directory scratch File Edit Back 7 J Folders Favorites Viel C Program Files f scratch 5 system downloads HE D WINDOWS aclipse e Local Disk D Tools Help M p Search liz Folders X makefile h A Tn EIX 6 BB Mame I ert demozin6 E Ipe210x E main Size 7 KE 4 KE 13 EB 4 EB 1 EB lt Tvpe 5 File Windows MT Command Script H File C File File ERK i Date Modified 5 14 2005 11 13 AM 5 12 2005 12 28 AM 5 14 2005 12 51 PM 5 14 2005 12 48 PM 513 2005 1 06 AM E Click
117. flash identify the Entry Point es d ym I cdtproject project ENTRY startup crt lst crt o crt s demo2106_blink_flash cmd specify the LPC2106 memory areas Ipc210x h main c MEMORY main dmp main hex main map main o main out flash ORIGIN QO LENGTH FLASH ROM ram isp low A ORIGIN 0x40000120 LENGTH Variables used by Philips ISP bootloader ram ORIGIN Ox40000200 LENGTH free RAM area ram isp high A ORIGIN Ox4000FFEO LENGTH variables used by Philips ISP bootloader DODD O mm E 8 8 8 eS demo2106 blink ram define a global symbol stack end stack end Ox4000FEDC Tasks E Console x2 a Y Ee BB A e oe Oo terminated Insight Program C Program Files GNUA4RM bin arm elf insight exe writable Insert First we define an entry point specifically startup as defined in the assembler function crt s ENTRY startup The Linker command script uses the following directives to lay out the physical memory MEMORY flash ORIGIN 0 LENGTH 128K FLASH ROM ram_isp_low A ORIGIN 0x40000120 LENGTH 223 variables used by Philips ISP ram ORIGIN 0x40000200 LENGTH 64992 free RAM area ram isp high A ORIGIN Ox4000FFE0 LENGTH 32 variables used by Philips ISP You might expect that we d define only a flash and a ram memory area In addition to those we ve
118. gt ram put all the above in RAM it will be cleared in the startup code ALIGN 4 advance location counter to the next 32 bit boundary bss end define a global symbol marking the end of the bss section end define a global symbol marking the end of application RAM lt Tasks El Console oN Y Y Ew BB ee B Writable Insert The first thing done within the SECTIONS command is to set the location counter The dot means right here and this sets the location counter at the beginning to 0x000000 z0 set location counter to address zero Now we create our first output section located at address 0x000000 This creates a output section named startup and it includes all sections emitted by the assembler and compiler named startup In this case there is only one such section created in crt s This startup output section is to go into FLASH at address 0x000000 Hemember that the startup section has the interrupt vectors must be placed at 0x000000 and the startup code also sets the stacks modes and copies the data and bss sections startup startup gt flash Now we can follow the vector table and assembler startup code with all code generated by the assembler and C compiler this code is normally emitted in text sections However constants and strings go into sections such as rodata and glue 7 so these are included for completeness These code bits a
119. gurations A different perspective may be associated with each supported launch mode and can optionally be opened when a configuration is launched or when an application suspends via the Debug preferences To indicate that 4 perspective should ce 1 Java Application nat be opened select Mone F JUnit Plug in Test bes Remote Java Application Debug st SWT Application Restore Defaults cue In the Main tab set the name to anything you like and the project to demo2106 blink ram was of course lazy and made the debug configuration name the same as the project Set the C C Application to main out Main out is an arm elf format file that has the executable and debug information within the file Create manage and run configurations Configurations Mame demoz106 blink ram e C C Attach to Local Application e C C Local Application i E C C Postmortem debugger Main IF Debugger BN Commands Ee Source E Common 8 Eclipse Application ar s Embedded debug launch 6 demozi 6 blink ram E Java Applet demaozi blink ram Browse I Java Application C Application Ju JUnit C main out Search Project Browse i Jo JUnit Plug in Test _Search Project Browse p Remote Java Application m SWT Application Delete Apply Revert Under the Debugger tab use the browse button to set the GDB debugger text window to c pr
120. he following lines are executed If we expand the make variables used the lines would be crt o crt s echo assembling arm elf as ahls mapcs 32 ocrt o crt s crt lst The gt crt Ist directive creates a assembler list file The assembler options being used are ahls listing control turns on high level source assembly and symbols mapcs 32 selects 32 bit ARM function calling method O crt o create an object output file named crt o The GNU linker is used to prepare the output from the assembler and C compiler for loading into Flash and RAM as shown below main out crt o main o demo2106_blink_flash cmd echo linking LD LFLAGS o main out crt o main o If the target output file main out is older than the two object files or the linker command file then the commands on the following lines are executed The Linker options being used are Map main map creates a map file T demo2106 blink flash cmd identifies the name of the linker script file Note that l ve kept this GNU makefile as simple as possible You can clearly see the assembler C compiler and linker steps They are followed by the objcopy utility that makes the hex file for the Philips ISP boot loader and an objdump operation to give a nice file of all symbols etc 17 Compiling and Linking the Sample Application OK now it s time to actually do something First let s Clean the project this gets rid of all object and list files etc
121. ication and re launching the debugger we can inspect variables once a breakpoint has been encountered fe TET TTT TTT TTP PP eo ow a Function declarations choc oh co ee o oo o oo E A oo AA AAA w void Initialize void void feedi vnid void IRO Routine void _ attribute X i iinterrupt IBEQG void FIO Routine void attribute 4 interrupti i FIo 1 void SWI Routine void attribute interrupt sWwi 1 void UNDEF Routine void attribute interrupt UNDEF I REET EET EA a AA ARANA AAA Header files THETA TTT ATTA A Aa Hinclude LPC210x h FREER hk KCN RARA AAA ck CK CM oAohck a ee Global Variables FERRERA AAA RARA RARA ARANA RARA RANA RRA RARA UU UNUS UC UU UN int a ff global uninitialized variable int pe ff global uninitialized variable int B ff global uninitialized variable short h 2 ff global initialized variable short i 3 ff global initialized variable char j 6 ff global initialized variable Struct commas i int nbytes char pBuf char buffer 32 channel i5 channel bufier 0 Faster than a speeding bullet MAIN OW OCA CA CN CR RA AAA RARA a a a CACERES CRUCE int main iwvoid i unsigned int j ff loop counter stack variable static int a b c ff static uninitialized variables static char d ff static uninitialized variables static int Ww 1 static initialized variable static long x 5 ff static initialized variable static char Y 0x04
122. iles directory Its name is LPC210x IPC exe Here s the External Tools window before editing External Tools Create manage and run configurations Please specify the location of the external tool you would like to configure Configurations Name New configuration E Ant Build 3 Q Program Q New configuration E Main Refresh P Environment EJ Common Location to Browse Workspace Browse File System Variables J Working Directory Browse Workspace Browse File System Variables Arguments Variables Note Enclose an argument containing spaces using double quotes i External Tools Create manage and run configurations Create a configuration that will run a program Configurations Mame LPcz000 Flash Utility c Ant Build Program TR T configuration El Main ES Refresh s Environment E Common Location D Program Files LPC2106 ISP PC210x ISP exe Browse Workspace Browse File System Variables Working Directory Browse Workspace Browse File System Variables Variables Mate Enclose an argument containing spaces using double quotes p Jm Apply Revert eee Run ae Close everything out and return to the Run pull down menu Select Run External Tools Organize Favorites C C Eclipse Platform File Edit Navigate Search Project MA
123. in map TdemoziD06 blink flash cmd El main map CPFLAGS O ihex aie ODFLAGS x syms p main ot E makefile all test 61 125 demozi106 blink ram clean rm crt lst main lst crt o main o main out main hex main map main crmp test main out echo copying S CP S CPFLAGS main out main hex OD S ODFLAGS main out gt main drp main gut crt o main o demozi 06 blink flash cmd H echo linking LD LFL GS o main out crt o main o pert o crt s echo assembling 51451 SLAPLAGS GEL gt Grt lst miain o main c echo compiling EC CFLAGS main c 4 Tasks a 4d X Po 0 items m A Pa Leo a TE rs SOS wW ritable Smart Insert TL The general idea of the makefile is that a target could be a file is associated with one or more dependent files If any of the dependent files are newer than the target then the commands on the following lines are executed to recompile for instance Command lines are indented with a Tab character main o main c arm elf gcc l c O3 g main c In the example above if main c is newer than the target main o the command or commands on the next line or lines will be executed The command arm elf gcc will recompile the file main c with several compilation options specified If the target is up to date nothing is done Make works its way downward in the makefile if you ve deleted all object and output files it will compile and li
124. inish ix J2SE Runtime Environment 5 0 Update 3 Complete Installation Completed The Install Wizard has successfully installed J25E Runtime Environment 5 0 Update 3 Click Finish bo exit Ehe wizard As a quick check go to the Windows Start menu and select Start Control Panel Add or Remove Programs Scroll down the list of installed programs and see if the Java J2SE Runtime Environment was indeed installed f Add or Remove Programs fi Currently installed programs Show updates Sort by Change or UT H Hel Ad Remove Programs Size 117 00MB 5 3 pa Jasc Paint Shop Photo Album 5 Add New Jasc Paint Shop Pro Studio Dell Editon Programs 34 Learnz Player Uninstall Only Size 0 68MB m Bl Lec2000 Flash Utility Add Remove ee Macraiao ns riat PbS desc The Sun Microsystems web site is very dynamic changing all the time Don t be surprised if some of the example displays shown here are a bit different 4 Eclipse IDE The Eclipse IDE is a complete integrated development platform similar to Microsoft s Visual Studio Originally developed by IBM it has been donated to the Open Source community and is now a massive world wide Open Source development project Eclipse by itself is configured to edit and debug JAVA programs By installing the CDT plug ins you can use Eclipse to edit and debug C C programs more on that later When properly setup you will have a sophisticated programmer
125. ink Flash CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile volatile volatile CxCCunlatile lt vo latile CxCCunlatile CxCCunlatile CxCCunlatile volatile uvolatile uvolatile uvolatile uvolatile uvolatile x Cuolatile uvolatile uvolatile uvolatile lt wolatile x wolatile x wolatile CxCtCunlatile x wolatile lt wolatile x wolatile lil Search unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned long long long long long long long long long lang lang lang lang long long long long long long long long long long long long long long long long Header file for Philips LPC21H4 LPC21H5 LPC21HB6 BxFFFFFHBBH gt BxFFFFFBB4A BxFFFFFHHBB gt gt BxFFFFFHBBC BxFFFFFH1H BxFFFFFH1 4 BxFFFFFH18 gt gt BxFFFFFH1C AxFFFFFA2B gt gt AxFFFFFA3B gt gt AxFFFFFA34 gt gt BxFFFFF1BHB BxFFFFF184 BxFFFFF18B8 BxFFFFF1BC BxFFFFF11BH BxFFFFF114 BxFFFFF118 BxFFFFFi11C BxFFFFF128 BxFFFFF124 BxFFFFF128 BxFFFFF12C BxFFFFF138 Bx
126. inking arm elf ld w Map main map Tdemozi 6 blink flash cmd o main out crt o main o GMU ld version z 15 OCO0pyvindg arm elf objcopy 0 ihex main out main Hex arm elf objdump x 3s3yms main out gt main dimp 18 Setting Up the Hardware For this tutorial we ll be using the Olimex LPC P2106 Prototype Board Connect a straight through 9 pin serial cable from your computer s COM1 port to the DB 9 connector on the Olimex board Attach the 9 volt power supply to the PWR connector Install the BSL jumper and the JTAG jumper LPC2000 Flash Utility V2 2 0 mum qua M oY oe 9 P a Y oe 2 3 gt Ciz GIL C9 BE EN EN cles TTT TET TA QA on mi cl 5 DEN momo e To run the Philips LPC2000 Flash Utility it s easiest to just click on the External Tools button and its down arrow to pull down the available tools Click on LPC2000 Flash Utility to start the Philips Boot Loader Resource demo2106 blink flash cmd Eclipse Platform File Edit Navigate Search Project Run Window Help iri i alm Iq BS m S T Ak 1LPC20D0 Flash Utility Flzsh cmd X hilips boot pplication I Y 3 Insight Run As E a demazi 6 blink f cdtpraject ae B project ee crt st QL External Tools mot loader 1 p erba Organize Favorites u crt s HAM used by boot Sri demozi06_blink_Flash cmd PEG Sia lpc210 h jw G mai
127. ion to GCC by Brian J Gough Richard M Stallman Foreword The purpose of this book is to explain the use of the GNU C and C compilers gcc and g more SIPs void hella math library libm default gcc object file containing options gec more List Price 44955 Price 13 57 and eligible for FREE Super Saver Shipping on orders over 25 See details You Save 6 50 32 Availability Usually ships within 24 hours Ships from and sold by Amazon com 14 used amp new available from 13 15 Edition Paperback ARM Architecture Reference Manual 2nd Edition by David Seal List Price 4529 Price 40 24 and this item ships for FREE with Super Saver Shipping See details You Save 17 75 3155 Availability Usually ships within 24 hours Ships from and sold by Amazon com ded t ARCHITECTURE EFERENCE or MANUAL Want it delivered Tuesday June 217 Order it in the next 44 hours and 57 minutes and choose B ue One Day Shipping at checkout See details 39 used amp new available from 26 00 fs Dean a P y Edition Paperback ARM System on Chip Architecture 2nd Edition by Steve Furber List Price 4445 Price 29 39 and this item ships for FREE with Super Saver Shipping See details You Save 15 60 55 Availability Usually ships within 24 hours Ships from and sold by Amazon com Want it delivered Tuesday June 21 Order it in the next 41 hours and 55 minutes and choose One Day Shipping at checkou
128. is done in the short function feed below Setting Multiplier and Divider values PLLCFG 8x23 feed Enabling the PLL PLLCON 8 x1 feed Wait for the PLL to lock to set frequency while lt t PLLSTAT PLOCK gt gt Connect the PLL as the clock source PLLCON Mx3 5 feed gt Enabling MAM and setting number of clocks used for Flash memory fetch 4 celks in this case MAMCR x2 5 MAMT IM x4 Setting peripheral Clock pclk gt to System Clock Ccclk gt UPBDIU Bx1 a Problems El Console X Properties Search PAE a e G oO Y amp Writable Smart Insert 90 16 CiC main c Ecli Ww ARM Cross Developm fm Print Docs E Calculator IG A qe 11 16PM We have to set up the Phased Lock Loop PLL and that takes some math Olimex LPC P2106 board has a 14 7456 Mhz crystal We d like the LPC2106 to run at 53 2368 Mhz has to be an even multiple of crystal in this case 3x According to the Philips LPC2106 manual M cclk Fosc where M PLL multiplier bits 0 4 of PLLCFG cclk 53236800 hz Fosc z 14745600 hz Solving M z 53236800 14745600 z 3 6103515625 M 4 round up Note M 1 must be entered into bits 0 4 of PLLCFG assign 3 to these bits The Current Controlled Oscillator CCO must operate in the range 156 Mhz to 320 Mhz According to the Philips LPC2106 manual Fcco cclk 2 P where Fcco CCO frequency cclk 53236800 hz P PLL divisor bits 5 6 of PLLCF
129. l n nee Soe w da z 22 Debug the RAM Project The previous exercise running the RAM project from the Flash Utility was of academic interest but essentially of no practical value Well it is kind of cool that you can do that with a flash utility Eclipse CDT interfaces seamlessly to the GDB debugger that is an integral part of the GNU tool chain When you click on the Debug button you will be able to watch the execution of your program graphically as it goes from breakpoint to breakpoint You can park the cursor over a variable name and see its current value assuming that execution has stopped of course You ll be able to look at structured variables see the ARM registers and have the ability to modify variables and registers Unfortunately the inability of the current Wiggler OCDremote hardware to support hardware breakpoints and flash reprogramming limits the debugger to RAM based applications We will need the following hardware setup Olimex ARM JTAG Adapter 20 pin JTAG JE 2 222222 23232332332 2 JA Port f PPP Pn ed MHMMIENIEEIN MGE 22 ASSO mc M T OU MG EG DO Oo NANA e 6 HTTP HMH OLIMEX COM DEU Bl a mu mu mu HW mu mu mu mu mu mu Hu mu mu mu 1 e The Olimex ARM JTAG Adapter is a clone of the Macraigor Wiggler JTAG interface It costs about 19 95 and all fits into a DB 25 shell bought a straight through printer cable from my local computer retailer and
130. l uninitialized variable C main c int global uninitialized variable main dmp main hex main map main o main out K makefile initialized variable initialized variable initialized variable short short char ty e global global global Ww Ww Q Ce TET alae neno Tasks El Console 33 X C Build demo2106_ blink Flash Writable Smart Insert The main program starts out with a few function prototypes Note that the interrupt routines mentioned in the crt s assembler program reside in the main program We ve used the GNU C compiler syntax that identifies the interrupt routines and makes sure that the compiler will save and restore registers etc whenever the interrupt is asserted I ve also included a few do nothing m variables both initialized and uninitialized LED J to illustrate that the compiler will put the 2 initialized variables into the data section E l and the uninitialized ones into the bss section U1 26 13 TXDO R12 We re going to try to toggle a single I O 27 RICK PO 8 TXDO PWMI 772 Roe 330 bit ificallv P0 7 which is the Oli DBGSEL Pa 1 RXDO PHM3 iopo It specitically FU Which IS tie Simex RST PQ 2 SCL CAPO O pos red LED ST PQ 3 SDA MATO 0 app PO 4 SCK CAPQ 1 P Pe 5 MISO MAT E a f Een 20 NC1 P 6 MOSI CAPO 2 28 ED ss NC2 Pa 7 SSEL PWM2 HS pp 8 co NC3 PO 8 TXD1 PWM4 4 4 By the way with this
131. lat crt o main o main out main hex main map main dmp rim Cannot latat main lst No such file or directory make clean Error 1 ignored Cancel 7 To build the project click on Project Build All Since we deleted all the object files and the main out file via the clean operation this Build all will assemble the crt s startup file C compile the main c function run the linker and then run the objcopy utility to make a hex file suitable for downloading with the Philips ISP Flash Utility Resource main c Eclipse Platform Sel File Edit Navigate Search Bical Run Window Help gt Open Project amp iQ nd Aii wa FEY amp Resource 5 Navigator 22 N md S crt s K makefile 3 mainc X HB outline 23 b m E frt Build Al pack on n nw x watt xut xn tmu n tnt tuxs Build Project 2 15 demo2106_blink_flash Build Working Set foe ee Initialize A A a a a a a a a a cdtproject Clean feed project Build Automatically IRQ Routine S crt s void B FIQ Routine ES demo2106 blink fli Properties SWI Routine C Ipc210x h UNDEF Routine Gi main c void IRQ Routine void _ attribute _ interrupt IRQ LPC210x h K makefile void FIQ Routine void attribute interrupt FIQ q aC pal 15 demo2106_blink_ram void SUI Routine void _ attribute interrupt SWI r void UNDEF Routine void att
132. lize AS int a global uninitialized variable set io pins for led PO 7 int ES global uninitialized variable IODIR OxOO000080 pin PO 7 is an outpi int 8 global uninitialized variable Ox40000290 lt main 28 gt mov r2 536870904 v Ox40000294 lt main 32 gt add r2 r2 163840 Pw lt lil gt Ea lt lll gt o E Console X Tasks Memory B X aB r B ri 7 demo2106 blink ram Embedded debug launch Debugger Process 9 10 05 1 09 PM tgw TOA section text section size 1208 total size 2515 section data section size 24 total size 2515 ciclo section text section sent 636 section size 1208 total sent 636 total size 2515 section text section sent 1208 section size 1208 total sent 1208 total size 2515 gt GDB Debugger Ll Command Window lt H Debug Control The Debug view should be on display at all times It has the Run Stop and Step buttons The tree structured display shows what is running in this case it s the OCDRemote utility and our application shown as Thread 0 e Debug X h Y p O E Je mU dy qe omm EQ OCDRemote Program hee pJ Cilcvguinusrilacalbinyacdremate exe demoz106_blink_ram Embedded debug launch Bae Embedded GDB 2 10 05 1 20 PH Suspended g Thread 0 Suspended 1 main at main c 46 pa Debugger Process 9 10 05 1 20 PM M
133. ll go into FLASH memory text collect all sections that should go into FLASH after startup text all text sections code rodata all rodata sections constants strings etc rodata all rodata sections constants strings etc glue_7 all glue 7 sections glue 7t all glue 7t sections etextz define a global symbol etext after the last code byte flash put all the above into FLASH We follow the text output section all the code and constants etc with a symbol definition which is automatically global in the GNU toolset This basically sets the next address after the last code byte to be the global symbol etext end of text There are two variable areas data and bss The initialized variables are contained in the data section which will be placed in RAM memory The big secret here is that an exact copy of the data section will be loaded into FLASH right after the code section just defined The onus is on the programmer to copy this section to the correct address in FLASH in this way the variables are initialized at startup just after a reset The bss section has no initializers Therefore the onus is on the programmer to clear the entire bss section in the startup routine Initialized variables are usually emitted by the assembler and C compiler as data sections data _data global symbol locates the start of data section in
134. llers which are sold all over the world Mr Lynch has previously worked for Mennen Medical Calspan Corporation and the Boeing Company He has a BSEE from Ohio University and a MSEE from State University of New York at Buffalo Jim is a single Father and has two children who now live in Florida and Nevada He has two brothers one is a Viet Nam veteran in Hollywood Florida and the other is the Bishop of St Petersburg also in Florida Jim plays the guitar and is collecting woodworking machines for future projects that will integrate woodworking and embedded computers Lynch can be reached via e mail at lynchzilla aol com 24 Some Books That May Be Helpful The following is a short compendium of books that l ve found helpful on the subject of ARM microprocessors and the GNU tool chain l ve reproduced the Amazon com data on them GCC The Complete Reference by Arthur Griffith The GNU Compiler Collection GCC is the most important piece of open source software in the world more SIPs instruction scheduling parameters builtin apply execute the configure script release eqcs call insn more List Price 459399 Price 39 59 and this item ships for FREE with Super Saver Shipping See details You Save 20 40 14 Availability Usually ships within 24 hours Ships from and sold by Amazon com Only 5 left in stock order soon more on the way 57 used amp new available from 8 70 Edition Paperback An Introduct
135. logies Products Jobs Company Profile CONSUMER PRODUCTS PROFESSIONAL PRODUCTS oo Product Information Information as of 2004 07 10 Product Categories hn Analog and mixed E Bend signal devices informed datasheet Audio Bus devices Mi Datasheet kd Email translate kd Disclaimer hd Applications kd Support amp tools kd Similar products hd General description hd Features ki Block diagram hd Products amp packages Clocks amp Watches Data hd Parametrics Communications Discrete modules SB General description Discretes Display drivers dentificatinn Z Security Logic Micracantrallers Peripherals Video s Wired Communications Wireless Communications naar oT Bie Tal The LPC2104 2105 and 2106 are based on a 16 32 bit ARM TOMI S CPU with real time emulation and embedded trace support together with 128 kbytes kB of embedded high speed flash memory 4 128 bit wide memory interface and a unique accelerator architecture enable 32 bit code execution at maximum clock rate For critical code size applications the alternative 16 bit Thumb Mode reduces code by more than 3 pct with minimal performance penalty Due to their tiny size and low power consumption these microcontrollers are ideal for applications where miniaturization is a key requirement such as access control and point of sale With a wide range of serial communications interfaces and on chip SRAM option
136. n ll aL OCDremote Favorites LPC2000 Flash oa Select All Deselect all Now verify that the OCDremote is in the list of External Tools favorites Click n Run External Tools and see that it s now included in the list of favorites C C Eclipse Platform File Edit Navigate Search Project A window Help js lg m Rr ei 6 Q Run Last Launched Ctrl Fii gt Ye Debug Last Launched F11 CIC P Run History 1 5 demo2106 blink Flash Run As 61 15 demoz106 blink ram Run Debug History Debug s Debug F External Tools d QL 1 LPC2000 Flash Utility F 2 OCDremote Run As An outline is not available Problems El console 53 ig Q External Tools e En A FEL CL lt herminated gt C Program Files GMUAR organize Favorites Now is a good time to point out that there s a handy shortcut button in Eclipse to run the External Tools Click on the External Tools button s down arrow to expand the list of available tools 4 gt C C Eclipse Platform File Edit Navigate Search Project Run Window Help ln i HOGlm O a v E CIC P D Q 1 LPC2000 Flash Utility a Bg E demoz106_blink_Flash H E demo2106 blink rar F 2 OCDremote Run As FN External Tools Organize Favorites Problems Eee EM Properties a Ek e Se mS Build demaz1 6 blink ram 10 Verifying the PATH Settings Ther
137. n c m p main dmp ft main hex T main map jt com main o EM LLL main out T E 39 makefile UE leri AM d ram isp hic n The Philips LPC2000 ISP Flash Programming will start up Es LPC2000 Flash Utility File Buffer Help DHILI DS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Part C eclipse workspace demo2106_blink_flas Blank Check f Entire Device CoMt Selected Sectors Use Baud Rate Execute Code Upload to Flash pe lod EN 5 13200 Erase End Sector ta met sec 2 Compare Flash Manual Reset Device Use DTR RTS Device tor Reset and LPC21 04 Read Part ip m Poal Loader ATAL Freg kHz 14746 Device ID Mus Leeds in Selection Now fill out the LPC2000 Flash Utility screen Browse the workspace for the main hex file Set the Device to LPC2106 Set the crystal frequency to 14746 as per the Olimex schematic The default baud rate COM port and Time out are OK as is Es LPC2000 Flash Utility File Buffer Help DHILIDS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication BELE l Connected To Port warkspace sdemaz1 O6 blink flash amp main hed O Blank ed Entire Device JCOMt Selected Sectors Use Baud Hate Execute Code Upload to Flash 4 19200 Start Sector u after Upload Erase Compare Flash Manual Reset End Sector 14 Time Out sec 2 Use DTR R
138. nce have a high speed internet connection always select Direct Connection Click Next to continue Cygwin Setup Select Connection Type Select Your Internet Connection Setup needs to know how you want it to connect to the internet Choose the appropriate settings below Direct Connection C Use lE5 Settings C Use HTTP FTP Proxy Proxy Host Cancel Now the Cygwin Installer presents you with a list of mirror sites that can deliver the Cygwin GNU Toolkit It s a bit of a mystery which one to choose picked http planetmirror com because it sounds cool You may have to experiment to find one that downloads the fastest Click Next to continue Cygwin Setup Choose Download 5ite s Choose A Download Site Choose a site from this list or add your own sites to the list Available Download Sites http mirror mes and gov http mirror pacific net au http mirrors dotsre org http mirrors kernel org http mirrors ren net http mirrors theonlinerecordstore cam planetmirrar com at or edere p soumces red http sourceware mirrors tds net http wy carfield com hk http vena mirror ac ul http ZI venu signal com User UAL Back Cancel Cygwin will download a few bits for a couple of seconds and then display this Select Packages list allowing you to tailor exactly what is included in the down load Cygwin Setup Select Packages
139. nitialize 116 gt strb rz r3 Peet i Ox40000404 lt Initialize 120 gt bl Ox40000454 lt feed gt i jil The Step Into and Step Out Of buttons work in the same was as for C code O Inspecting Registers Unfortunately parking the cursor over a register name R3 e g does not pop up its current value For that you can refer to the Registers view A Main Click on the symbol next to Main and the registers will appear The Philips LPC2106 doesn t have any floating point registers so registers FO through FPS are not applicable E 645 Main H9 m 110 riu 1010 r2 B5 1919 r3 534790004 1010 r4 536690688 1010 r5 2147482932 1919 r amp 1073742120 inti 0 191 r5 1656272053 1010 r3 1109953465 191 r10 2105601601 1010 11 1073805976 1919 r12 1073805964 1919 lt n 1073805964 1010 1073742856 1010 pe 1073742856 am Pt O wu FS 0 am Fo O Wu FF 0 au fps 0 1919 cosr 536871120 If you dont like a particular registers numeric format you can click to highlight it and then bring up the right click menu The Format option permits you to change the numeric format to hexadecimal for example Em Main 1 rj 110 oor rl O no fe Go no ra 1010 0101 uu ro 21474 Iv Enable 1091 pg 107374 Disable nu tf O Wu pg 16562 pi 1010 pg 11099 O Cast To Type yor 10 2105 Wu 111 1073 uu 112 1073 1
140. nk everything GNU make has a helpful variables feature that helps you reduce typing If you define the following variable CFLAGS l c fno common O3 g You can use this multiple times in the makefile by writing the variable name as follows CFLAGS will substitute the string I c O3 g Therefore the command arm elf gcc CFLAGS main c is exactly the same as arm elf gcc l c O3 g main c Likewise we can replace the compiler name arm elf gcc with a variable too CC arm elf gcc Now the command line becomes CC CFLAGS main c Now our rule for handling the main o and main c files becomes main o main c echo compiling CC CFLAGS main c Its worth emphasizing that forgetting to insert the TAB character before the commands is the most common rookie mistake in using the GNU Make system The compilation options being used are l specifies include directories to search first project directory in this case C do not invoke the linker we have a separate make rule for that fno common gets rid of a pesky warning O3 Sets the optimization level Note set to O0 for debugging g generates debugging information The assembler is used to assemble the file crt s as shown below crt o crt s echo assembling AS S AFLAGS crt s gt crt Ist In the example above if the object file crt o is older than the dependent assembler source file crt s then the commands on t
141. nly usable for programs running from RAM memory At this point you re probably saying this is great all these tools and they re FREE In the interest of honesty and openness let s delineate the downside of the free open software GNU tools e he GNU tools do not currently generate as efficient code as the professional compilers e he Eclipse CDT Debugger cannot set a software breakpoint in FLASH since it can t erase and reprogram the FLASH e he OCDRemote JTAG utility does not support hardware breakpoints If you were a professional programmer you would not accept these limitations For the student or hobbyist the Eclipse GNU toolset still gives fantastic capabilities for zero cost The Eclipse GNU Compiler toolset we will be creating in this tutorial operates in two modes A Application programmed into FLASH i RE PHILIPS LPC2000 Flash Utility V220 es hoppas I A Be a M gt M M M A x Berd Li HEj m 0d H i E H E EEE Dp VI DU IT y Ea a ul AE la Be nm u 3 r OLIMEX LTD ex COPYRIGHT C 280 oO a Duomo DODODODDDODO EEE SHE eee PPP TETU FET BEEBE BERBER LPR E BEEBE BERBER RRR BEEBE BEB RBBB BEBE EBB BRB RBRBRE EERE REE ES O 6 HTTP HHH OLIMEX COM DEU SERENA BHENHBNENENENHENHEHNEHEEHEN B In this mode the Eclipse GNU development system assembles compiles and links you
142. ns that Test and Performance Tools TPTP you need You will need a Java runtime environment JRE to use Eclipse All downloads are provided under the terms and conditions of the Eclipse org Software User Agreement unless otherwise specified Download ow Eclipse SDK 3 1 windows torrents Top 10 Eclipse Downloads Rich Client Platform RCP Other downloads for 3 1 Eclipse project FRG Newsgroups 1 Eclipse SDK 3 1 latest release Documentation and help Documentation and hel 2 Eclipse SDK 3 2MH latest milestanestable Eclipse Project 3 Eclipse Modelling Framework EME Downloads Project home JDT Java Development Tools Downloads Project home PDE Plugin Development Environment DowNoads Project Este csl eletti SITE i home 4 C Development Tools COT b Visual Editor VE Platform Downloads Project hame Eclipse Tools Project Downloads Project home C C IDE Downloads Project horme COBOL Downloads Project home TPTP EMF Downloads Project home DIndatecd fii 1405 b Internet When working with the Eclipse and CDT it s important to be sure that the CDT plugin you ve selected is compatible with the Eclipse revision you also selected Be sure to study the Eclipse web sites to be sure that you have compatible revisions selected If you click on Eclipse SDK 3 1 where it says Download Now shown above this is the Windows version of the download What
143. nue click Next The next screen lets you choose where OCDRemote is installed OCDRemote normally installs in c cygwin usr local bin We ll have to make sure that this directory is on a Windows Path Click on Next to accept c cygwin usr local bin as the OCDRemote installation directory Macraigor Systems Hardware Support Package 7 12 InstallShield Wizard E Choose Destination Location 1 5 Select folder where setup will install Files Install M acraigor Systems Hardware Support Package 2 12 ta Scugwinsusrslacalbin Installshield Be joven Clicking on Install will complete the OCDRemote installation Macraigor Systems Hardware Support Package 2 12 InstallShield Wizard FS Ready to Install the Program la 4 The wizard is ready to begin installation Click Install to begin the installation IF you want to review or change any of your installation settings click Back Click Cancel to exit the wizard lnstallS hield eT ies The Wizard completion screen lets you restart your computer to put OCDRemote into the Windows registry Macraigor Systems Hardware Support Package 2 12 InstallShield Wizard InstallShield Wizard Complete The InstallShield Wizard has successfully installed Macraigor Systems Hardware Support Package 2 12 Before you can use the program vou must restart your computer Yes want to restart my computer now CO Ma will restart my computer later Remove a
144. ny disks fram their drives and then click Finish to complete setup Just like the Philips ISP Flash Utility we should install the Macraigor OCDremote utility as an external tool that can be accessed easily from the Eclipse CDT RUN pull down menu Start up Eclipse and if necessary switch to the C C perspective by clicking Window Open Perspective Other C C Bele E Resource Resource Eclipse Platform File Edit Navigate Search Project Run oU Help LR i amp Q 4 los AM TES New Window Mew Editor Open Perspective dd E CVS Repository Exploring Shaw Vi k DIA VIE a acs 7 Java Browsing Customize Perspective Save Perspective As Reset Perspective Close Perspective EM Close All Perspectives E0 Team Synchronizing select Perspective 2 Browsing fe CIC nee Hierarchy Hacs Repository Exploring Debug amp Java d Java Browsing fel Java Type Hierarchy ai Plug in Development Resource default El Team Synchronizing Navigation Preferences D items i ES Description Resource Le Outline TO 7m An outline is not available Switching perspectives brings up the C C window perspective and this will be remembered when you re enter Eclipse C C Eclipse Platform File Edit Navigate Search Project Run Window Help 5 Ee 8 86 8 G 0 Q amp e 4 CCP
145. oasters cars fighter jets and Roomba vacuum cleaners This is where the real action is in the field of computer science and engineering Can today s young student or home hobbyist tired of watching Reality Television dabble in microcomputer electronics The answer is an unequivocal YES Most people start out with projects involving the Microchip PIC series of microcontrollers You may have seen these in Nuts and Volts magazine or visited the plethora of web sites devoted to PIC computing PIC microcomputer chips are very cheap a couple of dollars and you can get an IDE Integrated Development Environment compilers and emulators from Microchip and others for a very reasonable price Another inexpensive microcontroller for the hobbyist to work with is the Rabbit microcomputer The Rabbit line is an 8 bit microcontroller with development packages board and software costing less that 140 l ve longed for a real state of the art microcomputer to play with One that can do 32 bit arithmetic as fast as a speeding bullet and has all the on board RAM and EPROM needed to build sophisticated applications My prayers have been answered recently as big players such as Texas Instruments Philips and Atmel have been selling inexpensive microcontroller chips based on the 32 bit ARM architecture These chips have integrated RAM and FLASH memory a rich set of peripherals such as serial I O PWM l2C SSI Timers etc and high performance at low power cons
146. ock of Wigglers to make this connection but there are large numbers of the device out there that don t have this modification like my Olimex Wiggler Use an ohmmeter on the 25 pin printer connector on the Wiggler to see if these two pins are connected If not you can easily disassemble the Olimex Wiggler and tack solder a jumper to do the job Again you must connect pin 8 to pin 15 VIII 411 used that 30 gauge Radio Shack blue Teflon coated hookup wire and a microscope to do the soldering above lf you have a good magnifier the DB 25 pins on the wiggler have the pin numbers embossed in the white plastic above and below the rows of pins We re not quite finished with our Wiggler suffering There s the final issue of the PC Printer port mode Most modern PCs like my new Dell have the Printer Port defaulted to ECP mode The Wiggler will not work with the printer port configured for ECP mode The Macraigor web site has a FAQ with the following citation What mode must my parallel port be in As far as the parallel port is concerned a Wiggler is a simple uni directional device It will work with the parallel port in any mode EXCEPT ECP It will NOT work in ECP mode at all The Raven works best with a parallel port in EPP mode It may work in ECP mode If the parallel port is in an older mode such as uni directional AT or compatible the Raven will work but slower Remember the mode is set in the CMOS bios of your
147. ogram files GNUARM bin arm elf gdb exe and check the box that instructs the debugger to stop at main on startup Create manage and run configurations Configurations Mame demozi amp blink ram e Cic Attach to Local Application e C C Local Application a e C C Postmortem debugger Main F Debugger ll Commands S Source 8 Eclipse Application lg Embedded debug launch Debugger Embedded GDE e M Stop at main on startup zEiHdemozi06 blink ram V t fl Java Applet 7 Java Application fu JUnit om 3 JUnit Plug in Test Remote Java Application GDB debugger C Program Files GNUARMbin arm elf gdb exe Mew Delete swt SWT Application Under the commands tab enter the following two GDB commands to run at startup target remote localhost 8888 load Create manage and run configurations Configurations Mame demozid06 blink ram e C C Attach to Local Application E CIC Local Application Boe A d debugger Main 5 Debugger tmi Commands By Source E Common T A Eclipse Application H O Embedded debug launch 6 demo2106 blink ram Rn Java Applet PJ Java Application Ju JUnit FE JUnit Plug in Test AZ Remote Java Application 51 SWT Application Mew Delete Apply Revert The target remote command specifies that the protocol used to talk to the application is GDB Remote Serial protocol
148. ommon 00 g AFLAGS ahls mapes sSe o c fu LFLAGS Map main map Tdemozi 6 blink ram cmd CPFLAGS O ihex ODFLAGS X ayms all test C Create a Debug Launch Configuration The first order of business is to set up a debug launch configuration The quickest way to get to the debug launch configuration screen is to click on the insect button insect bug get it Specifically click on the down arrowhead to bring up the debug pull down menu B Note Debugging is limited to applications targeted to RAM execution suspect that fairly soon an affordable USB JTAG debug interface and software drivers will be available that will permit use of the two hardware breakpoints available in the ARM JTAG hardware These two breakpoints will work in flash memory In this situation you could use the Philips Flash Utility to download the code into flash and then start the Eclipse debugger Click on the Debug selection in the debug pull down list to bring up the Debug configuration screen C C main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help mi s Slim g 6 i e OQ Q 9 0 Ee ES cic i Ad cic Projects EZ s Mavigator Bac 6 1 demoz106 blink ram ae ar Mm Ll m Rmus TUUM MT 1 demoz1in6 blink Flash e Debug i gt a EE demozi amp blink ram P hoch ow c C TTP TPP a CN r a Tr H Binaries H Includes void Initializ
149. on without leaving the debugger Of course you need to kill the OCDRemote and the Debugger and restart the download after the build as specified above This is necessary for this release of CDT because the Restart button appears inoperative The advantage is that you don t have to change the Eclipse perspective just stay in the Debug perspective otart the application and it will stop on the breakpoint line this will take a long time 9 seconds on my Dell computer If you park the cursor over the variable x after the program has suspended on the breakpoint it will display that the current value is 9 ff endless loop to toggle the red LED PO while ii for j O j 5000000 j 1 fi wait SOO msec IOSET OxXDODODOGSO ff red led off for 3 O j 5000000 3 1 i wait SOO msec IOCLE OxXDODODDOSO red led on DEC m If you specify that it should break when x 50000 you will essentially wait forever The way this works the debugger breaks on the selected source line every pass through that source line and then queries via JTAG for the current value of the variable x When x 50000 the debugger will stop Obviously that requires a lot of serial communication at a very slow baud rate Sadly the OCDRemote and wiggler combination cannot service a hardware breakpoint the ARM supports two hardware breakpoints that can stop on an address and or data value Still you may find some use for this feature In the Br
150. ool from within Eclipse The CDT debugger started from within Eclipse communicates with the Macraigor OCDRemote program that operates the JTAG port using the Wiggler With the CDT debugger you can connect to the Wiggler and load the GNU main out file into RAM From this point on you can set software breakpoints view variables and structures and of course run the application The drawback is that the application must fit within RAM memory on the LPC2106 which is 64 Kbytes Still it s better than nothing My purpose in this tutorial is to guide the student or hobbyist through the myriad of documentation and web sites containing the necessary component parts of a working ARM software development environment l ve devised a simple sample program that blinks an LED that is compatible in every way with the GNU assembler compiler and linker There are two variants of this program a FLASH based version and a RAM based version If you get this to work you are well on your way to the fascinating world of embedded software development Take a deep breath and HERE WE GO If you are very new to ARM microcomputers there s no better introductory book than The Insider s Guide to the Philips ARM7 Based Microcontrollers by Trevor Martin Martin is an executive of Hitex a UK vendor of embedded microcomputer development software and hardware and he obviously understands his material PHILIPS gt SP TWARE DEVELOPMENT TOOLS THE INSIDER S GUID
151. pe board since it has an open prototype area for adding I2C chips and the like for advanced experimentation When you do design and develop something really clever you could use the LPC H2106 header board soldered into a nice Jameco or Digikey prototype board and know that the CPU end of your project will work straight away If you need to build multiple copies of your design Spark Fun can get small runs of blank circuit boards built for 5 00 per square inch You can acquire the Eagle Lite software from CadSoft for free to design the schematic and PCB masks o0 the hardware to experiment with 32 bit ARM microprocessors is available and affordable What about the software required for editing compiling linking and downloading applications for the LPC2106 board Embedded microcomputer development software has always been considered professional and priced accordingly It s very common for an engineer in a technical company to spend 1000 to 5000 for a professional development package once ordered 18 000 of compilers and emulators for a single project In the professional engineering world time is money The commercial software development packages for the ARM architecture install easily are well supported and rarely have bugs In fact most of them can load your program into either RAM or FLASH and you can set breakpoints in either The professional compiler packages are also quite efficient they generate compact and speedy code The
152. pherals are memory mapped so all I O registers are defined in this file so you don t have to type in the absolute memory addresses C C IpcZ10x h Eclipse Platform File Edit mio Ge C C Projects 23 Navigate Search Project Run Window Help m jb 83 d Q 3 Q QQ S E e Ipe210x h ES O Ed Becc 02 Outline 3 Ui u p demaziD08 blink Flash O Includes R Ipc210x h s crt s d main c demo2106 cmd 3 makefile E E h d ee ee of ee of Bifndef def ine LPC21HWz H LPC21Hx H LPC21Hx H Vectored Interrupt Controller UIC x def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine define define define def ine def ine def ine def ine def ine def ine def ine Prablems amp Console X UIGIRQStatus UIGFIQStatus UIGRawIntr UIGInt amp elect UIGIntEnahle UIGIntEnGlr VICSoftInt VICSoftIntClr UIGProtection UIGUectfrddr VIicCDefVectAddr VICUect ddra UICUecthddri UICUecthddrz UICUecthddr3 UICUecth ddr4 UICUecthddrb5b UICUecthddr amp UIGCUecthiddr7 UICUecthddr amp UICUecthddr 7 UICUecthddridb UICUecthddrii UICUecthddriz UICUecthddri3 UIGCUecthddri4d UICUecthddrib5 UIGCUectnt 1H UIGUectnt li UIGCUectnt 12 UIGUectnt 13 UICUectnt 14 UIGUectnt 15 Properties Build demoz2106 bl
153. r application for loading into FLASH memory The output of the compiler linker suite is an Intel hex file e g main hex The Philips In System Programming ISP utility is started within Eclipse and will download your hex file and program the flash memory through the standard COM1 serial cable The Boot Strap Loader BSL jumper must be shorted installed to run the ISP flash programming utility To execute the application you remove the BSL jumper and push the RESET button to start the application Unfortunately the Insight debugger cannot set a software breakpoint it can t program FLASH and it also doesn t support hardware breakpoints This effectively renders the debugger useless in this mode B Application programmed into RAM Olimex ARM JTAG Adapter WIGGLER LPT1 RA TMU E 20 pin rc 17 OLIMEX LTD 9 COPYRIGHT C 2003 JTAG DUDODO DODODODDDOD O Port FREE PP EEE FEET BEEBE BEBE BRR EERE BEBE RBBB RBBB EERE ERB ES HTTP HHH QLIMEX COM DEU In this mode the Eclipse GNU development system assembles compiles and links your application for loading into RAM memory The output of the compiler linker suite is a GNU main out file The PC is connected from the PC s printer port LPT1 to the JTAG port through the Olimex ARM JTAG interface costs about 19 95 from Spark Fun Electronics The Olimex ARM JTAG is a clone of the Macraigor Wiggler You can run the OCDRemote program as an external t
154. ribute i interrupt UNDEF s m ZU h i AAA j main PLOCK Initialize feed IRQ_Routine FIQ_Routine SWI Routine UNDEF Routine Header files AAA include LPC210x h AAA Global Variables AS 00000040 PPPPPPEOOOOOA int a global uninitialized variable int r global uninitialized variable int 3 global uninitialized variable short h 2 global initialized variable short i 3 global initialized variable char j global initialized variable v lt ill E Console x Problems a Ex prt r3 0 C Build demo2106_blink_flash make k clean rm crt lst main lst crt o main o main out main hex main map main dmp rm cannot lstat crt lst No such file or directory rm cannot lstat main lst No such file or directory rm cannot lstat crt o No such file or directory rm cannot lstat main o No such file or directory rm cannot lstat main out No such file or directory rm cannot lstat main hex No such file or directory rm cannot lstat main map No such file or directory rm cannot lstat main dmp No such file or directory make clean Error 1 ignored writable Smart Insert 4 1 We can see the results in the Console Window at the bottom A Console DD Problems B Ex FE amp Build demoz1 06 blink Flash assembling arm elf as ahls mapcs 3z 0 crt o crt s gt crt lst compilincdg arm elf qee I fno common 03 g main c l
155. ritable Insert Resource demo2106 blink flash cmd Eclipse Platform Sele File Edit Navigate Search Project Run Window Help Im HSlmM I a HPl eo o ES Resource gae HO C Ule CPT Sas mane E manm E demoz106 birme A pa A e E B je i demo2106 blink Flash MEMORY MAP B cotproject Ox40010000 project gt tst Ox4000FFFF crt o isp hi variables and stack crt s for Philips boot loader FE demoz106_bink flash cmd 288 bytes Ox400OFEEO Ox4000FEDC main hex Ox4000FED8 main map a memo Ox4000FED4 main out K makefile Ox4000FEDO tS demo2106 blink ram x Ox4000FECC l Ox4000FECS lt Stack end Stack area for user program terminated Insight Program C Program Files GNUARM bin arm elF insight exe Writable Resource demo2106 blink flash cmd Eclipse Platform Do Bj demo2106 blink flash cmd X bss end E e demo2106 blink Flash E cdtproject project crt lst crto bss uninitialized variables 579 8 95 8 oia bss start C Ipc210x h C main c main dmp main hex MAMAS variables used by Ox400001FF TUE Philips boot loader nies 223 bytes Ox 40000120 demo2106 blink ram mum Plink 0x4000011F ram vectors Ox40000040 Ox4000003F Interrupt Vectors re mapped Ox40000000 data initialized variables 0x40000200 lt OxXOOO1FFFF cdtproject project crt
156. rmi PROCESSOR 4 xd e Take a very careful look at the Edit System Variable window the Path Edit in this case Edit 5ystem Variable variable value b cygwinbin c Apragram files gnuarmibin You should see the following paths specified all separated by semicolons The path is usually long and complex you may find the bits and pieces for GNUARM interspersed throughout the path specification used cut and paste to place all my path specifications at the beginning of the specification line this is not really necessary You should see the following paths specified c cygwin bin c program files gnuarm bin c cygwin usr local bin If any of the three is not present now is the time to type them into the path specification lve found that not properly setting up the Path specification is the most common mistake made in configuring Eclipse to do cross development This completes the setup of Eclipse and all the ancillary tools required to cross develop embedded software for the ARM microcomputer family Philips LPC2000 family in specific If you stayed with me this far your patience will soon be rewarded Or as Yoda would say Rewarded soon your patience will be 11 Creating a Simple Eclipse Project At this point we have a fully functioning Eclipse IDE capable of building C C programs for the ARM microprocessor specifically for the Olimex LPC P2106 prototype board We will now create an Eclips
157. s up to 64 kilobytes they are very well surted for communication gateways and protocol converters soft modems voice recognition and low end imaging providing bath large buffer size and high processing power Various 32 bit timers PWM channels and 32 GPIO lines make these microcontrollers particularly suitable for industrial control and medical systems AB Features Key features e 16 32 bit ARM TDMI S processor 14 57 64 kA on chin Static RAM If you scroll down this page you will see a link to the LPC2000 Flash Utility download Click on the ZIP file LPC2000 Flash Utility date 2004 03 01 AB Support amp tools LP 2104 Single Chip 32 bit Microcontroller Erratasheet date 2004 06 01 LPE2105 Single Chip 32 bit Microcontroller Erratasheet date 2004 06 01 LPE2106 Single Chip 32 bit Microcontroller Erratasheet date 2004 06 01 LPit2104 Erratasheet date 2003 12 10 LPEZ105 Erratasheet date 2005 17 10 LPE2106 Erratasheetidate 2003 12 10 Philips Microcontroller Line Card date 2004 03 05 LPE21042105 2106 Leaflet date 2004 02 24 Philips The Innovation Leader in Mocrocontrollers date 2004 06 30 FOF LE 1E E I sr Manual date 2003 09 E vees Development Tools tar LPC 100 devicestidate 2005 05 71 As before we ll save the downloaded zip file in our empty c scratch directory This is a fairly short download only about 2 megabytes File Download You are downloading the File i j lpc O00
158. t A Navigator x X CNT S crt s Bi demo2106 blink flash cmd X C main c main map demo2106 blink ram cmd n2 1 I BEH t 5 demo2106 blink flash now define the output sections cdtproject Peppa SECTIONS crt Ist crt o is un a D set location counter to address zero 5 demo2106 blink Flash cmd G Ipc210x h startup startup gt flash the startup code goes into FLASH main c main dmp main hex main map collect all sections that should go into FLASH after startup main o main out text all text sections code 5 makefile rodata all rodata sections constants strings etc 61 15 demo2106 blink ram rodata all rodata sections constants strings etc glue 7 all glue 7 sections glue 7t all glue 7t sections _etext define a global symbol etext just after the last code byte gt flash put all the above into FLASH data collect all initialized data sections that go into RAM data create a global symbol marking the start of the data section data all data sections _ data define a global symbol marking the end of the data section ram AT gt flash put all the above into RAM but load the LMA copy into FLASH bss collect all uninitialized bss sections that go into RAM _bss_ start define a global symbol marking the start of the bss section bss all bss sections
159. t See details 64 used amp new available from 20 00 Edition Paperback lank incida this hank Embedded System Design on a Shoestring Embedded Technology Series by Lewin Edwards There exist a large body of literature focused on teaching both general embedded systems principles and design techniques and tips and tricks for specific microcontrollers more SIPs current output section bss end gdb stubs sourcecode files clear bss more ck List Price 49 95 Coo Xm Price 49 95 and this item ships for FREE with Super Saver Shipping See details Availability Usually ships within 24 hours Ships from and sold by amp mazan cam 11 used amp new available from 47 97 Edition Paperback The ARM documentation can be downloaded free from the ARM web site http www arm com documentation The Philips Corporation has extensive documentation on the LPC2000 series here http Awww semiconductors philios com pip LPC2106 html All the GNU documentation in PDF format is maintained by among others the University of south Wales in Sidney Australia found the GNU assembler and linker manuals very readable the GNU C compiler manuals are very difficult http dsl ee unsw edu au dsl cdrom gnutools doc Of course the bookstore is full of Eclipse books but they are all about the JAVA toolkit So far no one has published anything on the CDT plugin Finally avail yourself of the many discussion groups
160. t is also in ARM 32 bit code not Thumb One label is made global startup This will be available to other modules in the project and will also appear in the map The GNU assembler doesn t require you extern anything If a symbol is not defined in the assembler file it is automatically assumed to be external The vector table is 32 bytes long and is required to be placed at address 0x000000 You will see later in this tutorial that the interrupt service routines referenced in the Vector Table are just endless loop stubs in the main c function and the interrupts are turned off The NOP instruction at address 14 is an empty spot to hold the checksum Page 179 of the Philips LPC2106 manual states The reserved ARM interrupt vector location 0x0000 0014 should contain the 2 s complement of the check sum of the remaining interrupt vectors This causes the checksum of all of the vectors together to be O Before you fall on your sword you ll be happy to know that the Philips Flash Loader will calculate that checksum and insert it for you That s why we show it as a NOP This part of the crt s file sets up the various interrupt modes and stacks Resource crt s Eclipse Platform File Edit Navigate Search Project Run Window Help Pi el Em Q Fy Resource i Ert 2 15 demoz106 blink Flash Reset Handler cdtproject PO project Reset Handler j crt Ist crto Setup a stack for each mode note that this only se
161. tack size from RO we re limiting the stack for IRQ mode to just 4 bytes We re not planning to support IRQ interrupts in this example msr CPSR c ZMODE IRQ I BIT F BIT this puts the CPU in IRQ mode mov sp rd stack pointer for IRQ mode is 0x4000FEDO sub r0 r0 ZIRQ STACK SIZE RO is now 0x4000FECC Now we put the ARM into SVC Supervisor mode by setting the MODE SVO bit in the CPSR As mentioned above SVC mode has its own private copies of R13 and R14 We now set the supervisor mode stack pointer to Ox4000FDDC Again by subtracting the SVC stack size 4 bytes from RO we re sizing the stack for SVC mode to 4 bytes msr CPSHR c ZMODE SVC I BITIF BIT This puts the CPU in SVC mode mov sp r0 stack pointer for SVC mode is 0x4000FECC sub r0 r0 SVC STACK SIZE RO is now 0x4000FEC8 The ARM User mode and the ARM System mode share the same registers and stack For this very simple example we ll run the application in User mode Setting up the stack for User mode also sets up the stack for System mode Now we put the ARM into USR user mode by setting the MODE USR bit in the CPSR We now set the USR mode stack pointer to Ox4000FEC8 msr CPSRHR c ZMODE USR BIT F BIT User Mode mov sp rd To summarize the above operations let s draw a diagram of the stacks we just created RAM STACK USAGE 0x40010000 Ox4000FFFF last address in internal Philips ISP Flash Loader Stack and variables 288
162. tatic char OxO4 static int ne const char tpText The 0400002584 lt main 16 gt ldr Ed ax40000288 xmain z str ri Initialize the system Initialize set io pins for led FO 7 IODIR 0x00000080 pin PO T is an output everything IOSET U x naannan led off IOCLR OxO0000080 led on sou ll lt TT a Able E T 7U Initialize the system E Console x Tasks Memory demozi blink ram Embedded debug launch Debugger Process 9 9 05 12 38 AM gdb target remote localhost aa8a8a8 qdbj load isectlon texrtr secrion size ls 08 total size 2515 Seelion data Seccion 198 4 ESESI STEB SIBI gdb G Components of the DEBUG Perspective Before operating the Eclipse debugger let s review the components of the Debug perspective Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Ma Help r mis o 9 sa A 15 4 on r gt ES Debug 22 e gt O amp BRA we Q OCDRemote Program AS Cicygwinusrilocal binjocdremote exe F demo2106 blink ram Embedded debug launch E e Embedded GDB 9 10 05 1 10 PM Suspended Thread 0 Suspended 1 main at main c 46 e Debugger Process 9 10 05 1 09 PM Debug Control BEES E F Debug Resource Variables x j 4260351 69 a 0 b 2 0 69 c 0 069 d 69 w 1 69 x 25 Breakpoints Expressions
163. tentially harm pour computer IF you da nat trust the source do not open ar save this file whats the risk Select the temporary c scratch directory as the target of the download Save As TEE CD embeddededt 20050810 hy Recent Documents E Desktop My Documents My Computer File name 2ulinedt 20050810 i Ky Metwork Save as type winzip File v The second Zylin CDT zip file will download into the c scratch folder This file is a shorter file only 173 Kb Download complete Download Complete Saved zylincdt 20050810 zip From wian zlin cor Downloaded 173 KB in 1 sec Download to Crscrabchizyvlincdt 20050810 zip Transfer rate 173 KB Sec Close this dialog box when download completes select both Zylin CDT files in the c scratch folder using Windows Explorer and use WinZip to extract them to the c eclipse folder scratch File Edit View Favorites Tools Help ae O Back gt d JJ search oy Folders Bee db Address Folders X Mame amp Size Type Date Modified C3 1356 ML Lembeddedcdr 20050810 11 497 KB Winzip File 9 3 2005 7 11 PM 5 My Music Sl zylincdt 200 Open with WinZip 9 3 2005 7 26 PM 5 Program Files Print 9 scratch Explore 5 source Files las Browse with Paint Shop Pro Studia TT s Je m Add Files to Library Call winzip 4 Cal Add to Zip file Scan For Viruses 3 Add to scratch zip 3 Add to recently used Zip File
164. tform File Edit Window Help ri ejedsBit O Q J c C C Projects CASTE i eet 1 E LPC2000 Flash Utility Fie Bufer Help PHILIPS Flash Programming Navigate Search Project Run Erase Blank Blank Check Filename D eclipse workspace test main hex e Entire Device Selected Sectors Execute Code Upload ta Flash 4 erora a uU Erase Part ID Boot Loader in End Sector 14 Compare Flash Device Manual Reset Device LPc2104 y ATAL Freg kHz 14746 Device ID Now cancel the LPC2000 Flash Utility and quit Eclipse ES de C C f Gi hs ge Outline 3 i LPC2000 Flash Utility V2 2 0 Communication Connected To Fart COM1 Use Baud Aate 19200 Time Out sec e Use DTR RTS for Reset and Boot Loader Selection 9 Installing the Macraigor OCDremote Utility OCDRemote is a utility that listens on a TCP IP port and translates GDB monitor commands into Wiggler JTAG commands This permits Eclipse GDB to communicate to the Olimex LPC P2100 board as a target monitor accessed via Ethernet Macraigor has always made this utility available on the internet as freeware The OCDRemote utility can be downloaded at You should see the following screen open up Home View Cart Site Map Contact Legal Macraigor Systems Make your debugging a little bit easier Home Hardware Products Software Products
165. tines They are just simple endless loops we don t intent to allow interrupts in this simple example Resource main c Eclipse Platform File Edit Navigate Search Project Run Window Help Ims HSlgal J avFl eo o BuF ES Resource 8 amp demo2106 blink Flash c B edtproject po B project PLLFEED 0xAA crt lst PLLFEED 0x55 E ert o crt s E demo2106_blink_flash cmd Ipe210x h main c B main dmp main hex E main map Stubs for various interrupts may be replaced later E main o main out 0 9 makefile H E demo2106 blink ram B edtproject 8 project i E crt Ist B crt o void FIO Routine void i s crt s while 1 F demo2106_blink_ram cmd 8 Ipc210x h main c 2 main dmp void SUI Routine void main hex while 1 B main map y E main o B main out 9 makefile void UNDEF Routine void while 1 void feed void void IRQ Routine void while 1 Tasks El Console 53 B EK r 2 T3 H C Build demo2106 blink Flash writable Smart Insert 15 Description of the Linker Script demo2106 blink flash cmd Let s look now at the linker command script demo2106 blink flash cmd l ve included extensive annotation to make it very clear how the memory is organized Resource demo2106 blink flash cmd Eclipse Platform File Edit Navigate Search Project Run Window Help
166. tory Click Next to continue is Setup GNUARM Select Destination Location Where should GNUSAM be installed pum Setup will install GNUARIM inta the following folder To continue click Next IF you would like to select a different folder click Browse D Program Files GNUARM Al least 62 9 MB of free disk space i required ee lt Back NT Cancer We ll also take the defaults on the Select Components window Click Next to continue te Setup GNUARM Select Components Which components should be installed Select the components you want to install clear the components you do nat want to Install Click Mest when you are ready to continue Full installation w Little Endian 77 0 MB v LE Libraries 9 7 MB v No Fast Multiplier 38MB T ARM THUMB Intermorking 9 8 MB v THUMB 18 8 MB v THUMB Libraries 9 5 MB D v ARM THUMB Interearking 3 5 MB i Floating Point LL nit FPU Libraries Current selection requires at least 216 9 MB of disk space 00 00 eek oen D onem Take the default on this screen Click Next to continue fe Setup GNUARM Select Start Menu Folder Where should Setup place the program s shortcuts f 5 Setup will create the program s shortcuts in the following Start Menu folder To continue click Mest IF vou would like to select a different folder click Browse Ur norm It s very important that you don t check
167. ts up a usable stack crt s for User mode lso each mode is setup with interrupts initially disabled e demo2106_blink_Flash cmd j d Ipc210x h r stack end CPSR c MODE UND E ACIN ET Undefined Instruction Mode sp r r r UND STACK SIZE CPSR c SMODE ABT I BIT F BIT hort Mode sp r r r FABT STACK SIZE ae inion CPSR c MODE_FIQ I_BIT F_BIT FIQ Mode cdtproject sp r E project rO r0 fFIQ STACK SIZE j crt Ist CPSR c MODE IRO I BIT F BIT IRQ Mode j crt n sp r g arts ro r0 HIRO STACK SIZE E demoz2106 blink ram cmd CPSR c MODE SVC I BIT F BIT Supervisor Mode d Ipez1 x h sp ED j d main c r r HS3VC STACK SIZE main dmp CPSR MODE SYS I BIT F BIT User Mode main hex sp r 7 j 7 main map j main o main out of makefile Tasks El console X w En PI T C Build demo 106_blink_Flash The label Reset Handler is the beginning of the code Recall that the first interrupt vector at address 0x000000 loads the PC with the contents of the address Reset Addr which contains the address of the startup code at the label Reset Hanaler This trick used in the entire vector table loads a 32 bit constant into the PC and thus can jump to any address in memory space vectors Idr PC Reset Addr Reset Addr word Reset Handler Whenever the LPC2106 is reset the instruction at 0x000000 is executed first it jumps to Reset Handler From
168. ty e Reporting Problems Wailing Lists e Dhnofhcial Hewsgroups e Gold Stars e Whrror Sites Donations Documentation FAQ e User s Guide e API Reference e Acronyms Contributing Snapshots oource in CVE GNU Cygnus Windows gum F Fi l j gi k GV WITI What Is Cygwin Cygwin is a Linux like environment for Windows It consists of two parts e A DLL feyewinl dil which acts as a Linux API emulation layer providing substantial Linux API functionality A collection of tools which prowide Linux look and feel The Cygwin DLL works wath all non beta non release candidate 1266 32 bit versions of Windows since Windows 95 with the exception of Windows CE Whiat Isn t Cygwin e Cygwin is not a way to run native linux apps on Windows You have to rebuild your application ror source if you want to get it running on Windows e Cygwin is not a way to magically make native Windows apps aware of ONIX functionality like signals ptys etc Again you need to build your apps from source if you want to take advantage of Cygwin functionality Help contact web page other info Historical cygwin into E find a package or or file in the cygwin release get help on using setup exe Install or update Latest Cygwin DLL release version 1s 1 5 15 1 ib Internet The first thing to do is to click on the install icon We need to download the setup executable and a
169. ug Manifest mt MF File 6 27 12005 3 06 PM 182 3075 127 ecipseiplug kaf plugin xml AML Document 6 27 2005 3 06 PM 186 2895 134 a e Mi lt lil gt Selected 0 Files O bytes Total 1102 Files 112 899KB WinZip will ask you into what directory you wish to extract the contents of the zip file In this case you must specify the root drive C Extract C lscratchleclipse SDK 3 1 win32 zip Extract to O Local Disk C af cygwin fy DELL aS Documents and Settings p download My Documents aa DRIVERS H E eclipse f y 1386 My Computer Files Open Explorer window b Selected files holders re Overarite existing files amp 9 All files folders in archive O Fi Skip older files Places Use folder names The WinZip Utility will start extracting all the Eclipse files and directories into a c eclipse directory on your root drive C Extracting src zip At this point Eclipse is already installed some things are done when you run it for the first time The beauty of Eclipse is that there are no entries made into the Windows registry Eclipse is just an ordinary executable file Here s what the Eclipse directory looks like Wr eclipse File Edit View Favorites Tools Help Q Back gt d JJ Search lig Folders BER X de X Falders Mame Type Date Modified E e Local Disk 17 3 configuration File Folder 6 19 2005 7 00 PM C3 armlib E features File Folder 6 19 2005 7 00 PM E ATI 5
170. umption A very good example from this group is the Philips LPC2000 family of microcontrollers The LPC2106 has the following features all enclosed in a 48 pin package costing about 11 80 latest price from Digikey for one LPC2106 Key features e 16 32 bit ARM7TDMI S processor e 64 kB on chip Static RAM e 128 kB on chip Flash Program Memory In System Programming ISP and In Application Programming IAP via on chip boot loader software e Vectored Interrupt Controller with configurable priorities and vector addresses e JTAG interface enables breakpoints and watch points e Multiple serial interfaces including two UARTs 16C550 Fast 12C 400 kbits s and SPI M e wo 32 bit timers 7 capture compare channels PWM unit 6 outputs Real Time Clock and Watchdog e Up to thirty two 5 V tolerant general purpose I O pins in a tiny LQFP48 7 x 7 mm package e 60 MHz maximum CPU clock available from programmable on chip Phase Locked Loop with settling time of 100 us On chip crystal oscillator with an operating range of 1 MHz to 30 MHz Two low power modes Idle and Power down Processor wake up from Power down mode via external interrupt Individual enable disable of peripheral functions for power optimization Dual power supply o CPU operating voltage range of 1 65 V to 1 95 V 1 8 V 8 3 pct o I O power supply range of 3 0 V to 3 6 V 3 3 V 10 pct with 5 V tolerant I O pads oeveral companies have come forw
171. utomatically run it File Download Security Warning Do you want to run or save this file Mame setup exf Type Applicatidn 279 KB From WAAL CY Rin cor Cancel While files from the Internet can be useful this file type car potentially harm your computer IF vou do nat trust the source do not run or save this software what s the risk Now the Cygwin wizard will start up Select Next to continue Cygwin Setup A 14 Cygwin Net Release Setup Program This wizard will quide you through the installation and updating of the Cygwin environment and a plethora of GNU packages gt Setup exe version 242r Copyright 2000 2001 Red Hat Ine http sources redhat com icygvin Choose Install from Internet and then click Next Cygwin Setup Choose Installation Type Choose A Download Source Choose whether to install or download fram the internet or install from files in a local directory Install from Internet C Download from Internet C Install from Local Directory na o N Now we specify a directory where all the downloaded components go our c scratch folder will do just fine Cygwin Setup Select Local Package Directory Ea Select Local Package Directory E Select a directory where you want Setup to store the installation files it downloads The directory will be created if it does not already exist Local Package Directory C scratch Cancel Si
172. w set the Ignore Count to 5 This means that the debugger will ignore the first five times it encounters the breakpoint and then stop Properties for C C breakpoint Common p Comman Filtering Type C C line breakpoint File CHeclipse workspace demo2106_blink_rammain c Line number 61 v Enabled Condition Ignore count 5 File Edit Refactor Navigate Search Project Run Help bra dem E 2 OcDRemote gt Procrem ES pal Cocygwiniusr local binwocdrenate exe H demo2106_blink_ram Embedded debug launch Hga Embedded GDE 9 10 05 4 06 PM Suspended Ege Thread 0 Suspended Breakpoint hib zm 1 main at main c 61 jm 3 Debugger Process 9 10 05 4 06 PI Get used to this sequence Now when you hit the Run Continue button again the program will blink 5 times and stop Don t expect this feature to run in real time Each time the breakpoint is encountered the debugger will automatically continue until the ignore count is reached This involves quite a bit of debugger communication at a very slow baud rate In addition to specifying a ignore count the breakpoint can be made conditional on an expression The general idea is that you set a breakpoint and then specify a conditional expression that must be met before the debugger will stop on the specified source line In this example a line has been added to the blink loop that increments a variable x Double click on that line to set a
173. w Project window appears check if C and C appear as potential projects If this is true Eclipse CDT has been installed properly Mew Praject Select a wizard Wizards us Java Praject Xe Java Project from Existing Ant Buildfile HH E Java H E Plug in Development H E Simple Back Next gt Cancel 6 CYGWIN GNU Toolset for Windows The GNU toolset is an open source implementation of a universal compiler Suite it provides C C ADA FORTRAN JAVA and Objective C All these language compilers can be targeted to most of the modern microcomputer platforms such as the ARM 32 bit RISC microcontrollers as well as the ubiquitous Intel Microsoft PC platforms By the way GNU stands for GNU not Unix really l m serious Unfortunately for all of us that have desktop Intel Microsoft PC platforms the GNU toolset was originally developed and implemented with the Linux operating system To the rescue came Cygwin a company that created a set of Windows dynamic link libraries that trick the GNU compiler toolset into thinking that it s running on a Linux platform If you install the GNU compiler toolset using the Cygwin system you can literally open up a DOS command window on your screen and type in a DOS command like this gt arm elf gcc g c main c The above will compile the source file main c into an object file main o for the ARM microcontroller architecture In other words if you install the Cygwin GN
174. y ME eae Help LPC2000 Flash Utility V2 2 0 Erase Blank Communication Flash Programming Filename Connected To Fart C eclipse workspace demo2 E blink flas ea Cheat Entire Device LUMT m Selected Sectors Use Baud Hate 19200 Execute Code Upload to Flash he after Upload Start Sector U End Sector 14 Time Out sec 2 Manual Heset Use DTR RTS E for Reset and Boot Loader Selection Device Device Lec 06 m Part ID ATAL Freq kHz 14746 Device ID Boot Loader ip Erased LPC2000 Flash Successtully The RAM Buffer screen now appears Click on Load Hex File This is just an operation that fetches the hex file and puts it into the Philips ISP Flash Utility Es LPC2000 Flash Utility RAM Buffer amp H 4000 0000 FF FF FF FF FF Haooo 007 0 amp H 4000 0020 amp H A000 0030 H4000 0040 amp H 4000 0050 amp H 40600 0060 amp H 4000 O70 amp H 4000 0080 amp H 4000 0090 H4000 0040 amp H 4000 D060 H4000 OOCO amp H 4000 QD H4000 00 0 H4000 OOFO H4000 0100 amp H 4000 0110 amp H 4000 0120 H4000 0130 amp H A000 0140 amp H 40060 0150 amp H 4000 0160 amp H 4000 0170 amp H 4000 0180 H4000 0190 amp H 4000 0140 amp H 4000 0180 amp H 4000 1C0 H4000 O1D H4000 TEU H4000 OTFU FF FF FF Uuuuuuuuuuuuuuuuu w FF FPF FR FF Fr FF Load Hes File Upload to RAM Download RAM 2 i 2 Fill Buf
175. y code in crt s to save space You might also ask Do we still clear the bss section The answer is absolutely yes RAM memory powers on into an unknown state We want all uninitialized variables to be zero ar start up Of course stupid programmers rely on uninitialized variables to be zero at boot up this is how they get into trouble with uninitialized variables not all compilers do this automatically At this point if you haven t cleaned and built the project do it now Make sure the BSL jumper is installed Now use the External Tools toolbar button to find the Philips ISP Flash Utility and start it To make sure that we are not fooling ourselves click on Erase to clear the flash memory Es LPC2000 Flash Utility i File Buffer Help PHILIPS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Part C eclipse workspace demo2106_blink_flas a a Entire Device comt Selected Sectors Sosa Cade Use Baud Fate Upload to Flash e EET 5 19200 Compare Flash Manual Reset J E d Sector Time Out sec 2 Device Use DTR RTS Device Lec 06 ELT Part ip E for Reset and Boot Loader ATAL Freg kHz 14746 Device ID Boot Loader ip selection Erased LPC2000 Flash Successfully Now we can be sure that the blinking LED is not the Flash application running Click on Buffer RAM Buffer Operations LPC2000 Flash Utilit
176. z1 x h fw to be loaded into memory code goes into FLASH variables go into RAM g crt s p d main c i Any symbols defined in the Linker Script are automatically global and e E crt o armle jt program E main o armle it SF main out armle To force the linker to use this LINKER SCRIPT just add the T demo210 crt lst 7 to the linker flags in the makefile j E demaz106 blink ram cmd ft mein amp jt LFLAGS main hex pa main map m makefile a The Philips boot loader supports the ISP In System Programming via tt In Application Programming for flash programming from within your apr E bull A The hant ln adndaear 11525 DAM rere tr mod rra MITT BST load irarishleas nr nada ii gt Properties Se Ex BE et G ri 7 lt terminated LPC2000 Flash Utility Program C Program FilesiLPC2106 ISPILPCz1 x ISP exe H B E E Map main map nostartfiles T demozi06 blink ran writable 21 Differences in the RAM Version File CRT S In the startup assembler file used a simple trick to move the startup code away from the vectors to ensure that it doesn t encroach on the Philips ISP Flash Loader low RAM area C C crt s Eclipse Platform mfx File Edit Navigate Search Project Run Window Help G G G O Q O H eS ee SM A B demo2106 blink ram cmd Bi crt s a iSc e B v PC FIQ Addr An EN is mot le demo2106 blink Flash Soar Q Binaries A Reset Addr
177. ze cra lt Initialize 54 gt zInitialize raa zInitialize r3z Initialize 296 gt lsl 16 lsr 16 lsr 10 r3 r3 1 Oxl r3 0 x Ox400003ce lt Initialize 60 gt r3 Eos E35 If we click the otep Over button bO0x400005 0 Connect the PLL as the clock source PLLCOMN O0x3 capp ae en Initialize 104 gt Initialize 105 gt lt Initialize 112 gt Initialize 116 gt F 5360870912 gt xe uu ngdg agul r3 2060766 Ox1fc000 r3 128 OxBO 3 gt OUx3 r3 Ear r3 E rZ ES Ox400003 4 Ox400003 8 Ox400003fc Ox40000400 feed Ox40000404 lt TInitialize 120 gt 040000454 lt feed gt in the Debug view the debugger will execute one assembler line Outline fe Disassembly xo Za Ox40000308 lt Initialiset 76 gt mov r3 r3 lal 16 Ox400003de lt Initialize S50 gt mow r3 r3 lsr 16 Ox400003e0 lt Initialize 54 gt mow r3 r3 lar 10 Ox400003e4 lt Initialize 55 gt and Eds Ed HI Oxl Oax40000s5eS lt Initialize 22 gt cmp r3 0 0x0 Ox400003ec lt Initialize 26 gt ber Ox40000305 lt Initialize 50 gt Connect the PLL as the clock source PLLCON x3 4 Ox400003f0 lt Initialize 100 gt mow r3 S36870912 Oxeooooooo Ox400003f4 lt Initialize 104 gt add r3 r3 2060766 ae Ox400003f8 lt Initialize 105 gt add r3 r3 128 0x80 Ox400003fc lt Initialize 1l2 gt mow rz H3 OS Ox40000400 lt I
178. zip embeddedcdt 200xmmdd zip and zylincdt 200xmmdd zip to the Eclipse directory Download the following two files from the Zylin web site http www zylin com embeddedcdt 20050810 zip http www zylin com zylincdt 20050810 zip Zylin discuss embeddedcdt binary snapshot CDT 3 0 RC3 yvind Harboe oyvind harboe at zylin com Wed Aug 10 09 12 41 CEST 2005 e Previous message Zylin discuss dispplay the remote memory content e Next message Zylin discuss embeddedcdt binary snapshot CDT 3 1 e Messages sorted by date thread subject author Changes updated to CDT CVS HEAD before installing this version take special care to delete all previous versions of the zylin CDT embedded plugin all launch entries for the Zylin CDT embedded plugin Installation http www zylin com embeddedcdt html Download binary a http www zylin corm embeddedcdt z 0050810 zip Dad UU Y gt IT PIW CALAT LALL Mus 1 LILI LIO D http www zylin com zylincdt 2z0050810 zip Source code In zylincdt yyyymmdd zip above The patches to CDT are in the files named org eclipse cdt debug mi core txt yvind Harboe http www zylin com First click on http www zylin com embeddedcdt 20050810 zip to download Then click on Save in the File Download window File Download Do you want to open or save this file 3 Mame embeddedcdt 2 0050810 zip Type Winzip File 11 2 ME From www zvlin

Download Pdf Manuals

image

Related Search

Related Contents

取扱説明書  CitiDISK DV2-QR 取扱説明書  Electronic Solar Switch - DC circuit breaker for SMA inverters  Samsung SCX-1000 Series User's Manual  MODE D`EMPLOI ET MANUEL D`ENTRETIEN  IOS-408 User`s Manual    Astronomie und Spektroskopie - Astrophysik Kiel  

Copyright © All rights reserved.
Failed to retrieve file