Home
ARM Cross Development with Eclipse REV-3
Contents
1. ys free ram ty d ram i i A aaa ne mene eG oe eee We ae el 0x40000234 lt _bss_end A bss uninitialized variables At Dar oia a 0x40000218 lt _bss_start edata tf d Xr J data initialized variables tf i 0x40000200 data _ x y variables used by 0x400001FF g ram isp low Philips boot loader 223 bytes 0x40000120 R pe Ox4000011F ty ram vectors free ram A e e e Ox40000040 Ox4000003F Interrupt Vectors re mapped ty 64 bytes Ox40000000 R tf gt OXOOO1FFFF pe y s al rca te ad aaa PS Ox0000032c pe pe copy of data area flash pe 0x00000314 z _etext pt YF pe Ox00000180 main pe Ox00000278 feed ufi i main i OxXO00002c4 FIQ Routine Ox00000206 SWI Routine t7 OxOO0002ec UNDEF Routine 0x000002b0 IRQ routine it i
2. Tasks EJ Console HN B Ex BEEF El C Build demo2106 blink Flash Writable Smart Insert 14 26 We re going to try to toggle a single V I O bit specifically PO 7 which is the CEU Olimex red LED By the way with E this hardware arrangement U1 26 13 TXD R12 P0 7 1 turn off LED fs RICK PO 8 TADO PAML oa 330 P0 7 0 turn on LED g Dese o 2 scL cape g 18 Pe RST Pa 2 SCL CRP0 0 pp T PQ 3 SDA MATO Q Spo PO 4 SCK CAPO 1 Sis NY LED P Pa 5 MISO MATO 1 oe 20 NC1 PQ 6 MOSI CAPO 2 28 ED Ss NC2 PQ 7 SSEL PUN2 SS pos aa NC3 P 8 TXDL PWM4 H tt 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 P0 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 l O bits So we don t have to bother with the Pin Select registers in this
3. 0x00000ice initialize 0ox000000D4 Startup Code i assembler qe 2 3 Ox00000040 Reset Handler 0x0000003F Interrupt Vector Table unused pr 64 bytes A 0x00000000 startup pe 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 v v MEMORY pe i ram isp low A ORIGIN 0x40000120 LENGTH 223 t 1 Author James P Lynch sf Ex La x x x x x x x o o a e a a a a a a a identify the Entry Point ENTRY startup specify the LPC2148 memory areas MEMORY flash ORIGIN Q0 LENGTH FLASH ROM ram isp_low A ORIGIN 0Ox40000120 LENGTH variables used by Philips ISP bootloader ram ORIGIN Ox40000200 LENGTH free RAM area ram isp high A ORIGIN Ox40007FE0 LENGTH variables used by Philips ISP bootloader ram usb dma ORIGIN Ox FDOOODO LENGTH on chip USB DMA RAM area not used define a global symbol stack end Stack end 0x40007EDC now define the output sections SECTIONS 0 set location counter to address zero startup startup gt flash the startup code goes into FLASH text collect all sections that should
4. J2SE TM Runtime Environment 5 0 Update 2 Click below to download gt Offline Multi jre 1 5 0 it AS 1596 p exe 15 25 MB amp Linux Platform Linux RPM in self extracting file jre 1 5 0 02 linux i586 rpm bin 15 27 MB amp amp Linux self extracting file jre 1 5 0 02 linux i585 bin 15 78 MB amp 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 sparcva sh 8 33 MB Solaris x86 self extracting file jre 1 5 0 02 solaris i585 sh 14 44 MB 2 Solaris AMD64 self extracting file jre 1 5 0 02 solaris amdB4 sh 4 72 MB 2 Linux AMD64 RPM in self extracting file jre 1 5 0 02 linux amd64 rpm bin 14 91 MB p Linux AMD64 self extracting file jre 1 5 0 02 linx amd64 bin 15 41 MB 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 immediately Windows Offline Installation Multi language jre 1 5 0 z windows I585 p exe 15 75 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 Do you want to run or save this file Mame jre 1 5 0 z windaws ib86 p exe Type Application 15 2 MB From sumsdici 11 vhoski sun cam
5. Dvenarite existing files Skip older files Use folder names To verify that Eclipse had the CDT installed properly start Eclipse by clicking on the desktop icon E Eclipse 3 1 When Eclipse starts click on File New Project Resource Eclipse SDK Beic AES Edit Refactor Navigate Search Project Run Window Help Mew AlE 4 ShifE M Open File Close Chrl F4 Close All Ctrl Shift F4 H save Chrl s E Save S Save All Ctr Shift 5 Revert Move Rename Fz Refresh F5 Convert Line Delimiters To y Print Ctrl P Switch Workspace g g Import p Export Properties Alt Enter 75 Folder E Project EST Resource a 1 File F Untitled Text File Fy Other Ctrl M fresas In Folder Loc ii gt When the New Project window appears check if C and C appear as potential projects If this is true Eclipse CDT has been installed properly Mew Project Select a wizard Wizards dem Java Project o BE Java Project From Existing Ant BuildFile i E Plug in Development H E Simple conca If you don t see the C and C listed here s what might have happened It s possible to disable the CDT plug in To see where this may be done click Help Software Updates Manage Configuration Project Run Window E G 3 gt E welcome main c gt El 2 Help Contents fe RARRRARASR EP Search FE Qo gt r e
6. 3 Java Application symbal file main out Ju JUnit set pc 0x0 coo J JUnit Plug in Test por Ea ma XU 3 continue Remote Java Applicakiot SWT Application Apply Revert The following is a list of commands that are executed when the Eclipse GDB debugger starts up target remote localhost 8888 monitor reset monitor softbkpts off symbol file main out set pc 0x0 thbreak main continue Let s go through these commands one by one target remote localhost 8888 This is a GDB command that specifies communication with the remote target via Remote Serial Protocol GDP will use internet port 8888 which is the default port that the Macraigor OCDRemote uses monitor reset Command sent to OCDRemote that resets the CPU monitor softbkpts off Command sent to OCDRemote that controls breakpoint specification softbkpts lt ON OFF gt ON use both hardware and software breakpoints default OFF use only hardware breakpoints for stopping and source stepping CPU This means that all breakpoint commands will be directed to the ARM7 hardware breakpoint circuits There are just two hardware breakpoint circuits so you must limit yourself to only two breakpoints at a time symbol file main out This is a GDB command to read the symbol file main out to extract its symbol information and statement and variable addresses set pc 0x0 This is a GDB command that sets an ARM register In this case we set
7. 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 amp lkmlm 3 G 35 OQ Q i 9 04 d 5 e ES Raci i Ee C C Projects 3 Navigator O B om E ar Me NE SOE rr r CA CA C TTT PPP aaa r ao JAN arations i TEERE RAE AA nr cnc cr cr cnn nr cr rrr cr rr rr n FS EJ demozi06 blink flash dl E 4 demoz106_blink_ram m 9 Binaries i Includes id Initialize roid H im Ipezi x h id feed void fe 8 crt s m e main c i IRQ Routine ivoid _ attribute _ interrupt IRQ j j amp nj crt o armle id FIO Routine void attribute interrupt FIO j Ea main o armle SWI Routine void attribute interrupt SWI 6 5 main out armle void UNDEF Routine void attribute interrupt UNDEF m cre lst mri demo2106_blink_ram cmd gORCHCKCh Ch CH K Ok Ch Hh KOKCh Ch hOKCK Ch HCHCKCh hh KCh Ch hck Ok ch h Wok Ch h A k h ck h a Ch hh ARANA NARA 2 man om Header files Bj main hex LB main map SF makefile Problems E Console EZS 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 lau
8. LPC P2148 PROTOTYPE FOR LPUC2148 ARM TDMI S MICROCONTROLLER noooooooe DHUgmur l is I I I I poooopoopogooaoe t n T I I I I I I numm e Li E x a L gagaaggaagadaadac ouricx s n B L H BH Hl Car H D U n JB 6 n 3 1s LEALL HI nd a on o HTC 2085 i fi Fra Z d TI Ere enr j I pm LEDI la HHH ULIMEX COMZDEU y COPYRI um EE fu d m a Note that the BSL jumper has been replaced with a blue dip switch 1 at the upper left Set towards the crystal is the run position set to the left near the RS 232 connector is the flash programming position The JTAG jumper and the 20 pin JTAG connector are at the extreme upper left The red reset button is between the dip switch and the JTAG connector The wall wart power supply the RS 232 programming cable and the JTAG adapter are all the same Note that there are two LEDs above the two push buttons The schematic shows that LED is connected to GPIO port P0 10 That s different from the LPC P2106 board The schematic also shows that the crystal is 12 MHz That s different also This means that the Phased Lock Loop PLL setup will have to be revised The memory map is different as the newer LPC2148 has 512k of FLASH and 40K of RAM We ll have to recalculate all stack locations The User Manual shows that the LPC2148 supports high speed IO ports this c
9. Location D Program Files LPC2106 ISP PC210x ISP exe Browse Workspace Browse File System Variables Working Directory Browse Workspace Browse File Svstem Variables variables Mote Enclose an argument containing spaces using double quotes p om Apply Revert O 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 Mag Tit i e oO e F Run Last Launched Ctri F11 M Debug Last Launched Fil Window Help C C Projects t amp Mavigator 22 T as Run History Run AS Run p Debug History Debug s Debug X External Tools Run AS QL External Tools 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 E Favorites e MOYE I p Down Click the selection box for LPC2000 Flash Utility This will add it to the favorites list Selection Needed Select Launch Configurations FIQ 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 C C Eclipse Platform ad File Edit Navigate Search Project MA
10. Problems AECA Properties Search C Build deme2106 blink Flash ouccess is at hand the expanded Projects view in the Navigator pane on the left shows our imported files C C Eclipse Platform E B File Edit Navigate Search Project Run Window Help m Ej ecic Resource n J m El An outline is mot available H AG Includes l K Ipczi x h m s crt s El e main c 2 demaoz1086 cmd Ed makefile fdemozi 8 blink Flash This is a good place to identify the imported source files Description of Project Files loc210x h Standard LPC2106 header file Startup assembler file main c Main C program Crt S makefile GNU makefile demo2106 blink flash cmd GNU Linker script file 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 peripherals 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 LS Navigate Search Project Run Window Help ab E 89 d 9 35 Q Q Ge C C Projects 23 demo2106_blink_Flash 22 Includes h Ipcz103 h s crt s d main c demo2106 cmd KA makefile H e Ipez10x h El E h d ee of ee of of Bifndef Budef ine LPC21HWz H LPC21Hx H
11. ff Initialize the system Initializeil ff set io pins for led PD 7 IODIR OxO0O00008O ff pin PO 7 is an output everything else is input after reset IOSET OxOO00000s80 led off IOCLE OxOO000080 led on ff endless loop to toggle the red LED PO while 1 for 3 O 3 5000000 j wait 500 msec IOSET x DO0OOSD ff red led off for 3 O 3 5000000 j 7 ff wait 500 msec IOCLE x g 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 elther by breakpoint or pause static char v Jx 3 static int f 7 const char z yet The Pain in Spain struct EntryLock i long Key int niccesses char name is ccess 14705 D Spiderman For a structured variable parking the cursor over the variable name will show the values of all the internal component parts LALL CILA Y AU xXLI if SLaALLE LILL LALLU YAL Laan LE static int z YT ff static initialized variable const char tpText The Bain in Spain struct EntryLock 4 long key int niccesses char ame 16 iedess 14705 0 Spiderman i 14705 n ccesses 0 name Spi ff Initialize the system Initializel fo set io pins for led PO 7 IODIR OxO0O00008O pin PO is an
12. 6 Recalculate the Stacks The memory maps of the LPC2106 ARM processor and the newer LPC2148 ARM processor are different The LPC2148 has more FLASH and less RAM This effects the stack placement LPC2106 AHB Peripherals VPB Peripherals 4 0 GB DxFFFF FFFF 375GB xF OOQ 0000 345GB xEDDO 0000 30GB OxCO00 0000 Reserved for Extemal Memory 3a 0x8000 0000 Boot Block re 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 Ox0002 0000 l 00001 FFFF 128 kB On Chip Non olatile Memory 00000 0000 0 0 GB 4 0 GB 3 75 GB 3 5 GB 3 0 GB 2 0 GB 1 0 GB 0 0 GB LPC2148 RESERVED ADDRESS SPACE BOOT BLOCK 12 KB REMAPPED FROM ON CHIP FLASH MEMORY RESERVED ADDRESS SPACE B kB ON CHIP USB DMA RAM LPC2146 2148 RESERVED ADDRESS SPACE 32 kB ON CHIP STATIC RAM LPC2146 2148 15 kB ON CHIP STATIC RAM LPC2142 2144 8 kB ON CHIP STATIC RAM LPC2141 RESERVED ADDRESS SPACE TOTAL OF 512 kB ON CHIP NON VOLATILE MEMORY LPC2148 TOTAL OF 256 kB ON CHIP NON VOLATILE MEMORY LPC2146 TOTAL OF 128 kB ON CHIP NON VOLATILE MEMORY LPC2144 TOTAL OF 64 kB ON CHIP NON VOLATILE MEMORY LPC2142 TOTAL OF 32 kB ON CHIP NON VOLATILE MEMORY LPC2141 DxFFFF FFFF OxFOOO 0000 DxEDQOU 0000 0xC000 0000 08000 0000 Dx7FFF DODD DxzFFF CFFF Dx7FDO 2000
13. Hun J save Cancel potentially harm your computer IF you do nat trust the source da nat Y while files From the Internet can be useful this file type can Iun or save this software what s the risk Now the downloading will start Saving 15 0 z windaws ibB6 p exe From sunsdlci 11 vhask1 sun com Estimated time left 45 sec 3 09 MB of 15 2 MB copied Download Eo Ce Mjre 1 5 0 O02 windows i5686 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 vou 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 Finish 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 J25E Runtime Environment was indeed installed f Add or Remove Programs TT Curre
14. 14 Execute Code lv after Upload Manual Reset Device LPC2106 TAL Freg kHz 14746 Read Device ID File Upload Successfully Completed LPC2000 Flash Utility V2 2 0 Communication Connected To Port COMI ki Use Baud Aate 19200 Time Dut sec 2 Use DTR RTS for Reset and Boot Loader Selection Remove the BSL boot strap loader jumper and hit the RST button r B4 OLIMEX LTO MOR WE is COPYRIGHT C gt 2083 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 r LPFLTEPIDIIPITIIILIJ 0000004401 da ia ia ia Is oir ioo o 45 15 e Ie Ie e I e I8 Ir fr e fepe ein To Io In e e e Ee e de a I rr edere opel oe poe ege gon IT Ir pops In Io Io Io Too De Ie To I9 To Dn ATP II TIITIB mei Ii 7 Ir fro dede Io Ie felolo Io Io Io Io t Iris TeieieIeleleno Io r 14 As LS E E E E 3 2 PE ELELEE E see n Ue SR piyi GQ a d ca e m e e dias dia o Wo L t a o po s EE B ee E r 9 B OK admit it this photo has the reliability of a Bigfoot video 19 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
15. Address E D Program Files PC2106 ISP m Folders x Name 4 Size Type Date Modified ag Pc2inx IEP 515 KB Application 3 17 2004 10 28 AM Program Files 8 a E Prog fa E ST6UNST 3KB Text Document 7 11 2004 1 55 AM EE E 321Studios E Adaptec E Ej Adobe E E AIMOS el America Online 7 0 E E America Online 8 0 E E America Online 8 0a EE E 40D E E amp OL Companion e lO Applied Insights E lA ATI Multimedia e G ATI Technologies E E Autodesk EE O as E i Common Files zy ComPlus Applications EE p Futuris Imager E Gemstar E O GNUARM 3 Google E E HP El E MSI a B InstallShield Installatioi e A Internet Explorer E G iPod E gt Tunes ala Java C3 LPC2106 ISP A Meaccennar li er mn 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 P 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 Im HBI a lecro 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 E Browsing CVS Repos
16. PLLSTAaAT PLOCE Connect the PLL as the clock source PLLCON x3 teedii ff Enabling MAM and setting number of clocks used for Flash memory fetch 4 cclks in this case MANCR Ox2 MANTIMN Ox4 Setting peripheral Clock pelk to System Clock ceclk VPBDhIV x 8 Controling the LED I O Port There are two things to consider here First the Olimex LPC P2106 board had the LED attached to port P0 7 while the newer LPC P2148 board has two LEDs LED1 is attached to port PO 10 Also the LPC2148 has the new fast I O ports designed to satisfy the scores of customers who complained about how slow the toggle rate was on the LPC2106 ports In the code snippet from main c below note that we set the System Control and Status Flags Register SCS to enable the fast I O ports The LED1 is in the port O setup so that is identified as FIOOxxx in the Ipc214x h file MAIN C Code Snippet ff set io pins for led P0 10 303 x 3 ff select the fast version of the I O ports FIODODIR OxO0000400 ff pin PO 10 is an output everything else is input after reset FIOOSET 0x00000400 led off FIOOCLE 0x00000400 led on ff endless loop to toggle the red LED PO 7 while 1 for ij 0 4 lt 5000000 j wait 500 msec FIODSET 0x00000400 red led off for ij 0 j lt 5000000 j wait 500 msec FIODCLE OxOO0000400 red led on This completes the conversion of the fla
17. 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 demo2106_ blink ram Project contents jw Use default Directory Ci eclipse workspace demoz106_blink_ram Browse lt Back Mex Cancel 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 prs lim G 6 d Q 3 O Q 10 9 1 05 ES Rjcice ca m ca Ol 8 o 2 ag ca B E E E v An outline is not available eS demo2106_blink_flash AS demo2106_blink_ram Problems El Console x Properties A 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 cre lst O crt o I8 crt s MJ demoz106 blink ram cmd Ipc210x h main c O E main dmp O E main hex D E main map O E main o D
18. 40000520 OO OO 00 FO E1 FF arii mr an an nn nn 7A rr FF li gt Now we have a split pane display of the memory in hex and ASCII Console Eiman r Fe st GE Eu E emory x e Memory Renderings EE x Memory Renderings E Box nniFar vue 4 04000044 Ox400004F4 Ox400004F4 lt Hex gt Ox400004F4 Ox400004F4 ASCII gt l C 400004F0 00 oo oo oo 68 65 400004F0 e R 20000500 53 7O 61 63 BE au nu 40000500 a p a i n O O O O 40000510 5 oo 00 ad 15 as oo 40000510 O Oo Oo L1 a O O E F 40000520 6G 61 bE 20 61 o T3 20000520 h a n a B8 p e 40000530 75 Bc Bc 65 74 au nu 20000550 1 1 1 e t O O O O 240000540 n5 oo Do au 1 au nu 2000054 O Li O O O O O O O 40000550 oo oo 00 oo oo oo oo y 40000550 O Oo Oo Oo Oo Oo Oo Oo Oo Y 40000560 nu au 0d g EU E1 FF E pooo560 O Li LI LI Y O O E 4000050 au nu Do au 8 EC FF g ngg5s5780 O Li O O x i Y O x 20000550 nu nu Do au EU E1 FF 40000580 O Li O O a a Y LI LI 400005230 oo oo 00 ad 8 EC FF 40000590 O Oo Oo Oo X i Y O x 40000540 au oo Do au EU E1 FF 2000540 O Li O O Y O O 40000560 nu nu Do au Ta EC FF 400005560 O Li O O x i y O x 20000520 au nu Do au EU E1 FF 2pooosc lt 0o O Li O O a a Y LI O 4nnnnsnn nn nn A A 4nnnnEnn n mn n n v 4 al nl sy IM lll gt E lii gt Click on the Link Memory Rendering Panes E button This means that scrolling one memory rendering will automatically scroll the other one in synchronism Click on the Togg
19. Boot Block re 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 10GB 0x0002 0000 l 0x0001 FFFF 128 kB On Chip Non Volatile Memory 0x0000 0000 0 0 GB Resource demo2106_blink_flash cmd Eclipse Platform SE File Edit Navigate Search Project Run Window Help Is H imm IA Hl eo ES Resource Ta Navigator 23 N i A 8 crt s B demo2106 blink flash cmd X S crt s main c main map demo2106_blink_ram cmd E E demo2106 blink flash i identify the Entry Point cdtproject project ENTRY startup crt Ist crt o crt s demo2106_blink_flash cmd specify the LPC2106 memory areas Ipc210x h main c MEMORY main dmp main hex flash ORIGIN O LENGTH FLASH ROM M ram isp_low A ORIGIN 0x40000120 LENGTH variables used by Philips ISP bootloader iain ram ORIGIN 0x40000200 LENGTH free RAM area main out makefile ram isp_high ORIGIN Ox4000FFEO LENGTH variables used by Philips ISP bootloader s demo2106_blink_ram ES p pu e OY Eu a e E p pu pae p define a global symbol stack end stack end Ox4000FEDC Tasks EJ Console x i 77 Ex BB so a E lt terminated gt Insight Program C Program Files GNUARMbinarm elf insight exe Writable Insert 156 24 First
20. EA NONE e HTTP HMH OLIMEX COM DEU e In this mode the Eclipse GNU development system assembles compiles and links your application for loading into FLASH memory The output of the compiler linker suite is an Intel hex file e g main hex The Philips LPC2000 Flash Utility is started within Eclipse and will download your hex file and program the flash memory through the standard COM 1 serial cable The Boot Strap Loader BSL jumper must be shorted installed to run the Philips flash programming utility Next you remove the Boot Strap Loader BSL jumper and attach the JTAG cable or just leave it in By starting the OCDRemote utility the Eclipse debugger can operate in FLASH with two hardware breakpoints The Eclipse debugger will initialize the GDB debugger by loading the symbols from the output file main out It will also instruct the OCDRemote utility to convert all Eclipse software breakpoints to hardware breakpoints It will set a temporary hardware breakpoint at main and set the PC to 0x000000 the reset vector This will start execution and the Eclipse debugger will stop at main Now you can debug to your heart s content as long as you dont specify more than two breakpoints 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
21. Ml p2 85 m 3 1 MM r4 One FFFFFFR eC 2c000 AM r5 2147482932 Disable ma r5 1073742120 x Display As Array mn 1010 r amp 1658272053 1010 ra 1109953465 Restore Original Type W r10 2105601601 Find variable Ctrl F pm r11 1073805976 NS MM r12 1073805964 Ms Mel Sp 1073805964 Add Register Group mur Ir 1073742792 Restore Default Register Groups ol pc 1073742832 l m Fo O Farmat LS HT A 0 im F2 0 23 Watch ot f3 0 Mui 0 Mu FS 0 eiui F6 0 mna ff O Wn fps 0 MOO cose 536871120 W Enable ut Cast To Type Now the value for r7 has been changed to Ox1F8 E A Main AMM ro 110 MME rl 0 MM 12 85 1910 r3 1 Mi 19 OxfFFFFFFFennzcODO 100 p5 2147482032 100 r amp 1073742120 100 r7 Oc FB 4 ra 1656272053 1010 0101 i Variables Registers 3 oS 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 Q 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 ERE Help New Window New Editor i a US i gt j U 0Olvar Open Perspective Shor View unch Customize Perspective Sg Breakpoints Alk Shift O B DE
22. button and its down arrow to pull down the available tools Click on LPC2000 Flash Utility to start the Philips Boot Loader Resource demo 106_blink_flash cmd Eclipse Platform Fie Edit Navigate Search Project Run Window Help ta S i G Gc Navigator El Sl 1 LPC2000 Flash Utility Nip M hilips boot ipplication I a 3 Insight Run As Elles demo2106 blink F si cdtpraject project crt sk QL External Tools mot loader 1 m crea Organize Favorites d crt s HAM used by hoot Sri demoz106_blink_Flash cmd p 7 2n Ipcz1 x h e p E main c ES pu main dmp ft main hex ft p main map m main CIE LL LZ D main aut j MH makefile EE ceni RA hi aa ut n The Philips LPC2000 ISP Flash Programming will start up Es LPC2000 Flash Utility File Buffer Help DH l a DS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Port C eclipse workspace demo2106_blink_flas oe Blan Check f Entire Device coMt C Selected Sectors Uned Slegin F Execute Code Use Baud Rate i after Uploac Start Sector Poo LESA Erase Compare Flash Manual Reset ELLE Eg St 14 Time Out sec El Device Use DTR RTS Device for Reset and LPC21 04 Read Part ip m pps ATAL Freg kHz 14746 Device ID Salt SET in selection Now fill out the LPC2000 Flash Utility screen Browse the workspace for the main he
23. ff Initialize the system Initialize set io pins for led PO 7 IODIR OxO00000060 pin PO is an output everything lil E Console 23 7 Tasks E miE rmrm OCDRemote Program C cygwinusrilacal binycdremote 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 The GDB load command shown above downloads the executable into RAM Here is an example of OCDRemote failing Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help Ca gt lim 3 Q Q i99 9 Pi bl H e o Ej B cic Debug ii Debug x A fbd variables 53 7 Breakpoints 8 E Sx CRUS EQ lt term n Ipczi x h La makefile 8 main c Da int main ivoid i unsigned int Static int ff li b c ff static un static unl 1 ff statis in static initia OxD4 static in Y static in pText The Rain in Spain static char static int static long static char N 4 d og nn og ue static int const char ff Init
24. 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 cucvgwinibinic cy guiniusr local bin 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 At this point we have all the GNU tools needed to compile and link software for Windows Intel computers lt 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 Rick Collins 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 qnuarm 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 ma
25. mak i Fie Edit View Favorites Tools Help Q O Y JO search Ps Folders lr XX 6 ES va Control Panel Ed X EN tp 2a DA Accessibility Add Hardware Add or Administrative Automatic BDE Date and Time G Switch to Category View Options Remowv Tools Updates Administrator A y 25 w o Hg v Display Folder Options Fonts Game Intel Intel R Intel R Controllers Modem on Extrem PROSet Wired See Also A Windows Update 9 Help and Support Y En D T gt va e Internet Java Keyboard Mail Mouse Network Network Setup Options Connections Wizard L amp t 5 e EB e Phone and Portable Media Power Options Printers and QuickTime R Regional and Modem Devices anguage 2 e 9 g Scanners and Scheduled Security Sounds and Speech System Tagfbar and Cameras Tasks Center Audio Devices 3 e e a User Accounts Windows Wireless Firewall Network Set Now click on the Advanced tab below System Properties System Restore Automatic Updates aris General Computer Name Hardware Advanced System Microsoft Windows lt P Home Edition Version 2002 Service Pack 2 Registered to Jim Lynch 76477 0EM 0011903 00102 Manufactured and supported by Dell Dimension DIM3000 Intel R Pentium R 4 CPU 2 80G Hz DOLL 2 79 GHz 512 MB of RAM Support Information Now click on the Environment Variables button System Properties System Restore Automati
26. roD d Main 35 Debugger EN Commands Es Source E Common 8 Eclipse Application E Fc Embedded debug launct Commands 3 demo2106_blink_Fla 86 demoz106_blink_ran Jawa Applet 3 Java Application 4Ju JUnit Ju JUnit Plug in Test p Remote Jawa Application sa SWT Application target remote lacalhosk 8888 load Apply Revert TM The target remote command specifies that the protocol used to talk to the application is GDB Remote Serial protocol 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 In this case the load command will download the executable code into RAM and the Eclipse GDB debugger will use the symbol information contained within the main out file to locate all statements and variables When we debug FLASH programs we can t use the load command since the GDB debugger cannot program FLASH memory In this case we will use the Philips Flash Utility to burn the executable into FLASH and substitute the GDB command symbol file main out to provide the debugger with the statement locations and symbol information There is more on this later in the tutorial The source tab can be left at its default settings Likewise the commor tab can be left at its default setting Click
27. set MODE SVC 0x13 Supervisor Processing Software Interrupts Mode set MODE ABT 0x1 Abort Processing memory Faults Mode set MODE UND Ox1B Undefined Processing Undefined Instructions Mode set MODE SYS Ox1F System Running Priviledged Operating System Tasks Mode set I BIT 0x50 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 lt Tm Tasks Bg Console 3 tu B Ex eO rien C Build demo2106 blink Flash This part of the crt s file sets up the interrupt vectors Note that all of the code and data that follows goes into the text section It 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
28. static char j a d static int W 5 Y const char tpText The set io pins for led PO 0400002584 lt main 16 gt ldr ES IODIR OxOO000080 pin PO 7 is an output everything Ox40000288 lt main 20 gt str E3 IOSET x aonganosn0 led off IOCLR oOxo00000080 fo led on Initialize the system Si il Si L jl El Console a Tasks Memory se Es BB mE PF1 demo2106_blink_ram Embedded debug launch Debugger Process 9 9 05 12 38 AM gdb target remote localhost S5858855 qgdb load isectlon rtexr secrtion size 1ls 08 toral size 251 5 Section data Seccion 1 e 4 tpotal si2e 2515 gdb H Components of the DEBUG Perspective Before operating the Eclipse debugger let s review the components of the Debug perspective Debug main c Eclipse SDK Sel File Edit Refactor Navigate Search Project Run Ms Help ta gt lima 5 0O Q 1099 103 e Pr ES Debug Resource Debug ZN B 1 mot 34 0 e cs TES resieonts Expressions Modales Registers Signals 4 E Q OCDRemote Program j 4260351 pa C cygwin usrilocal bin ocdremote exe 9 a 0 R 2 36 demo2106_blink_ram Embedded debug launch 69 b 0 Variable display 2 Embedded GDB 9 10 05 1 10 PM Suspended Debug c 0 2 Thread 0 Suspended 9 d B reakpol nt summ ary 1 main at main c w oa M cni a PM Co ntrol 8 x Heg ster d ISP
29. 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 CPSHR c ZMODE UNDII BIT F BIT This puts the CPU in undefined mode mov sp r0 stack pointer for UND mode is 0x40000FEDC sub r0 r0 FUND STACK SIZE Register RO is now 0x4000FED8 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 FMODE ABT I_BIT F_BIT this puts CPU in Abort mode mov sp r0 stack pointer for ABT mode is 0x4000FED8 sub r0 r0 ZABT STACK S
30. 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 5 X Saving embeddedcdt 20050810 zip From wa zylin com Estimated time left 1 min 38 sec 2 41 MB of 11 2 MB copied Download to Ciscratchlembeddedcdt 20050810 zip Transfer rate 97 9 KB 5ec C Close this dialog box when download completes Open Open Foldd A 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 Mame 2ylincdt 20050810 zip Type Winzip File 173 KB From Wii zlin com om M see JY re Always ask before opening this type of file harm vour computer IF you do nat trust the source do not open ar Y While files from 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 3 scratch Save in CD embeddededt 20050810 My Recent Documents My Documents My Computer File name My Network Save as type WinZip File The second Zylin CDT zip file will download into the c scratch folder This file is a shorter file only 173 Kb Download complete 173 KB in 1 sec Cuscratchzylincdt 20050810 zip 173 KB Sec Downlo
31. 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 0 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 t Resource crt s Eclipse Platform File Edit Navigate Search Project Run Window Help Ci gt UE BIA e ro E ES Resource e an H T h d Eie demoz106 blink Flash F Roset Handler PO cdtpraject project Reset Handler j crt Ist crko Setup a stack for each mode note that this only sets up a usable stack crt s for User mode lso each mode is setup with interrupts initially disabled demo2106_blink_flash cmd Ipe210x h r stack end i main c CPSR_ c MODE_ UND I BIT F_BIT sor ipsicl neo j Miser ete imi More lt Se E main dmp sp r P all nes r0 r0 FUND STACK SIZE e e CPSR c SMODE ABT I BIT F BIT ibort Mode main j sp r eb r rO FABT STACK SIZE EAE maketile ES demesine blink ram EPSR c MODE FIO I BIT F BIT FIO Mode cdtpraject sp r project r r FIQ STACK SIZE crt let CPSR c SMODE IRQ LI BIT F BIT IRQ Mode j crko sp ru j s T ro ri SIRO STACK SIZE demo2106_ blink ram cmd CPSR c SMODE SVcC i BLT F BIT Supervisor Mode
32. 35 O Q 0 9 JO 0 c specify the LPC2106 memory areas MEMORY i flash ORIGIN OxO0000000 LENGTH free FLASH EPROM area ram ORIGIN Ox40000000 LENGTH free RAM area define a global symbol stack end E stack end OxX4b00FEDC A Problems El Console 33 E Xx b w G ri 7O lt herminated gt LPC2000 Flash Utility Program C Program Files LPC2106 ISPILPC210 _15P exe writable Insert 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 F3 ES E imi e 65 CRAC 3 0 ME 9 e 45 4 he Fy arc gt gt now define the output sections SECTIONS 1 startup i startup ram the startup code goes into FLASH collect all sections that should go into FLASH after startup text all text sections code Fodata all rodata sections constants strings etc Fodata all rodata sections constants strings etc w Glue 7 all glue Y sections no idea what these are Glue tj all glue 7t sections ino idea what these are
33. 9 9 05 12 38 APT Suspended El gf Thread 0 Suspended E 1 lt symbol is not available gt iss wal Debugger Process 9 9 05 12 38 AM 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 r u 5m i O Q lc ei e Debug X bh EQ OCDRemote Program a Cicvgwinusrlacalbinyacdremote exe El St demo 106_blink_ram Embedded debug launch Bee Embedded SDB 9 9 05 12 38 AM Suspended E g Thread 0 Suspended zz maint at main c 46 Debugger Process 9 9 05 12 38 AM makefile Le main c 3 El outline pr Disassembly x int main void i 8 int main void i Ox40000z274 lt maln gt mow riz E ff Li Ox40000278 lt main 4 gt stmdb sp secs static un Ox4000027e lt main 5 gt sub ril static un Ox40000280 lt main 12 gt sub sp unsigned int static int static char E Ll static in fo static initia unsigned int 0x04 static in static int static int z 73 static in static char const char calla gt la a a alias static int static long x Initialize the system Static char 0x04 Initializei l static int 7 static long x
34. Dx7FDO 1FFF Dx7FDO 0000 Ox FCF FFFF 04000 8000 04000 TFFF 04000 4000 04000 3FFF 04000 2000 04000 1FFF 0x4000 0000 x3FFF FFFF 00008 0000 Dx DO FFFF Dx DO4 0000 Dx DO3 FFFF 00002 0000 00001 FFFF 00001 0000 0x0000 FFFF 00000 000 00000 7FFF 00000 0000 The end of RAM for the LPC2106 is at 0x4000FFFF The end of RAM for the LPC2148 is 0x40007FFF there also is an 8K RAM block at 0x7FD00000 for USB DMA operations but we won t use that for the stacks The LPC2148 also has 512K of FLASH eprom The linker command file has been reproduced in its entirety below There is extensive annotation showing the new memory map for the LPC2148 The linker commands that have changed are noted also i ee a a e a e a a a e ee a a a a a a e a a e a a a a a a a a a a a a a a a a a a a a a e a a a e a a a a demo2148 blink flash cmd LINKER SCRIPT t7 pe v 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 t7 pe v Any symbols defined in the Linker Script are automatically global and available to the rest of the program pe v To force the linker to use this LINKER SCRIPT just add the T demo2148 blink flash cmd directive to the linker flags in the makefile t7 LFLAGS Map main map nostartfiles T demo2148 blink flash cmd tf Bol xj yt ay T Th
35. E Ipc210x h sp r j E main c ro r 8SVC STACK SIZE E main dmp CPSR c MODE SYS I BIT F BIT User Mode E main hex p ro i 7 i j main map main o ll e main out q q HT E of makefile Tasks El console 23 b o B E pii rm H C Build demaz1 6 blink Hash 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 Adadr which contains the address of the startup code at the label Reset Handler 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 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 0x4000FEEO 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
36. Environment 5 0 Update 2 you must agree to the software license below a Printer Friendly Page sun Microsystems Inc Binary Code License Agreement forthe 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 Accept Decline One more choice to decide on we want the online installation for Windows developers sun com search tips Search in Developers Site v m The Source for Java Developers ava Download J2SE TM Runtime Environment 5 0 Update 2 NOTE 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 t Download problems or Questions See the Sun Download Center FAO
37. Ju Juni CED Ji JUnit Plug in Test Remote Java Application ser SWT Application Apply Revert cose Now click on the Debugger tab Click the Browse button and locate the arm elf gdb debugger This executable is in the c Program Files GNUARM bin directory x Debug Create manage and run configurations Configurations Mame demoz2106_ blink flash pe C C Attach to Local LE C C Local 4pplicatior 3 Le C C Postmortem deb Mai C45 veure ui Commands Es Source Common 5 Eclipse Application i Debugger Embedded GDB e Stop at mainit on startup Advanced HF Embedded debug launct bejg demozi 6 blink rai pebugqeroetons 6 New configuration Bes Java Applet T era ir GDB debugger C Program Files GNUSARM bin arm elf gdb exe Ju JUnit Ju JUnit Plug in Test pe Remote Java Application EZ SWT Application A lll gt Delete Apply Revert dese Now click on the Commands tab Enter the list of commands as shown Create manage and run configurations Configurations Mame demo2106_blink Flash e C C Attach to Local E ClC Local Applicatior fe C C Postmortem det E Main HF Debugge BN Commands Y Source a Common Eclipse Application se Embedded debug launch Commands sh paee SNR target remote lacalhast 8888 36 demoz2106_blink_rar Oboe Java Applet monitor softbkpts off
38. 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 Pana y Edition Paperback ARM System on Chip Architecture 2nd Edition by Steve Furber List Price 44499 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 checkout 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 g
39. M ARM THLUMB Intermorking ls Floating Point LL rit e FPU Libraries Current selection requires at least 216 9 MB of disk space Take the default on this screen Click Next to continue is Setup GNUARM Select Start Menu Folder Where should Setup place the program s shortcuts To continue click Mest IF vou would like to select a different folder click Browse Eo Tas 7 It s very important that you don t check 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 M Click on Install to start the GNUARM installation e Setup GNUARM Ready 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 locations D Program Fil
40. Now click the Step Out button again The debugger will execute out of the initialize routine to the next source line in the calling function which is main ff Initialize the system Initialize i set io pins for led PO IODIR 0x00000080 f f pin PO 7 is an output ev IOSET OxXDODDO0DODOSO fo led off IOCLR OxOO000080 led on endless loop to toggle the red LED PD 7 while 1 Now let s set a breakpoint A good choice is the endless loop at the points where we turn on the LED Click on the far left margin to set the breakpoint ff Initialize the system Initialize i set io pins for led PO 7 gt IODIR 0x00000080 fo pin PO 7 is an output everything IOSGET OxDODODOSO ff led off IOCLE OxDODODOSO tf led on ff endless loop to toggle the red LED P 0 7 while 1 for 3 0 j 5000000 j 1 ff wait SOO msec va IOSET UxXOOOQUOUSO ff red led off for j 0 3 5000000 j ff wait SOO msec IOCLR 0x00000080 ff red led on Now click on the resume button to execute to the breakpoint ff Initialize the system Initialize l i fo aet io pins for led FO 7 IODIR OxO0000080 ff pin PO0 7 is an output everything IOSET OxDODODOSO fo led off IOCLE OxXDODODOSsO led on ff endless loop to toggle the red LED PO 7 while 1 for 3 0 j 5000000 j fi wait 500 msec x3 IOSE
41. PO0 7 is an outpi int 8 global uninitialized variable Ox40000290 lt main 28 gt mov r2 536870904 wv Ox40000294 lt main 32 gt add r2 r2 163840 Pw 4 lll gt B lt TT 3 la Console 53 Tasks Memory a Ex A r4 E r3 T demo2106 blink ram Embedded debug launch Debuager Process 9 10 05 1 09 PM Tygon IU sections text section sizes 1208 total sizes 2515 section text section sent 636 section size 1208 total sent 636 total size 2515 GDB Debu er section text section sent 1208 section size 1208 total sent 1208 total size 2515 gg section data section size 24 total size 2515 Com manq Wi ndow gdb lili l 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 Debug X W Be m EQ OCDRemote Program bee pa C cygeuinusrilacalibinyacdremake exe Ese demo2106_blink_ram Embedded debug launch eae Embedded GDB 2 10 05 1 20 PH Suspended g Thread 0 Suspended 1 main at main c 46 2 Debugger Process 9 10 05 1 20 PM Notes When you resume execution by clicking on the Run Continue button many of the buttons are grayed out Click on Thread O to highlight it and the buttons will re appear This is due t
42. Selected Sectors d Execute Code Use Baud Fate p snis cates 19200 after Upload Start Sector 0 Erase E Compare Flash Manual Reset zoe Genel I Tirme Clut sec Z Device Use DTRRTS Device LPC2106 E Part in for Reset and Boot Loader ATAL Freg kHz 14746 Device ID Boot Loader ip selection File Upload Successfully Completed After successfully burning the executable code into FLASH be sure to remove the BSL jumper C Create a new FLASH Debug Configuration We have already done one of these creating a debug configuration for debugging code loaded entirely into RAM This new configuration will be very similar just the GDB initialization commands are different First click on the Debug button specifically the pull down arrow Then click on Debug If HeSelm B O0 Q 7g 1 demo 106 blink ram E C C Projects X O e main c as demo2106_blink_Flash LS demoz106 blink ram Debug As w Debug Organize Favorites The Debug window reveals that we only have one Debug Configuration defined under the Zylin Embedded debug launch configurations This is demo2106_blink_ram designed to debug applications loaded entirely into RAM Click on New to permit specification of a new Debug Launch Configuration Debug Create manage and run configurations Configurations Mame demo2106_blink ram Bd fe C C At
43. 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 We will need the following hardware setup Olimex ARM JTAG Adapter AN 5 a auo ERR 20 pin JTAG Port m e e e e e 0 0 0 ene eo e c e e 6 NENA AAA AAA AAA AL BEENEEHEHNEHNHENENHENHEHEHEHHEHENENHENEHEHNHNHNHNEEN BEEBE eee SERRE PRR RRR BERR ERE RRR BEEBE BERBER eee BERBER SERB BBB mu BER BREE RRR RR eee eee BEB BREE BRR RRR BERBER BERBER eee SEB EB BEB BRB RBRE EERE RR ES e P2 HTTP HHH OLI MEX COM DEU u E a a a a a a E a E E a E P rE BPR RE RRR eee eee eee e a 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 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 ribbo
44. bits 0 4 of PLLCFG cclk 53236800 hz Fosc 14745600 hz Solving M 53236800 14745600 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 PLLCFG 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 2 PLLCFG bits 5 6 1 assign 1 to these bits Finally PLLCFG 0 01 00011 0x23 Final note to load PLLCFG register we must use the OxAA 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 peopl
45. complete Folder structure Create selected Folders only Now we have to indicate the destination for our source files Click on Browse on the line to the right that says Into Folder 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 Cancel 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 the local file system From directory Cryscratch Browse scratch S crt s I demoz106 cmd e Ipez1 x h d main c kA makefile Filter Types Select All Deselect All OE demoz106 blink flash Options Overwrite existing resources without warning Create complete folder structure le Create selected Folders only Cancel Now the C C perspective main screen will reappear Click on the expand symbol in the navigator pane to see if our files have been transferred C C Eclipse Platform File Edit Navigate Search Project Run Window i ol 8 d G ii E ejer 3 Resource oc Eu m mil T V 2 yen FT a E SER w An outline is mat eS AM A available Ba demo2106_blink flash
46. configuration 9 features 5 plugins 9 readme 9 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 eclipse File Edit View Favorites Tools Help Back Q d Search lie Folders x Ax 6 E B Falders Mame Size Type B E My Computer E configuration E amp e Local Disk C Dfeatures S 3 armlib plugins File Folder E E ATI readme File Folder 5 23 2005 10 59 P E ecipseproduct LKB ECLIPSEPRODUCT File 5 13 2006 2 55 P L capture 1 E GB DELL F az KB Application 5 13 2005 2 55 P E E Documents and Settings open LKB Configuration Settings 5 13 2005 2 55 P S download ia 17KB HTML Dacument 5 13 2005 2 55 P E 3 DRIVERS notice h yA 7KB HTML Document 5 13 2005 2 55 P into Start menu EI start 31 KE Executable Jar File 5 13 2005 2 55 P El eagle components E Scan For Viruses EasvScreen O gt eclipse Send To d E Compressed zipped Folder 3 configuration E Cy Features Mail Recipient El 4 plugins Ej readme Create Shortcut X Musicmatch Burner Plus amp C foo T Delete My Documents C gnu docs ll Rename 9 ARMLIB F Properties Ed 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
47. 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 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 Why did ARM design the port bits this way This scheme allows you to modify a bit without perturbing the others To turn the LED PO 7 off we can write IOSET 0x00000080 turn PO 7 red LED off Likewise to turn the LED PO 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 500000 j wait 500 msec IOSET 0x00000080 red led off for j 0 j lt 500000 j wait 500 msec IOCLR 0x00000080 red led on This scheme is very inefficient in that it hog ties the CPU whi
48. gdhi e get io pins for l ed PO 7 IODIR 0x000000s0 pin FO T is an output everything else is input after IOSET OxOO0000080 i led off The next maneuver is a bit of a mystery To get the debugger to operate with two breakpoints you have to manually enter the GDB console command delete From the Stallman book Debugging with GDB Delete breakpoints range Delete the breakpoints watchpoints or catchpoint of the breakpoint ranges specified as arguments If no argument is specified delete all breakpoints GDB asks for confirmation unless you have set confirm off You can abbreviate this command to d To enter this command manually click inside the console view after the gdb prompt and type the delete command e em Tasks demo2106_blink_Flash Embedded debug launch Debugger Process 12 10 05 10 37 PM monitor reset monitor softbkpts off symbol file maln out set Spe OxD thbreak main continue llgdb delete it Obviously when the debugger starts and stops at main it must be using one of the two hardware breakpoint circuits as a resource Entering the delete command manually seems to take care of it have experimented with putting the delete command in the debugger startup commands to no avail If any of my readers can figure out why this is required please e mail me so can adjust the tutorial My theory is that that temp
49. 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 OCDemon from Macraigor Systems Make your debugging Wt a l i Lid a Fo hs P han piel A Ll f vi i A Pee i Y Mr palo a little bit easier E a Frer Sofware Home Hardware Products Software Products CPUs Tools etc Partners News Plash Programmer GNU Tools Batch Flash Programmer Target Access DLL J SCAN JTAG Debugger JTAG Commander Validator 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 14 Make sure you download OCDRemote version V2 14 since this is the one that supports hardware breakpoints Click on Run so it will download and immediately install OCDRemote File Download Security Warning Do you want to run or save this file Mame hwsuppark 2 14 8xe Type Application 3 00 MB From Wala ocdenan com While files fram the Internet can be useful this file type can potentially harm your computer IF you do nat trust the source do nat run ar save this software what s the risk The download phase is quick since the OCDRemote is only a couple of megabytes Opening hrisupport 2 14 exe from www ocdeman com Estimated time left 32 sec 513 KB of 3 00 MB co
50. main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help r5 7 lll pe m o m Q T S Ea L4 elz 5 E F Debug Fey cic amp Java Debug X Variables 9o Breakpoints 23 Modules Registers signals TO TERMICA E a OCDRemote Program Poe wa Cicvgwintusrllacalbinyacdremate exe E86 demozi amp blink Flash Embedded debug launch Er dE Embedded GDB 12 10 05 10 37 PM Suspended Es oP Thread 0 Suspended mm 1main atmain c 46 wal Debugger Process 12 10 05 10 37 PM j gt CA N Le main c ES ES pe Cutline E S int main void i Initialize Feed int du loop counter stack variable coh IRG Routine static int a static uninitialized wariables j FIQ_Routine d Ef SWI Routine static int W T2 static initialized variable 44 UNDEF Routine static long x 5 static initialised variable LPC210x h static char Y 0x04 static initialized variable static char Static uninitialized variables Static int z Ta static initialized variable ponst char pText The Rain in Spain Initialize the system Initializel main PLOCK Initialize feed v iue IRQ Routine i gt i FIG Routine E console 22 N Tasks a Ex BE demo2106_ blink Flash Embedded debug launch Debugger Process 12 10 05 10 37 PM cdi idgdo cdi Igdb gqdb gdb target remote localhost 5555 monitor reset monitor sotthkpts off symbol file main out set pc Oxo thbreak main continue
51. one conditional breakpoint that will stop on source line 64 only if the variable x is equal to 9 Sea Breakpoints 53 os Expressions KRESS FAS 2 7 Le Cuecdipseworkspaceidemoz106 blink ramimain c line 64 if x L Single Stepping Single stepping is the single most useful feature in any debugging environment The debug view has three buttons to support this ES JE Step Into Step Over Step Out Of Step Into Step Over Step Out Of 2 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 button to go to that breakpoint h Ipcz10x h amp makefile D manc X f Wait for the PLL to lock to set frequency while PLLSTaT amp PLOCKI ff Connect the PLL as the clock source PL
52. options being used are I 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 03 Sets the optimization level Note set to 00 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 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 the 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 S 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 bei
53. pop up its current value For that you can refer to the Registers view ASA 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 Elian Main nu pO 110 ra 534790004 rd 536690685 ra 2147482932 ro 103742120 HiT rere yo 1658272053 rere r3 1109953455 rer 110 2105601601 1010 111 1073805976 1010 112 1073805964 rele sp 1073805964 1010 k 1073742856 100 pc 1073742856 aim FO 0 am FL O am fe 0 am Fi am Pt O am Po O am fo O am fv O 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 Set Value Enter a new value Far r oa Now the register display shows r4 in hexadecimal format MM rO 110 TT E ri T ids HH rz AS c HH r3 1 ur r4 OxFFFFFFFReEOO2cOO0 uA r5 2147482932 MM r amp 1073742120 la 1010 e ui 18 1658272053 Mui r9 1109953485 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 ES Debug Resource Hey cic za M Main WW yO 110 ot rl 0
54. project and make builder settings Make builder settings LS Projects Make Builder Error Parsers Binary Parser Discovery Options CiC Indexer Build command i 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 EN NN Mote See Workbench automatic build preference Iw Build Incremental Build all M 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 Ek ar File Edit wiew Favorites Tools Help e m Back d p Search MES Folders i x o6 E IB Folders x Marne Size Type Date Modified 5 capture x Is lsdiff 1 KB System File 5712005 11 45 El ES cygwin Pl herve 1 279 KB Application 6 23 2004 4 45 E 3 bin Tm 84 KB Application 4 5 2005 8 28 ans E mail files 2KB File 8 15 2003 6 25 5 etc mailshar SKB File a 15 2003 6 25 El ES lib E make 145 KB Application 5 21 2003 1 3 3 tmp P makegeo 6EB Application 10 10 2004 7 5 E 3 us Lmakeinfo 190 KB Application 4 11 2005 9 45 sy E 1 var w This is a good time to point out the differences between Build All Build Project and Clean Build All Will execute the com
55. set frequency A Iniialze E dema2106 blink ram whilei iPLLSTA T amp PLOCEKI EE Feed E Binaries m IRQ Routine ER Includes j Connect the PLL as the clock source j FIG Routine H h pc210x h i S crE s i 8 main c i 5 crt o armle PLLCON x3 teedii Enabling MAM and setting number of clocks used for Flash memory fetch SwI Routine UNDEF Routine LPC 10x h q e E main o armle MAMCR Ox2 DE main aut armle MAMTIM xa r E cr lst j h El i El demo2106_blink_ram cmd 0 Initialize MEMAP re map vector table to RAM l manne MEMMAP OxD2 main hex j main main map FLOCK SEET LO eripheral Clock CLE to System Clock Jeclk Ed makefile a a p P Y Initialize Baia feed IRQ Routine FIQ Routine we Mee IBAI E T3 ra Problems El console 3 b Properties lt terminated gt LPC2000 Flash Utility Program C Program FilesLPC2106 TSPALPICZ10x TSP exe writable Smart Insert Since we are not using any interrupts in this example this addition does not really matter I 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
56. 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 Remember 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 all 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 etext z 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 conta
57. 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 link everything GNU make has a helpful variables feature that helps you reduce typing If you define the following variable CFLAGS l c fno common 03 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
58. to RAM cdtproject ldr etext project ldr data crt lst ldr edatal crto cmp R3 cit s ldrlo Ri 4 demo2106_blink_flash cmd strlo R2 4 Ipc210x h blo main c main dmp Clear bss section Zero init main hex T 0 debi ldr bss start TE ldr bss end main out cmp R2 makefile gt demo2106 blink ram strlo R1 4 blo cdtproject Zh S project 3 crt lst Enter the C code crt o b main crt s 5 demo2106 blink ram cmd C Ipc210x h main c 2h main dmp main hex main map 2 25 d D Ey Bi p ue p p ey Ee e 0 p 1 m Tasks El Console x 8 B e gB ri n a E main o C Build demo2106_blink_flash main out A makefile z 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 gl
59. 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 long long long long long long long long long long long long long long long long long long long long long Header file for Philips LPC21H4 LPC21H5 LPC21HB6 HxFFFFFHHH HxFFFFFHHA HxFFFFFHHB gt gt HxFFFFFHHC HxFFFFFH1H HxFFFFFH1 455 HxFFFFFH18 HxFFFFFH1C HxFFFFFH2H HxFFFFFH3H HxFFFFFH34 HxFFFFF1HH HxFFFFF1H4 HxFFFFF1HB8 HxFFFFF1HC HxFFFFF11H HxFFFFF114 AxFFFFF1185 gt AxFFFFF11C0 gt gt BHxFFFFF12H AxFFFFF124 gt gt AxFFFFF1285 gt AxFFFFF120 gt gt BxFFFFF13H AxFFFFF134 gt gt AxFFFFF1385 gt HxFFFFF13C HxFFFFF2HH HxFFFFF2H4 HxFFFFF2H8 HxFFFFF2HC HxFFFFF21H xFFFFF214 gt gt v o Ed Bec 02 Outline 3 a gw dk db dE db dE db dk db dk db dk db dk dp dk E dk dE dk dE dk dE db dp db d db O4 db G4 db 4 Zi Lr ha _LPC210xH A EXTINT 3 EXTWAKE IPC I2ADR IPC I CONCLR I C I2CONSET I C I DAT IPC I 5CLH IPC I25CLL I C I 5TAT IOCLR IODIR IOPIM IOSET MAMER MAMMAP MAMTIM PEON PCONP PINSELD PINSEL1 PLLCFG PLLCON PLLFEED PLLSTAT PM CCR PWM CRO PAM CR
60. your apps from source if you want to take advantage of Cygwin functionality Donations Documentation FAQ e User s Guide Help contact web page other info Historical cygwin into as API Reference get help on find a package or e Acronyms Install or update Zr using or file inthe cygwin Contributing setup exe release Snapshots poutce in CVs Latest Cygwin DLL release version 1s 1 5 16 1 ib Internet The first thing to do is to click on the install icon We need to download the setup executable and automatically run it File Download Security Warning Do you want to run or save this file Mame setup exf Type Applicatidn 279 KB From w cyi 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 alx Cygwin Net Release Setup Program This wizard will guide you through the installation and updating of the Cygwin environment and a plethora of GNU packages E Setup exe version 242r Copyright 2000 2001 Red Hat Inc http sources redhat com cygvin 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 inst
61. 00 Selected Range Start eH 40000000 Run from Address H40000200 C Thumb ARM Entire Buffer End amp H4ODOFFFF 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 Look in C3 demo2106_blink_ram 4m t ls main hex hy Recent Documents 3 D esktop Mu Documents hu Computer My Network File name main Places Files of type Hes Files hex Lancel 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 lt 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 in
62. 080 pin PO 7 is an output everything Y lt TT gt E console 23 _Tasks x Ex BB r El r 7H 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 ax File Edit Refactor Navigate Search Project Run Window Help Jjri GE amp lmi 0O Q jJ4j n S o6 o Ej Acc die Debug di z amp OCDRemote Program a Cicvgwintiusrilacallbinjacdremate exe E F demoz106_blink_ram Embedded debug launch E m Embedded GDE 9 9 05 12 38 AM Suspended E aP Thread dni Sealy h Ipe210x h i e main c 3 O Cutline Disassembly Xx int main ivoid i WK xfffe2zdc atreg x 7fffezb5 strvsda x7fffez543 ldrleb x 7fffez58 subvss x 7fffez5c atreg x 7fffezb56l strvsda x7fffez523 ldrleb x7fffez58 ldmvsia x7fffezb5c andmv Ox fffe 70 andes x 7fffez743 andny x 7fffez 78 andcs x fffez c stene Oxv fffe2z250 ldezl Oxv fffez5 ldczl Oxvfffezbas cmpeas Ox ffifez 5c andny x fffezHl stcne x yffTfezas EN lt q iiil E Console ETS Tasks Memory m o Ex BE A G enaa demoz106_blink_ram Embedded debug launch Debugger Process 9 9 05 12 38 AM igdb target remote lo
63. 0x4D000003f0 lt Initialize 100 gt r3 F 536870912 DxeDODOODO Ox400003f4 lt Initialize 104 gt r3 r3 2060768 Ox1fco00 Ox400003f5 lt Initialize 105 gt r3 r3 128 0x80 Ox400003fe lt Initializet ile gt ra 3 P Ux3 Ox40000400 lt Initialize 116 gt rz r3 feed i Ox40000404 lt Initialize 120 gt 040000454 lt feed gt click the Step Over button in the Debug view the debugger will execute one assembler line Outline AF Disassembly EN m Ox400003508 lt Initialiset 76 gt mov r3 r3 lal 16 W5 Ox400003de lt Initialize 50 gt mow r3 r3 lar 16 Ox400003e0 lt Initialiset 4 gt mow r3 r3 lar 10 Ox400003e4 lt Initialize 55 gt and r Eds 1 Oxl Ox40000s5eS lt Initialize 22 gt cmp r3 0 0x0 Ox400003ec lt Initialize 26 gt ber Ox400003058 lt Initialize 650 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 ea 1 Ox4000035 8 lt Initialize 105 gt add r3 r3 128 0x80 2 Oax4b000s3ftce lt Initialize 1l2 gt mov rz H3 7 Ux3 Ox40000400 lt Initialize 116 gt strb rz r3 Teed 14 Ox40000404 lt Initialize 120 gt bl Ox40000454 lt feed gt 3 4 T FI The Step Into and Step Out Of buttons work in the same was as for C code P Inspecting Registers Unfortunately parking the cursor over a register name R3 e g does not
64. 14 4151 5151 5151 dnaggadaag otoconia E DE O DEO GEE Asistslejelelc 004dnda DERAHE 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 O0 and rebuild File makefile mak NAME demozi Ub5 blink ram CE arm elt qee LD arm elf 1d w AR arm elf ar AS arm eli as CP arm elf objcopy OD arm elf objdump CFLAGS I c tno common 00 g AFLAGS ahls mapcs 32 0 c a LFLAGS Map main map Tdemoz106 Blink ram cmd CPFLAGS O ihex ODFLAGS X syms 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 XR oT
65. 210x 4 demo2106 2 main c demo2106 3 main map demoz106 4 demazi 6 cmd demazi06 Exil omen 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 su Import File system Source must nat be empty From directory Filter Types Select All Deselect All Into folder demoz106_blink_flash Browse Options Overwrite existing resources without warning C Create complete Folder structure Create selected folders only omen Click on the directory scratch and hit the OK button in the Import from directory window on the left below Import from directory Select a directory to import From e Local Disk C armlib 3 ATI ic capture 5 cygwin 3 DELL Documents and Settings download DRIVERS ee Click on Select All in the Import window below right to um get the source files selected for import into our project Foo Ez 1386 5 memo 3 My Music Import File system Please specify Folder la TNNT LEILA E WINDOWS 1 zclipse From directory C scratch Browse Folder p scratch s crt s E Make New Folder v demo2106 cmd d Ipczi x h d main c K makefile Filter Types TD Deselect All Into Folder Cm D Options Overwrite existing resources without warning Create
66. 288 hz lt page 48 gt of Philips LPC2166 manual PLLCFG 8 Ai 8x23 Pos Fec From Table 1 Finally within the 156 mhz to 328 mhz range 5 6 1 good choice for P since it s P 2 PLLCFG bits Cassign 1 to these bits gt 66611 to load PLLCFG register we must use the xAA followed 8x55 write sequence to the PLLFEED register this is done in the short function feed below Final note Setting Multiplier and Divider values PLLCFG 8x23 feed Enabling the PLL PLLCON Bx1 5 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 6x3 feed Enabling MAM and setting number of clocks used for Flash memory fetch 4 rclks MAMCR 8x2 5 MAMT IM x4 Setting peripheral Clock pclk gt to System Clock Ccclk gt UPBDIU x1 5 in this case gt feed Initialize PLOCK LPC210 feed Initialize main E EE E AnS Properties Search Problems El Console 23 90 16 writable Smart Insert E Calculator fiw Print Docs tay ARM Cross Developm C C main c Ecli 11 16 PM 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
67. 3 Community i Bug Database netBeans Forums This distribution af the J25E Development Kit JOK includes NetBeans IDE which is a powerful integrated development enviror Learning platform More into Tutorials amp Code Camps Online Sessions amp Courses Instructor Led Courses Course Certification JDK 5 0 Update 3 The 125E Development Kit JDK supports creating J25E applications More 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 Java Installation Tf Ba sun cores 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 Sun JAVA tools you will have to pay royalties to them developers sun com searchtips Search in Developers Site w mnm The Source for Java Developers Terms of Use Please indicate whether you accept or do not accept the following software license agreement s 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
68. 32 bit ARM7TDMI S processor e 64 kB on chip Static RAM 128 kB on chip Flash Program Memory In System Programming ISP and In Application Programming IAP via on chip boot loader software Vectored Interrupt Controller with configurable priorities and vector addresses JTAG interface enables breakpoints and watch points Multiple serial interfaces including two UARTs 16C550 Fast lC 400 kbits s and SPI Two 32 bit timers 7 capture compare channels PWM unit 6 outputs Real Time Clock and Watchdog Up to thirty two 5 V tolerant general purpose I O pins in a tiny LQFP48 7 x 7 mm package 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 several companies have come forward 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 a year ago and you can see it on their web site ww
69. 550 40000560 40000570 40000550 400005290 40000540 400005580 40000520 400005D0 4nnonnsen Column Size 1 unit oo000c0000 53706169 05000000 66616E20 FSSBCHCHS OS5000000 oo00c0000 ooo0o00000 o0000000 ooo0o00000 aagaadgaaadu oo0000000 oo000000 OOOOO0O0 oo0000000 rine 54606520 bEOQOOOOO 18050040 612073 70 74000000 01000000 oo0c0000 EQEIFF F TBECFF F EQEIFF F JBECFF F EDE1FF F TOECFF F EUEIFF F JTOGECFF F FWIFiFF7F 52b1696 4000300 40617374 65656469 a7aaaooaou augadgaaaau oo000000 OGSESFF TF TBECFF F OSESFF TF TOECFF TF SESFF F TOECFF TF 3ESFF F JTOECFF F ee FFYF O69SbBEZO 06000000 657220774 6E6TZ 6z 04000000 00000000 ON0000000 OEOOOOO0 EC010040 OFOOO000 BCO10040 OEQOOOO0 BCO10040 DEOQOOOOO Ec010040 moni right click menu option that will jump all over memory for Console ME i pa ts T O d o X de Memory Renderings Box O 400004F4 Ox400004F4 lt Hex gt emory Monitors ox400004F4 400004F0O 40000500 40000510 40000520 40000530 40000540 40000550 40000560 40000570 40000550 400005290 400005140 40000580 400005C0 40000550 annannsrn oo000000 53706169 oO5000000 65516E20 FSGCHCHS o5000000 ooo000000 ooo000000 oo000000 ooo000000 ooo00000 oo000000 ooo000000 ooo000000 adada nnnnnnnn is Reset to Base Address Go to Address 2 units w units B units Column Size Reformat Hide Address Column 16 units Copy T
70. 59 PM _Breakpoints Modules Registers Signals grAB ISxR O 69 j 40284 6 a 0 69 b 2 0 69 c2 0 69 d static int wW static long x 5 static char y 0 static int z Y const char Initialize the sys Initialize set io pins for le IODIR OxO00000080 IOSET OxO0000080 IOCLR OxO0000080 endless loop to td while 1 for 3 0 j lt IOSET OxDDOOODS for j 0 3 3 IOCLR Oxo0000008 pTe O Undo Typing Revert File Save Shift Left Comment Uncomment Content Assist Add Include Format Show in C C Projects Refactor Open Declaration Open Definition Ctrl Z Ctrl V Ctrl Ctrl Ctrl Space Ckri4 ShifE N Ctrl Shift F F3 Ctrl F3 c initialized variable Lic initialized variable bic initialized variable tic initialized variable ething else is input after re i o r y Outline es feed IRQ Routine FIQ Routine ooo 00000 Initialize PLOCK Initialize feed IRQ Routine FIQ_Routine SI Routine LUNDEF Routine Ctri Shift Down Ctrl Shift Up Go to next member Go to previous member Tasks Memory All Declarations a x Ek AB e E Fr H demo2106 blink flash Embedded debug la gdb gdb gdb de gdb gdb thbreak Wai continue console 33 All Rererences Run to Line Resume At Line gdb 3Y Add Watch Expression Ru
71. ARM Cross Development with Eclipse Version 3 By James P Lynch December 11 2005 Preface to Version 3 When revised this tutorial in September 2005 everything needed to provide a complete Eclipse ARM cross development package was in place The only shortcoming was that the Eclipse debugger could not debug programs in FLASH Now that issue has been resolved Macraigor Systems LLC updated their free OCDRemote utility to handle hardware breakpoints GDB remote serial protocol Z1 addr length commands The Macraigor OCDRemote utility has a monitor command monitor softbkpts off that forces the utility to convert all Eclipse software breakpoints which don t work in FLASH to hardware breakpoints ARM7 cores allow two hardware breakpoints and they do of course work in FLASH When you double click on the breakpoint area on the left side of the source window in Eclipse you are now setting an ARM hardware breakpoint You can only set two hardware breakpoints a limitation of the ARM7 core This is not much of a roadblock You can single step in and out of functions inspect and change variables view memory dumps and work in assembler mode If you need more than two breakpoints you can elect not to send the monitor softbkpts off command during GDB initialization and thus debug RAM based applications with all the software breakpoints you desire James P Lynch 1 Introduction credit my interest in science and electr
72. CAES eclipse org home eclipse org wh ats eclipse in featured eclipse available now T en 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 developrnent environments for Jawa C C and others testing and performance business intelligence rich client applications and embedded development 4 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 forget to check nut the Eclipse Project FAQ 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 aur thanks to HP IBM Intel Magma and Novell for generous donations to our website infrastructure August 24 Eclipse Foundation and sybase Announce Approval of Ec
73. CD 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 controllers 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 lynch007 Wgmail com 25 Acknowledgements have been very fortunate to have the advice and constructive comments from readers all across the world give my heartfelt appreciation to all and specifically to Kjell Eirik Andersen is the R amp D Chief Engineer at Tandberg Storage ASA a company that designs and manufactures half height LTO tape drives Kjell helped me with the GDB startup commands that prepare
74. E main out K makefile Filter Types Select All Deselect All Into Folder demoz108 blink ram Browse Options Overwrite existing resources Without warning C Create complete Folder structure Create selected Folders only z Back Next gt Cancel RAM 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 0 E e M ER dl da Ge Cic P E E E T Fia A H E demo2106_blink_Flash dud demozl06 blink ram cmd LINKER SCRIPT ES demozi amp blink ram e Binaries Re a Includes i The Linker Script defines how the code and data emitted by the GNU C cc h Ipcz1 0x h po to be loaded into memory code goes into FLASH variables go into RAM 8 ert s pe e main c ny symbols defined in the Linker Script are automatically global and e R crt o armle i program 2 main o armle it main out armle a To force the linker to use this LINKER SCRIPT just add the T demozide crt lst to the linker flags in the makefile j demaz106 blink ram cmd pe main dmp ft main hex m main map m a Donee Et The Philips boot loader supports the ISF In System Programming wia tE In Application Programming for flash programming f
75. EERE o AAA aa 2 LPUCSIUX R void IRQ Routine void att 9 Clean will discard all build problems and built states The next time a build oJ Hinclude ERRE REET TEE EEE Global Variat TEETER ARA E AAA int g E glog int int short h short i char 3 n dw oll ol _ Tes Ww o Start a build immediately Build demo2106_blink_Flash make k clean rm crt lst main lst crt o main o main out main hex main map main cdmp rim Cannot latat main lst No such file or directory make clean Error 1 ignored You can see the results of the Clean operation in the Console window at the bottom Expect to see some warnings if there isn t anything to delete 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 ax Resource main c Eclipse Platform File Edit Navigate Search M8 Run Window Help BSB la sm ES Ei ness Close Project 8x Navigator 23 b o md S crt s 3 makefile 3 mainc X HB outline 3 b II gt E A e a ws ew 2 15 demo2106_blink_flash Build Working Set gt PUREDIDR BERRACBI
76. EORA Initialize cdtproject Clean CARAS 3 feed project Build Automatically 2 IRQ Routine crt s void Lj FIQ_Routine ES demo2106 blink fli Properties SWI Routine C Ipc210x h UNDEF Routine c main c void IRQ Routine void _ attribute interrupt IRQ Y LPC210x h 3 makefile void FIQ Routine void _ attribute_ interrupt FIQ q 4 15 demo2106 blink ram void SUI Routine void _ attribute interrupt SWI ar void UNDEF Routine void attribute interrupt UNDEF A i A JONCRCRCNCNCA ChCAONCh RARA ARRE HAKATA Ch h A ONCh Ch A A a 8 8 NUN UN A i Header files x 3 RAS o main Hinclude LPC210x h a Initialize feed IRQ Routine ERRE RARA ERRE RARA ARRE HAA AAK KAKA KAKA OK KATA UN UN o FIQ Routine Global Variables o SWI Routine BNCRCACKCACh Ch AONCh Ch AONCA Ch A ON ONCh Ch AONCA Ch hOAONCh Ch AONCh Ch ACA ONCh Ch A ON CA Ch A AUN Ch A ON CN A S a NN A o UNDEF Routine int d global uninitialized variable int r global uninitialized variable int 8 global uninitialized variable short h 2 global initialized variable short i 3 global initialized variable char j 6 global initialized variable v lt TT x El console sc W Problems a Ex e e C Build demo2106_blink_flash make k clean rm crt lst main lst crt o main o main out main hex main map main cdmp rm cannot lstat crt lst No such file or directory rm cannot lstat main lst No such file or d
77. Flash Utility V2 2 0 Communication Erase Blank i Entire Device Heus Ene Selected Sectors Start Sector U End Sector 14 Flash Programming Connected To Port COM Use Baud Rate 19200 Filename C eclipse workspace demo2106_blink_flas Upload to Flash IY FNC Time Out sec 2 Manual Heset Compare Flash Use DTR RTS for Reset and Boot Loader Selection Device Device Lec 06 T Part ID ATAL Freq kHz 14746 Device ID Boot Loader ip Erased LPC2000 Flash Suecessfully 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 gt LPC2000 Flash Utility RAM Buffer amp H 4000 0000 amp H A000 DOT 0 amp H 4000 0020 H4000 0030 amp H 4000 0040 amp H 4000 0050 amp H4000 0060 amp H 4000 0070 amp H 4000 0080 amp H 4000 0090 amp H 4000 aps H4000 D060 H4000 D0CO amp H 4000 0000 H4000 00 0 H4000 DOFO H4000 0100 amp H 4000 0110 amp H A000 0120 H4000 0130 amp H 40060 0140 H4000 0150 amp H 4000 0160 H4000 0170 amp H 4000 0180 H4000 0190 amp H 4000 0140 H4000 0180 amp H 4000 1C0 H4000 O1D amp H 4000 OTEO amp H 4000 01F0 Uyuuuuuuuuuuuuuugy m Load Hex File Upload to RAM Download RAM i 2 Fill Buffer Code Execution Address Range Fill value FF sH400002
78. I PWM CR PWM CR3 PM EMR PAM IR 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 RACIAJ ES Navigator 3 Ne 6 Ci cts x e E e P EODD dec WoW No o Www wuwhuwhwhwuhus usu tnt t 2 15 demo2106 blink Flash 3 cdtproject project crt lst crt o S crt s Module includes the interrupt vectors and start up code 5 demo2106_blink_flash cmd Gi Ipc210x h a a a a a a e e a a e e a a a a a ae RARA c main c 5 main dmp Stack Sizes Bo set UND STACK SIZE 0x00000004 stack for undefined instruction interrupts is 4 bytes B X set ABT STACK SIZE Oxo0000004 stack for abort interrupts is 4 bytes ol set FIQ STACK SIZE Ox00000004 stack for FIQ interrupts is 4 bytes Mi monk set IRQ STACK SIZE OXO0000004 stack for IRQ normal interrupts is 4 bytes makefile oe MA set 3WC STACK SIZE Ox00000400 stack for SVC supervisor mode is 1024 bytes crt s STARTUP ASSEMBLY CODE Standard definitions of Mode bits and Interrupt I amp F flags in PSRs program status registers set MODE USR 0x10 Normal User Mode set MODE FIO Oxil FIQ Processing Fast Interrupts Mode set MODE IRQ Ox12 IRQ Processing Standard Interrupts Mode
79. IZE 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 MODE 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 Ox4000FDEO Again by subtracting the IRQ stack 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 0x4000FDDC Again by subtracting the SVC stack size 4 bytes from RO we re sizin
80. 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 Eclipseis 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 E z Vorkspace 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 Workspace Use this as the default and do not ask again When you click OK the Eclipse main screen will start up Java Eclipse SDK File Edit Navigate Search Project Run Window Help e x P cg If you made it this far you now have a complete 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 H
81. L int main roid i unsigned int static int static char static int static long x ff loop counter stack variable cs static uninitialized variables static uninitialized variables 1 static initialized variable static initialized variable O0x04 static initialized variable 7 static initialized variable const char nText The Rain in Spain Static char nid ood pp Static int ff Initialize the system Initializeli set io pins for led PO 7 IODIR OxO0000080 pin PO is an output everything else is input after reset IOSET OxO0000080 led off IOCLR OxO0000080 f led on endless loop to toggle the red LED PO while 11 i for ij 01 j 5000000 j 1 wait SOO msec IOSET OxoOooo0o0so red led off 1 O 3 lt 5000000 j wait SOO msec IOCLR OxO0000080 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 l l Filtering Type C C line breakpoint File Cieclipseworkspace demoz 106 blink _ram main c Line number 64 vw Enabled Condition x 2 8 Ignore count t A nice feature of Eclipse debugging is that you can edit the source file within the debugger and rebuild the application without leaving the debugger Of course you need to kill
82. LOOM O02x3 feed i l Enabling MAM and setting number of clocks used for Flash memory fetch 4 cclks in this c HA MCR xZ HAMTIM 0x4 Click the Step Over button 3 The debugger will execute one instruction A pc210x h makefile 8 main c Y Wait for the PLL to lock to set frequency while PLLSTAT amp PLOCK ff Connect the PLL as the clock source PLLCOON Ox3 ENEEEM 4 Enabling MAM and setting number of clocks used for Flash memory fetch 4 cclks in this c MAMCE UxZz MiMTIM 0x4 T void feed voidi 1 PLLFEED 0xAA PLLFEED 0x55 x ii E Notice that the Step Out Of button is illuminated Click the Step Out Of button The debugger will execute the remaining instructions in feed and return to just after the function call Connect the PLL as the clock source PLLCON x3 feed Enabling MAM and setting number of clocks used for Flash memory fetch 4 celks in this c gt MAMCR 0x2 MANTIN Ox4 M 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 application and re launching the debugger we can inspect variables once a breakpoint has been encountered ER ec Wow oc wc TTT TTT TTP PP rr ero a Function declarations co oh o ee ee ee ee a wf void Initialize void void feediroid void IRO Routine void a
83. LPC21Hx H Vectored Interrupt Controller UIC x Hefine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine idef ine def ine idef ine def ine def ine def ine def ine def ine def ine def ine def ine def ine define define Hefine def ine def ine def ine def ine def ine def ine Prablems B Console x Build demaz1 06 blink Flash UIGIRQStatus UIGFIQStatus UIGRavIntr UIGInt amp elect UIGIntEnahle UIGIntEnGlr VICSoftInt VICSoftIntClr UIGProtection UIGUectfrddr UIGCDefUecthfddr UICGCUecth ddr UICUecthddri UICUecthddrz UICUecthddr3 UICUecth ddr4 UICUecthddrb UICUecthddr amp UIGCUecthddr7 UICUecthddr amp UICUecthddr 7 UICUecthddridb UICUecthddrii UICUecthddriz UICGCUecthddri3 UIGCUecthddri4d UICUecth ddrib5 UIGCUectnt 1H UIGCUectnt li UIGUectnt 12 UIGUectnt 13 VICUectCnt 14 UIGUectnt 15 Properties wolatile wolatile wolatile wolatile wolatile wolatile wolatile wolatile CxCCunlatile CxCCunlatile c vuo latile CxCCunlatile c volatile CxCCunlatile CxCCunlatile CxCCunlatile volatile uvolatile uvolatile uvolatile uvolatile uvolatile uvolatile uolatile x Cuolatile x Cuolatile CxCtCunlatile Cx CtCunlatile Cx CtCunlatile Cx CtCunlatile CxCtCunlatile Cx Ctunlatile CxCtCunlatile lil Search unsigned unsigned unsigned unsigned unsigned unsigned
84. LR 0x00000080 red led on endless loop to toggle the red LED PO 7 while 1 E console 37 Tasks Memory mi d Ex Ed r4 EI za demozi amp blink Flash Embedded debug launch Debugger Process 12 10 05 9 21 PM set pc 0x0 qdbj thbreak main qdbi continue gres writable Smart Insert Let s step into the initialize function Click on the Step Into button 7 Note that we have no breakpoints specified at this point The debugger executes to the first source line in the initialize function and stops ff Setting Multiplier and Divider values gt PLLCFG xz3 feedi l Enabling the PLL PLLCON Ox1 feed Now let s click the Step Over button to advance one source line a Now we re at another function call feed ff Setting Multiplier and Divider values PLLEOFG O0x23 feedil Enabling the PLL PLLCON x1 feed l Now click the Step Into button The debugger will execute to the first source line in the function feed void feedi voidi 1 PLLFEED UxAA PLLFEED O0x55 Now click the Step Out button The debugger will execute out of the feed routine to the next source line in the calling function which is initialize ff Setting Multiplier and Divider values PLLCFG Uxz3 eedi Enabling the PLL PLLCON 0 1 eedi fo Wait for the PLL to lock to set frequency while i PLLSTAT amp PLOCEJ1
85. Philips ISP Flash Loader to force the CPU to start at the address of Reset Handler which is at 0x40000200 This bypasses using the RESET 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 E C C demo2106 blink ram cmd Eclipse SDK SE im bj File Edit Refactor Navigate Search Project Run Window Help n ll im ae at S O Q P po gt Ej Debug acc lava Le main c E makefile main c 8 demo2106 blink ram cmd X Toc F FS a o c c c E c E RN E y go demozl1 06 blink ram cma LINEER SCRIPT tr oe s oe ER E The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are ee to be loaded into memory code goes into RAM variables go into RAM pS jt 4 EG Any symbols defined in the Linker Script are automatically global and available to the rest of the 7 En program af p irs Es To force the linker to use this LINKER SCRIPT just add the T dermoz106 blink ram cmd directive yj PEG to the linker flags in the makefile af jt y i LFLAGS Map main map nostartfiles T demoz106 blink ram cmd w E pe ae The Philips boot loader supports the ISP In System Programming via the serial port and the IAP 7 In Application Programming for flash programming from within your ap
86. RA RA RARA RARA AAA Function declarations ocho A ee ee ee ee ee ee AA AAA gl void Initializelvoid void feed vaid void IRO Routine void Attribute __ iiinterrupti IRQ void FIO Routine void _ Attribute interrupt FIQ j void SWI Routine void _ Attribute interrupt Sui ji void UNDEF Routine void attribute finterrupt UNDEF KORR Ch ch ck Koh ch ck kch ch ck Ach chc k ch ch ck Kch ch ck ck h ch ck ck h ch ck Kch ch ch kch h ch Ach hck ch ch ck Kch ch ck AEH El Console 2 X Tasks OcDRemote Program C cygwiniusrilocalibinjocdremote exe ES Debug Fey ccs e Java gt ELS Cutline 3 amp Li E pw py rox eere a Initialize feed IRQ Routine FIG Routine S wI Routine UNDEF Routine LPCz10x h Keep clicking on the OCDRemote button until it synchronizes If you have no luck refer to the suggestions given in the section 21 D concerning debugging of RAM applications F Launch the Debugger Obviously we have to launch the right configuration Click on the Debug button and its pull down menu Select the demo2106 blink flash debug launch configuration Debug main c Eclipse SDK File Edit Refactor Maviga Search Project Run Wine RETE e os Organize Favorites If the debugger launches successfully you should see the commands executed in the console view and the debugger will halt at main with no breakpoints set Debug
87. RE Microsoft Windows Currentyer GoogleDesktop CPregram Filesiaan SOFTWARE Microsoft windows Currentversion Re hkemd CAWINDOWSisystem SOFTWAREWMIicrasofEwindowsWCurrenEversion Re igfxtray CoWINDOWS system SOFTWARE Microsoft Windows Current versioni Re IntelMEM Cu Program Files Intel SOFTWARE Microsoft windows Current ersion Re C Cameradssistant C Program FilesiLagit SOFTWARE Microsoft Windows Current ersin Re Elkctrl CoMINDOWS system SOFTWAREYicrosoFtWwindowstCurrenEversianlR InstallHelper C Program FilesiLagit X SOFTWAREYMicrasaeFtwindowstCurrenbversianlR C coms COMWINDOWS system SOFTWARE Microsoft Windows CurrentVersion Re C meagent EAPROGRA 1 mcafee And dtm erneersiop L4 mcundate CAPROGRA 1mcafe ERE a e Enable All 2 Disable Al Click on Disable All Windows will ask you to re boot and the PC will restart with none of the start up programs running Use the same procedure to reverse this action Try a lower speed JTAG clock rate The slowest speed is 8 4 kHz whilst the fastest speed is 1 380 kHz Go to bed let it win tonight F 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 co
88. T 0x00000080 red led aff for j O j 5000000 j 1 wait 500 msec IOCLR 0x00000080 red led on _ If you want to execute normally remove all the breakpoints use the breakpoints view to see all the ones you have used and use the right click menu to remove all Then click on the Resume button to execute continuously Now the application should run and blink the LED If you want to stop execution hit the suspend button In the screen shown below the debugger has stopped within one of the delay for loops Debug X zx a Variables gt x O e6 xd V EG ocDRemote Program pj C cvgwintusrllocalbinacdremote exe 1 26 demo2106_ blink Flash Embedded debug launch E ee Embedded SDB 12 10 05 10 37 PM Suspended 2 Thread 0 Suspended Signal SIGTRAP received Description Trace bre 1 maint at main c 60 ed Debuaaer Process 12 10 05 10 37 PM lil gt Le main c 3 b IOCLR x fo led on ff endless loop to toggle the red LED FO 7 while 11 gt for j 0 3 5000000 j 1 fo wait SOO msec IOSET OxOO000080 fred led off for ij O 3 lt 5000000 j 1 fo wait SOO msec IOCLR 0x00000080 ff red led on Of course all the Eclipse debugging features such as hover variable display display of local and global variables and structures memory dumps assembler language d
89. Text 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 v 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 x j 3301707 nee 6 a 0 jul G b 2 Lx E mm Bda Select All Cera xe w 1 Copy Variables Cri c Mad M7 Enable TES x v Disable O x Display 4s Arrav x A Cast To Type Set Value Restore Original Type Enter a new value For c Find variable Ctrl F ms hange Value 52 Fa Add Global variables MH Remove Global Variables de Remove Al Global variables Format x 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 N 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 th
90. Window Help gt E amp amp 8 Run Last Launched CirHF11 ES C C o Debug Last Launched F11 B Outline 3 Run History n outline is not available RUA AS RUN C C Projects Ta Navigator 3 Debug History Debug As Debug X External Tools REF 1 LPC2000 Flash tility Run As Q External Tools Organize Favorites D errors 0 warnings O infos Description Resource Click on LPC2000 Flash Utility to verify that it runs C C Eclipse Platform File Edit Navigate Search Project Run Window Help IG H amp G l 0 Q BF toro ES c E JL LPC2000 Flash Utility File Buffer Help L E a C3 Fu Fu LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Port D eclipse workspace test main hex at Blank Eheck Entire Device COMt Selected Sectors Upload ta Flash Iz Enecultt Code CUm ater Upload StatSector T Erase Compare Flash Manual Reset uuu 15 Time Out sec E Device Use DTReATS Device LPC2104 a ag Part ID for Heset and Boot Loader ATAL Freg kHz 14746 Device ID Bao Eesder in Selection Now cancel the LPC2000 Flash Utility and quit Eclipse 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 Macraigor has always made this utility available on the
91. aded Download to Transfer rate C 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 Cl winzip S Scan Far Viruses i Convert to Adobe PDF Open With Send To Cut Copy Create Shortcut Delete Rename File Edit View Favorites Tools Help a Oo Back 7 gt i yo Search Wey Folders T a6 Address Folders X Mame 2 Size Type Date Modified 1366 aa 11 497 KE winzip File 9 3 2005 7 11 PM A a E ZEN i NEN i lu My Music ac y lincdt zl Open with WinZip 4 13 2005 FH E PM 5 Program Files Print 9 scratch Explore 5 source Files las Browse with Paint Shop Pro Studia m Ge Add Files to Library oy A Cl Add to Zip file 3 Add to scratch zip Cl Add to recently used Zip File Call Extract Eo Cal Extract to here 3 Extract to here using File names for Folders Sl Extract to Folder Cl Zip and E Mail scratch zip Cl Zip and E Mail Plus cd Encrypt 3 Configure WinZip Extract Extract to eclipse Ei amp Local Disk C aS cugwin Gy DELL Ey download a DRIVERS a eclipse f y 1386 My Computer Files My Network Selected files Folders 5 All files folders in archive Placez a Documents and Settings CE JD mc Use zip file names for folder
92. agd a serial cable attached to COM1 it aIzTs e 2 2 7 agoaoaoaaaag aaoaoaaooaoaadg agooagguaagdage aooo diare au aisIejejejejejetejete Beslslclelelelelejelelele e ici 000000 nccc E pueIvIarejejejejejeir c eIe ajejejejyeye eye c c t corn 0100000 Cca de Ja fa Jo fojo jojojo OIR BPADODODHHEL Power plug from 9 volt wall wart power supply ejufejefeja je ajejeje jejeje eJjojojefeja je e ejeje eje e SUR aa dl quad a dada Jae Cip Hed stripe on ribbon cable must be next to Debug JTAG jumper and the power plug The Debug JTAG jumper MUST be installed B Program Application into FLASH This was covered in Section 18 of the tutorial Using the techniques already discussed restart Eclipse and open the demo2106 blink flash project Do a Clean followed by a Build All Then start the external tool Philips LPC2000 Flash Utility and burn the main hex file into FLASH as shown below You must fit the BSL jumper to do this also suggest removing the JTAG ribbon cable from the wiggler while operating the Philips LPC2000 Flash Utility Re connect it when you re finished burning the FLASH memory Es LPC2000 Flash Utility E File Buffer Help DE l a DS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Fort Jworkspace demo2106_blink_flash main hex Blank Check fe Entire Device com1 O
93. ain Initialize the system Initialize t set io pins for led PO 7 IODIR OxOO0000080 pin PO 7 is an output everything Y lii gt E Console 3 Tasks amp E PA eee C Build demo2106 blink ram Writable Smart Insert 4 1 E Start the OCDRemote utility The Macraigor OCDRemote utility must be started before the Debugger is launched Remember 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 Fie Edit Refactor Navigate Search Project Run Window Help 15 gt ES Debug 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 Ini HSelm O Q H H eo o ES acc X Debug W Debug X O t9 variables gt Breakpoints ZJ sts E a 0 E Q OCDRemote Program el A AS a Ipc 10x h Le makefile i main c 3 W i JE Disassembly 529 int main void unsigned int i ffol static int hie static un static char static un static int 1 static in static long 5 static initia static char x s static in static int 73 f f static in const char tpText The Rain in Spain
94. al Tools Organize Favorites C C C Eclipse Platform Sele File Edit Wavigate Search Pr Run window Help F3 E Ej EN CA ctr Fil A a ES he C C rm x WE Mi Debug Last Launched F11 fe Ca ig E n TX H e Run History Run As H demoz106 blink Flash An outline is not available 6 15 demoz106 blink ram Run Debug History Debug s Debug CB External Tools Lj Problems E console 3 gt gt aperti M se Na ee z E A s A amp terminated gt C Program Fiesta NUAR MI Dine 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 LL Mew configuration ll aL oCDremote Favorites QL LPC2000 Flash Binig M Select All Deselect all Now verify that the OCDremote is in the list of External Tools favorites Click on Run External Tools and see that it s now included in the list of favorites C C Eclipse Platform Seles File Edit Navigate Search Project MA window Help r E ei B3 1 Run Last Launched Chri F11 50 E Hg c c Debug Last Launched F11 ac Ce OM J demo2i06_blink_flash Run As 61 15 demo 106_blink_ram Fun rt a a ig le 2 5 1 An outline is n
95. al are two examples of how to calculate the needed PLL initialization values One example is for a system without USB and the other one is for an application that does employ the USB This tutorial does NOT use the USB version Fosc 12000000 hz crystal frequency Fcco 2 PLL current controlled oscilator frequency cclk 60000000 hz desired system clock cclk 60000000 M 5 PLL multiplier value Fosc 12000000 Therefore we write M 1 or 4 into the 5 bits of the PLLCFG register PLLCFG 4 0 00100 The PLL divider value P must have one of the values 1 2 4 8 as long as Fcco is in the range of 156 Mhz to 320 Mhz Let s calculate the high and low limits of Feco 156000000 cc PER 1 3 156 Mhz 60000000 2 320000000 Do i25 eres oca 26 320 Mhz 60000000 2 Obviously the highest value of P that we can pick is 2 This value will not exceed the limitation that Fcco is less than 320 Mhz Therefore we look at Table 22 of the Philips LPC214x User Guide and see that a value of P 2 will require us to enter binary 01 into bits 6 5 of the PLLCFG register PLLCFG 0 01 00100 0x24 The only change to the initialize code in the main c source code is the setting of the PLL configuration register as shown below Setting Multiplier and Divider values PLLOFG Ox24 fsedil Enabling the PLL PLLCON Ox1 feed fo Wait for the PLL to lock to set frequency while
96. all from files in a local directory Install from Internet C Download from Internet C Install from Local Directory i ON 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 maf Select Local Package Directory 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 m Local Package Directory C scratch Cancel Since 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 Port feo 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 Download Site Choose a site from this list or add your own sites to the list Available Download Sites http mirror mcs anl quo http miro
97. 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 The RAM based version is limited to the LPC2106 RAM space 64K but you can set an unlimited number of software breakpoints The FLASH based version can be burned into onboard flash using the Philips ISP utility and then debugged using JTAG as long as you limit yourself to two breakpoints hardware 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 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 SUN Java Runtime 2 Eclipse IDE 3 Eclipse CDT Plug in for C C Development Zylin custom version 4 CYGWIN GNU C C Compiler and Toolset for Windows 5 GNUARM GNU C C Compiler for ARM Targets 6 Philips Flash Programmer for LPC2100 Family CPUs 7 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
98. as a very long name This download is a 18 megabyte file and takes 30 seconds on a cable modem 32 of bu 15_gcc 4 0 0 c c _nl 1 13 0 m E Saving OEC CHE nl 1 13 0 gi 6 1 exe from wia gnuarm com Estimated time left 2 min 3 sec 7 25 MB of 23 0 MB copied Download to o bu 2 15_gcc 4 0 0 c c _m 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 scratch File Edit View Favorites Tools Help AN o Back O d pa Search Ep Folders Folders A Mame 5 pictures ees bu 2 15 gcc 4 D 0 c c nl 1 13 0 gi 6 1 9 Program Files m C3 scratch AA o oo M S TT p TT Pes The GNUARM installer will now start Click Next to continue a Setup GNUARM Welcome to the GNUARM Setup Wizard This will install GNHUASAM 4 0 0 on pour computer It is recommended that you close all other applications before continuing Click Nest to continue ar Cancel to exit Setup m Accept the GNU license agreement don t worry it s still free Click Next to continue e Setup GNUARM License Agreement Please read the following important information before continuing Please read the following Licen
99. at www sun com The following screen will appear Click on Downloads Java 2 Standard Edition to continue SS 4 gt Y SUN microsystems STORAGETEK THE LEADER IN DATA MANAGEMENT Sun Microsystems Completes Acquisition of StorageTek to deliver excellent 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 NESST I Solaris 10 OS for Schools More News Shop for Products Java 2 Standard Edition Communities Solaris Service DevemperTos Developers Help the Servers Solaris 10 IAS System Administrators Victims of FER Top Downloads i x64 Products StarOffice Partners pr EN Hurricane UltraSPARC Iv Stora ge New Downloads investors Red Cross Katrin a Patches amp Updates Education Sun Store See All Take me to Communities Donate Contact About Sun News amp Events Employment Privacy Terms of Use Trademarks powered by 4 Sun Copyright 1994 2005 Sun Microsystems Inc miren 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 A Downloads The links below will take yo
100. aths 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 Eclipse 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 Fie Edit Navigate Search Project Run Window Hel
101. ation 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 m Restore Defaults 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 Files 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 3k Ant Build Q Program O New configuration E Main Refresh Li Environment EJ Common Location zzi Browse Workspace Browse File System Variables Working Directory Browse Workspace Browse File System Variables Arguments A B Variables Note Enclose an argument containing spaces using double quotes d External Tools Create manage and run configurations Create a configuration that will run a program Configurations Name Lec2000 Flash Utility EQ Program Q New_configuration E Main ES Refresh P Environment ES Commen
102. ay etc Le Ipc210x h makefile Le maine 23 N ELI Outline Disassembly 23 V EL LE EAE a 443 A int main void 1 Function declarations Ox40000274 lt main gt mow riz sp i ee ee j MW Ox40000278 lt main 4 gt stmdb sp rll riz lr pc Ox4000027c lt main 5 gt sub rii ELZ 4 0x4 void IAAARABARA void Ox40000260 lt main 12 gt sub Sp sp 8 Oxs void feed void Lili unsigned int j void IRQ Routine void attribute interrupt IROQ static int a void FIQ Routine void attribute interrupt FIQ static char d Assembler void SWI Routine void _ attribute interrupti SWI static int wW Di void UNDEF Routine void attribute interrupt UNDEF Static long x 5 ISP ay f f Static char y LXXXLLLLLCLLLLLLLCLCLLCLCLCLC CC CC a a a a a a e a a a static int Z Header files C a AAA AAA AA AAA AAA Hinclude LPC210x h C Code Display const char pText The Rain in Spain 0x40000284 lt main 16 gt ldr r3 pc 196 Ox40 Ox40000288 lt main 20 gt str r3 rii 16 Initialize the system Initializel Global Variables Ox4000026c lt main 24 gt bl Ox40000354 lt Initialize FHKKHHHAA AAA TATA CA A hh ATTRA oh oh ch ch ch hoch Ch ch Ch A Ch AAA ATH A AAA AAA TATA AS f ERRE ERRE int a global uninitialized variable set io pins for led PO 7 int E global uninitialized variable IODIR OxOO0000080 pin
103. 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 22 Debug the FLASH Project Debugging an application configured for FLASH execution is not only possible but fairly easy It s a two step process use the Philips LPC2000 Flash Utility to burn the application into onboard FLASH memory and then run the Eclipse GDB debugger to control execution A Hardware Setup The following hardware setup is required Olimex ARM JTAG Adapter WIGGLER LPT1 COM1 Ciz Cll Co EN EN EN e 6 LETT O b i 20 H an E pin i E JTAG y IMEX LTD Port AE O Se FRESE SE ES EF Le X muss SAA ee bb amp C oim os D O4 m oc M oL UI US KD A CEU 4 Ow oy ow NENA e HTTP HMMH OLIMEX COM DEU The only thing to remember about the hardware setup is to fit the bootstrap loader jumper BSL while programming the FLASH using the Philips LPC2000 Flash Utility and to conversely remove the BSL jumper while debugging To ensure that the hardware is set up correctly for FLASH debugging refer to the photograph below BSL jumper is installed when programming FLASH memory BSL jumper is removed while debugging LIN a A oe oe A e rj anna dada gagggagog alelaielelelelelela gi goaogggcaagaadgagd Oooo oe ele alelalolaloalajoJojejo
104. c 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 m 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 For Jim Lynch Variable Value TEMP Ci Documents and Settings Jim Lynchic TMF C Documents and Settings Jim Lynch System variables Variable PUMBER_ OF P ccyqwinibinic program Filesanuarmi PROCESSOR 4 xd Mew Delete Take a very careful look at the Edit System Variable window the Path Edit in this case Edit System Variable Variable value b cygwinbin c pragram files gnuarm bins 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 p
105. calhost 8888 unsigned int 3 ff d static int a fo static un static char d static unm static int W 1 fo static in static long x 5 static initia static char v 0x04 f static in z 7 f static in const char pText The Rain in Spain static int Initialize the system Initialize set io pins for led PO 7 IOPDIR x 000080 pin PO is an output everything IOSET OxOo0o000080 ff led off IOCLR OxOoo00080 led on qdo load iascblohe LsxEb smerhigcgnh sisse LSDB nbotalesze 9 2515 section data section size 24 total size 2515 gab 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 can be a little slow You may want to experiment with a faster speed setting for the Olimex wiggler The debugger is idle waiting for you to issue a command G 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 Debug x b i oT X e mh CR gU TE D j gt z Eg OCDRemote Program ie wal Cicyowin usr local binjocdremote exe Eee demaozi s amp blink ram Embedded debug launch a Embedded GOB
106. cc UU a a ETE aa Dynamic Help FETE a r C UU CE C E a a a a ES Key Assist Ctri ShiFt L void Initial Tips and Tricks void feed vo Cheat Sheets void void void If you click on Eclipse C C Development Tools 3 1 0 you will see an option to disable the CDT plug in If this has been disabled use these menus to reverse this situation E Configuration Sele File al TT E Sle le 5 BI c RB Eclipse SDK H ciecipse i Am Eclipse C C Development Tools 3 1 0 Eclipse Project SDK 3 1 1 Eclipse C C Development Tools 3 1 0 Eclipse C C development tools Binary runtime and user documentation Available Tasks Scan For Updates earch For updates For this feature fou can enable or disable the Functionality of a Feature The Feature is not removed by this action Show Properties View properties of the Feature such as version provider name license agreement etc 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 originall
107. ce 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 cammunicatians interfaces and an chip SRAM options up to 64 kilobytes they are very well suited 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 Loa 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 B Support amp tools LP 2104 Single Chip 32 bit Microcontroller Erratasheet date 2004 06 01 LFC2105 Single Chip 32 bit Microcontroller Erratasheet date 2004 06 01 LPE2106 Single Chip 32 bit Microcontroller Erratasheet date 2004 06 01 LPit2104 Erratasheet date 2005 12 10 LPEZ105 Erratasheet date 2005 17 10 LPE2106 Erratasheetrdate 2003 12 10 Phil
108. de two great decisions I gave them Steve Furber 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 Cyawin Linux and MacOS The toolchain consists of the GNU binutils compiler set GCC and debugger Insight for Windows and 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 avoided purely comrmercial pointers in our projects section at our resou
109. e all rodata sections constants strings etc j all rodata sections constants strings etc all glue 7 sections all glue 7t sections 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 lt tasks El Console 2 q Y Ee bbl of E 73 7 0 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
110. e Philips boot loader supports the ISP In System Programming via the serial port and the IAP tf In Application Programming for flash programming from within your application j pr e The boot loader uses RAM memory and we MUST NOT load variables or code in these areas j ye ty pe RAM used by boot loader Ox40000120 Ox400001FF 223 bytes for ISP variables Ox40007FEO Ox4000FFFF 32 bytes for ISP and IAP variables qe Ox40007EEO Ox40007FEO 256 bytes stack for ISP and IAP pe ty pe wf MEMORY MAP 0x40008000 _ R re variables and stack 0x40007FFF x ram isp high for Philips boot loader 32 256 288 bytes Pi Do not put anything here Ox40007EEO _ R j UDF Stack 4 bytes Ox40007EDC lt _stack_end R j ABT Stack 4 bytes 0x40007ED8 ty R j pe FIQ Stack 4 bytes Ox40007ED4 R pe IRQ Stack 4 bytes Ox40007EDO pe R tf ys SVC Stack 4 bytes Ox40007ECC R ufi Ox40007EC5 ex stack area for user program fi qe he qe ed V
111. e linker command file to Ipc2148 cmd cima Projects X E J H mmu rea a Ld demozi e amp blink Flash JE W demo2106_blink_rarn Et demoz148 blink Flash 3 Includes S crE s Le main c L makefile 5 Change all Text Strings 2106 to 2148 Basically search all five files and replace all occurrences of 2106 with 2148 The safest thing to do is to open each file and search replace using the Edit menu found that the Search pull down menu doesn t look at the makefile Most of these changes are to annotation but in the case of the makefile it effects a filename The linker command file is a good example PRE Wokk ok ck kk Kok ck RARE Kokckck kckockck Kok hock ck ok RRA A ck ckck ck ok ck ck ch ck oko kck ck ck ck ck ch k ko kck ck k ck ck ch k ck ck ck kh k k ck ch kh k ck ch hok hoch ch hok hoch ch kc demoz145 blink flash cmd LINKER SCRIPT ER E ja The Linker Script defines how the code and data emitted by the GNU C compiler and assembler ja to be loaded into memory code goes into FLASH variables go into RAM ES jw Any symbols defined in the Linker Script are automatically global and available to the rest i pe program ES ja To force the linker to use this LINKER SCRIPT just add th T demozi45 blink flash cmd dire Fi to the linker flags in the makefile ES ja LFLAGS Map main map nostartfile s T demozi46 blink flash cmd ES je
112. e 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 P PHILIPS SEMICONDUCTORS News Center Markets Key Technologies Products Jobs Company Profile oo Product Information CONSUMER PRODUCTS PROFESSIONAL PRODUCTS YOUR COUNTRY TF Information as of 2004 07 10 Product Categories mY fe Analog and mixed E Download signal devices informed datasheet Audio Bus devices Clocks amp Watches Data Communications hd Datasheet ki Email translate kd Disclaimer hd Applications kd Support amp tools hd Similar products kd General description hd Features hi Block diagram hd Products amp packages hd Parametrics Discrete modules SB General description Discretes Display drivers dentification Z Security Logic Microcontrollers Peripherals eVideo s Wired Communications Wireless Communications aaa rT 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 interfa
113. e 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 routines 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 Im HOelB I J avV ileo o Be F ES Resource SIOS v demo2106_blink_flash B edtproject i B project PLLFEED 0xAA B crt lst PLLFEED 0x55 E ert o crt s PE demo2106 blink Flash cmd e Ipc210x h main c E main dmp main hex B menma Stubs for various interrupts may be replaced later B main o B main out 0 l9 makefile 5 15 demo2106 blink ram S cdtproject 8 project i 3 crt lst crt o void FIQ Routine void b is cie while 1 F demo2106_blink_ram cmd e Ipc210x h d main c E main dmp void SWI Routine void E main hex while 1 E main map E main o main out 9 makefile void UNDEF Routine void while 1 void feed void void IRQ Routine void while 1 lt Tasks El Co
114. e 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 a File Buffer Help DHILIDS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Pork C eclipse workspace demo2106_blink_flas E BERE Entire Device comt Selected Sectors Use Baud Rate Execute Code Upload to Flash e me T 5 18200 Compare Flash Manual Reset J E dSector us Time Out sec 2 Use DTR RTS Device Device LPc2106 Part ID Eoo Read 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 SEs LPC2000 Flash Utility eae Help LPC2000
115. e structured variable Access bring up the right click menu and select Add Watch Expression XY Add Watch Expression Run As b EN Add Watch Expression Expression to watch Access name 6 amp cea Note that it now appears in the Expressions view ee p g 8 channel 28 Arcess name 6 m You can type in very complicated expressions Here we defined the expression i z h RT zar gan rd channel 29 Arcess name 6 m ASS O 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 Outline lari Disassembly X 4 mL Ox400003d08 lt Initialize 7b gt E3 ls1 16 Ox400003de lt Initialize s0 gt ES lar 16 Ox4000053e0 lt Initialize 54 gt E35 lar 10 Ox400003e4 lt Initialize 55 gt ra r3 1 Oxl Ax40000s53es lt Ilnitialize 9z gt r3 0 OxO Ox400003ec lt Initialize 29b6 gt Ox400003c08 lt Initialize 50 gt Connect the PLL as the clock source PLLCON x3 3
116. ebugging etc all work great in this FLASH debugging motif I m not going to repeat that information please review the material on RAM based application debugging and try these features If you have to restart the debugger recall this sequence from our RAM debugging Bi gt Kits both the OCDRemote and the debugger and o E H FLASH Debugging Check List If you can commit the following simple points to memory you will be rewarded with hours of worry free FLASH debugging 23 The Author Sounds Off Last year decided to see if it was possible to put together a complete low cost ARM software development system for embedded programming Purchasing a commercial package seemed out of the question since the price ranged from 900 to several thousand dollars Affordable quick start packages typically have a time limit on usage or limitations on the code size Microsoft has recently developed express versions of their tools for free non commercial use However their code targets are typically for the Windows Intel platform That s when looked into the GNU tools and the Eclipse platform They re open source and free The problem discovered is that the documentation is targeted for experts The GNU documentation assumes you are a Linux expert and the Eclipse documentation is targeted for JAVA programmers The CDT plug in for Eclipse currently has no books available for reference Recognizing the difficulty in findin
117. ector 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 ES we a Su a LOS Pe h NS ada os Ae NE NAE a ONE UPC used that 30 gauge Radio Shack blue Teflon coated hookup wire and a microscope to do the soldering above If 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 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 maneuve
118. edPackages amp Default Postlnstalllast amp Default i iu gt lt Back ET Cancel Click Next to start the download 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 M Disk Cancel When the installation completes Cygwin will ask you if you want any desktop 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
119. elling Framework EMF Downloads Project home 4 C Development Tools CDT JDT Java Development Tools Downloads Project home PDE Plugin Development Environment DowNoads Project 5 Graphical Editor Framework GEF home B Visual Editor E Platform Downloads Project home Eclipse Tools Project Downloads Project home C C IDE Downloads Project hame COBOL Downloads Project home TPTP EMF Downloads Project home DIndated Sim diris LL El 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 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 feclipse home 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 eclipse downloads Your preferred mirror appears to have this file eclipse S0K 3 0 21032 zip United States United States U
120. eneral 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 Ep with GDB The GA Sout Lil Dije IFTESN fra iba a wd 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 Amazon com e ARCH INSIDE List Price 49 95 11 used amp new available from 47 97 Edition Paperback Debugging with GDB The GNU Source L evel Debugger Paperback by Richard Stallman Roland H Pesch Stan Shebs You can use this manual at your leisure to read all about GDB more SIPs running gdb your pragraut gdb data trace snapshot selected stack frame more CAPs Command Synopsis Examining the Symbol Table Command There Free Software Foundation Configuration Specific Information more tin 5 customer reviews List Price 40 46 Price 19 80 amp eligible for FREE Super Saver Shipping on orders over 25 See details You Save 10 20 3496 Availability Usually ships within 24 hours Ships from and sold by Amazon com See more on holiday shipping Want it delivered Tuesday December 13 Order it in the next 30 hours and 4 minutes and choose One Day Shipping x checkout See details 18 used amp new available from 19 79 The ARM documentation can be downloaded free from the ARM web s
121. er In H H E ArcSoft Ga ATI Technologies Ea Borland H E BVRP Software E BVRP Software Inc H E corresy 6 23 Classes H E Clients E E Corel B a Cygnus Solutions 3 a Cygwin fg mounts vz ng Program Op g 26 Dell E 3 63 Dell Computer A Mall Tarma T aai Marne lab Default value not set Mame labjiDefault heap chunk in mb Type REG 32 REG DwORD value not set Ox 00000800 2045 Kev String value Binary Value DWORD Value Multi String value Expandable String value My ComputeriHKEY LOCAL MACHIMETSOFTWAREW vgnus Solutions Cy gu mS Reboot your computer and pray
122. ere 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 lt 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 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 efficie
123. essii 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 GNUAAM on your computer Extracting files C Program Files GNUSAM Sinclude c 44 D O backward heap A Cancel When it completes the following screen is presented Make sure that Add the executables directory to the PATH variable is checked This is crucial Setup GNUARM m Completing the GNUARM Setup Wizard Setup has finished installing GNUARM 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 000 Cem Da 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 COM1 port of the desktop computer to the Olimex LPC P2106 board s flash or RAM memory W
124. g and assembling all these software components decided to make copious notes for myself concerning how went about this task The result is this tutorial the purpose being a detailed exposition of all the procedures required to build a completely free ARM software cross development package This tutorial is designed for novices assume only that you are familiar with C language used the Philips LPC2000 family of embedded ARM controllers as the tutorial s hardware examples These chips are inexpensive rich in onboard peripherals and contain significant onboard RAM and FLASH 512K of Flash in the LPC2148 Other manufacturers such as Analog Devices Atmel Cirrus Logic OKI ST Microelectronics Texas Instruments Intel Freescale Samsung Sharp and Hynix all produce ARM offerings worthy of consideration lm sure that many of the ideas in my tutorial can be transposed to these other manufacturer s designs 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 described in great detail how to download and 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 lm not finished writing tutorials My next tutorial will involve using ARM interrupts and how to design and implement I2C port expanders to interface to L
125. g 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 CPSR c ZMODE USR I 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 0x4000FFFF Philips ISP Flash Loader Stack and variables 288 bytes 0x4000FEEO 0x4000FEC8 USR mode SYS mode stack Stack grows downward until it collides with RAM last address in internal bottom of Philips ISP UND stack pointer ABT stack pointer FIQ stack pointer IRQ stack pointer SVC stack pointer USR SYS stack 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 r3 g 5 m9 I amp 149 eo gt ES Resource tS Navigator 2 N ELI S Eg mo2106_blink_flash copy data section Copy from ROM
126. 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 no idea what these are glue t all glue 7t sections no idea what these are _etext define a global symbol _etext just after the last code byte j 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 _edata define a global symbol marking the end of the data section gt 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 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 7 PLL Setup The Olimex LPC P2148 board has a 12 mhz crystal The setup of the phased lock loop PLL must be revised On page 34 of the LPC214x User Manu
127. gth and takes 9 minutes to download with my broadband cable modem lf 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 2 9 Saving eclipse SDK 3 1 32 zip From ftp cse buffalo edu Estimated time left 7 min 33 sec 7 41 MB of 103 MB copied Download Eo Cidownload eclipse SDK 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 sex Q d pers ME Folders EF ae Size Type Date Modified El E DRIVERS 7 eclipse 5DK 3 1 win32 105 476 KB Compressed zipped Folder 94 3 2005 10 52 AM E C eclipse Cl C3 1386 E My Music El C3 Program Files Folders Mame 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 Awww 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 fi
128. gx the debugger for FLASH debugging His favorite hobby is playing with small microcontrollers Kjell lives in Oslo Norway with his family and two cats Design Applications Engineer Spencer Oliver from the United Kingdom also provided me with valuable guidance on how to set up the Eclipse system for FLASH debugging Spencer was too bashful to send me a picture 26 Some Books That May Be Helpful The following is a short compendium of books that I ve found helpful on the subject of ARM microprocessors and the GNU tool chain I 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 Introduction 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
129. hanges the addressing of the ports if we wish to utilize this new high speed port feature 1 Create a New Project Using the techniques described earlier in the tutorial create a new Eclipse Standard Make C project and give it the name demo2148_blink_flash C C Eclipse SDK File Edit Refactor Navigate Search Project i im He m lw e8 Cc EJ demoziD6 blink Hash H S demozi 6 blink ram LS demoz148 blink Flash 2 Import the Tutorial Files You can use the File Import pull down menu and browse to the demo2106 blink flash project and pick the following five files to import lpc210x h a crt s n E i A main c demo2106 blink flash cmd T Y demo2106 blink flash makefile mak 6 3 demazi s amp blink ram 2 1 demaz148 blink Flash ES Includes E h Ipezi x h E S crE s EE e main c Sri demoz106_blink_Flash cmd 3 Find the Right Include File The include file Ipc210x h is the incorrect file for the LPC2148 found an include file posted by Philips Applications Group on the Yahoo LPC2000 message board http f1 grp yahoofs com v1 QEeeQyAcAaF5GWXpBCeeHj6uYAN C2R5PijwYZB9Eu7CRO6XOlglDhlhsd YnraxKA2y81CdwRCQa9Y vwigle IHhqBWgGaFIiQ LPC214x h That s some web address isn t it Delete the lpc210x h file and import the correct one which is Ipc214x h 4 Rename the Linker Command File Use the Eclipse right click menu in the projects view and rename th
130. he 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 12C SSI Timers etc and high performance at low power consumption 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 88 latest price from Digikey for one LPC2106 Key features e 16
131. he program regedit Type the name of a program Folder document ar Internet resource and Windows will open it For you Open regedit When the Registry Editor starts up you should see the following 5 Registry Editor File Edit View Favorites Help E a My Computer Name uu HKEY CLASSES ROOT ab Default value not set GS HKEY CURRENT USER E HKEY LOCAL MACHINE GL HKEY LISERS 9 HKEY CURRENT CONFIG My Computer HKEY CURRENT USER Click on HKEY LOCAL MACHINE SOFTWARE Cygnus Solutions Cygwin and you Will see the following display Registry Editor File Edit View Favorites Help E a My Computer a HKEY CLASSES ROOT H 23 HKEY CURRENT USER 1 HKEY LOCAL MACHINE El HARDWARE 9 Sam 29 SECURITY g de Tal H 3 3 Adobe H 2 63 America Online Ea Analog Devices a Apple Computer In 23 ArcSoft H E ATI Technologies a Borland H BVRP Software Ea BVRP Software Inc H E caftsv 2g Classes 9 Clients H E Corel o C Cygnus Solutions as a Program Op g 2 Dell H 3 63 Dell Computer i Lo r P mma Ile Enter a new DWORD entry heap_chunk_in_mb 0x0000800 256 mb as shown below Registry Editor File Edit View Favorites Help O E my Computer H HKEY_CLASSES_ROOT H E HKEY_CURRENT_LISER S HKEY_LOCAL_MACHINE EHE HARDWARE g g sam of SECURITY B a SOFTWARE H 2 9 Adobe H 2 3 America Online H E3 Analog Devices E 2 3 Apple Comput
132. he serial port and the IAP j In Application Programming for flash programming from within your application t7 The boot loader uses RAM memory and we MUST NOT load variables or code in these areas pe wy RAM used by boot loader Ox40000120 Ox400001FF 223 bytes for ISP variables Ox4000FFEO Ox4000FFFF 32 bytes for ISP and IAP variables pe 0x4000FEE0 Ox4000FFDF 256 bytes stack for ISP and IAP j t7 f X m e Ex GB et SA lt terminated gt Insight Program C Program Files GNUARM bin arm elF insight exe E i writable Insert Resource demo2106_blink_flash cmd Eclipse Platform Sele File Edit Navigate Search Project Run Window Help Ins BSlal a wlweo o ES Resource IC gt 0002 CEE 00 78 Se z v E demo2106_blink_flash MEMORY MAP i cdtproject 0x40010000 project 2 crt ict A Ox4000FFFF crt o isp hi variables and stack S crt s for Philips boot loader F demo2106_blink_flash cmd 288 bytes Ox4000FEEO Ipc210x h main c Ox4000FEDC main dmp main hex 0x4000FED8 E main map H main o Ox4000FED4 B main out E makefile Ox4000FEDO tS demo2106 blink ram x Ox4000FECC Ox4000FEC6 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 f B demo2106_blink_f
133. ialize the system Initializetli set io pins for led FPO 7 IODIR OxO00000080 ff pin PO 7 is an output everything MM lt ii gt E console Tasks Ex RE 3 m T lt berminated gt OCDRemaote Program C cvguintustilocalbinocdremote exe DU Demon Initializelardgetr 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 Make sure your computer is not running cpu intensive applications in the background such as internet telephone applications my beloved SKYPE for example The OCDRemote wiggler system does bit banging on the LPT1 printer port which is fairly low in the Windows priority order For Windows XP users here is a simple way to get rid of all those background programs Click Start Help and Support Use Tools System Configuration Utility Open System Configuration Utility Startup Tab gt System Configuration Utility General SISTEM INT WIN INT BOOT INI Services Startup Item Command Location mcupdate CUPROGRA 1 mcafee HELMISOFTWARE Microsoft Windows Currentier McAgent EAPROGRA 1mcafee HELMISCPFTWA
134. ined 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 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 gt 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 gt flash specifies the load memory address essentially an exact cop
135. ips 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 MM E E I sr Manual date 2003 09 E vees Development Tools tar LPC2100 devicest date 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 lpc 000 Flash utility zip From wiew semiconductors philips com Would vou like to open the file ar sawe iE to your computer Saving Ipc2000 Flash utility zip From www 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 El WinZip Evaluation Version Ipc2000_flash_utility zip mE File Actions Options Help ease Mew Open Favorites Extract Encrypt View Install Wizard X Mame Type Modified Size Ratio Packed Path 8j setup exe Install Applic 7 15 2000 12 00 AM 138 776 32 6 1 4 CU PC210x ISP CAB Winzip File 9417 2004 11 21 AM 2 041 648 1 2 1029 E setup Ist LST File 9 17 2004 11 22 AM 4001 79 Bu Selected O files O bytes Total 3 files 2 135KB Now you can see that the download directory has a setu
136. irectory 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 assembling arm elf as ahls mapes 32 Compiling arm e lf qee I c fno common 03 q main a linking 0 ert o ecrt s gt crt lst arm elf ld w Map main map Tdemozi 6 blink rlash cmd 0o main out GMU ld version z 15 CO0pyvindg arm elf objcopy O ihex main out main hex arm elf objdump x 3s3yms main out gt main drp 4 1 A Ek rt r3 0 JUUESmem 0 0 0 Baan Build demoz1 06 blink Flash Crt o main o 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 M M Ad MC COM M M LM m o nl oo LS Ciz Cil C8 EHE EN EN i NANO ADA BHEHNHNHENENNHENMNEHNENENNHNENENEN O HTTP WMMH OLIMEX COM DEU e To run the Philips LPC2000 Flash Utility it s easiest to just click on the External Tools
137. ite http www arm com documentation The Philips Corporation has extensive documentation on the LPC2000 series here httip www semiconductors philips 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 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 APPENDIX1 Porting LPC2106 Projects to other Processors The Olimex LPC P2106 board was arbitrarily chosen as the hardware example for this tutorial Many readers will be interested in how to modify the projects shown in this tutorial to other ARM processors This process is not difficult will demonstrate conversion of the demo2106 blink flash project to the Philips LPC2148 ARM7 processor specifically the Olimex LPC P2148 board To make this conversion you need two things the Olimex LPC P2148 schematic and the Philips UM10139 LPC214x User Manual can be downloaded from their web sites
138. itory Exploring F Debug amp Java iJ Java Browsing fed Java Type Hierarchy 4p 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 Help ri geljedBHBIs 0 I 4 wo o C C Projects ESSE 0 dE Outline XN AO od amp An outline is not available El Problems 28 Console Propertes KS 7H 0 errors 0 warnings O infos Description Resource Now we want to add the Philips LPC2000 Flash Utility to the External Tools part of the Run pull down menu Select RUN External Tools External Tools C C Eclipse Platform File Edit Navigate Search Project MAA window Help po Ele Go te F Run Last Launched Ctri F11 rm Run History Run As Run Debug History Debug As Debug E External Tools Run AS 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 iu p E M 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 configur
139. l Value FF Start amp H 40000000 End amp H 400004 LPC2000 Flash Utility 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 H4000 0000 FF FF FF FF FF FF 44000 0010 FF FF FF FF FF H4000 0020 FF FF FF FF FF H4000 0030 H4000 0040 H4000 0050 H4000 0060 H4000 0070 amp H 4000 0080 H4000 0090 H4000 0040 H4000 ODED H4000 DOCO H4000 DODO H4000 ODED amp H 4000 DOFO amp H 4000 0100 amp H4000 0110 amp H4000 0120 H4000 0130 H4000 0140 amp H 4000 0150 H4000 0160 H4000 0170 H4000 0180 amp H 4000 0190 H4000 MA0 H4000 0180 H4000 MCO H4000 0100 H4000 MEC H4000 01F0 Uuuuuuuguuuuuuuy e Load Hex File Upload to RAM Download RAM 2 i Fill Buffer Code Feeble Address Range Fill value FF M40000200 Selected Range Start eH 40000000 Run from Address J Thumb tf ARM t Entire Buffer End amp H40D0FFFF LPC2000 Flash Utility Your application should blink just like the Flash EPROM version did Time for the Bigfoot picture i d p e e al d me d d RR A M a NN m L s IET A A SEA A A as z m a i ndi mj a 3 al Ada 21 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
140. lash cmd X _bss_end 2 5 demo2106 blink Flash B edtproject project cre lst crt o bss uninitialized variables oc a al _bss_start C Ipc210x h C main c data initialized variables 0x40000200 lt variables used by Ox400001FF Philips boot loader 223 bytes Ox40000120 Ox4000011F ram vectors Ox40000040 Ox4000003F Interrupt Vectors re mapped Ox40000000 main o main out mes demo2106_blink_ram OXDOO1FFFF cdtproject project crt lst crt o demo2106_blink_flash main hex main map main o E main out 9 makefile 2 demo2106_blink_ram 0x00000104 Ox00000103 Ox00000040 Ox0000003F copy of data area 0x00000284 lt Interrupt Vector Table Ox00000000 The easy vay 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 0xF000 0000 VPB Peripherals 3 5 GB OxE000 0000 3 0 GB 0xC000 0000 Reserved for External Memory 20 GB 0x8000 0000
141. ld ga Coma rea coa The Wizard completion screen lets you restart your computer to put OCDRemote into the Windows registry Macraigor Systems Hardware Support Package 2 14 InstallShield Wizard InstallShield Wizard Complete The InstallShield Wizard has successtully installed M acraiqor Systems Hardware Support Package 2 14 Before you can use the program you must restart your computer Yes want to restart my computer now CO Mo will restart my computer later Remove any disks fram their drives and then click Finish to complete setup Back Cancel 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 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 MA Window Help pe E 6 YA Run Last Launched CtrHFl1 P 5 2 E Hcc Debug Last Launched Fil H Run History An outline is not available Run 45 Run Debug History Debug s Debug F External Tools d Gh 1 LPC2000 Flash Utility E External Too
142. le Memory Monitors Pane gt button This will expand the display erasing the memory monitors list on the left Console i Memory x E ri ce z T la emory Renderings Box Memory Renderings d f Ox400004F4 Ox400004F4 lt Hex gt Ox400004F4 Ox400004F4 ASC gt s jz e 2 ja la 400004FO0 au au O0 65 55 20 ae 400004FO O O O O Al h e E a i n 40000500 53 FI 51 ba bE au au au Oe 40000500 3 p a i n O O O O O O O 40000510 O05 au au O0 15 05 au 40 46 0000510 O O O O O O O 3 F a a t 40000520 68 51 BE 20 61 20 3 0 65 40000520 H a n a 3 p e d i 40000530 75 Bc Bc 65 T4 au au au D 40000530 u l 1 e t O O O O O O O 40000540 05 oO ag OO O1 au au au OO 40000540 O O O O O O O O O O O da 40000550 00 au au O0 ag au au au O0 7 40000550 O O O O O O O O O O O om 40000560 au au OO EL El FF TF OS m 40000560 O O O O a O O a Y Of 40000570 O00 au au O0 78 EC FF E 78 40000570 O O O O x i Y O x i Y O 40000590 o au au OO EL El FF TF BK 400005680 O O O O Y O O a Y O 40000590 00 au au O0 78 EC FF TF 78 40000590 O O O O x i Y O x i Y O 40000540 OO ac ag EL E1 FF TF 03 40000s40 O O O O a O O Y O 40000580 00 au au O0 78 EC FF TE 78 40000580 O O O O x i Y O x i Y O 40000520 u OO ut EL E1 FF TF 03 40000520 O O O O a O O A O 4nnnnenn nn nn nn nn 78 OUR OUR 7F 8 annnnmmn n nmn n n v 4 9 n v i amp n ij lii gt lt lii E Personally I think this Eclipse memory display is a
143. le 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 PO CIC Pr 23 3 1 d demo2106_blink_flash Binaries 15 Includes h Ipc210x h crt s main c crt o armle 2 main o armle s main out armle Eg crt Ist demo2106 cmd main hex main lst main map I makefile Sim 6 main Ist a f G O Q Bats Sr B ee Ipc210x h E main map E demo2106 cmd Bi main c X Initialize define PLOCK 6x460 void Initializetvoid gt lt Setting the Phased Lock Loop lt PLL gt Olimex LPC P2106 has a 14 7456 mhz crystal We d like the LPC2186 to run at 53 2368 mhz Chas to be an even multiple of crystal PLL multiplier bits 4 of PLLCFG gt 53236866 hz 147456808 hz where M cclk Fosc According to the Philips LPC2186 manual M cclk Fosc Solving M 53236866 14745666 3 6163515625 M 4 round up crt Ist 52 Note M 1 must be entered into bits 6 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 53236888 2 2 212947
144. les 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 ET Ly WinZip Evaluation Version eclipse SDK 3 1 win32 zip File Actions Options Help Open Favorites View Checkout Wizard Tvpe Modified Ratio Packed Path A 6f27 2005 3 13PM 1 402 943 5 1 328 edipseiplug E org eclipse com Executable J 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 eclipselplug pdebuild ant jar Executable J 6 27 2005 3 06 PM 27 816 10 24 982 ecipsetplug Fragment xml ML Document 6 27 2005 3 06 PM 325 36 207 eclipselplua plugin xrl ML Document 6 27 2005 3 06 PM 257 3095 180 eclpseplug Manifest mf MF File ble 12005 3 06 PM 243 33 162 eclipselplua Fragment xml 2ML Document 6 27 2005 3 06 PM 166 28 134 ecipseiplug Manifest mF MF File 6r27 12005 3 06 PM 182 3075 1z eclipselplug kaf plugin xml ML Document 6 27 2005 3 06 PM 156 28 134 Ba vy lt lll gt Selected 0 Files 0 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 Os EARRAS E evawin fy DELL E E Document
145. lipse 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 things started eclipse home eclipse org whats new bbs neun Welcome Welcome to eclipse org Eclipse is a kind of universal tool p technical articles visit the newsgri can find out about eclipse related e 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 teclipse eclipse org home eclipse downloads If youre new to Eclipse start by downloading the Eclipse SOK then browse the various project pages to find the useful tools and plugins 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 fiow Eclipse SDK 3 1 windows torrents Top 10 Eclipse Downloads Other downloads for 3 1 Eclipse project FAQ Newsgroups 1 Eclipse SDK 3 1 latest release Documentation and help Rich Client Platform RCP 2 Eclipse SDK 3 2M1 latest milestone stable Eclipse Project 3 Eclipse Mod
146. ls Organize Favorites O errors O warnings 0 infos In Folder Click on New and replace the name with OCDremote Use the browse file system to find it lt 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 s4 specifies 100 khz speed s8 is the slowest speed You will probably want to experiment with the speed setting Click on Apply to finish the setup External Tools Create manage and run configurations Run a program 0 Configurations Mame OCDremote oo 4 Ant Build Ej Program n LPC2000 Flash Utilit E Main i Refresh PS Environment E Common AL New configuration Location d Cicvgwinusriacalbinacdremate exe 4 Browse File System variables Working Directory Browse Workspace Browse File System variables lt ARMFTDMI S paa88 dwIGGLER al 54 Mote Enclose an argument containing spaces using double quotes g Variables nr Delete 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 Extern
147. main dmp E dmm Reset Handler main map K makefile demo2106_blink_ram Binaries i Includes Setup a stack for each mode note that this only sets up a usable stack h Ipc210x h for User mode Also each mode is setup with interrupts initially disabled S crt s Alli E main c crt o armle Problems E Console 23 Properties Y Ex AB 8 5 0 2 main o armle terminated LPC2000 Flash Utility Program C Program Files LPC2106 ISPALPC210x ISP exe E main out armle ert lst lli amp Rese t Handle r 4 4 SEU 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 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 C C main c Eclipse Platform File Edit Navigate Search Project Run Window Help ri H amp m la a amp 8 gG 5 0O Q 49 o o By 8 ES Beycic E Tee OU demo2106_blink_ram crd C main c S main c x CINES BS y 45033 9 ES demo2106 blink Flash Fe qum for the PLL to lock to
148. mand 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 t C C Eclipse Platform Fie Edit Mavigate Search WEE Run Window Help PS m E ET Becr 0 Q m S CIC Projects x Close Project 3 Resource Fit Build All c Build Project Build Working Set An outline is not i available demoz106_blink_Flash Clean Build Automatically Properties Search a A Create Make Target Build Make Target Properties Idemo 106_blink_Flash This is no different 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 CIC Eclipse Platform AE File Edit Mavigate Search Project Run Window Help ri u B G 8 B C O Q Jie lt ES ac gt lan E not available ae CIC Projects x Problems E console 83 Properties Search Console idemo
149. n 4s Debug As Writable Smart Insert 49 25 The debugger will execute to the source line you specified E Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help ri amp lglt 0 QqQ jomm4 l98 9 o BY Sosa R cices dla Aft Variables 3 5 Breakpoints Lo st ir X Sig Ol De nn Ia A ge p 4 i j 40740 n a 0 bonu c 0 Bem zw LI EQ OCDRemote Program pal CAcygwinusr local bin ocdremote exe Else demo2106_blink_Flash Embedded debug launch Bee Embedded GDB 12 10 05 9 21 PM Suspended EP Thread 0 Suspended ES 1main at main c 49 pal Debugger Process 12 10 05 9 21 PM main c X Be outline e static int z static initialized variable static long x 5 static initialized variable Initialize static char 0x04 static initialized variable tend static int mone static initialized variable IRQ Routine const char tpText The Rain in Spain FIQ Routine k SWI Routine fe Initialize the Syst en HH UNDEF_Routine Initializel LPC210x h q set io pins for led FO 7 IODIR OxXo000000s0 pin FO T is an output everything else is input after re IOSET U x ngagngsun led off IOCLR OxO0000080 led on main PLOCE Initialize Feed IRQ Routine for ij 0 3 lt 5000000 j 3 Wait SOO msec FIG Routine IOSET 0x00000080 red led off SWI Routine for 3 0 3 5000000 jr wait SOO msec UNDEF Routine IOC
150. n 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 revised their design and modified their stock 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 conn
151. nch 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 fe C C Attach to Local Application e C C Local Application fe Cic Postmortem debugger EH Perspectives l a Eclipse Application These settings associate a perspective with Embedded debug launch launch E I 3 Embedded debug launch configurations A different perspective may be associated with each supported launch E Java Applet mode and can optionally be opened when a configuration is launched or when an application suspends via the Debug preferences To indicate that a perspective should Java Application not be opened select None em Ju JUnit Ju JUnit Plug in Test bes Remote Java Application Debug m s SWT Application Restore Defaults o A 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 Name demo2106_blink_rarn E C C Attach to Local Applica
152. nfiguration accessed above clicking on the Bug button will suffice If you re not sure use the pull down arrow to see exactly what configuration will be started Eclipse SDK Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Windi gt il ES Debug i b C 56 1 demoz106_b D Debug s Nata Search 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 SEE File Edit Refactor Navigate Search Project Run Window Help pr m O Q 150 APO d E Eacic Debug di 09 Variables 23 Breakpoints Expressions 388 Xx X TO lp O cQ OCDRemote Program pal CUcygwinlusrllocalibiniocdremote exe 1 36 demo2106 blink ram Embedded debug launch E e Embedded GDB 9 9 05 12 38 AM Suspended Th Ipc210x h makefile Le main c 92 i Outline Disassembly 98 int main void Pending unsigned int j 1 static int h c static un static char static un 2 static int 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 OxO0000
153. ng used are Map main map creates a map file T demo2106 blink flash cmd identifies the name of the linker script file Note that I 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 Click on Project Clean and fill out the Clean dialog window Resource main c cclipse Plau vm File Edit Navigate El ane F3 M LA inei Project Close Project Window Help 7 s s E s an Build All CErl B amp El ld EXETER RA AAA AAA AER AA AAA ARA rn n AAA AAA ttt tt ttt AAA pedi EF T demo2106_blink Flash Function declaratii Be cdtpraject S i E motes ES E io Clean B crt s 1d z E demoz106_blink_ Wo mee z d Ipczt x h iex 8 main E occurs the projects will be rebuilt From scratch void FIQ Routine void att void SUI Routine void ata f Clean all Heer sl pla fell Clean projects selected below void UNDEF Routine void att i d E MES demo2106 blink blink Flash PREETI OW J Header files Li demo WIS OIMNE TERETE TEE
154. niversity of Buffalo CSE Deparment Please select a mirror for this file eclipse SD0K 3 0 04032 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 des Canada Reachable ca United States Calvin College p United States University of Buffalo CSE Department United States Www WEB Inc South America Brazil EclipseRio PUC Ria Main Download Site Canada Main eclipse org downloads area 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 Ftp cse bufralo edu MC NECI a Always ask before opening 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 Save As Save in O f pm My Recent Documents 3 Desktop My Documents hy Computer File name eclipse 5 DK 3 wins wv hy 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 len
155. nking continuously IEEE Le Ipc 10x h amp makefile E manc X static int 1 static Jong x 5 static char 0xo4 static int ra const char nText The Pain in Spain ff Initialize the system Initializeil fo Bet io pins for led PO IODIR O xDO0DocosoO IOSET x n l0DsO0 IOCLE OxOOO00080 ff led off f led on ff endless loop to toggle the red LED P 0 7 while 1 for 3 0 3 lt 5000000 j 1 IOSET Oxggooooosa for 3 0 3 lt 5000000 j 1 IOCLR 0x00000080 K Setting a Breakpoint wait SOO msec red led off wait 500 msec red led on Fi ff Static initialized variable ME fo static initialized variable Static initialized variable fo static initialized variable f fo pin POL is an output everything else is input afte 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 j Of j lt 5000000 j IOSET OxOQO000080 for ij O j 5000000 j 1 IOCLR x nc gODJSO0 if hip if I4 wait SOO msec red led QIL wait 500 msec red led on Now click on the Run Continue button in the Debug view e Assuming that this is the only breakpoint set the program will execute to the breakpoint line and stop Le Ipc210x h L makefile Le mainc ES Y O static int g 7 static initialized variable MM const cha
156. nsole 23 B E r 2 r3 G 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 I 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 pos Ie gt gt ES by Resource L E E 3 i LEA AA AAA AA AAA AA AAA AA AAA AA AAA AA AAA AA AA AAA AAA AA AAA AAA AA AAA AA AAA AAA AA AAA AAA AAA AA AAA AAA AAA AAA E demo2106 blink flash demo2106 blink flash cmd LINKER SCRIPT cdtproject de project del B crt lst The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are 1 iv 3 ert o pe to be loaded into memory code goes into FLASH variables go into RAM S crt s E demo2106 blink flash cmd ft Any symbols defined in the Linker Script are automatically global and available to the rest of the program pe ad dis To force the linker to use this LINKER SCRIPT just add the T demo2106 blink flash cmd directive sy qe to the linker flags in the makefile B main map pa main o LFLAGS Map main map nostartfiles T demo2106 blink flash cmd B main out jt K makefile jz H E demo2106_blink_ram pe The Philips boot loader supports the ISP In System Programming via t
157. nt CEri4 ShiFE l Content Assist Cri 5pace Add Include CLEri4 ShiFE4 M Format Crri ShiFt F Show in C C Projects ff endless loop to toggle the red LED PO 7 while 1 for j Of j 5ODO000 j i IOSET x OOSO if for j Of j 5OD0000 j i IOCLE x 0000n080 di Refactor Open Declaration C Ctrl ShiFk Down Ctrl Shift Up Open Definition Go to next member Go bo previous membe All Declarations All References demo 106_blink_rarn PS See debug launch Debugger Process S m ISBOGLION LexLt ugmLiod sEHuL a2lB sBILIONMR B1z8 3 Resume At Line 15 sections text ssepLidgH degL b2B5 scctilon S1EB ud Add Watch Expression dl section text section sent 1208 section size Run As l Ee z5 section data section size 24 total size 25 Debug As d gdb Team Compare With j Replace with j writable Preferences Ion See 1 139 171 Ak 1 In 3 Col 62 REC TRE EX Create Make Target start ia ARM Cross Developm ET 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 execute the line You can right click the Resume at Line choice to continue execution from that point If there are no other breakpoints set then the Blink application will start bli
158. nt code as the professional compilers e The Eclipse CDT Debugger can only set two hardware breakpoints in FLASH e You need an internet broadband connection to download all these free software tools If you were a professional programmer you might 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 three modes A Application programmed into FLASH no debugging 0 AAN E mt 3 anuo LETT E m z p E m us ga uc Ba ce og um g an TL D r RS D a ee S222 _ SSS SSSEESEE E s 5 E E SF N tog FP A APO aa ERR RRR RRR E gi O ROTM dm ose RR Cb g UB UR RO OA QD D ER oop od NANA NANA e HTTP HHH OLIMEX COM DEU e In this mode the Eclipse GNU development system assembles compiles and links your application for loading into FLASH memory The output of the compiler linker suite is an Intel hex file e g main hex The Philips LPC2000 Flash Utility is started within Eclipse and will download your hex file and program the flash memory through the standard COM 1 serial cable The Boot Strap Loader BSL jumper must be shorted installed to run the Philips flash programming utility To execute the application you remove the BSL jumper and push the RESET button to sta
159. ntly installed programs show updates Sort by Change or m Ad Remove Programs Sze 117 00MBE 3 Jasc Paint Shop Photo Album 5 Add Mew Q Jasc Paint Shop Pro Studia Dell Editon Programs 34 Learnz Player Uninstall Only Size D 58MB i Bl Lec2000 Flash Utility ee Macraldc stems Hat Add Remove yy PE I 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 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 A Eclipse org Main Page Microsoft Internet Explorer File Edit View Favorites Tools Help e x Q BE a pp search SE Favorites A ES H Lj y ap 3 Address TEA gt EA Q3
160. o Clipboard i Set as Default Ey Print Properties PrnriPFF TE MAFAFFOF PRI This will repaint the memory rendering in Byte format Console BLISS nea te A ra ts CH emarv Monitors d 3 e Memory Renderings d 4 Ox400004F4 Ox400004F4 Ox400004F4 lt Hex gt 400004F0O 40000500 40000510 40000520 40000530 40000540 40000550 40000560 4000050 40000550 40000590 40000540 40000580 40000520 a4nnnnsnn 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 o E sci 5 at Emory Memory Renderings Memory Renderings nniFarz sp A i Tr A em d 0000044 040000464 Ox400004F4 zHex Ox400004F4 lt 0x3400004F4 gt e do li 1 15 18 L5 Le de Memory Monitor Ox400004F4 lt 0x400004F4 gt 400004F0 oo MEA 65 Select rendering s to create 20000500 53 70 61 69 6E 00 00 BO pd erring 20000510 05 BIN OO 00 15 05 Oo c ms 40000520 68 61 6E 20 61 20 73 EDO UNE Unsigned Integer 40000530 75 BC BC 65 74 BIN 00 20000540 05 OO 00 00 01 BIN 00 20000550 00 OO 00 OO 00 BIN 00 20000560 00 OO 00 00 EQ El FF 20000570 ao OO 00 00 TO EC FF 40000550 00 OO 00 00 EQ El FF 200005390 00 OO 00 OO 7O EC FF 20000540 00 OO 00 00 EQ El FF S4Q00005BO OU OO Lu Lu 7O EC FF
161. o arrowheads until the line changes to this Devel 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 Devel Q Install Libs O Default Libs O Install Web O Default Web Q Install Archive Install Click on the little circle with the arrowheads until you change the four 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 a ix Select Packages Select packages to install C Keep C Prev Cur C Exp View Category Category Current BI All amp Default Admin d Default Archive 4Y Install Base amp Default Database amp Default Devel amp Install Doc 4 Default Editors amp Default Games amp Default Graphics 4 Default Interpreters 4 Default Mail amp Default Math d Default bling amp Default Het amp Default Publishing Default Shells 4 Default System amp Default Test amp Default Utils amp Default t Web amp Install 011 4 Default A Hemov
162. o 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 A can be maximized to full screen minimized or returned to multi pane by the maximize and minimize buttons at the CI upper right corner J 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 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 E A AAA Le lpc 10 h amp makefile 6 manc X e Unda Ctrl Revert File static int 1 Save W static long x 5 Y z static char x 4 static int 73 Cut O CEr E const char DEED HE THESE Copy Ctrl Paste Chriw ff Initialize the system Initialize Shift Right Shift Left set io pins for led PO 7 Comment Chr IODIR x gc nnls0 if pin POs ias an d Uncomment Ctrl IOSET Oxoooo00080 ff led off Add Block Comment Crrl ShiFt rocLR OxoOo000080 f led on Remove Block Comme
163. obal 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 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 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 lve also included a few do nothing variables both initialized and uninitialized to illustrate that the compiler will put the initialized variables into the data section and the uninitialized ones into the bss section Resource main c Eclipse Platform File Edit Na
164. of embedded microcomputer development software and hardware and he obviously understands his material PHILIPS D gt SETA DEVELOPMENT TOOLS THE INSIDER S GUIDE TO THE PHILIPS ARM 7 BASED MICROCONTROLLERS An Engineer s Introduction To The LPCz100 Series Trevor Martin B5c hons CEng MIEE www hitex co uk arm You can download this e book for free from the Hitex web site htto www hitex co uk arm lpc2000book 4ndex 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 l ve used Hitex tools professionally and can vouch for their quality and value Read his book Better yet it s required reading 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
165. 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 Run MA Help 8 New Window Mew Editor Open Perspective E manc A Show View g0 Team Synchronizing Customize Perspective Save Perspective As Other Reset Perspective Close Perspective Close All Perspectives Navigation 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 AE je SDK Cex Search Project Run Window Q Q 9 5 Gecic Xe Debug i gt ES Baci E ala malo Be Ef Resource B Ipc210x h C makefile BB mainc X EL Outline mj Disassembly Z3 5N ELI int main void unsigned int j ji li static int Dec static un static char static u B static int 1 static in static long x 5 static initia static char 0 static in static int 7 static in const char pText The Rain in Sp
166. onics 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 toasters cars fighter jets and Roomba vacuum cleaners This is where the real action is in the field of computer science and engineering It s called embedded software development Can today s young student or home hobbyist tired of watching Reality Television dabble in microcomputer electronics T
167. orary breakpoint command thbreak main is not removing itself as advertised but I m really not sure of this G Debugging in FLASH Debugging in FLASH is exactly like debugging in RAM as described earlier with just two exceptions e You can only set two breakpoints at a time If you are stepping you should have no breakpoints set since Eclipse needs the hardware breakpoints for single stepping e If you re compile your application you must stop the debugger re build and burn the main hex file into FLASH using the Philips LPC2000 Flash Utility The Eclipse GDB debugger cannot program FLASH memory The right click menu function Run to Line is best in this scenario since it does a temporary hardware breakpoint and you don t have to remember if you left a breakpoint on somewhere Let s practice with our example Click on the source line Initialize and bring up the right click menu Click on the Run to Line menu choice Debug main c Eclipse SDK BE ES Debug Ere CIC SJ Java File Edit Refactor Navigate Search Project Run Window Help F3 Gl amp im 0O Q 09 9 2 50 E Debug 23 p o 22 i gt 109 Variables 3 7 Q OCDRemote Program pa C cygwintusrilocalibintocdremote exe 3 demo2106 blink Flash Embedded debug launch ee Embedded GDB 12 10 05 8 59 PM Suspended Thread 0 Suspended 1 main at main c 46 p3 Debugger Process 12 10 05 8
168. ort However there are a few stumbling blocks when trying to debug embedded applications Open source Eclipse CDT eCos and libstdc Mailinglist Zylin has made some modifications in Eclipse CDT for Windows a plugin to improve support for GDB embedded debugging in CDT for eCos applications Zylin would like to extend a special thanks to Alain Magloire of the CDT team for making this possible Download nam 7 VIIT T3 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 unzip 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 22 42 CEST 2005 e Previous message Zylin discuss dispplay the
169. ot available Debug History Debug s Debug F External Tools d QL 1 LPC2000 Flash Utility 2 OCDremote Run As Problems El console 23 gt gt Propertie External Tools ie Em BB r El ri 0 lt herminated gt C Program Piles GMLIAR 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 C C Eclipse Platform File Edit Navigate Search Project Run Window Help EF E1 li 63 d G 5 O Q Sar EX OH SES H demo2106_blink_Flash H E demo2106_blink ram Q 1 LPC2000 Flash Utility FL 2 OCDremote Run As FN External Tools Organize Favorites Problems Mae EM Properties 2 Es cb m r3 CB Build demaz1 6 blink ram 10 Verifying the PATH Settings There 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
170. our output sections startup this output section holds the code in the startup function defined in crt s text 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 S HSelH l amp a wleo o ha Navigator x Ne Hl B demo2106_blink_flash cmd X 4 E ex v 2 15 demo2106_blink_flash cdtproject project SECTIONS crt Ist crt o O S crt s 5 demo2106 blink flash cmd Ipc210x h main c main dmp main hex main map main o main out text K makefile rodata gt demo2106_blink_ram rodata glue 7 glue 7t _etext gt flash now define the output sections startup startup gt flash data data data _edata gt ram AT gt flash bss _bss_start bss ram ALIGN 4 bss end _end c main c main map demo2106 blink ram cmd set location counter to address zero the startup code goes into FLASH collect all sections that should go into FLASH after startup all text sections cod
171. 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 co pText Ox400004F4 E A 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 c4 j 5000000 a ll b 0 c 0 d 1 x 5 rbd y ue 2 7 a pText Ox400004F4 EE Access code key 14705 name 1 p name z2 i name 3 cl name 4 e name 5 r name 6 m name 7 a namel n E name 9 name 10 name 11 2 name 12 9 name 13 l name 14 E name 15 key 14705 n ccesses 0 name 3piderman n g gaogsoagagsagga sagaosadgao If you click on the Show Type Names button displayed with its type as shown below 7s I unsigned int j 3301707 x ink a O int b 0 int c xj char d int w 1 long int x 5 J char y sintz char p
172. owever 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 To download the Zylin version of the CDT plug in click on the following link http Awww 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 Eclipse CDT plugin Eclipse CDT has excellent GDB supp
173. p all E G 3 Q Q AP e Ej Be cce as Fy d H E An outline iz nat available Problems El Console 2 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 i a Java Project v med Plug in Project E a C ME Managed Make C Project a standard Make Project Ge C Pl CvS H E Java 3 Import H E Plug in Development rA Export H E Simple Switch Workspace Open External File 1 Ipc210x h derno 106 2 main c demo2106 3 main map demo2106 4 demo2106 cmd demoz106 Exil 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 Iv Use default ET DEED 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 L Make Project Settings Define the
174. p utility and another zip file containing the LPC2000 Hex Utility Click on the setup exe application to start the installer scratch File Edit Wiew Favorites Tools Help Q3 sack gt d ya Search iy Folders EBk X de AX Mame Falders E ee Local Disk C E 3 armlib Alink AK eatiin tA sOm uio tritus ch 9 capture start the installer C DELL 5 Documents and Setti lij gt ml ioc 2000_Flash_utility The LPC2000 Flash Utility setup now starts Click on OK to proceed LPC2000 Flash Utility Setup 2 LPC2000 Flash Utility Setup Ed m Welcome to Ehe LPC2000 Flash Utility installation program io 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 LPC2000 Flash Utility Setup Begin the installation y 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 bd LPE2000 Flash Utility Setup was completed successtully Here we see the utility residing in the Program Files directory just as promised LPC2106 ISP File Edit View Favorites Tools Help pack O Ba JO Search Woy Folders Ey X 3 X
175. pied Download to Temporary Folder Transfer rate 78 2 KBs Sec Close this dialog box when download completes Oper Open Folder The Macraigor installer should start up click Next to continue Macraigor Systems Hardware Support Package 2 14 InstallShield Wizard E Welcome to the InstallShield Wizard for Macraigor Systems Hardware Support Package 2 14 The InstallShield Wizard will install Macraigor Systerns Hardware Support Package 2 14 on your computer To continue click Mert 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 2 14 InstallShield Wizard E Choose Destination Location Select folder where setup will install Files Install Macraigor Systems Hardware Support Package 2 14 ta ScugiinsusrMacalsbin InstallShield Be ie Clicking on Install will complete the OCDRemote installation Macraigor Systems Hardware Support Package 2 14 InstallShield Wizard E Ready to Install the Program P 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 InstallShie
176. plication t Si us i The boot loader uses RAM memory and we MUST NOT load variables or code in these areas ay ie RAM used by boot loader Ox40000120 x400001FF 223 bytes for ISP variables Ox4000FFEO Ox4000FFFF 32 bytes for ISP and IAF variables Ox2000FEEO Ox4000FFDF i255 bytes stack for ISP and IAP fr tf fr t Z MEMORY MAP us js 0x40010000 e SSS BEA pr OX4000FFFF tr E Variables and stack ae p for Philips boot loader i F 55 bytes p Do not put anything here 0x4000FEE0 a m i ES E ER UDF Stack 4 bytes Gx4000FERQ lt Stack end e ft ty e s ABT Stack 4 bytes Ox4000FEDS E ft y pm FIQ Stack 4 bytes Ox4000FED4 a fe y dal IRO Stack 4 bytes Ox4000FEDO id ft y i SVC Stack 4 bytes Ox4000FECC af ft dE Ox4000FEC8 ues i stack area for user program wi wi Problems E Console 3 Properties PRENDE writable Insert 8 36 CA demo2106 blink ram cmd Eclipse SDK a ES File Edit Refactor Navigate Search Project Run Window Help r3 mi amp lm e e 3 id G 45 O Q 9 o c Ej dsDebus macc Shave SS 4x40000464 lt 4 x40000445 lt bss start edata data ini
177. r pText The Rain in Spain ff Initialize the system Initializeli set io pins for led PO 7 IODIR OxOO00008O pin PO 7 is an output everything else is input afte IOSET OxO0000080 led off 7 IOCLR x 000080 led on fy endless loop to toggle the red LED P 0 7 while i41 for ij O 3 lt 5000000 j wait 500 msec da IOSET OxDo00o0D0so ff red led off for ij O 3 lt 5000000 j wait 500 msec IOCLR 0x00000080 red led on ee CA HCACACHCA CN ACACN MCRCA MCRCACAChCACACh CA NCACNCHCA a e AUN UN ES lil gt bull oince 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 on the far left symbol This brings up the pop up menu below and click on Breakpoint Properties for 3 0 j lt 5000000 j 1 Toggle Breakpoint Disable Breakpoint Breakpoint Properties Run As Debug As Team Compare With Replace With rrr irn rrr rr aa r wc F F F Add Bookmark r Add Task E27 wv Show Quick Diff CEriz 5hiFE 0 In the Properties for C C breakpoint window set the Ignore Count to 5 This means that the debugger will ignore the first five times it encounters the breakpoint and then stop Proper
178. r pacific net au http mirrors dotsre org http mirrors kernel org tho Z mirrors ren net http mirrors theonlinerecordstore cam planetmirror com p sources redhat rimrar redeiire ne http sourceware mirrors tds net http www carfield corm hk http w mirror ac ul tho ZI venu signal com User UAL 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 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 amp Default Database amp Default Devel amp Default Doc amp Default Editors 4 Default Games amp Default Gnome amp Default Lit 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 tw
179. rces 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 US x binutils 2 14 gcc 3 3 2 c ct newlib 1 12 0 gdb 6 0 PEG TGZ 35 2 MB 6CC 3 4 toolchain Cygwin binutils 2 15 gec 3 4 3 c c java 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 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 AA QUAM cor CC 3 Dn While files from the Internet can be useful this File type can 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 O scratch hy Recent Documents E Desktop hy Documents 2 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 h
180. 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 ii http www zylin corm embeddedcdt z 050810 zip oes WU oy na LALI 1 1 p 1 LILI LIO A 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 20050810 zip Type Winzip File 11 2 MB From ww zvlin com Cancel Always ask before opening this type af file While files from the Internet can be useful some files can potentially harm pour computer IF you do nat trust the source do not open ar save this file What s the risk Select the temporary c scratch directory as the target of the download and click Open C wINDOWS hy Recent i E adownload Documents My Computer File name embeddededt 2005081
181. right of the screen Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help C3 im 0 Q O0 in wd mur ES Debug Debug P3 G 69 Variables 23 Breakpoints dj vt A unt gt main c 23 a f Oz Outline 53 c pz WoW WoW NN NN UN RARA Function declarations WoW oW oon o RW AAA AAA AAA wf Initialize feed IRQ_Routine FIQ_Routine SWI Routine UNDEF Routine LPC210x h q void Initialize void void feed void void IRQ Routine void _ attribute t interrupt IRO void FIQ Routine void _ attribute interrupt FIQ void SWI Routine void _ attribute f interrupt SWI void UNDEF Routine void _ attribute interrupt UNDEF j eeeeceopttttrtt r s h i j ERRE A console is not available E Start the OCDRemote Utility As before you can start OCDRemote by clicking on the External Tools button and its pull down arrow and then click OCDRemote ch Project Run Window Help FL 2 OCDRemote QL External Tools Organize Favorites Obviously we re looking for this result Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help a S O a eaav 2 E Q OCDRemote Program z wal Clcygwiniusr localbinvocdremoate exe e main c 5 i wc UC REA RARA RARA RRA RARA RARA RAR AAA RA
182. ring around the CMOS setup you can find the Parallel Port setup and see what mode it is set up as If its ECP mode change it to EPP mode as did in the screen photograph below Save the CMOS setup and exit My printer is a USB device so this action didn t effect my printer operation ouse Port SB Enulation SB Controller serial Port 1 arallel Port Diskette Interfa Prinary Video Controller Onboard Video Buffer Report Let s review the hardware setup one more time Doesn t matter if the BSL jumper is installed or not j f a r i 0 1 2120 111 1 1 gee i alalalelelelele sepepepe epele e epepyejejejeje e ejpejejejejejeje epepejejejeje e e 400000000 alejolefofafofofafaja ajelofjojojoejefojofolo elolajealefalafejaleio alo fojeoJalolalelajelojol apejelejelelelelele retell i auuoaoa inciti i En elelelelelelelereter 1 ie jepajejejejoeTule tuaana ti cmi eperejeryejejejeje eIerejejejejereje moaggogda odugaRgo No need to unplug the serial cable ah er ted gr li S a e Ea p P ral Ee E a F y P H 7 C L i LI Li mu LI T r r aii a F MALTHE e d E z if E a mm acl de L Lj MM a ay a A T m 2 M ce E A F Lj dq om ey CA 3 m i Power plug from 9 volt wall wart power supply X AA A e a ki E de e a bi a a A 214131214
183. rom within your apr E Pc The hant lnadndaer uses DAM rere tr and rra MITT BST Inad irarishleas nr nada lli gt Quem DERIO ES lt terminated LPC2000 Flash Utility Program C Program FilesiLPC2106 ISPILPCz1 x ISP exe H H H H m E LFLAG5 Map main map nostartfiles T demoz106 blink ran vl writable Insert 20 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 File Edit Navigate Search Project Run Window Help ra gt a G G 7 G O Q V i zn S C C P RN A B demo2106_blink_ram cmd Bj crt s d ges e Le PC FIQ Addr 4n Me is not demo2106 blink Flash available Binaries A Reset Addr Reset Handler defined i this module below Includes Undef Addr UNDEF Routine defined in main c n Ipc210x h SWI Addr SWI Routine defined in main c S crt s PAbt Addr a UNDEF Routine defined in main c e c E main c DAbt Addr UNDEF Routine defined in main crt o armle IRQ Addr IRQ Routine defined in main El main o armle FIQ Addr FIQ Routine defined in main c S main out armle f o rounds the vectors and ISR addresses to 64 bytes total ert lst oe a skip past Philips ISP ram usage all the way to Ox40000200
184. rt the application B Application programmed and debugged into RAM Olimex ARM JTAG Adapter WIGGLER LPT1 a Hm x i e 20 in OLIMEX LTD 9 9 p COPYRIGHTCC 2003 JTAG Port BEB B BERBER RRR eee BEB EBB BBB BREE REE RBREREE eS HTTP HHH OLIMEX COM DEU e 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 tool 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 C Application programmed and debugged into FLASH Olimex ARM JTAG Adapter WIGGLER LPT1 COM1 E Od 7h OLIMEX LTD E COPYRIGHTCC 2803 o oO DODODODODOO AE ENE AA AAA AAA fs E
185. rucial 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 Cygwin com The Cygwin web site opens as follows File Edit View Favorites A Cygwin Information and Installation Microsoft Internet Explorer Tools Help ES E gt a yo Search S P Favorites E e Lj Lg e t Address Ee tins gt Cyewin Home Cymgwin Home Red Hat Cygwin Product Commutity Reporting Problems e Wailing Lists e Dunoficial Hewsgroups e Cold Stare e WWirror Sites GNU Cygnus Windows 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 jroz source if you want to get it running on Windows e Cygwin is not a way to magically make native Windows apps aware of UNL functionality like signals ptys etc Again you need to build
186. s and Settings Sy download biy Documents E DRIVERS mm aS eclipse PE i mc 1386 ans iii Open Explorer window Selected files folders Overwrite existing files amp 9 All files folders in archive Skip older files My Network OF Help NAE v Use folder names Help Placez 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 at this point eclipse File Edit View Favorites Tools Help Q tao z d P Search ls Foes E x o6 Folders x Mame Size Type Date Modified 3 amp w Local Disk Cr 5 configuration File Folder 6119 2005 7 00 PM 5 armlib Features File Folder 6119 2005 7 00 PM ES ATI 5 plugins File Folder 6119 2005 7 00 PM 5 capture readme File Folder 6119 2005 7 00 PM ES cygwin eclipsepraduct ECLIPSEPRODUCT File 3 11 2005 9 15 AM E DELL El cpl v10 HTML Document 3111 2005 9 15 AM 3 Documents and Settings EN eclipse Application 3 11 2005 9 15 AM E download notice HTML Document 3111 2005 9 15 AM E DRIVERS startup Executable Jar File 3 11 2005 9 15 AM 5 eagle components C EasyScreen Bo C
187. se Agreement You must accept the terms of this agreement before continuing with the installation GNU GENERAL PUBLIC LICENSE Version 2 June 1991 Copyright C 1989 1381 Free Software Foundation Inc 59 Temple Place Suite 330 Boston M 02111 1307 USA Everyone ls permitted to copy and distribute verbatim copies of this license document but changing it ig not allowed Preamble The licenses for most software are designed to take away your accept the agreement CO do not accept the agreement p tw lt Back oe cancer We ll take the default and let it install into the Program Files directory Click Next to continue 3 Setup GNUARM Select Destination Location Where should GNUSAM be installed O Setup will install GMUARM inta the following folder To continue click Next IF you would like to select a different folder click Browse D Program Files GNUARM At least 62 9 MB of free disk space iz required p lt Back ie Concer 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 Hest when you are ready to continue Full installation w Little Endian z LE Libraries T No Fast Multiplier v AAM THUMB Interworking 4 THUMB THUMB Libraries n
188. sh based demo2106_blink_flash project to the LPC2148 processor noticed that the JTAG Wiggler works much better on this Olimex board this might be a result of every JTAG pin now having 10K pull up and pull down resistors For those readers planning to port these example projects to other manufacturers this will be much more difficult Programming onboard flash is usually different Layout of the I O pins will certainly be different There is no substitute for detailed and careful reading of the manufacturer s User Manuals APPENDIX 2 Cygwin Heap Allocation Problems Quite unexpectedly my cygwin gnuarm system started occasionally crashing due to a heap allocation problem This can occur during any of the gnuarm utilities C compiler assembler objdump etc This is a typical error message compiling arm elf gcc I c fno common O0 g main c c program files gnuarm bin arm elf gcc exe 3828 couldn t allocate cygwin heap Win32 error 487 base 0x480000 top 0x48A000 reserve size 40960 allocsize 40960 page const 4096 main arm elf gcc 968 fork parent child 3828 died waiting for longjmp before initialization make Target all not remade because of errors In this situation you may have to change Cygwin s maximum memory The following is a link to the Cygwin description of the procedure http www cygwin com cygwin ug net setup maxmem html To change Cygwin s maximum memory click on Start Run and run t
189. suspende E console Al shift o C 1 5 Debug Save Perspective 45 Reset Perspective Close Perspective Close All Perspectives Disassembly Navigation 4 Display e Error Lag Preferences Gd Expressions lir irn lll ln ln lr cr nn n rn rn nnn n B Memory ES Modules O Outline rations TERETE EP EEE PEPE PEPE n nr n n aor Registers 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 Console MI emory Monitors 3 T Memory Renderings 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 TA elas Oo emor Monitors dox dfe Memory Renderings B ox Ox400004F4 Ox400004F4 zHex bes 0x400004F4 There s also a Go to Address you By right clicking anywhere within the memory rendering display area you can select 400004FO 40000500 40000510 40000520 40000530 40000540 40000
190. tach to Local oi E C C Local Applicatior E Clc Postmortem deb E Eclipse Application 36 Embedded debug launcl Project 85 demo2106 blink rai Li Ej Java Applet demoz106 blink ram Browse E Java Application C C Application Ju JUnit minot i aut Search Project Browse E JUnit Plug in Test iulii Search Project Browsen Main 35 Debugger W Commands Es Source E Common E Remote Java Applicatio ser SWT E This will bring up a blank window to define the new Debug Launch Configuration Click on the Main tab Give it the name demo2106 blink flash which is the same as the project name Likewise enter demo2106 blink flash as the project name you could browse for it Finally specify the file main out as the C C application Note that only the symbols will be used from this file we ve already programmed the code into FLASH via the Philips LPC2000 Flash Utility as shown above 3 Debug Create manage and run confiqurations Configurations Marge demo2106 blink Flash C C Attach ta Local C Local Applicatior m n C C Postmortem det Main Hj Debugger if Commands Es Source Common Xm Eclipse Application Esc Embedded debug launct project ps 6 demozi e blink rai s Mew configuration demazinB amp blink Flash Ba Java Applet CIC Application its Application main cut 3 Search Project Browse
191. 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 Start 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 wait SOO msec IOSET OxOOOO0U0SO ff red led off for ij O j lt 5000000 j j wait 500 msec IOCLR OxOO000080 ff red led on o x 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 Still you may find some use for this feature In the Breakpoint 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
192. the PC to 0x000000 so that execution will start from the FLASH reset vector address thbreak main This is a GDB command that sets a temporary hardware assisted breakpoint at the address symbol main When the ARM7 breaks at main the temporary breakpoint is automatically removed continue This is a GDB command to resume execution This essentially causes the ARM7 to start execution from the reset vector address 0x0000 and continue through all the initialization code until the address symbol main is reached Then it will do a temporary hardware breakpoint The Source and Common tabs are OK to leave in their default condition Click on Apply and Close to finish Answer Yes when the Save Changes dialog box pops up Save changes wish bo save them 9 The configuration demo2106_blink_Flash has unsaved changes Do you At this time it might be a good idea to click the debug button and then the Organize Favorites menu choice to make sure both of our debug launch configurations are in the list of favorites Just repeat the techniques we ve used before in this tutorial Debug main c Eclipse SDK File Edit Refactor Navigate Search Project Run Window D Switch to the Eclipse Debug Perspective Open the Debug perspective You can do this by clicking on Window Open Perspective Other Debug or you can select the Debug button at the upper
193. tialized variables 0 x40000430 lt _Etext data 0x400005 44 Ox400002c4 Initialize Text C Code Ox400002co UNDEF Routine Ox 400002Zbe alll Routine 408 bytes Ox 400002hs8 FIO Routine Ox400002h4 IRO Routine Ox400002 56 feed text Startup Code assembler 116 bytes Ox40000200 variables used by Oe 400001FF Philips boot loader 223 bytes Do not put anything here 0240000040 text Interrupt Vectors re mappedi O240000000 Problems El console 3 Properties ef A p 2 0 writable Insert 5 36 t CA demo2106 blink ram cmd Eclipse SDK File Edit Refactor Navigate Search Project Run Window Help ES3 amp ikmlut 85 d G 3 55 Q Q Je 9 tpo Ej Debug Fgycic java Le main c La makefile Le main c Ej demo2106 blink ram cmd X fw ft E fw E LR 5 jw 5 OXOOOLFFFF PEU unused flash eprom En i 65472 bytes ge i i 0ox00000040 jw z Interrupt Vector Table flash i P 0ox00000000 fF fw ES fw Author James P Lynch n iw A REA ARA AAA AAA AE AAA AAA nr rr RARA AAA RAE AAA AE AAA ARA AREA RARA ARA RAE AAA AAA ERA RARA AREA ARA RAE AA RA ARA AA EA AA AAA AAA Problems added quite a bit of annotation above to make it very clear how the memory flash and ram is organized e C C demo2106 blink ram cmd Eclipse Platform File Edit Mavigate Search Project Run Window Help J ri u amp g 6 ld G
194. ties for C C breakpoint Common Common Filtering Type C C line breakpoint File Cieclipseworkspaceldemo2106_blink_ramimain c Line number 61 v Enabled Condition Ignore count 5 To test this setup we must terminate and re launch the debugger a Debug main c Eclipse SDK File Edit Refactor Navigate Search ie Project Run E a Help E Q OcDRemote ET Paral Po je pal Cocygwiniusrilocallbinwocdrenate exe 36 demozi06 blink ram Embedded debug launch ae Embedded SDB 9 10 05 4 06 PM Suspended Egi Thread 0 Suspended Breakpoint hit main at main c 61 2 Debugger Process 9 10 05 4 06 PR 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 breakpoint Try Ipc210x h amp makefile f main c x p m
195. tion ea C C Local Application C C Postmortem debugger Main X Debugger Hi Commands Es Source E Common S Eclipse Application s Embedded debug launch 6 demo2106_blink_ ram EE Java Applet demo2106_ blink ram Browse fo Java Application CiC Application Ju JUnit main ouk Search Project Browse fu JUnit Plug in Test p Remote Java Application st SWT Application Mew Delete Apply Revert cose Under the Debugger tab use the browse button to set the GDB debugger text window to c program 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 demazi 6 blink ram i e CIC4 4 Attach to Local Application e CIC Local Application E C C Postmortem debugger Main F Debugger Bl Commands Es Source he A Eclipse Application Dese Embedded debug launch Debugger Embedded GOB demoz106_blink_ram r Debugger Options E Java Applet PJ Java Application Ju JUnit MX ed JUnit Plug in Test mr Remate Java Applicatian GDB debugger En SWT Application New Delete Under the commands tab enter the following two GDB commands to run at startup target remote localhost 8888 load Create manage and run configurations S Configurations Mame demozi 6 blink ram c C C Attach to Local qu
196. to the LPC2106 RAM memory You will see a progress bar at the bottom of the screen and it will indicate that the operation has completed gt LPC2000 Flash Utility RAM Buffer amp H4A000 0000 amp H 4000 0070 H4000 0020 H4000 0030 44000 0040 H4000 0050 H4000 0060 H4000 0070 H4000 0080 amp H 4000 0090 H4000 ODAT H4000 0080 44000 OCDE amp H 4000 0000 amp H 4000 00E amp H 4000 D0FO H4000 0100 H4000 0110 H4000 0120 H4000 0130 amp H 4000 0140 amp H 4000 0150 amp H 4000 0160 H4000 07 0 H4000 0180 H4000 0190 44000 01 50 H4000 0180 amp H 4000 070 amp H 4000 0100 amp H 4000 01 0 amp H 4000 07FD Load Hes File Code Execution Hun fram Address Buffer Upload Successfully Completed lo lo Dn LU Ou Dn Dn Dn Dn Dn Dn Dn Ou Ou Dn Ou Dn Dn Dn Dn Dn Dn Ou Ou Dn Dn Ou Dn D Ou Dn Dn FU FU 02 02 od Dn Dn Dn Dn D Dn Dn Ou Dn Dn Ou Dn Dn Dn Dn Dn Dn Dn Ou Dn Dn Ou Dn Dn Dn Dn Dn amp H 40000200 C Thumb t ARM 3F JF Ou Dn Ou Dn Dn Dn Dn Dn Dn Dn Ou Dn Dn Dn Dn Dn Dn Dn D Dn Dn Ou Dn Dn Ou Dn D Dn Dn D ES ES 40 40 OO Dn 00 Dn 00 Dn Dn Dn OO Dn 00 OO Dn Dn Dn Dn Dn Dn Dn 00 Dn Dn OU Dn Dn Dn Dn D lo Ou Co Ed Ou Dn Dn Dn Dn Dn Dn Dn Ou Dn Dn Ou Dn Dn Dn Ou Dn Dn Ou OU Dn Dn Ou Dn Dn Dn Dn Dn FU Dn 02 O
197. ttribute finterrupte leo i void FIO Routine void attribute interrupter Filo 1 void SWI Routine void attribute interrupt Swi 1 void UNDEF Routine void attribute interrupt UNDEF I FREER ESTER TTT EA a a AAA ck h oNChch ch RANA RANA Header files THETA ATTA TTT TTT TTA AAA Aa UN Hinclude LPC210x h FREER E CH OAohck ck kh cMohch TA a a ee Global Variables FERRERA ARA RAR RARA RARA UC RARA RARA RANA RRA RARA NAAA RARA RARA NANA int a ff global uninitialized variable int ES 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 62 ff global initialized variable struct commas int nbytes char pBuf char buffer 32 channel i5 channel bufier 0 Faster than a speeding bullet MAIN WC ACC CN UC NCC CRUCE CRECEN RC AURA URNA CRANE CAU UN CUN UU int main roidi i unsigned int j ff loop counter stack variable static int a b c ff static uninitialized variables static char d static uninitialized variables static int Ww 1 static initialized variable static Jong um b ff static initialized variable static char y 0x04 static initialized variable static int zZz TY ff static initialized variable const char pText The Pain in Spain struct EntryLock Long key int niccesses char n me 16 p Access 114705 0 Spiderman
198. type 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 So 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 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 Th
199. u to the download sites for the versions ofthe J25E plattorm that are curren Early Access download the Java 2 SDK Java 2 Runtime Environment documentation and other products related to Reference API Specifications Documentation JZSE 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 no 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 Download Java 2 Platform Standard Edition 5 0 Microsoft Internet Explorer File Edit View Favorites Tools Help Back gt f search Favorites s Ja W AM C Y gt Gb O B2 ss Ww O Address El http fawa sun com j25e 1 5 O download jsp Sun Developer Network Java Products and Technologies Technical Topics Developers Home gt Products amp Technologies Java Technology J25E Core Java gt J2SE 5 0 J25E 5 0 Download Java 2 Platform Standard Edition 5 0 a 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
200. urce makefile Eclipse Platform AE File Edit Navigate Search Project Run Window Help ri E amp B9 amp J4 9oo 2 B ES Resource ts Navigator ES E alas NAME demo2106 blink flash E demo2106_blink_Flash i n cdtpraject CE arm elf gcc Do project LD arm elf ld v j crt Ist AR arm elf ar E crko AS arm elf as 8 crts CP arm elf objcopy cs demo 106_blink_flash crnd OD arm elf ahbjdump x e Ipcz1 x h E main c CFLAGS I c fno cormon 03 q se main dmp AFLiGS ahls mapes 32 o crt o E main hex LFLAGS Map main map Tdemo2106 blink flash cmd Rl CPFLAGS O ihex P HM ODFLAGS Xx sqms pe main out E makefile all test E demo2106 blink ram clean rm crt lst main lst crt o main o main out main Hex maln map main dmp test main out echo copying CP CPFLAGS main out main hex LOD S ODFLA GS main out gt main dnp main out crt o main o demoz106 blink flash cmd echo linking LD LFLAGS o main out crt o main o prt o BEL B echo assembling 6 45 AFLAGS Grt s gt crt lst main o main c echo compiling CC CFLAGS main c Tasks EX 43 X E LH 0 items Td i rao mob 8 o c rh eos mmm Pe moldes Doe ehbos writable Smart Insert 1 1 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
201. vigate Search Project Run Window Help ela lav eo o lBES 2 Navigator xo Zo main dmp demo2106_blink_flash cmd G mainc X F E 3 E P WoW oW c oW NU UU UN UU UN UN UU Www a a a e at Function declarations E k demo2106 blink Flash ee ee ee ee eee ee ee eee ee ee ee eee ee ee ee eee ee ee ee eee d 3 3 cdtproject 3 project 3 ert lst void Initialize void crt o void feed void s crt s demo2106_blink_flash cmd void IRQ Routine void attribute i interrupt IRO Ipc210x h void FIQ Routine void i interrupt FIQ main c void SWI_Routine void i interrupt SWI main dmp void UNDEF Routine void i interrupt UNDEF main hex attribute attribute attribute main map JONCRCNCNCKCA ERRE RARA REA AER RARA RARA AHA hA AHA hA AHH 8 A 8 HATS main o A Header kiles main out AS 5 makefile include LPC210x h 5 15 demo2106 blink ram include x gt cdtproject z 3 project crt lst crt o Global Variables z s crt s AS AAA E demo2106 blink ram cmd int global uninitialized variable d Ipc210x h int 7 global uninitialized variable d main c int g 7 global uninitialized variable 5 main dmp 5 main hex short global initialized variable main map short j global initialized variable main o char j global initialized variable 5 main out K makefile
202. w etext define a global symbol etext Just after the last code byte ram put all the above into FLASH data collect all initialized data sections that go into RAM 1 data create a global symbol marking the start of the data section data all data sections Bdata define a global symbol marking the end of the data section ram put all the above into RAM but load the LMA copy into FLASH bss collect all uninitialized bss sections that go into RAM i hes start define a global symbol marking the start of the bss section baa all bss sections 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 Problems E Console 33S Properties Em A FE me Ly lt terminated gt LPC2000 Flash Utility Program C Program Files LPC2106 ISPALPCZ10x ISP exe writable Insert 11 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 copy code in crt s to sav
203. w 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 The Olimex web site is www olimex com You can also 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 lt costs about 79 95 plus 2 95 for the wall wart power supply For starting out would recommend the LPC P2106 prototype 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 proto
204. 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 0x4000FFEO0 LENGTH 32 variables used by Philips ISP j You might expect that we d define only a flash and a ram memory area In addition to those we ve 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 f
205. x 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 PHILIPS Flash Programming workspace sdemoz105 blink flash main hed 3 Upload to Flash 4 Execute Code after Upload Compare Flash ic LPC2106 Erase Blank Blank Check Erase Part ID Boot Loader ID ff Entire Device Selected Sectors Start Sector O End Sector 14 Manual Reset Read Device ID Now click on Upload to Flash to start the download LPC2000 Flash Utility V2 2 0 Communication Connected To Port COm1 hd Use Baud Rate 19200 T Time Out sect 2 Use DTR ARTS E for Reset and Boot Loader Selection 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 E Please reset your LPE2000 board now and then press OK The download will now proceed you ll see a blue progress bar at the bottom and then the status line will say File Upload Successfully Completed t LPC2000 Flash Utility File Buffer Help PHILIPS Flash Programming Erase Blank Blank Check Erase Part ID Boot Loader ip Filename workspacesdemo2106_blink_flashmain hex E Entire Device Selected Sectors Start Sector U End Sector
206. y 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 GNU 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 platform 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 c
207. y 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 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 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 Reso
208. z Ou Dn Dn Dn Dn D Dn Dn Dn Dn Dn OU Dn Dn Dn Dn Dn Dn Dn Ou Dn Dn Ou Dn D Dn Dn Dn SF ES 18 FO A0 El 14 FO DO 40 BL 02 DO 40 Bs 02 Oo OO 00 OO oo 00 OO OO Oo no OO OO Oo OO 00 OO oo OO 00 DO Oo 00 OO OO Oo 00 OO OO oo ngo OO OO Oo OO OO OO Oo ngo OO OO Oo OO OO OO Oo OO OO OO Oo 00 OO OO Oo OO OO OO oo OO 00 OO Oo OO 00 OO Oo OO OU OO Oo OO 00 OO Oo 00 OO OO Oo OO OO OO Oo 00 OO OO Oo no OO OO Oo OO OO OO oo 00 OO OO Oo OO OU OO Oo OO 00 OO Oo OO OO OO Oo OO OU OO 3F JF 00 D 00 Dn D Dn 00 Dn Ou Dn ag Dn ag OO Dn D 00 Dn Oo Dn Dn OU Dn 00 OO Dn D 00 Dn D ES ES 40 40 Ou Dn 00 Dn Dn 00 Dn Dn OO Dn 00 ag Dn 00 Dn Dn Dn 00 00 OO Dn 00 OU Dn Dn Dn Dn Dn f Selected Range Entire Buffer lo 14 CO Dn Ou Dn Dn Dn Dn Dn Dn Dn Ou Dn Dn Ou Dn Dn Dn Dn Dn Dn Dn Ou Dn Dn OU Dn Ou Dn Dn Dn FU FU Uz Dn Dn Dn Dn Dn Dn Ou Dn Dn Ou Dn Dn Ou Dn Dn Dn Dn Dn Dn Dn Ou Dn Dn Dn Dn Dn Dn Dn Dn JF JF Dn D ag Dn D Dn Dn Dn Dn Ou Oo Dn 00 OO 00 D Dn Dn Ou Dn Dn Ou Dn 00 Ou Dn 00 Dn Dn Dn ES ES 40 D OO Dn 00 Dn 00 Dn Dn Dn Oo Dn 00 OO Dn 00 Dn Dn Dn Dn Dn Ou Dn 00 ag Dn Ou Dn Dn 00 SER N3 N3 0N3 0N3 N3 4 003 003 3 B4 B G B m B Download HAM Save Hex File Fill Buffer Fil
209. z106 blink Flash 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 Bir scratch a fx an File Edit View Favorites Tools Help C9 pack eJ d yo Search e Folders Hak X o6 ie Folders x Mame size Type Date Modified El S Program Files ey Bert TKB 5 File 5 14 2005 11 13 AM c scratch demozin6 4KB Windows MT Command Script 5 12 2005 12 28 AM El Ga system downloads E Ipe210 13KB HFile 5 14 2005 12 51 PM E C3 WINDOWS E main 4KB CFile 5 14 2005 12 48 PM S aclipse E makefile 1 KE File 5 13 2005 1 06 AM E sw Local Disk D gt Click on the File pull down menu and then click on Import Then in the Import window click on File System CIC Eclipse Platform q File E it Navigate Search Project Run Window Help Tew Altz ShiFt M r iT Import B l Select Import resources From the local File system M Select an import source gF Checkout Projects From Cys 4 Existing Ant Buildfile LY Existing Project into Workspace Ook External Features Plug ins and Fragments Switch Workspace ternal File Ur EJ E Zip File ams Console d demo 106_bl 1 pc
Download Pdf Manuals
Related Search
Related Contents
IBM Heritage Network Router User Manual Crestron electronic DIN-1DIMU4 User's Manual Trimble LaserAce 1000 Rangefinder User Guide OP3000 Series User Manual TFMS 3.0, 3.1, 3.2, 3.3 森林用品 2 - Midmark Smeg UM4534 sink Copyright © All rights reserved.
Failed to retrieve file