Home
ARM_Cross Development_with_Eclipse
Contents
1. Any symbols defined in the Linker Script are automatically global and available to the rest of the program ir To force the linker to use this LINKER SCRIPT just add the T demo2106 blink ram cmd directive to the linker flags in the makefile pa LFLAGS Map main map nostartfiles T demozi06 blink _ram cmd The Philips boot loader supports the ISP In System Programming via the serial port and the IAP In Application Programming for flash programming from within your application The boot loader uses RAM memory and we MUST NOT load variables or code in these areas pe RAM used by boot loader Ox40000120 Ox400001FF 223 bytes for ISP variables Ox4000FFEO Ox4000FFFF 32 bytes for ISP and IAP variables Ox4000FEEO Ox4000FFDF 256 bytes stack for ISP and IAP S Writable Insert C C demo2106 blink ram cmd Eclipse Platform File Edit Navigate Search Project Run Window Help pate i eae na 1 0 Q 184 lve Ox40010000 Ox4000FFFF variables and stack for Philips boot loader 288 bytes Do not put anything here Ox4000FEEO Ox40DOFEDC Stack end Ox4000FEDS Ox4000FED4 Ox4000FEDO Ox40DOFECC Ox4000FECS writable Insert C C demo2106_blink_ram cmd Eclipse Platform File Edit Navigate Search Project Run Window Help JM Ad dA M data initialized variables C C demo2106 blink ram cmd Eclipse Pl
2. Places Use folder names Help 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 eclipse File Edit View Favorites Tools Help Q pack M gt d yo Search s rote Hab X o6 Folders x Mame Type Date Modified E se Local Disk C A configuration File Folder 6 19 2005 7 00 PM gt armlib features File Folder 6 19 2005 7 00 PM E ATI 5 plugins File Folder 6 19 2005 7 00 PM S capture readme File Folder 6 19 2005 7 00 PM ES cygwin 2clipseproduct ECLIPSEPRODUCT File 3 11 2005 9 15 AM 3 DELL El cplw10 HTML Document 3 11 2005 9 15 AM S Documents and Settings 28 eclipse Application 3 11 2005 9 15 AM 3 download amp amp notice HTML Document 3111 2005 9 15 AM 53 DRIVERS startup Executable Jar File 3 11 2005 9 15 AM eagle components men Easy Screen 5 configuration C3 features 5 plugins 9 readme 9 eclipse download Sy 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 n ES File Edit View Favorite
3. define a global symbol etext after the last code byte flash put all the above into FLASH We follow the text output section all the code and constants etc with a symbol definition which is automatically global in the GNU toolset This basically sets the next address after the last code byte to be the global symbol etext end of text There are two variable areas data and bss The initialized variables are contained in the data section which will be placed in RAM memory The big secret here is that an exact copy of the data section will be loaded into FLASH right after the code section just defined The onus is on the programmer to copy this section to the correct address in FLASH in this way the variables are initialized at startup just after a reset The bss section has no initializers Therefore the onus is on the programmer to clear the entire bss section in the startup routine Initialized variables are usually emitted by the assembler and C compiler as data sections data _data global symbol locates the start of data section in 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 th
4. Cygwin Setup Choose Installation Type Choose A Download Source Choose whether to install or download fram the internet or install from files in a local directory Install from Internet C Download from Internet C Install from Local Directory na o N Now we specify a directory where all the downloaded components go our c scratch folder will do just fine Cygwin Setup Select Local Package Directory maf Select Local Package Directory E 2 Select a directory where you want Setup to store the installation files it downloads The directory will be created if it does not already exist Local Package Directory C scratch Cancel 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 nttp 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 C
5. O Li Eclipse C C Development Tools Eclipse org L Lx Eclipse CIC4 4 Development Tools Eclipse org 4 Eclipse CIC Development Tools Eclipse org Eclipse C C development tools Binary runtime and user documentation 1 of 10 selected Filter Features included in other Features an the list Finish Accept the license agreement and click Next Install Feature License Some of the Features have license agreements that vou need to accept before proceeding with Ehe installation Ort Eclipse C C Development Tools Wht Eclipse CiC Development Toolir ECLIPSE ORG SOFTWARE USER AGREEMENT 17th June 2002 ECLIPSE ORG MAKES AVAILABLE SOFTWARE DOCUMENTATION INFOR OTHER MATERIALS FOR OPEM SOURCE PROJECTS COLLECTIVELY CON USE OF THE CONTENT 15 GOVERNED BY THE TERMS AND CONDITIONS C AGREEMENT AMD OR THE TERMS AND CONDITIONS OF LICENSE AGREEI NOTICES INDICATED OR REFERENCED BELOW BY USING THE CONTENT AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREE AMDJ OR THE TERMS AND CONDITIONS GF ANY APPLICABLE LICENSE Ac OR NOTICES INDICATED OR REFERENCED BELOW IF YOU Do NOT AGRA TERMS ARD CONDITIONS OF THIS AGREEMENT AND THE TERMS AMDO CE OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OF BELOW THEN YOU MAY NOT USE THE CONTENT Unless otherwise indicated all Content made available by Eclipse org I accept the terms in the license agreement Ido not accept the terms in t
6. Tasks EE Console HN a Ex NSa 7 E C Build demo2106 blink Flash Writable Smart Insert The main program starts out with a few function prototypes Note that the interrupt routines mentioned in the crt s assembler program reside in the main program We ve used the GNU C compiler syntax that identifies the interrupt routines and makes sure that the compiler will save and restore registers etc whenever the interrupt is asserted I ve also included a few do nothing C variables both initialized and uninitialized LED J to illustrate that the compiler will put the 7 initialized variables into the data section E and the uninitialized ones into the bss section Ul i 26 13 TXDO R12 We re going to try to toggle a single I O RTCK PO 8 TXDB PLMI RXDO 390 27 14 bit ificallv PO 7 which is the Ol DBGSEL PO 1 RXDO PAM3 Hera red LED T PO 3 SDA MATO O p PO 4 SCK CAPO 1 P PB 5 MISO MATO 1 T gM LED 29 NCI PO 6 MOSI CAPO 2 pp sa NC2 Pa 7 SSEL PMN2 S NC3 P0 8 TXD1 P4M4 H gt tt By the way with this hardware arrangement P0 7 1 turn off LED P0 7 0 turnon LED C C main c Eclipse Platform File Edit Navigate Search Project Run Window Help 3 amp l amp g amp amp amp ai G 135 Q Q 9 5 5 ES facic d C C Pr x Ay EI dema2106 blink ram cmd iS crt s El main c Y El mainc makefile da E E ERE RARA RRA Ch ch ch hc RARA RARA AR AR
7. sub r0 r0 ZIRQ STACK SIZE RO is now 0x4000FECC Now we put the ARM into SVC Supervisor mode by setting the MODE_SVC bit in the CPSR As mentioned above SVC mode has its own private copies of R13 and R14 We now set the supervisor mode stack pointer to Ox4000FDDC Again by subtracting the SVC stack size 4 bytes from RO we re sizing the stack for SVC mode to 4 bytes msr CPSHR c ZMODE SVC I BITIF BIT This puts the CPU in SVC mode mov sp r0 stack pointer for SVC mode is 0x4000FECC sub r0 r0 SVC STACK SIZE RO is now 0x4000FEC8 The ARM User mode and the ARM System mode share the same registers and stack For this very simple example we ll run the application in User mode Setting up the stack for User mode also sets up the stack for System mode Now we put the ARM into USR user mode by setting the MODE USR bit in the CPSR We now set the USR mode stack pointer to Ox4000FEC8 msr CPSRHR c ZMODE USR BIT F BIT User Mode mov sp rd To summarize the above operations let s draw a diagram of the stacks we just created RAM STACK USAGE 0x40010000 Ox4000FFFF last address in internal Philips ISP Flash Loader Stack and variables 288 bytes 0x4000FEEO bottom of Philips ISP Undefined mode stack 4 bytes Ox4000FEDC UND stack pointer Abort mode stack 4 bytes Ox4000FED8 ABT stack pointer FIQ mode stack 4 bytes 0Ox4000FED4 FIQ stack pointer IRQ mode stack 4bytes 0x4000FEDO
8. 3E 90909 9E 9E 3 0020 0 3 3 3 3030 30 30 3E II P T i Jal Program not running Click on run icon to start 490002a8 46 E Download the Application into RAM The first step is to download the application main out Click on Run Download main c Source Window Fil Run b w Control Preferences The Insight debugger recognizes straight away that it is not connected to the target board To accomplish this it will present a Target Properties dialog window Target Selection Cr Set breakpoint at main Connection Tamget GDBserverTCP gt I Set breakpoint at exit Hostna e flocalhost l Set breakpoint at Port C ssss Tr Display Download Dialog Use xterm as inferior s tty b More Options Cancel Help X___ Use the pull down list to select GDBserver TCP for the target Enter the Macraigor default Hostname as localhost Enter the Macraigor default Port as 8888 Check the box for Set Breakpoint at main Click OK to proceed Insight will connect to the target through the Wiggler It will then load the executable code into the LPC2106 RAM memory There s a blue progress bar shown at the bottom right Be patient the Wiggler is painfully slow This small file takes 6 seconds Pray that it says DOWNLOAD FINISHED in the status bar at the bottom left main c Source Window Ja fx File Run View Control Preferences Help IPPO me
9. P Q He Dremalg Cu Program FilesiaMWLIARIMbintarm elF insighE exe Browse Workspace Browse File System variables TES DUIS HUS 0 TOTO Cueclipsejwmorkspacedemo2106_blink_ram gt eee eee eee eee eee e Workspace Browse File System Variables Arguments variables Note Enclose an argument containing spaces using double quotes i p aee In the External Tools window above the Insight executable is typed into the Location text box You can use the Browse File System button to hunt for it The Working Directory and Arguments text box will contain the project s workspace file folder and the project s arm elf executable in this example main out For the moment you can leave these two text boxes blank we ll return to them later when we get ready to run the Insight debugger Similar to the Philips Flash Utility and the Macraigor OCDremote we d like to add the Insight debugger to our list of favorite External Tools Click on Run External Tools Organize Favorites C C Eclipse Platform PEE File Edit Navigate Search Pro Ld Run pw Help p zi T PDA Launched Ctrl F 11 E E Esas Mt Debug Last Launched Fil Run History H demo2106_blink_Flash Run As Ge demo2106 blink ram Run Debug History Debug As In the Organize External Tools window on the left below click on Add and then OK In th
10. You should see the following paths specified all separated by semicolons The path is usually long and complex you may find the bits and pieces for GNUARM interspersed throughout the path specification used cut and paste to place all my path specifications at the beginning of the specification line this is not really necessary You should see the following paths specified c cygwin bin c program files gnuarm bin c cygwin usr local bin If any of the three is not present now is the time to type them into the path specification l ve 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 12 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
11. d IpcziUx h d main c 4 makefile Now we have to indicate the Folder B Ps destination for our source REQUE romse files Click on Browse on Options the line to the right that Says z Overwribe existing resources without warning i i Create complete Folder structure Into Folder Create selected Folders only lt Back Cancel The proper destination folder appears in the Import Into Folder window below Click on the folder name demo2106 blink flash and click OK The directory name demo2106 blink flash should appear in the text box lt Import Into Folder Select a Folder to import into demo2106_blink_Flash demoz2106_blink_Flash conce Now the Import dialog is completely filled out we can click on finish to actually import the source files into our project File system Import resources From Ehe local File system From directory Cuscratch Browse scratch S crt s HE demoz106 cmd d Ipcz1 x h d main c kA makefile Filter Types Select All Deselect All Into folder demoz106 blink Flash Options Overwrite existing resources without warning Create complete folder structure le Create selected Folders only Cancel Now the C C perspective main screen will reappear Click on the in the navigator pane to see if our files have been transferred C C Eclipse Platform File Edit Navigate Search Project Run
12. 2 i 2 Fill Buffer Code Execution Address Range Fill value FF sH40000200 Selected Range Start eH 40000000 Run from Address H40000200 C Thumb ARM Entire Buffer End EH 4000FFFF LPC2000 Flash Utility Notice that the button titled Run from Address has the value amp H40000200 in it This is thanks to the ENTRY Reset_Handler directive in the linker command script file The Philips boot loader will simply load 0x40000200 into the PC register and let her rip When you click on the Load Hex File button the following dialog will be presented hy Recent Documents E Desktop Mu Documents hu Computer My Network File name main Places Files of type Hes Files hex 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 WARNING AN Code in Boot Loader RAM Area 2H40000120 amp H40O001FF or Boot Loader Stack Area Top 288 Bytes of RAM will be Ignored It will still execute OK of course since the hex file has no bytes defined for the area where we advanced the program counter past the Philips ISP low RAM usage Now click on the Upload to RAM button to l
13. c Ant Build Program TR T configuration Main ES Refresh s Environment E Common Location D Program Files LPC2106 ISP PC210x ISP exe Browse Workspace Browse File Svstem Variables Working Directory Browse Workspace Browse File System Variables Variables Mate Enclose an argument containing spaces using double quotes p Jm Apply Revert eee Run ae Close everything out and return to the Run pull down menu Select Run External Tools Organize Favorites C C Eclipse Platform File Edit Navigate Search Project MA Window Help F3 7 E amp 8 G GS Run Last Launched CtrF11 L h Debug Last Launched F11 C C Projects amp Mavigator 2 5 5 d Doe T Run History Run As Run Debug History Debug As Debug E External Tools Run As Q Externa Organize Favorites We re now going to put the Philips PLC2000 Flash Utility into the favorites list Click on Add in the window below Organize External x Favor ites cm Click the selection box for LPC2000 Flash Utility This will add it to the favorites list Selection Needed Select Launch Configurations G LPC2000 Flash Utility Select All Deselect All Now when we click on the Run pull down menu and select External Tools we see the LPC2000 Flash Utility at the top of the list aok
14. 5 ffs BxHh static in z T FAS xpText The Rain in Spain r3 pc 196 0x40000374 lt 5d gt r3 r11 1 16 j d d w 5 y Initialize the system Initialize hl xhBaB8B8H378 lt Initialize gt set io pins for led PB8 7 IODIR 8x88888888 pin PB 7 is an output everything else is input afte mou add mou add ldr orr str ze 0000008 6282500 ze 0000008 8x26 000 r2 H536870904 re r2 03848 r3 H 5368789H8h5 r3 r3 163846 r3 r3 r3 r3 128 r3 r2 Bx8H xd BBBgHHSH led off mou add mou str TAIR Ay aiming A ze 000060604 628000 r3 1536870988 r3 r3 1638456 re H128 BxBH r2 r3 ff Ted nn Program is running 48900348 62 You can use the two assembler step buttons to iterate through the assembler code E Step Step Into Over ASM ASM L Inspecting the ARM Registers You can see the ARM registers by clicking on the Registers toolbar button Registers Axe 002850604 0x80 0x8 0 Bx4c4b48 6xe 602c 006 xzFFFFda35 axadgdgggTzs Hx 8 6x1431 bc a3 Bx227dc57 G6x46aca642 Ax628b54b2 6xe 8828 Bbc 6x4b60bFecu Bx4c4b3F 0x40000408 FO F1 F2 F3 Fu FS F FF tps x B cpsr 6 200000dfF You can edit any register by clicking on it and typing a new value be careful about this one There s a right click pop up menu that lets you change to decimal disp
15. Click Cancel to exit the wizard InstallShield Coe a ies The Wizard completion screen lets you restart your computer to put OCDRemote into the Windows registry Macraigor 5ystems Hardware Support Package 2 12 InstallShield Wizard InstallShield Wizard Complete The InstallShield Wizard has successfully installed Macralgor Systems Hardware Support Package 2 12 Before vau can use the program vou must restart your computer Yes want to restart my computer now CO Ma will restart me computer later Remove any disks fram their drives and then click Finish to complete setup Just like the Philips ISP Flash Utility we should install the Macraigor OCDremote utility as an external tool that can be accessed easily from the Eclipse CDT RUN pull down menu Start up Eclipse and if necessary switch to the C C perspective by clicking Window Open Perspective Other C C Bele E Resource Resource Eclipse Platform File Edit Navigate Search Project Run oU Help LR i amp Q 4 los AM TES New Window Mew Editor Open Perspective dd E CVS Repository Exploring Shaw Vi k DIA VIE gy acs 7 Java Browsing Customize Perspective Save Perspective As Reset Perspective Close Perspective EM Close All Perspectives E0 Team Synchronizing Select Perspective 2 Browsing fe C C nee Hierarchy Hacs Repository Explo
16. Eclipse org Hardware Migration Phase Ill CVS and Mailing list outage on Saturday March 26th March 17 New Technology Project Proposals The Graphical Modeling Framework GMF Language Development Toolkit LDT Model Driven Development Integration Project MDDI March 8 Wi March 1 March 1 Eclipse Roadmap V1 0 draft released March 1 Eclipse Momentum Culminates in 2nd Annual EclipseCon 2005 March 1 Eclipse Community Thrives at EclipseCon 2005 March 1 Eclipse Makes BIRT Modules Available March 1 Multi Vendor Support Drives Adoption of Eclipse TPTP March 1 Eclipse Foundation Makes Web Services Tools Available February 28 Borland becomes a Strategic Developer Member of the Eclipse Foundation February 28 Eclipse Foundation Announces Election Results What s New History News views feature articles and announcements from around the community March 21 Java Basics Eclipse for Students by Yakov Fain in JDJ March 21 NASA Explores Eclipse Rich Client Platform by Scott Schram Click on Downloads to get things started eclipse org eclipse home eclipse downloads Get Eclipse Featured Downloads Welcome to the Eclipse downloads section If you re new to Eclipse start by downloading the Eclipse SDK then browse the various project pages to find the useful tools and plugins that you need If you have problems installing or getting the workbench to run check out the Eclipse
17. IRQ Routine FIG Routine a i T Problems E Console EN Properties E E A FI NES LJ lt berminated gt LPC2000 Flash Utility Program C Program FilesLPCz106 ISPALPCZ10x ISP exe writable Smart Insert Since we are not using any interrupts in this example this addition does not really matter l ve just added it for completeness you should always do this when devising a project to run in RAM After you follow the next steps and get the application to execute out of RAM you can run a little experiment and comment out the MEMMAP 0x02 line It will still run OK The reason for that is two fold First we don t use interrupts in this example Second we use the Philips ISP Flash Loader to force the CPU to start at the address of Reset Handler which is at 0x40000200 This bypasses using the HESET vector at 0x4000000 to start the application File DEMO2106 BLINK RAM CMD The entire project both code and variables is going to be loaded into RAM Therefore there are a few changes in the Linker Command Script file demo2106 blink ram cmd C C demo2106 blink ram cmd Eclipse Platform SE File Edit Navigate Search Project Run Window Help Ira DE IAE TOC RTERERARRA RARA RARA AAA AAA pe demoz2106_blink_ram cmd LINKER SCRIPT The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are to be loaded into memory code goes into FLASH variables go into RAM
18. latest price from Digikey for one LPC2106 Key features e 16 32 bit ARM7TDMI S processor e 64 kB on chip Static RAM e 128 kB on chip Flash Program Memory In System Programming ISP and In Application Programming IAP via on chip boot loader software e Vectored Interrupt Controller with configurable priorities and vector addresses e JTAG interface enables breakpoints and watch points e Multiple serial interfaces including two UARTs 16C550 Fast 12C 400 kbits s and SPI M e wo 32 bit timers 7 capture compare channels PWM unit 6 outputs Real Time Clock and Watchdog e Up to thirty two 5 V tolerant general purpose I O pins in a tiny LQFP48 7 x 7 mm package e 60 MHz maximum CPU clock available from programmable on chip Phase Locked Loop with settling time of 100 us On chip crystal oscillator with an operating range of 1 MHz to 30 MHz Two low power modes Idle and Power down Processor wake up from Power down mode via external interrupt Individual enable disable of peripheral functions for power optimization Dual power supply o CPU operating voltage range of 1 65 V to 1 95 V 1 8 V 8 3 pct o I O power supply range of 3 0 V to 3 6 V 3 3 V 10 pct with 5 V tolerant I O pads oeveral companies have come 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
19. main gut crt o main o demozi 06 blink flash cmd H echo linking LD LFL GS o main out crt o main o pert o crt s echo assembling 51451 SLAPLAGS GEL gt Grt lst miain o main c echo compiling EC CFLAGS main c 4 Tasks a aX Po 0 items m A Pa Leo a TE rs SOS wW ritable Smart Insert TL The general idea of the makefile is that a target could be a file is associated with one or more dependent files If any of the dependent files are newer than the target then the commands on the following lines are executed to recompile for instance Command lines are indented with a Tab character main o main c arm elf gcc l c O3 g main c In the example above if main c is newer than the target main o the command or commands on the next line or lines will be executed The command arm elf gcc will recompile the file main c with several compilation options specified If the target is up to date nothing is done Make works its way downward in the makefile if you ve deleted all object and output files it will compile and 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 O3 g You can use this multiple times in the makefile by writing the variable name as follows CFLAGS will substitute the string I c O3 g Therefore the command arm elf gcc CFLAGS main c is e
20. software GNU tools e he GNU tools do not currently generate as efficient code as the professional compilers e The Insight Debugger cannot set a software breakpoint in FLASH since it can t erase and reprogram the FLASH e he OCDRemote JTAG utility does not support hardware breakpoints lf you were a professional programmer you would not accept these limitations For the student or hobbyist the Eclipse GNU toolset still gives fantastic capabilities for zero cost The Eclipse GNU Compiler toolset we will be creating in this tutorial operates in two modes A Application programmed into FLASH PCIA Find Lis FSE PHILIPS LPC2000 Flash Utility V220 Laa haa sn wa oaa URN MR ET EB PAT OMA A EA EA M M M M M ad 22 VI DU e EX LT im TC 2003 A 5 v vo i 2002202220205 Ox ooo ras F amp F Fg S 85 D E zoo FPP AAPP LL ER RRR OR GC AN m UO D D 4D GM PO d 7 RAND Ok CP 74 UD o i NENA BHR ERR RRR ERR RRR Ree eee eee eee eee NENA BHENHEBNENHEHNEHNEHNENENHEHHEHEHEHEHNENENHEHENHEHEHNENENHEHEHENEHHEENEN BEBE BBR ERR RE RP R RRR eee ee ee eee eee ae eee RRR RRR RR EERE SG BEB BERR ERB RRR RRR RRR RR ee eee eee BEBE ERR ERR BRR RRR RRR RR Re eee eee BHR ERR RR RRR RRR RE RRR RRR eee eee 2 BERR ERR RR RRB R RR RRR ee eee ee eee ee ee BEEBE BEER EBB RE RER HERB R ERR REE RRR eee BEER EB EB REE BRB RE BERR RE RRE REE ERE eee e BEER ES LPC 1 In this mode t
21. us demo2106 blink ram Problems El Console 3 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 E cre lst L crt o 8 crt s MJ demo2106 blink ram cmd Ipc210x h main c O E main dmp O E main hex O E main map O E main o D E main aut K makefile Filter Types Select All Deselect All Into Folder demoz108 blink ram Browse Options Overwrite existing resources Without warning Create complete Folder structure Create selected Folders only ca The files we import are crt s demo2106 blink ram cmd Ipc210x h main c makefile mak Now if you Clean and Build you should see a completed project with all the resultant files as shown below C C demo2106 blink ram cmd Eclipse Platform File Edit Navigate Search Project Run Window Help ri s amp ej x o Q E O RARRA RRA RRA RRA RAN ROBO RORU RORUECRORUEOORUR eee eS An outline is not available E demos il blink ram cid LINEKER SCRIPT Br e demo2106_blink_ram p B Q Binaries po 8H Includes
22. Default Test amp Default Utils dde Default Web de Install 11 4 Default e RemowedPackages amp Default Postinstalllast amp Default Click Next to start the download C Exp View Category Bi Sr gt x Back a Cancel Now the Cygwin will start downloading This creates a huge 700 Megabyte directory on your hard drive and takes 30 minutes to download and install using a cable modem 99 Cygwin Setup Progress This page displays the progress of the download or installation Downloading Package Total HE Disk Cancel When the installation completes Cygwin will ask you if you want any 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 eas
23. ES Acc gt XA Ee Outline 3 An outline is not available C C Eclipse Platform File Edit Navigate Search Project AA Window Help Ia He g 3 58 Run Last Launched CtrHF11 CAC Projects Ta Navigator d le till rd Run History d Run As Run Debug History Debug As Debug F External Tools F 1 LPE2000 Flash Utility Run AS Q External Tools Organize Favorites D errors O warnings O infos META Ree Click on LPC2000 Flash Utility to verify that it runs C C Eclipse Platform File Edit CS E Navigate Search Project Run Window Help 5 e SE EI 0 Q were ES de C C E LPC2000 Flash Utility Fie Bufer Help PHILIPS Flash Programming Erase Blank Blank Check Filename D eclipse workspace test main hex e Entire Device Selected Sectors Execute Code Upload ta Flash 4 erora a uU Erase Part ID Boot Loader in End Sector 14 Compare Flash Device Manual Reset Device LPc2104 y ATAL Freg kHz 14746 Device ID Now cancel the LPC2000 Flash Utility and quit Eclipse LPC2000 Flash Utility V2 2 0 Communication Connected To Fort COM1 Use Baud Aate 19200 Time Out sec e Use DTR RTS for Reset and Boot Loader Selection 9 Installing the Macraigor OCDremote Utility OCDRemote is a utility that listens on a TCP IP port and tr
24. 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 We need to download the latest version of this program from the Philips web site and unzip and install it into the program files directory Then we will start Eclipse and add the LPC2000 Flash Utility as an external tool to be invoked Click on the following link to access the Philips LPC2106 web page www semiconductors philips com pip LPC2106 html The following web page for the LPC2106 should open PHILIPS YOUR COUNTRY T P PHILIPS SEMICONDUCTORS Hews Center Markets Key Technologies Products Jobs Company Profile CONSUMER PRODUCTS PROFESSIONAL PRODUCTS oo Product Information Information as of 2004 07 10 Product Categories hn Analog and mixed E Bend signal devices informed datasheet Audio Bus devices Mi Datasheet kd Email translate kd Disclaimer hd Applications kd Support amp tools kd Similar products hd General description hd Features ki Block diagram hd Products amp packages Clocks amp Watches Data hd Parametrics Communications Discrete modules SB General description Discretes Display drivers ldentification Z Security Logic Micracantrallers Peripherals Video Wired Communications Wireless Communications naar oT Bie Tal The LPC2104 2105 and 2106 are based on a 16 32 bit ARM TOMI S C
25. H 4000 OOFO 00 OO OO OO OO OO 00 00 00 00 00 00 OO H4000 0100 o0 00 00 00 OO OO OO 00 00 OO OO 00 DO OO DO DU LLL ee ee eee ee amp H4000 0110 00 OO 00 OO OO 00 00 00 00 00 00 H 00 H4000 01 20 DO 00 00 OW OO OO OO 00 00 OO OO 00 00 OO 00 00 LL ee ee ee eee H4000 0730 Oo OO 00 OW OO OO 00 00 o0 OO OO 00 00 A amp H 4000 0140 00 OO OO OO OO OO OO OO OO OO 00 00 DD OO amp H 4000 0150 00 OO OO OO OO OO OO 00 00 00 00 00 0 00 DD H4000 0160 Oo 00 00 OW OO OO OO 00 00 00 OO 00 DO OO OO DU LL Lee eee eee eee amp H 4000 0170 00 OO OO OO OO OO OO 00 00 00 00 00 00 H4000 0180 Oo 00 OO OW OOo OO OO 00 00 OO OO 00 DO DD OO DD LL Le eee eee ee eee amp H 4000 0190 00 o0 o OO 50 00 00 00 00 00 00 H 00 44000 0140 00 OO OO OO OO OO OO 00 A 00 BG 00 0 D0 D0 H4000 0160 o0 00 OO OW OOo OO OO 00 00 00 OO 00 DO OO OO DD LL Lee eee ee ee eee H4000 OICO 0 0 4 00 00 00 00 00 00 00 00 00 00 OD H4000 0160 OO OO OO OO OO OO OO 00 O 00 GG OQ 00 D0 H4000 TET Dy 00 00 OW OO OO OO 00 o0 00 OO OU 00 DD OO DU LL Lee eee ee ee eee amp H 4000 01FO 00 OO OO OO OO OO OO 00 00 00 00 00 OO Load Hex File Download HM Save Hex File Fill Buffer C
26. Install to continue with the installation or click Back if you want to review or change any settings Destination location D Program Filesstii NLISRM Setup type Full installation Selected components Little Endian LE Libraries Ma Fast Multiplier ARM THLIHMB Interworking THUMB Sit back and watch the GNUARM compiler suite install itself an Setup GNUARM Installing Please wait while Setup installs GHUSAM on your computer Extracting files C Program Files GNUSAM Sinclude c 44 D O backward heap 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 a Setup GNUARM Completing the GNUARM Setup Wizard Setup has finished installing GNUAR M on your computer The application may be launched by selecting the installed icons Click Finish to exit Setup Add the executables directory to the PATH variable a CET This completes the installation of the compiler suites Since Eclipse will call these components via the make file you won t have to think about it again It s worth mentioning that the GNUARM web site has a nice Yahoo user group with other users posing and answering questions about GNUARM Pay them a visit The GNUARM web site also has links to all the ARM documentation you ll ever need 8 Installing the Philips LPC2000 Flash Utility into Eclipse The Philips LPC2000
27. Ipcz10x h jw G main c m p main dmp ft main hex T main map jt com main o EM LLL main out T E 39 makefile UE leri AM d ram isp hic n The Philips LPC2000 ISP Flash Programming will start up Es LPC2000 Flash Utility File Buffer Help DHILI DS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Port C eclipse workspace demo2106_blink_flas Blank Check f Entire Device com Selected Sectors Use Baud Rate Execute Code Upload to Flash pe lod EN o 13200 Erase End Sector ta met sec 2 Compare Flash Manual Reset Device Use DTR RTS Device tor Reset and LPC21 04 Read Part ip m Poal Loader ATAL Freg kHz 14746 Device ID Mus Leeds in Selection Now fill out the LPC2000 Flash Utility screen Browse the workspace for the main hex file Set the Device to LPC2106 Set the crystal frequency to 14746 as per the Olimex schematic The default baud rate COM port and Time out are OK as is Es LPC2000 Flash Utility File Buffer Help DHILIDS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication BELE l Connected To Port warkspace sdemaz1 O6 blink flash amp main hed gt Blank ed Entire Device JCOMt Selected Sectors Use Baud Hate Execute Code Upload to Flash 4 19200 Start Sector u after Upload Erase Compare Flash Manual Reset End Sector 14 Time Out
28. Project FAQ or amp spectJ Development Tools AJDT try posting a question to tham downloads are provided under the terms and conditions of the Eclipse org Software User Agreement unless 120 otherwise specified Download now Eclipse SDK 3 0 2 ipse downloads page Eclipse Communication Framework ECF Eclipse Bl and Reporting BIRT ndows Other downloads fors Looking for the olg Top 10 Eclipse Downloads Eclipse Project Downloads Project home 1 Eclipse SDK 3 0 2 latest release JDT Java Developmen Tools Downloads Project home 2 dinsa SDK Ti RCS feet PDE Plugin Developm nt Environment Downloads Project home milestone stable Platform Downloads Prifject home 3 Eclipse Modelling Framework EMF 4 Visual Editor WE Eclipse Tools Project Downloads Project home 5 Standard Widget Toolkit ST C C IDE Downloads Project home 6 LIML2 EMF Downloads Projectihome 7 AJDT GEF Graphical Editor Hramework Downloads Project home UML2 Downloads Projedit home VE Visual Editor Downfpads Project home 9 Bl Reporting Tools BIRT 8 WebTools Project 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 0 2 where it says Download No
29. Projects 23 Navigate Search Project Run Window Help m C Gi l i G O Q Sv A e Ipe210x h ES O Ed Becc 02 Outline 3 Ui u p demaziD08 blink Flash O Includes R Ipc210x h s crt s d main c demo2106 cmd 3 makefile E E h d ee ee of ee of Bifndef def ine LPC21HWz H LPC21Hx H LPC21Hx H Vectored Interrupt Controller UIC x def ine Budef ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine def ine define define define define def ine def ine define define define def ine def ine def ine def ine def ine def ine def ine Prablems amp Console X UIGIRQStatus UIGFIQStatus UIGRawIntr UIGInt amp elect UIGIntEnahle UIGIntEnGlr VICSoftInt VICSoftIntClr UIGProtection UIGUectfrddr VIicCDefVectAddr VICUect ddra UICUecthddri UICUecthddrz UICUecthddr3 UICUecth ddr4 UICUecthddrb5b UICUecthddr amp UIGCUecthiddr7 UICUecthddr amp UICUecthddr 7 UICUecthddridb UICUecthddrii UICUecthddriz UICUecthddri3 UIGCUecthddri4d UICUecthddrib5 UIGCUectnt 1H UIGUectnt li UIGCUectnt 12 UIGUectnt 13 UICUectnt 14 UIGUectnt 15 Properties Build demoz2106 blink Flash CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile CxCCunlatile volatile volatile CxCCunlatile lt vo latile CxCCun
30. Window Help Ci i E C C Projects E3 E A SER b ad sy demo2106 blink flash Problems A Console X Properties Search IC Build demo2106_blink_Flash expand symbol Ban E Edicic Ef Resource ES gt lAn outline is not glue ouccess is at hand the expanded Projects view in the Navigator pane on the left shows our imported files C C Eclipse Platform File Edit Navigate Search Project Run Window Help ri m 8 d G gt it a Sy E E Es ey Includes El h Ipc210x h sl S erts re B Deere B e mme Eromen Console Properties Search S demo2106 cmd Build demo2106_blink_flash Ed makefile fdemozi 8 blink Flash Sees Ej ecic Resource ENS n outline is not available This is a good place to identify the imported source files Description of Project Files Ipc210x h Standard LPC2106 header file Startup assembler file Main C program GNU makefile demo2106 blink flash cmd GNU Linker script file crt s makefile 13 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 mio Ge C C
31. 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 lt directs the LPC2106 to re map the interrupt vectors to RAM at 0x40000000 C C main c Eclipse Platform File Edit Mavigate Search Project Run Window Help lm HSlm G O Q vV eo o By sf de CIC B ai x Es mL demozi amp blink ram cmd C main c Ej mainc x f P a dex a uw o c EEE demo2106_blink Flash Wait for the PLL to lock to set frequency Initialize AN Ses demo2106 blink ram while PLLSTAT amp PLOCE om feed H Binaries IRQ Routine ER Includes Connect the PLL as the clock source FIQ Routine W h Ipcz10x h PLLCON Ox3 SWI Routine amp S ert s feed UNDEF_Routine l main c 7 LPC210x h E e crto armle Enabling MAM and setting number of clocks used for Flash memory fetch q fl E main o armle MAMCR 0x2 HRF main out armle MAMTIM 0x4 r crt st 2 n E demaz1 6 blink ram cmd El main dmp MEMMAP Ox02 main hex j main main map o PELIE Initialize MEMAP re map vector table to RAM ff Setting peripheral Clock pelk to System Clock cclk VPBDIV x1 E makefile Initialize feed
32. are a professional engineer attempting to build an ARM development system with these techniques you have a fool for a chief engineer The professional compilers such as IAR Rowley and Keil etc are more efficient generally bug free and interface seamlessly with debuggers They allow debugging with either ram or flash executables and flash programming is usually accomplished with a single click You also have telephone support with these systems These professional packages save your company time and money in the long run This tutorial was written for students and grown up kids at heart its purpose is to foster their interest in computer science and electrical engineering It s a shame that the big players like Microsoft Kiel Borland and others don t develop a student hobbyist version of their software development packages priced at a give away point that a third world high school student could afford Bill Gates has criticized my country s school system for not developing enough computer scientists and engineers why not provide a non commercial version of his Visual Studio for students and provide code targeting for every popular microprocessor being sold today am not happy with the debugger described in the tutorial The Wiggler Insight combination works only for RAM based applications and thus limits software to less than 64K It s extremely slow and a bit unreliable Professional USB or Ethernet based debuggers are very expensiv
33. bat an eyelash about paying this time is money There is a low cost alternative to the high priced professional software development packages the GNU toolset GNU is the cornerstone of the open source software movement 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 l ve had more success running the open source Insight debugger than the debugger included with Eclipse however it s only usable for programs running from RAM memory At this point you re probably saying this is great all these tools and they re FREE In the interest of honesty and openness let s delineate the downside of the free open
34. click OK Select Perspective x Be C C BE C C Browsing CVS Repository Exploring F Debug amp ava iJ Java Browsing fel Java Type Hierarchy Plug in Development Resource default amp Team Synchronizing Eclipse will now switch to the C C perspective shown below and will remember it when you exit C C Eclipse Platform File Edit Navigate Search Project Run Window ie r uo e dBIe 0 l PULS An outline is not available El Problems 38 Console Propertes KH 7H O errors O 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 MA window Help le gt E amp amp G Run Last Launched CirH Fil x WES E Debug Last Launched F11 E Run History Run As RUF C C Projects A Debug History Debug As Debug FL External Tools Q External Tools Organize Favorites We want to add a new program to the External Tools list so click on Program and then New External Tools Create manage and run configurations Create a configuration that will run an Ant buildfile Configurations Lu rm Ci A Program H Perspectives These settings associate a perspective with Ant Build launch configurations A diferent perspective may be ass
35. ctrl E EERE IIEL A E EEEE Pe a ap E e Pe a w 9 YF Function declarations E demoz2106 blink Flash TRE doc E a Nw be cdtpraject aoe Clean X eres s rrE s oid E P demo2106 blink Fl Properties al i i j i i a Inc210x h Clean will discard all build problems and built states The next time a build e main c void IRQ Routine void att V occurs Ehe projects will be rebuilt From scratch E makefile void FIO Routine void att got mE E Et demo2106 blink ram void SUI Routine void ata Clean all projects Clean prajects selected below void UNDEF Routine void att n C eS demozi06 blink Flash ERRE RARA AAA RARA ANA CA CKCA CA OW Header files Li demo Jo Dif rar rir lr cl cnr cll n cl nr rcr cn cnn cnn n cr nr n Hinclude LPC lt 10x h KORCKCACkChCh kCkCh Ch Ch h k kch hok ch ch h chc hch hc h hoch oho Global Varia woche c TTT a int aq f gloy int Es y4 glog int z EF glog short he fi olor short i 3 FE glog char j 6 fo glog Start a build immediately gt x K Cancel AE Problems Build demaz106 blink Flash make k clean I rm crt lst main lat crt o main o main out main hex main map main dmp rim Cannot latat main lst No such file or directory make clean Error 1 ignored You can see the results of the Clean operation in the Console window at the bottom Exp
36. dk db dE db dk db dk db dk db dk dp dk dE dk dp dk dp dk dE dk dp db dE db 4E dE dX ESE _LPC210xH EXTINT 3 EXTWAKE IPC I2ADR IPC I2CONCLR IPC I2CONSET IPC I DAT IPC I 5CLH IPC I25CLL IPC I 5TAT IOCLR IODIR IOPIM IOSET MAMER MAMMAP MAMTIM T r a POMP PINSELO PIMSEL1 PLLCFts PLLCONM PLLFEED PLLSTAT Pw COR Pw CRO PW CRI PWwM CR PWwM CR3 Pw EIPMP Pw IR F4 14 Description of the Startup File CRT S Now let s look on the startup assembler file crt s Double click on it This part of the crt s file has some symbols set to the various stack sizes and mode bits Resource crt s Eclipse Platform File Edit Navigate Search Project Run Window Help r iG 8 Q 1 S S Navigator 23 E ye dotokokok ck ck ck AAA koh koh ok ok ok ok ok ok ko ko book ko d d n ko o o d o o d d ok d o d d d d n oo AAAARTA 2 15 demo2106 blink Flash B cdtproject crt s STARTUP ASSEMBLY CODE x project 2 crt lst B crt o s crt s Module includes the interrupt vectors and start up code F demo2106 blink Flash cmd e Ipc210x h LLL f c c c c f c c df f f f ff RA f f ff fff f f f RANA dc C main c main dmp Stack Sizes E main hex set UND STACK SIZE Ox00000004 undefined instruction interrupts is 4 bytes B nest nee set ABT STACK SIZE Ox00000004 abort interrupts is 4 bytes B mano set FIQ STACK SIZE Ox00000004 FIQ interrupts is 4 bytes r Bi meno set IRQ STACK SIZ
37. files 2KB File 8 15 2003 6 25 E etc mailshar SKB File a 15 2003 6 26 El lib E make 145 EB Application 5 21 2003 1 3 Ca B ll us makeinfo 190 KB Application 4 11 2005 9 45 4 E 1 var E Emp P makegeo amp KB Application 10 10 2004 7 5 This is a good time to point out the differences between Build All Build Project and Clean Build All Will execute the command make clean all It will first clean delete all object list and output files Then it will rebuild everything whether needed or not Build Project Will execute the command make all This will not clean delete anything It will only compile those source files that are out of date Clean Will execute the command make clean Will clean delete all object list and output files lt C C Eclipse Platform Fie Edit Mavigate Search Aya Run Window Help LS m 5 Ej Becc Close Project 0 Q ta i Resource m Fr Build All Ha CIC Projects X imd 57 Build Project Build Working Set n outline is mot ramen 3 available Peg demo2106_blink_Flash Clean Build Automatically Properties Search a O Create Make Target Build Make Target Properties Idemazi amp blink Flash This is no 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 Perspecti
38. func Startup 2 crt o armle main o armle startup te main out armle i E crt st Exception Vectors demo2106_blink_flash main dmp vectors ldr Reset Addr ldr Undef Addr ldr SWI Addr ldr P bt Addr ldr D bt Addr nop Reserved Vector holds Philips ISP checksum ldr PC OxFFO0 see page 71 of Insiders Guide toj the Philips ARM Base ldr FIQ Addr 2 in h E main hex 2 E main map K makefile eS demo2106_blink_ram Reset Addr vord Reset Handler defined in this module below Undef Addr Word UNDEF Routine defined in main c SWI Addr Word SWI Routine defined in main c PAbt Addr word UNDEF Routine defined in main c DAbt Addr word UNDEF Routine defined in main c IRQ Addr word IRQ Routine defined in main c FIQ Addr word FIQ Routine defined in main c Word o rounds the vectors and ISR addresses to 64 bytes total v lt gt Problems El console i i Properties Z A E Al lt terminated gt LPC2000 Flash Utility Program C Program Files LPC2106 ISP LPC210x_ISP exe Note that all of the code and data that follows goes into the text section 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 ass
39. isp hi variables and stack crt s for Philips boot loader FE demoz106_bink flash cmd 288 bytes Ox400OFEEO Ox4000FEDC main hex Ox4000FED8 main map a memo Ox4000FED4 main out K makefile Ox4000FEDO tS demo2106 blink ram x Ox4000FECC l Ox4000FECS lt Stack end Stack area for user program terminated Insight Program C Program Files GNUARM bin arm elF insight exe Writable Resource demo2106_blink_flash cmd Eclipse Platform Do Bj demo2106_blink_flash cmd X bss end E e demo2106 blink Flash E cdtproject project crt lst crto bss uninitialized variables 579 8 95 8 oia bss start C Ipc210x h C main c main dmp main hex MAMAS variables used by Ox400001FF TUE Philips boot loader nies 223 bytes Ox 40000120 demo2106 blink ram mum Plink 0x4000011F ram vectors 0x40000040 Ox4000003F Interrupt Vectors re mappedi Ox40000000 data initialized variables 0x40000200 lt OxXOOO1FFFF cdtproject project crt lst crE o demo2106_blink_flash copy of data area 0x00000284 lt 0x00000104 Ox00000103 Ox00000040 OXDODODOSF ES demo2106_blink_ram Interrupt Vector Table Ox00000000 The easy way to prevent the linker from loading anything into a memory area is to define a MEMORY region for it
40. line with a dash on the far left 51 f f set io pins for led PB8 7 Guy 52 IODIR xBHBBHBSHR pin PB 7 is an output everything el 53 IOSET dxHBdHBHHBSH led off 54 IOCLR 6xB5060506886 led on 55 56 54 f f endless loop to toggle the red LED PHB8 7 58 while 1 4 59 01 IOSET 8x 80080888 red led off 62 For j 8 j lt 50000006 j 35 ZZ wait 588 msec 63 IOCLR HxBHBHBBBBS red led on 64 65 gt l Instant Inspection of any Variable or Data Structure Anytime the Insight Debugger is stopped you can maneuver the cursor over any variable name and it will display its current value If the variable is a C Structure then a sign will appear that will expand the structure display if clicked 30 i 37 int main void 4 38 39 int 1 46 static int a b c 41 static char 15 b 0 42 static int W 43 static long 5 un static char y x h 45 static int zZz T 46 const char pText The Rain in Spain 47 48 ff Initialize the system 49 Initialize 58 L 1 set lo pins for led PB8 7 B 22 ODIR 0x00008888 pin P8 7 is an output J Resuming Execution To let the program take off and start running continuously or run to the next breakpoint you use the Continue button Continue Now you should see the LED Blinking The Run button has changed shape into a Stop button Let s show that Bigfoot photograph again of the Olimex LPC P2106 board executing the blink
41. main you ll see that the breakpoint is just after the stack frame setup after entry to main A bit quirky isn t it main c Source Window m El File Run View Control Preferences Help IOPE OU PP ADORA AE iaf aa a nain c gt nain SOURCE gt J 37 int main void 4 dd 39 int 4B static int Static uninitialized 41 static char static unini 42 static int static initialized u 43 Static long x 5 ff static initialized v 44 static char static initialized variable 45 static int static initialized u 47 48 Initialize the system 49 Initialize t 58 51 set io pins for led PHB 7 52 IODIR 6x60000686 pin P6 7 is an output everything else is input after reset 53 IOSET BxB6000088 led off 54 IOCLR 8x606000088 led on 55 56 57 endless loop to toggle the red LED PB 7 58 while 1 4 59 68 For j 8 j lt 5000000 j 3 ZZ wait 500 msec 61 IOSET Bx060000808 red led off 62 For j 8 j lt 5000000 j ZZ wait 560 msec 63 IOCLR BxB0000080 red led on 64 65 66 67 68 7 Initialize FA 33 3C 3E3 3E EXE JE E JE E 3 E JE C JE QE JE 2C 3 2C 3 3 3E JE E JE E JE E JE E 3 3 E 3E E JE 3 E 9 E 9 2C 9E QE 3E E 3E 9E 3E JE 3 3 3 3 P 2d gt Program stopped at line 46 A88882a8 46 The Insight Debugger has the following toolbar buttons associated with executing the applicati
42. 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 y gt eclipse eclipse org home 3 about us s eclipse org E downloads m ARGS whats new eclipse in the news featured eclipse corner articles newsgroups O Welcome community search Welcome to eclipse org Eclipse is a kind of universal tool platform an open extensible IDE for anything and nothing in particular Find out what eclipse is all about check out the 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 out 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 FAGs please see our legal stuff page Eclipse logos and graphics are found on our logos page March 21
43. ou 50 WEI Run History Run As E 2 demo2106_blink_Flash An outline is mot available E demo2106 blink ram Run Debug History Debug As Debug F External Tools d Gh 1 LPC2000 Flash Utility Problems El console 3 gt Propertie Qh 2 OCDremote B Ex p Ei rm C Build demaz1 6 blink ram Run As F External Tools Organize Favorites In the External Tools dialog window below click on New configuration on the left External Tools Create manage and run confiqurations Please specify the location of the external tool you would like to configure Configurations fame New configuration HE Ant Build Program ta LEC2000 Flash Ukilit al Main wn Refresh P Environment LE Common New configuration Location a OcCDremote A Browse Workspace Browse File System variables Working Directory Browse Workspace Browse File System variables variables Mote Enclose an argument containing spaces using double quotes t Apply Revert Now fill this dialog in as shown below The Insight Debugger is the executable file arm elf insight exe and it s in the c Program Files GNUARM bin folder External Tools Create manage and run configurations Run a pragram Configurations Mame Insight Ant Build EQ Program IL LPC2000 Flash Utilit Main v Refresh PS Environment E Common IL New configuration Location
44. pe The Linker Script defines how the code and data emitted by the GNU C cc ih Ipcz1 x h fw to be loaded into memory code goes into FLASH variables go into RAM g crt s p d main c i Any symbols defined in the Linker Script are automatically global and e A crt o armle jt program E main o armle it SF main out armle To force the linker to use this LINKER SCRIPT just add the T demo210 crt lst to the linker flags in the makefile j E demaz106 blink ram cmd pe mein amp jt LFLAGS main hex pa main map m makefile a The Philips boot loader supports the ISP In System Programming via tt In Application Programming for flash programming from within your apr E hull ik Tha hant lIlaadar 11525 DAM arnar and rra MITT BST load trariahlas nr nada ii gt Properties Se Ee Bil et Erin lt terminated LPC2000 Flash Utility Program C Program FilesiLPC2106 ISPILPCZ1 x ISP exe H B E E Map main map nostartfiles T demozi06 blink ran writable 21 Differences in the RAM Version File CRT S In the startup assembler file used a simple trick to move the startup code away from the vectors to ensure that it doesn t encroach on the Philips ISP Flash Loader low RAM area C C crt s Eclipse Platform mfx File Edit Navigate Search Project Run Window Help G G G O Q O H eS ee SM A B demo2106 blink ram cmd Bi crt s a iSc e B v PC F
45. simply a collection of files that are inserted into two Eclipse directories The CDT plugin selected must be compatible with the Eclipse SDK 3 0 2 release we just installed To determine this click on the following CDT link http update eclipse org tools cdt releases new CDT Update Download Site latest CDT downloads for Eclipse Welcome to the CDT new release update site The contents of this site may only be used with Eclipse 3 0 x Ung Also the CDT 2 x builds will not work with Eclipse 3 1 For new CDT 3 0 builds that will work with Eclipse 3 1 please visit our weekly build site Ave anew separate release site For more information see http www eclipse org cdt There are two ways to install the CDT this update site or the old fashioned way using zip files Installing from the Update Site To install CDT from the update site in the Help menu select Software Updates and then Find and Install Select Search for new features to install and click Next Click New Remote Site to add an update site with the URL http download eclipse org tools cdt releases new Select the appropriate CDT entry and click next to show the list of features for this release ihe o features the CDT runtime and the CDT SDK The SDK feature is a superset of the CDT runtime with the addition of the CDT source Place a ud mu next to Sus desired iu uid click din the rest of the pages to get the install started After the install is complet
46. ss irm elf objcopy irim eltf ab j dump In the Working Directory text window use the Browse File Space button to locate and select the folder that the project resides In this example it s cieclipselworkspaceldemo2106_ blink ram Under the Arguments text window specify the GNU output file main out These changes will guarantee that Insight starts out with the correct source files External Tools Create manage and run configurations Run a program Configurations Mame Insight e Ant Build E P A Emm Main Ti Refresh PS Environment E Common LPC2000 Flash Uttilit Location a SIEDEGIOEE c Program Files GNUARM bin arm elF insight exe Browse Workspace Browse File System variables Arauments Variables Mate Enclose an argument containing spaces using double quotes i Apply Revert C Start the Macraigor OCDremote application Click on the External Tools toolbar button and start the OCDremote C C demo2106 blink ram cmd Eclipse Platform File Edit Mavigate Search Project Run Window Help r35 tmleimia id G 5 OQ Q aeg oror ES oct 4 ae C C Pr EN Hg demoz106 blink ram cmd x Y aL LESZODO Flash Utility BS 4c ee Te demo2106_blink_flash EE demaz1 6 blink ram E Binaries Ea Includes E R Ipez10x h H S crE s H e main c E E crt o armle E E main o armle Ee main ou
47. start the OCDremote are as follows CARM7TDMI S specifies the CPU being accessed p8888 specifies the pseudo TCP IP port being used dWIGGLER specifies the JTAG hardware being used a1 specifies LPT1 for the Wiggler S7 specifies next to slowest speed It s a good idea to not tamper with these values Click on Apply to finish the setup t External Tools Create manage and run configurations Run a program V O N Configurations Mame OCDremote pun 2 Ant Build E Program ZEN LPC2000 Flash Uilit E Main f Refresh P Environment E Common Q Mew configuration Location ge IE qi Cicvgwiniusrilocalbinacdremate exe eO Browse File System variables Working Directory Browse Workspace Browse File System variables CORMYTOMI S paa888 dwIGGLER al 57 variables Note Enclose an argument containing spaces using double quotes ii gt S Lm Run Just like the Philips LPC2000 Flash Utility we d like to include the OCDremote application in our list of favorite External Tools This allows us to quickly start the OCDremote JTAG server from within Eclipse Click on Run External Tools Organize Favorites C C C Eclipse Platform SE File Edit Mavigate Search Pr Run Windpw Help Ai gt E i BN CYP ast Launched Ctrl F 11 i ES 2 ES Fey cic o Au B Mis Debug Last Launched F11 CONS DA E e Run History
48. the External Tools Click on the External Tools button s down arrow to expand the list of available tools 4 gt C C Eclipse Platform File Edit Navigate Search Project Run Window Help ln i HOGlm O a v E CIC P D Q 1 LPC2000 Flash Utility a Bg E demoz106_blink_Flash H E demo2106 blink rar F 2 OCDremote Run As FN External Tools Organize Favorites Problems MEE EM Properties a Ek e Se mS Build demaz1 6 blink ram 10 Installing the INSIGHT Graphical Debugger Eclipse CDT has its own debugger employing the GDB serial protocol The truth is l ve been unable to get it to work reliably with the Wiggler using OCDremote and with the Segger J Link USB JTAG interface using the J Link server written by Nick Randell As far as JTAG debugging goes the Eclipse debugger is just not ready for prime time they are working on it Insight is a pretty good open source debugger that can be made to work with the Wiggler JTAG interface It is already present in the GNUARM directory on C Program Files installed earlier Let s install the Insight Debugger as an Eclipse External Tool Click on Run External Tools External Tools amp C C Eclipse Platform PESE File Edit Navigate Search Project NEUE Window Help js r3 as Ini ES Ay C Run Last Launched Ckrl F11 i Es ES Hie C C em Eh gt 7 fi Debug Last Launched F11 Hz
49. type in X W and this will be displayed long int 5 int 1 int 3687732 atu long 6 Add watch Structured variables will have symbols that can be clicked on to expand the structure SO you can see all the inner bits Hemember that the Watch Window only updates when the Insight Debugger hits a breakpoint or stops R Entering GDB Commands For those who know the original text only GDB debugger well you can open a GDB Console and start typing For example to ask GDB to display the variable j in the function main type the following command into the Console window Console Window gdb p main c j 1 6 1606 gdb S Some Insight Observations To restart the application from the beginning recommend downloading and hitting the Run button again It will not ask you for the connection details Click the close button at the top right when you re finished debugging This will terminate and remove Insight and also terminate OCDremote If you crash you ll probably have to use the Windows Task Manager ctrl alt del to stop OCDremote 23 The Author Sounds Off This tutorial was designed for students and hobbyists those with limited funds It described in great detail how to download and install all the component parts of a complete ARM software development system and gave two simple code examples to try out Of course the beauty of this is that it s completely free If you
50. w da z 22 Execute the RAM Project with the Insight Debugger The previous exercise running the RAM project from the Flash Utility was of academic interest but essentially of no practical value Well it is kind of cool that you can do that with a flash utility Packaged within the GNUARM toolkit is the Insight Graphical Debugger You can start it as an external tool very conveniently and it is specifically designed to debug GNU applications We will need the following hardware setup Olimex ARM JTAG Adapter 20 pin JTAG Port e The Olimex ARM JTAG Adapter is a clone of the Macraigor Wiggler JTAG interface It costs about 19 95 and all fits into a DB 25 shell bought a straight through printer cable from my local computer retailer and fitted it from the LPT1 printer port to the ARM JTAG Wiggler The Wiggler was then fitted to the 20 pin JTAG header on the Olimex LPC P2106 board The red stripe on the ribbon cable is pin 1 and should be nearest the power plug The Debug JTAG jumper should be fitted It doesn t matter if the BSL jumper is installed or not Make all these connections with the power off A Blunt Talk About the Wiggler Let s talk bluntly about the Wiggler The Wiggler is one of many products from the Canadian company Macraigor It connects the parallel port of your PC to the 20 pin JTAG header on the Olimex LPC P2106 board It is just a simple level shifter and a transistor Macraigor charge
51. watching Reality Television dabble in microcomputer electronics The answer is an unequivocal YES Most people start out with projects involving the Microchip PIC series of microcontrollers You may have seen these in Nuts and Volts magazine or visited the plethora of web sites devoted to PIC computing PIC microcomputer chips are very cheap a couple of dollars and you can get an IDE Integrated Development Environment compilers and emulators from Microchip and others for a very reasonable price Another inexpensive microcontroller for the hobbyist to work with is the Rabbit microcomputer The Rabbit line is an 8 bit microcontroller with development packages board and software costing less that 140 l ve longed for a real state of the art microcomputer to play with One that can do 32 bit arithmetic as fast as a speeding bullet and has all the on board RAM and EPROM needed to build sophisticated applications My prayers have been answered recently as big players such as Texas Instruments Philips and Atmel have been selling inexpensive microcontroller chips based on the 32 bit ARM architecture These chips have integrated RAM and FLASH memory a rich set of peripherals such as serial I O PWM 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 80
52. 0 69 168 592 203 121 070 108 277 3 039 1 194 3 744 3 744 3 719 3 719 3 550 3 550 33 456 4 610 3 388 3 388 Path eclipse readme eclipse plugins org junit_3 8 11 eclipse plugins org junit_3 8 1 eclipse plugins org junit_3 8 11 eclipse plugins org junit_3 8 1 eclipse plugins org eclipse update ui 3 0 1 eclipse plugins org eclipse update ui 3 0 1 eclipse plugins org eclipse update ui 3 0 1 eclipse plugins org eclipse update ui_3 0 1 eclipse plugins org eclipse update ui 3 0 1 warning co gif GIF Image Wl mH cd CTE Tes nc lil Selected Files 0 bytes 3 11 2005 9 15 AM 173 150 eclipse plugins org eclipse update ui 3 0 1 24 3d MAME n dc N inr oc eclinestohinine ae nolim mA ia Total 2832 Files 93 870KB 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 scratch eclipse 5DK 3 0 2 win3 zip Extract to 3 i i Desktop E 3 My Computer Desktop E E 3 Local Disk E GS Shared Documents Ey My Documents H Local Disk D My Documents m s Local Disk E ad A DVD R w Drive F 4 5j 3 My Network Places My Documents My Computer Files Open Explorer window Selected files folders Overwrite existing files amp 5 All files folders in archive Lancel M k Q Files F Skip older files y Networ
53. 14 91 MB amp Linux AMD64 self extracting file jre 1 5 0 02 linnx amd64 bin 15 41 MB amp For Customer Service e mail SDLC EXT amp 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 45 ME Es Windows Online Installation Multi language jre 1 5 0 z windaws i585 p iftw exe 271 27 KB E 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 02 windows 586 p exe Type Application 15 2 MB From sumsdici 11 vhosti sun cam Aun Save Cancel While files from the Internet can be useful this file type can potentially harm pour computer IF vou do not trust the source do not min or save this software What s the risk Now the downloading will start 20 of jre 1_5_0_02 windo X e Saving 50 z windaws ib86 p exe From sunsdici 11 vhost1 sun com OLLO Estimated time left 45 sec 3 09 MB af 15 2 MB copied Download Eo Dipa jre 1_5 0 O02 windows i566 p exe Transfer rate 276 KB Sec Close this dialog bos when download completes Open Open Folder After downloading the installation will proceed automatically i J2SE Runtime Environment 5 0 Update 3 Progress Installing The program Features vou sel
54. 2 3 4 5 Fi 8 g E F ASCII dx 4888BAbA 0x54 0 68 8x65 8x28 8x52 061 ze x20 x69 x61 8x69 The Rain in Spai OxABBBBACA x e dx 88 dx BB dx BB dx B x xog xB x 6 x66 xO 0x400004d4 axe 0x00 axe x xB xa xB a xa xB 0x400004e4 0x09 0x00 axe xBB xB xH xA xA xBB xB Bx48BBBAFA Ax n 8x66 866 xB x xB x29 9d xh xd Bx 488885 BA Axes BF xcb Bx7d Bx4c ax 81 x5b xb5a BxcA 6x9a 8 0x40000511 xae axd Axis x7b 8x16 B1 6x06 Bx Ba Bx7a xe2 axha Bxb2 Bzdc BxbH 8x4 HH88524 xbr 0x55 Axb2 Axb2 Ax 42 Axcb Ax21 xag Ax65 Ax5c Ax99 Bxc AxF2 Ax 48 0x21 Bx7b U B ex 8x4 0888534 Hx H7 Bx OF Axb A Ax he Ax62 Ax 68 Ax62 Ax47 xf Axfb Ax2d Axae Ax89 Ax12 Hx af Ax ab Nb bG 0 8x4 0808544 Hx fF Ax9b AxbY9 Bxda Axd Ax58 Ax 49 Ax 4e Bx1c Axi Axb Ox F Hx i Ax fF 1 Hx 46 x88 AIH r 8x4 0888554 axb ax F9 xb1 x76 8x11 8xc11 8x11 8xe 8x98 xa8 xe9 x5r ax9c 8x71 gxir Bxda 0x40000564 0x55 Ox6e Ox3F 0x28 Oxen BxBF 8x33 6x8 0 OxF3 Ox4c BxFF 0x24 Bxaa Bxec Bx11 Ox36 Un 4 N Inspecting the Stack Frame ran the application with a breakpoint set inside the feed routine main c Source Window Ja fx File Run View Control Preferences He
55. 2106 header board soldered into a nice Jameco or Digikey prototype board and know that the CPU end of your project will work straight away If you need to build multiple copies of your design Spark Fun can get small runs of blank circuit boards built for 5 00 per square inch You can acquire the Eagle Lite software from CadSoft for free to design the schematic and PCB masks 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
56. 5 static int Dump Memory at x Set Breakpoint at n Spain 47 48 ff Initializi Open Another Source Window 49 Initialize Open Source in external editor co o 51 f f set io pins for led PB8 7 52 IODIR x B8BB8B888 pin P 6 7 is an output everything else 53 IOSET BxH BB BHSH led off 54 IOCLR GHxd BBH BBSH led on 55 56 of endless loop to toggle the red LED P 58 while 1 4 59 6H For j 8 j lt 5000000 j 2 ZZ wait 500 msec 61 IOSET 0x00000080 f f red led off 62 For j 8 j lt 598060608 j 9 wait 500 msec IOCLR 60x00000080 f f red led on E e 9E 3E QE IE 3E 9E IE 3E IE 3E E IE 3E JE 3E 3E IE 3E 9E 3E 3E IE 3E e IE 3E E 3E 3E IE 3IE 9E E 3E IE IE 9E IE 3E DE E 3E IE 3E E Initialize Yd III IE II EEE 9E E E E JE 9E JE E 3 3 JE JE 3 3 3 3E 3E 3E E 0C 30 0C 20 00 0 90 0 00 90 00 0 90 3 P 1 AAA AAA E Program is running 4888828 46 The Watch Window itself can be displayed by clicking on the Watch Expressions toolbar button d Another easy way to enter variables into the Watch Window is to just type the variable name into the text box at the bottom When you hit the enter key it will appear in the list of watched variables Here typed in the variable name w x long int 5 w int 1 T Add Watch You can also type expressions into the Watch Window For example you could
57. 7 red LED off Likewise to turn the LED PO0 7 on we can write IOCLR 0x00000080 turn PO 7 red LED on As you can see it s fairly simple to manipulate I O bits on the ARM processor To blink the LED a simple FOREVER loop will do the job selected the loop counter values to get a one half second blink on off time endless loop to toggle the red LED P0 7 while 1 for j 0 j lt 5000000 j wait 500 msec IOSET 0x00000080 red led off for j 0 j lt 5000000 j wait 500 msec IOCLR 0x00000080 red led on This scheme is very inefficient in that it hog ties the CPU while the wait loops are counting up The Initialize function requires some explanation C C main c Eclipse Platform File Edit Navigate Search Project Run Window Help HFi uH amp imit amp eS d GQ 359 O Q 4 i 0 j w F Ej Recicer z g cic Pr gt Ol E Ipez10x h S crt s E main map E demo2106 cmd main c X E main lst E ert lst m j gem gt AS ur di id El Initialize le demo2106_blink_flash a sf Ai Edefine PLOCK 0x400 15 Includes h Ipc210x h void Initialize lt void gt lt 3 feed s EEX 3 Initialize main c Setting the Phased Lock Loop lt PLL gt PLOCK a crt o armle a LPC210 main o armle we feed Se main cut Lorki Olimex LPC P21 6 has a 14 7456 mhz crystal Initialize crt lst
58. A A RARA ch ch h ch EEA CK CK CKCKCKCKCHCKCKCh Ch hh ch ho MAIN ak Ck ACH K ch hoch TERT koh oh hok oh oh ck ck ch h Ch h ck koh Hh hchchohokhokoh A H 6 demoz1i 6 blink Flash pe Binaries j Ea Includes E h Ipc210x h int main void i EE ats E d main c int qu loop counter stack variable E E crt o armle static int Bp Static uninitialized variables g Ri main o armle static char static uninitialized variables m main aut armle static int 1 static initialized variable j m crt st static long x 5 static initialized variable static char 0x04 Static initialized variable static int UM Static initialized variable const char pText The Rain in Spain main hex main map KA makefile Initialize th t RES demo2106_blink_rarn ff Initialize Seen Initializel set io pins for led FO 7 IODIR x n00050 pin PO is an output everything else is input after reset IGSET OxOOo0o00060 fo led off IOCLR ux angagaggasuo led on endless loop to toggle the red LED P 7 while 11 for 3 O j lt 5000000 j ff wait 500 msec IOSET OxXDODODOSO red led off for 3 0 j lt 5000000 j ff wait 500 msec IOCLR OxXDODODOSO fred led or E 7 r3 Problems EJ console 3 Cw Properties a Ex r4 E E bs C Build demo2106_blink_ram writable Smart Insert The Philips LPC2106 has 32 I O pins labeled P0 0 through P0 31 Most of thes
59. AM 0x40000234 bss uninitialized variables 0x40000218 data variables 0x40000200 0x40000000 0x020000 copy of data variables 0x000268 Constants strings etc FLASH Initialize Main otartup Code 0x000020 Vector Table 0x000000 17 Description of the Makefile The makefile is the last source file we need to look at built the makefile to comply with the GNU make utility and be as simple as possible Resource makefile Eclipse Platform AE File Edit Navigate Search Project Run Window Help r 8 E amp ilmim j4 o o liB ES Resource TS Navigator ES b mm demo2106_blink_flash crad Elmanma Gets Eletit E mainam ff makefile ha EA H T ANE demozi 06 blink flash Elle demo2106_blink_flash A E cdtpraject arm elf gcc na project arm elf ld v j m crt st arm elf ar E e crko arm elf as ben crk s arm elf objcopy P demoazi 6 amp blink Flash cmd arm elf objdump ve d Ipc210x h von C main c CFLAGS I fno common 03 g mn main dmp AFLAGS ahla mapcs 32 0 CELO i main hex LFLAGS Map main map TdemoziD06 blink flash cmd El main map CPFLAGS O ihex aie ODFLAGS x syms p main ot E makefile all test 61 125 demozi106 blink ram clean rm crt lst main lst crt o main o main out main hex main map main crmp test main out echo copying S CP S CPFLAGS main out main hex OD S ODFLAGS main out gt main drp
60. ANCE BY SELECTING THE ACCEPT BUTTON AT THE BOTTOM OF THE iM 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 If The Source for Java Developers 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 11 Download problems or Questions See the Sun Download Center FAQ J2SE TM Runtime Environment 5 0 Update 2 Click below to download Linux RPM in self extracting file jre 1 5 Q 02 linux i586 rpm bin 15 27 MB Linux self extracting file jre 1 5 0 02 linux i586 bin 15 78 MB 3 Solaris SPARC 32 bit self extracting file jre 1 5 0 02 solaris sparc sh 19 45 MB E Solaris SPARC 64 bit self extracting file jre 1 5 0 02 solaris sparcv8 sh 8 33 MB amp amp Solaris x86 self extracting file jre 1 5 0 02 solaris i586 sh 14 44 MB amp Solaris AMD64 self extracting file jre 1 5 0 02 solaris amdB4 sh 4 72 MB 3 Linux AMD64 RPM in self extracting file jre 1 5 0 02 linux amd64 rpm bin
61. ARM Cross Development with Eclipse By James P Lynch 1 Introduction credit my interest in science and electronics to science fiction movies in the fifties Robbie the Robot in the movie Forbidden Planet especially enthralled me and watched every episode of Rocky Jones Space Ranger on television In high school built a robot and even received a ham radio operator license at age 13 Electronic kits were popular then and built many Heath kits and Knight kits everything from ham radio gear to televisions personal computers and robots These kits not only saved money at the time but the extensive instruction manuals taught the basics of electronics Unfortunately surface mount technology and pick and place machines obliterated any cost advantage to building it yourself and Heath and Allied Radio all dropped out of the kit business What of our children today They have home computers to play with don t they Do you learn anything by playing a Star Wars game or downloading music think not while these pastimes may be fun they are certainly not intellectually creative A couple years ago there were 5 billion microcomputer chips manufactured planet wide Only 300 million of these went into desktop computers The rest went into toasters cars fighter jets and Roomba vacuum cleaners This is where the real action is in the field of computer science and engineering Can today s young student or home hobbyist tired of
62. CK SIZE CPSR c SMODE ABT I BIT F BIT hort Mode sp r r r0 FABT STACK SIZE on CPSR c RMODE FIQ I BIT F BIT FIQ Mode cdtproject sp r E project rO r0 fFIQ STACK SIZE j crk let CPSR c MODE IRO I BIT F BIT IRQ Mode j crt n sp r g arts ro r0 HIRO STACK SIZE E demoz2106 blink ram cmd CPSR c MODE SVC I BIT F BIT Supervisor Mode d Ipez1 x h sp ED j d main c r r HS3VC STACK SIZE main dmp CPSR MODE SYS I BIT F BIT User Mode main hex sp r 7 j 7 main map j main o main out of makefile Tasks El console X w En PI T C Build demo 106_blink_Flash The label Reset_Handler is the beginning of the code Recall that the first interrupt vector at address 0x000000 loads the PC with the contents of the address Reset_Adar 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 F
63. Char B XB int 1 long int 5 char 1064 int 7 j a b C d y X y z P Inspecting Breakpoints You probably know that breakpoints are set by clicking on the little dashes to the far left of the Insight Source Window click again and the breakpoints are removed Insight also has a breakpoint summary window which can be accessed by clicking the Breakpoints button on the Insight toolbar The Breakpoints window shows every breakpoint you ve created Breakpoints Breakpoint Global Address File Line Function 4000034c main c af main H60003bc main c 52 main 40000408 main c 61 main 400004208 main c 63 main Using the pull down menus and the right click menu you can easily disable any or all breakpoints remove them completely etc Q Watch Window The Watch Window allows you to create a display of all your favorite variables that will be displayed whenever the application has stopped There are several ways to add a variable to the Watch Window The most convenient method is to hover over a variable with the cursor right click and select Add to Watch main c Source Window Ja lt File Run view Control Preferences Help SUP OO PE SASA rim Se el main c main SOURCE ab BI 37 int main void 4 38 39 int 4B static int D C static uninitiali 31 static char static un 42 static int static initialize 43 static long iodo 44 static char 4
64. E OXO0000004 IRQ normal interrupts is 4 bytes A makefile ES m nom set 3SVC STACK SIZE Ox00000400 SVC supervisor mode is 1024 bytes Standard definitions of Mode bits and Interrupt I amp F flags in PSRs program status registers set MODE USR Ox10 Normal User Mode j set MODE FIQ 0x11 FIQ Processing Fast Interrupts Mode set MODE IRQ 0x12 IRQ Processing Standard Interrupts Mode set MODE SVC 0x13 Supervisor Processing Software Interrupts Mode set MODE ABT 0x17 Abort Processing memory Faults Mode j set MODE UND Ox1B Undefined Processing Undefined Instructions Mode j set MODE SYS Ox1F System Running Priviledged Operating System Tasks Mode set I BIT 0x80 when I bit is set IRQ is disabled program status registers set F BIT 0x40 when F bit is set FIQ is disabled program status registers M gt e B EK r Q T3 H C Build demo2106 blink Flash This part of the crt s file sets up the interrupt vectors C C crt s Eclipse Platform PEE File Edit Navigate Search Run Project Window Help Ira Jj 6 d Q 5 O Q 2 0 5 ww Ff ES Edcicee i c iie 53 we m a ic main c demo2106_blink_ram cmd demo2106_blink_flash cmd main map main map l gt A uj alB v An outline is not available 2 15 demo2106_blink_flash Binaries Includes h Ipc210x h Global Reset Handler s crt s global startup main c
65. G server These are the three paths that must be present in the Windows environment c cygwin bin c program files gnuarm bin c cygwin usr local bin To verify that these paths are present in Windows and to make changes if required start the Windows Control Panel by clicking Start Control Panel Control Panel File Edit View Favorites Tools Help Back gt JO search 7 Folders EEE X X Ea 15 Add or emoy vi Control Panel Accessibility Add Hardware Options y Display Folder Options 9 Internet Keyboard Options hws amp Phone and Portable Media Power Options Printers and Modem Devices Faxes 3 5D Scannersand Scheduled Security Sounds and Cameras Tasks Center Audio Devices User Accounts Windows Firewall G Switch to Category View Tools See Also Fonts Game Intel YY Windows Update 9 Help and Support Java Mail _ b Wireless Network Set Now click on the Advanced tab below System Properties w 9 Administrative Automatic Updates ow Controllers Moder on zs D Mouse QuickTime wv Speech mak Lj Date and Time Intel R PROSet Wired Network Setup Wizard Y Regional and anguage BDE Administrator Intel R Extrem Network Connections a System System Restore Automatic Updates General Computer Name Hardware System Microsoft Windows lt P Home Edit
66. IQ Addr An EN is mot le demo2106 blink Flash Soar Q Binaries A Reset Addr Reset_Handler defined in this module below Includes Undef Addr UNDEF Routine defined in main wf n Ipc210x h SWI Addr SWI Routine defined in main s crt s PAbt Addr UNDEF Routine defined in main E main c DAbt Addr UNDEF Routine defined in main i d crt o armle IRQ Addr IRQ Routine defined in main c main o armle FIQ Addr FIQ Routine defined in main c F main out armle k o rounds the vectors and ISR addresses to 64 bytes total F FF crt lst Ec w skip past Philips ISP ram usage all the way to Ox40000200 main dmp a main hex main map K makefile demo2106 blink ram Binaries m j 12 Includes Setup a stack for each mode note that this only sets up a usable stack hj Ipc210x h for User mode lso each mode is setup with interrupts initially disabled s crt s i E main c 7 crt o armle E console 33 N Properties m 5g Ex BB r4 E F3 2 main o armle lt terminated gt LPC2000 Flash Utility Program C Program FilesLPC2106 ISPALPC210x ISP exe E main out armle ert lst ill ua H Reset Handler Rese t Handle r E EE EE EE EE EE E xq Remember that the entire project code and variables will be loaded into RAM starting at
67. IRQ stack pointer SVC mode 4bytes 0x4000FECC SVC stack pointer 0x4000FEC8 USR SYS stack RAM USR mode SYS mode stack Stack grows downward until it collides with The next part of the sections as shown e setup of the data and bss Resource crt s Eclipse Platform File Edit Navigate Search Project Run Window Help r3 il 3 JW l9 0 ex Navigator 22 i mnrgmp main dmp demo2106_blink_flash cmd S crt s E Tes demo2106_blink_flash copy data section Copy from ROM to RAM B cdtproject ldr R1 etext 3 project ldr R2 7 data crt lst ldr R3 edatal B crt o cmp R2 R3 S crt s ldrlo RO Ri 4 FS demo2106 blink Flash cmd strlo RO R2 4 C Ipc210x h blo 1b C main c main dmp i ini ms Clear bss section Zero init main hex mov RO 0 ee ldr Ri bss start 5 main o m A ldr R2 bss end z main out Ri R2 9 makefile cmp d E us demo2106 blink ram strlo RO Ri 4 cdtproject blo 2b zh 5 project E crt Ist Enter the C code crt o b main crt s 5 demo2106_blink_ram crd endfunc C Ipc210x h end E main c Zh A main dmp lt gt main hex possem aea main map Tasks El console 23 a ala 5 20 main o C Build demo2106 blink flash main out makefile The data section contains all the initialized static and global variables The GNU linke
68. P Search oy Folders Ei x kd z Folders A Mame 4 3 Program Files Cilecipse SDK 3 0 2 win32 scratch 5 source code w Contents of folder C scratch Eclipse is delivered as a ZIP file eclipse SDK 3 0 2 win32 zip You can use WinZip to decompress this file and load its constituent parts on your hard drive If you don t have WinZip you can get a free evaluation version from this address http www winzip com There s a decent Help file supplied by WinZip Therefore we re going to assume that the reader is able to use a tool such as WinZip to extract from zip files In my computer with WinZip installed double clicking on the zip file name eclipse SDK 3 1M7 win32 zip in the Windows Explorer display above will automatically start up WinZip WinZip Evaluation Version eclipse SDK 3 0 2 win32 zip File Actions Options Help Gas we Open Favorites P junit jar El about html I update wiz gif I uninstall wiz gif Iv install_wiz gif D def wizban jpg I config wiz gif s Encrypt Type HTML Dacum PL Document PROPERTIE Executable 3 HTML Dacum GIF Image GIF Image GIF Image Paint Shop P GIF Image w amp g View Checkout Modified 3 11 2005 9 15 AM 3 11 2005 9 10 AM 3 11 2005 9 10 AM 3 11 2005 9 10 AM 3 11 2005 9 10 AM 3 11 2005 9 15 AM 3 11 2005 9 15 AM 3 11 2005 9 15 AM 3111 2005 9 15 AM 3 11 2005 9 15 AM Wizard Size i Packed 156 652 39 20
69. PU with real time emulation and embedded trace support together with 128 kbytes kB of embedded high speed flash memory 4 128 bit wide memory interface and a unique accelerator architecture enable 32 bit code execution at maximum clock rate For critical code size applications the alternative 16 bit Thumb Mode reduces code by more than 3 pct with minimal performance penalty Due to their tiny size and low power consumption these microcontrollers are ideal for applications where miniaturization is a key requirement such as access control and point of sale With a wide range of serial 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 14 57 64 kA on chin Static RAM If you scroll down this page you will see a link to the LPC2000 Flash Utility download Click on the ZIP file LPC2000 Flash Utility date 2004 03 01 AB Support amp tools LP 2104 Single Chip 32 bit Microcontroller Erratasheet date 2004 06 01 LPE2105 Single Chip 32 bit Microcontroller Erratasheet date 2004 06 01 LPE2106 Single Chip 32 bit Microcontrolle
70. Project Create a Mew C Project using make to build it Project name demoz1 6 blink Flash Project contents W Use default ne S The New Project dialog box appears next If you click on the Make Builder tab you ll notice that Eclipse build command is make Make is provided by the Cygwin GNU tools New Project E L Make Project Settings ELI Define the project and make builder settings C Make builder settings i Projects Make Builder Error Parsers Binary Parser Discovery Options C C Indexer Build command Iv Use default Build command Build Setting Stop on First build error Workbench Build Behavior Workbench build type Make build target Build on resource save Auto Build e o Mote See Workbench automatic build preference Iv Build Incremental Build all w Rebuild Full Build clean all Iv Clean clean Cancel Let s remind ourselves that we installed the Cygwin GNU tools earlier in the tutorial and the Windows Explorer will show that the make exe file is indeed in the directory c cygwin bin as shown below File Edit Viel DER Favorites Tools Help ae pack leg d Jo Search E ie Hab X A E B Folders X Mame Size Tvpe Date Modified 5 capture E lsdiff 1 KB System File 5 7 2005 11 45 E 3 cygwin nx 1 279 KB Application 6 28 2004 4 45 E 3 bin Tm S4KB Application 4 5 2005 8 28 glui examples mail
71. RST button for good luck B Final Preparations Before Starting Insight Debugger The following procedure to start the Insight Debugger and download and debug our RAM application is based on very painful experimentation on my part There may be other ways to do this please have fun trying other approaches Before we start the Insight Graphical Debugger should mention that debuggers absolutely hate compiler optimization This one is no different We have been compiling with OS3 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 OO and rebuild File makefile mak NAME demozl106 blink ram CE LD AR An CP OD GELAiL AFLG LFLAGH CPFLAGA OUP LA all test We also need to arm eli gco arm elf ld w arm elf ar arm elf as arm eltf objcopy arm eltf ob jdump I fno common Cons ahls mapces 3z o c lt T Hap main map Tdermos106 blink ram cma 0 ihex X syms configure Insight to the specific project we are debugging Hemember the external tools configuration window set up earlier Click on the External Tools toolbar button to bring up this window Help d 0 Q e 4 Pe s Q 1 LPC2000 Flash Utility FM 2 OCDremote Q4 3 Insight ram cmd mozZ10 D ILE irm elf cdqcc Abm elr l Armieelf
72. Run s demaozin6 amp blink Flash n outline is mot available H S demoz2106 blink ram Fun Debug History Debug s Denia D aM E ri B lt berminated gt C Program Files SNUGRM Bina Now click on Add in the Organize External Tools window and follow that by checking OCDremote in the Add External Tools Configurations window Click on OK to add the OCDremote to the list of favorites Add External Tools Favorites Organize External Tools Select Launch Configurations LL Mew configuration ll aL OCDremote Favorites LPC2000 Flash oa Select All Deselect all Now verify that the OCDremote is in the list of External Tools favorites Click n Run External Tools and see that it s now included in the list of favorites C C Eclipse Platform File Edit Navigate Search Project A window Help js ri lg m Rr ei oy fA Run Last Launched Ctrl Fii gt Ye Debug Last Launched F11 CIC P Run History 1 5 demo2106 blink Flash Run As 61 15 demoz106 blink ram Run Debug History Debug s Debug F External Tools d QL 1 LPC2000 Flash Utility F 2 OCDremote Run As An outline is not available Problems El console 53 ig Q External Tools e En A FI CL lt tberminated gt C Program Piles GMNLIAR organize Favorites Now is a good time to point out that there s a handy shortcut button in Eclipse to run
73. TH variables used by Philips ISP bootloader ram ORIGIN Ox40000200 LENGTH free RAM area ram isp high A ORIGIN Ox4000FFEO LENGTH variables used by Philips ISP bootloader Fi i p B O Ey E mm E 8 8 8 6 15 demo2106 blink ram define a global symbol stack end stack end Ox4000FEDC Tasks E Console x2 a Y Ee BB A e oe Oo terminated Insight Program C Program Files GNUARMbinarm elf insight exe writable Insert First we define an entry point specifically startup as defined in the assembler function crt s ENTRY startup The Linker command script uses the following directives to lay out the physical memory MEMORY flash ORIGIN 0 LENGTH 128K FLASH ROM ram_isp_low A ORIGIN 0x40000120 LENGTH 223 variables used by Philips ISP ram ORIGIN 0x40000200 LENGTH 64992 free RAM area ram isp high A ORIGIN Ox4000FFE0 LENGTH 32 variables used by Philips ISP You might expect that we d define only a flash and a ram memory area In addition to those we ve 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 et
74. We d like the LPC2106 to run at 53 2368 mhz Chas to be an even multiple of crystal 9 main E demo2106 cmd According to the Philips LPC2106 manual M cclk Fosc where M PLL multiplier bits 0 4 of PLLCFG gt main hex cclk 53236888 hz main lst Fosc 14745688 hz BeBe Ap Solving M 53236888 14745688 3 6103515625 j makefile M 4 round up Note M 1 must be entered into bits 8 4 of PLLCFG Cassign 3 to these bits The Current Controlled Oscilator CCO gt must operate in the range 156 mhz to 328 mhz According to the Philips LPC2186 manual Fcco cclk 2 P where CCO frequency 53236866 hz PLL divisor bits 5 6 of PLLCFG gt Solving Fcco 53236888 2 P P trial value gt Fcco 5323688080 2 2 FccA 212947266 hz good choice for P since it s within the 156 mhz to 320 mhz range From Table 19 page 48 gt of Philips LPC2166 manual P 2 PLLCFG bits 5 6 1 C assign 1 to these bits Finally PLLCFG 6 i 88811 BMx23 Final note 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 Setting Multiplier and Divider values PLLCFG 8x23 feed Enabling the PLL PLLCON 8 x1 feed Wait for the PLL to lock to set frequency while lt t PLLSTAT PLOCK gt gt Connect the PLL as the clock source PLLCON Mx3 5 feed gt Enabling MAM and setting number of clocks used for Flash memory fetch 4 c
75. a breakpoint in FLASH The OCDremote application cannot deal with GDB z commands which refer to hardware breakpoints the LPC2106 has two hardware breakpoints This is the reason that debugging with this simple device is limited to applications configured to run from RAM exclusively Obviously the 64K limitation of the Philips LPC2106 limits the size of an application you can fit into RAM However it s better than nothing Let s review the hardware setup one more time Doesn t matter if the BSL jumper is installed or not s AE eA an aa A e A m pem pex gj auadaagadaa gagaa gagaadaadrc g 0 0 oo go ggg qgogaagagq o ejejyejej ejejejejeje agauogadaadanad agoaoaaadadi ajelolojolafofofajo No need to unplug the serial cable m d agoadogauaagagaq sIsIajejejetejejere ais ejejejejejeteje afelelejeiejelelelerele pees 00000000 CIAO EEeIvIsieiejale e eieie e ris DDODDDDDODODDDD op sie s s e e e s s se arelal als SODDDDODDOPODE oe 51 5151 a 1 2 9 P 9I DDDDDDDbPbppbtr JGDDPpppPpppbponptr wiejejerejere Ixje oej ej ejuje viv ie uejejejiojeje efpe ejejyeje e eJjojojefeja je e ejeje eje e me EEL aggaga gaar Power plug from 9 volt wall wart power supply RERET at Hed 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
76. allation w Little Endian 7TOMB v LE Libraries 9 7 MB v No Fast Multiplier 38MB T ARM THUMB Intermorking 9 8 MB v THUMB 18 8 MB v THUMB Libraries 9 5 MB D v ARM THUMB Interearking 3 5 MB i Floating Point LL nit FPU Libraries Current selection requires at least 216 9 MB of disk space 00 00 eek oen D onem Take the default on this screen Click Next to continue i8 Setup GNUARM Select Start Menu Folder Where should Setup place the program s shortcuts oo Fir Setup will create the program s shortcuts in the following Start Menu folder To continue click Next IF you would like to select a different folder click Browse p 5 Cr OL ce 7 Its very important that you don t check Install Cygwin DLLs We already have the Cygwin DLL installed from our Cygwin environment installation Since all operations are called from within Eclipse we don t need a desktop icon either Click Next to continue e Setup GNUARM Select Additional T asks Which additional tasks should be perfarmed Select the additional tasks you would like Setup to perform while installing GHUAR FM then click Met Additional icons Create a desktop icon Cygwin options Install Cygwin DLLs Click on Install to start the GNUARM installation a i Setup GNUARM Heady to Install Setup is now ready to begin installing GNUARM on your computer Click
77. and ram is organized C C demo2106_blink_ram cmd Eclipse Platform File Edit Mavigate Search Project Run Window Help J ri E amp lm 6 G 3 O Q 4 6 E specify the LPC2106 memory areas MEMORY i flash ORIGIN OxO00000000 LENGTH free FLASH EPROM area rat ORIGIN Ox40000000 LENGTH free RAM area define a global symbol stack end Stack end Ox4000FEDC writable Above defined two memory areas for flash and RAM consistent with the LPC2106 memory map Of course we re going to load everything code and variables into RAM Note that also created a global symbol stack end that is used in the startup routine to build the various stacks The address is positioned just after the stacks and variables used by the Philips ISP Flash Utility C C demo2106 blink ram cmd Eclipse Platform AE File Edit Mavigate Search Project Run Window Help Sla 6 6 4 G 1 0 Q 18 7 tp gt ES Bcc di Im CENTER Ga Bes Rec Wee o now define the output sections SECTIONS i startup startup ram text rodataj rodata Glue 7 Glue t Btext ram data i data i dataj Bdata ram ss s 1 _bs3 Start hs2 ram ALIGN 43 bss end zu end 0 1 Problems E Console 5 gt Properties lt terminated gt LPC2000 Flash Utility Program C Program FilesLPC2106 TSPALPCZ10x ISP exe the star
78. and then avoid assigning any text data or bss sections into it The first order of business in the linker command script is to identify the memory available this is easy in a Philips LPC2106 the RAM and FLASH memory are on chip and at fixed locations Page 29 of the Philips LPC2106 User Manual shows the physical memory layout 4 0 GB OxFFFF FFFF AHB Peripherals 375 GB OxF000 0000 VPB Peripherals 35GB OxE000 0000 30GB 0xC000 0000 Reserved for External Memory 20GB 0x8000 0000 Boot Block 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 0x0002 0000 l 0x0001 FFFF 128 kB On Chip Non Volatile Memory 0 0 GB 0x0000 0000 Resource demo2106_blink_flash cmd Eclipse Platform File Edit Navigate Search Project Run Window Help Ir3 Gl amp Q E IDO gt 5 Navigator 58 Hi S at s Bi demo2106 blink Flash cmd X S crt s C main c main map demo2106 blink ram cmd Se E B v mo2106 blink flash identify the Entry Point es d ym I cdtproject project ENTRY startup crt lst crt o crt s demo2106_blink_flash cmd specify the LPC2106 memory areas Ipc210x h main c MEMORY main dmp main hex main map main o main out flash ORIGIN O LENGTH FLASH ROM ram isp low A ORIGIN 0x40000120 LENG
79. anslates GDB monitor commands into Wiggler JTAG commands This permits Eclipse GDB to communicate to the Olimex LPC P2100 board as a target monitor accessed via Ethernet Macraigor has always made this utility available on the internet as freeware The OCDRemote utility can be downloaded at You should see the following screen open up Home View Cart Site Map Contact Legal Macraigor Systems Make your debugging a little bit easier Home Hardware Products Software Products CPUs Tools etc Partners Ne E Flash Programmer GNU Tools Batch Flash Programmer Target Access DLL J SCAN JTAG Debugger JTAG Commander alidator OCD Commander If you scroll the above screen down a bit you should see the download for OCDRemote Click on the link DOWNLOAD Windows OCDRemote v2 12 For Linux Click on Run so it will download and immediately install OCDRemote File Download Security Warning Do you want En run or save this file Mame hwsuppark 2 12 amp xe amp Type Application 2 95 MB From wanw acdeman cam Cancel While files from the Internet can be useful this File type can potentially harm your computer IF you do not trust the source do nat run or save this software What s the risk The download phase is quick since the OCDRemote is only a couple of megabytes Opening hwisupparE z 12 exe From www acdemaon cam Estima
80. ash the startup code goes into FLASH main c main dmp main hex main map collect all sections that should go into FLASH after startup main o main out text all text sections code 5 makefile rodata all rodata sections constants strings etc 61 15 demo2106 blink ram rodata all rodata sections constants strings etc glue 7 all glue 7 sections glue 7t all glue 7t sections _etext define a global symbol etext just after the last code byte gt flash put all the above into FLASH data collect all initialized data sections that go into RAM data create a global symbol marking the start of the data section data all data sections _ data define a global symbol marking the end of the data section 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 gt ram put all the above in RAM it will be cleared in the startup code ALIGN 4 advance location counter to the next 32 bit boundary bss end define a global symbol marking the end of the bss section end define a global symbol marking the end of application RAM lt Tasks El Console oN Y Y Ew BB PI B Wri
81. atform File Edit Navigate Search Project Run Window Help 0x40000464 lt 0x40000445 lt 0x40000430 lt 0x40000344 0x400002 ca writable E 3 c 1 Pii Mi ME dc SIE text C Code 408 bytes Ox400002c 0 Ox40000ehbe Ox 400002hb6 Ox400002h4 O0x400002 985 Text Startup Code fassembler 116 bytes Variables used hy Philips boot loader 23 bytes Do not put anything here Text Interrupt Vectors re mapped Problems El Console 3 Properties lt terminated gt LPC2000 Flash Utility Program C Program Files LPC2106 ISPLPC210x_15P exe Ox 40000200 Ox400001FF Ox 40000040 Ox 40000000 writable _edata Mata rain Initialize Insert UNDEF Routine WI Routine FIO Routine IRQ Routine feed C C demo2106_blink_ram cmd Eclipse Platform File Edit Navigate Search Project Run Window Help ri E amp lgIG amp i G l 5 O Q amp 4 o d E i Ed OxOO01FFFF oe iw i unused flash epror ES i 65472 bytes d E 0x00000040 FU Interrupt Vector Table flash E jt 0x00000000 it ES it it Author James P Lynch if Ez ERE RARA ARA RARA RARA E RARA RARA RARA RARA RAR RARE RARA RARA E RARA RARA a RARA RA RARA RARA ARA aa identify the Entry Point ENTRY Reset Handler writable Insert added quite a bit of annotation above to make it very clear how the memory flash
82. ative linux apps on Windows You have to rebuild your application ror source if you want to get it running on Windows e Cygwin is not a way to magically make native Windows apps aware of ONIX functionality like signals ptys etc Again you need to build your apps from source if you want to take advantage of Cygwin functionality Help contact web page other info Historical cygwin into E find a package or or file in the cygwin release get help on using setup exe Install or update Latest Cygwin DLL release version 1s 1 5 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 WAAL CY Rin cor Cancel While files from the Internet can be useful this file type car potentially harm your computer IF you do nat trust the source do not run or save this software what s the risk Now the Cygwin wizard will start up Select Next to continue Cygwin Setup A 14 Cygwin Net Release Setup Program This wizard will quide you through the installation and updating of the Cygwin environment and a plethora of GNU packages gt Setup exe version 242r Copyright 2000 2001 Red Hat Ine http sources redhat com icygvin Choose Install from Internet and then click Next
83. ble static initialized v IM II cr nm mn ME gg x m gm 1 w Il rm XO omm mai ll The Rain in Spain 53 IOSET 5 4 IOCLR 5 5 56 of endless loop to toggle the red LED P 58 while 1 4 50 6 For j 8 j lt 50000003 j 5 ZZ wait 588 msec 61 IOSET 6x60000080 red led off 62 For j 8 j lt 50000003 j 3 ZZ wait 588 msec 63 IOCLR 6x660000080 ff red led on 64 5 gt 66 o 68 70 Initialize Y III 30 9 3E II 3 JE E 3E E 3 JE 3E 9E 3 3 JE 3 3 9 3E 30 IO IE 9 30 303 3 JE 3E JE 3E 3 2E 30 30 3 90 0C 30 903 303090 3030 96 3 3 A hdi 6x600600086 led off BxGHG808888 led on T gt l Program stopped at line 52 489062b4 52 H Step Through a Few Lines of Code Click the STEP OVER button the program executes one line stopping on the highlighted line The green highlight indicates the line to be executed next 51 ff set io pins for led P 7 tw E SG IODIR xHBHBHBSB pin PB 7 is an output SH IOCLR BxBB6BBBB363 led on Click the STEP OVER button the program executes one line Note that the LED goes off 51 set do pins for led PB 7 TW g 52 IODIR 8x88888888 pin P8 7 is an output 53 IOSET HBxB88888888 led off 55 Click the STEP OVER button the program executes one line Note that the LED goes on Also note that the program executes to the next
84. blink_flash cmd Ipe210x h main c B main dmp main hex E main map Stubs for various interrupts may be replaced later E main o main out 0 9 makefile H E demo2106 blink ram B edtproject 8 project B crt Ist B crt o void FIO Routine void i s crt s while 1 F demo2106_blink_ram cmd e Ipc210x h main c 2 main dmp void SUI Routine void main hex while 1 B main map y E main o B main out 9 makefile void UNDEF Routine void while 1 void feed void void IRQ Routine void while 1 Tasks El Console 53 B EK r 2 T3 H C Build demo2106 blink Flash writable Smart Insert 16 Description of the Linker Script demo2106 blink flash cmd Let s look now at the linker command script demo2106 blink flash cmd l ve included extensive annotation to make it very clear how the memory is organized Resource demo2106 blink flash cmd Eclipse Platform File Edit Navigate Search Project Run Window Help imita IESU A ES Resource E E e Ex ERAS 5 15 demo2106 blink flash demo2106 blink flash cmd LINKER SCRIPT cdtproject de project rt 5 crt lst The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are crt o to be loaded into memory code goes into FLASH variables go into RAM crt s demo2106 blink flash cmd Any s
85. c into flash and ram Note that we created a global symbol all symbols created in the linker command script are global called stack end It s just located after the stack variable area used by the Philips ISP Flash Utility boot loader as mentioned above stack end 0x4000FEDC Now that the memory areas have been defined we can start putting things into them We do that by creating output sections and then putting bits and pieces of our code and data into them We define below four output sections startup this output section holds the code in the startup function defined in crt s 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 n BaelabJaQ 9 9 e gt gt A Navigator x X CNT S crt s Bi demo2106 blink flash cmd X C main c main map demo2106 blink ram cmd n2 1 I BEH t 5 demo2106 blink flash now define the output sections cdtproject Peppa SECTIONS crt Ist crt o is un a D set location counter to address zero 5 demo2106 blink Flash cmd G Ipc210x h startup startup gt fl
86. cense Agreement Please read the following important information before continuing Pleaze read the following License Agreement You must accept the terms of this agreement before continuing with the installation GNU GENERAL PUBLIC LICENSE Version 2 June 1991 Copyright E 1989 1991 Free Software Foundation Inc 59 Temple Place Suite 330 Boston MA 02111 1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document but changing itis not allowed Preamble The licenses for most software are designed to take away your accept the agreement do not accept the agreement p o tm lt Back Lone tarea We ll take the default and let it install into the Program Files directory Click Next to continue ts Setup GNUARM Select Destination Location Where should GNUSAM be installed pum Setup will install GNUARIM inta the following folder To continue click Next IF you would like to select a different folder click Browse D Program Files GNUARM Al least 62 9 MB of free disk space i required ee lt Back NT Cancer We ll also take the defaults on the Select Components window Click Next to continue te Setup GNUARM Select Components Which components should be installed Select the components you want to install clear the components you do nat want to Install Click Mest when you are ready to continue Full inst
87. ct Packages screen below you ll see the following line Devel Default You must click on the little circle with the two arrowheads until the line changes to this y Devel 4 Install This will force installation of the default GNU compiler suite for Windows Intel targets Here s the Select Packages screen before clicking on the circle with arrowheads The following four packages must be selected and changed from default to install Archive O Default Devel Default Libs O Default Web O Default Archive Install Devel Q Install Libs O Install Web O 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 Select Packages Select packages to install E ax E C Keep Prev Category Curent All amp Default Admin 4 Default Archive de Install Base 4 Default Database 4 Default Devel e Install Doc 4 Default Editors 4 Default Games amp Default Graphics 4 Default Interpreters amp Default Libs amp Install Mail amp Default Math de Detautt Ming dde Default Met dr Default Publishing amp Default Shells amp Default System amp
88. e Add External Tools Favorites window on the right below click and check mark the Insight debugger select box and then click OK to add it as a favorite Add External Tools Favorites Br anFigurations F L Organize External Tools y Favorites Gu LPC2000 Flash TQ Q OlLDremote Remove Lip Down a Select All Deselect all Finally click on OK to officially add Insight as a favorite External Tool Organize External Tools Favorites Lec2000 Flash Utility Q OCDremoate m E BT QL Insight dichas Up Drown Cancel As one final confidence check click on the Run External Tools button and verify that all three tools are properly installed It s worth mentioning that to run the Insight Graphical Debugger you will click on OCDremote first to get it running and then click on Insight to start the debugger Resource Eclipse Platform File Edit Mavigate Search Project Run Window Help Int HSla la lv eo o A x Y Q 1 LPC2000 Flash Utility G 2 QOCDremote H E demoz106_blink_F QL 3 Insight a demoz106 blink r Run As p G External Tools Organize Favorites 11 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 JTA
89. e buffalo edu Coen f EE Dres 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 What s the nik Now browse to the c scratch directory that you created previously Save As Save in O 2 pm hy Recent Documents C3 Desktop My D acuments i hy Computer File name eclipse SDK 3 0 2 wind2 v p Muy Network Dave as type Winzip File w Cancel L mmu BEN Click on Save to start the download Now the download will start Eclipse is delivered as a ZIP file It s 85 megabytes in length and takes 8 minutes and 20 seconds to download with my broadband cable modem If you have a dialup internet connection this will be excruciating If you don t have a cable modem high speed internet connection suggest you find somebody who does and go over there with a blank CDROM and a gift 7 of eclipse SDK 3 0 2 win32 zip Completed fa Saving Cipse SDK 3 0 2 win3z zip From FEp cse burFala edu Estimated time left 7 min 13 sec 5 88 MB of 85 4 MB copied Download Eo Cuscratchleclipse 50K 3 0 2 410 32 zip Transfer rate 166 KB 5ec Close this dialog box when download completes Oper Open Folder When the Eclipse download completes you should see the following zip file in your scratch directory Wr scratch File Edit View Favorites Tools Help sack d
90. e data section in RAM This helps us create a copy loop in the crt s assembler file to load the initial values into the data section in RAM The command ram specifies the Virtual Memory Address that the data section is to be placed into RAM think of it as the final destination in RAM and all code references to any variables will use the RAM address The command AT flash specifies the load memory address essentially an exact copy of the RAM memory area with every variable initialized placed in flash for copying at startup You might say why not let the Philips boot loader load the initial values of the data section in RAM directly from the hex file The answer is that would work once and only once When you power off and reboot your embedded application the RAM values are lost The copy of the data area loaded into flash for copying during startup is placed by the GNU linker at the next available flash location This is conveniently right after the last byte of the prog section containing all our executable code The bss section is all variables that are not initialized It 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 R
91. e SASA rina zda main c y nain v SOURCE v 37 int main void E 38 39 int 3 46 static int a b c static uninitializei 41 static char d static unin 42 static int w 1 static initialized 43 static long x 5 static initialized variable 44 static char y 8x85 static initialized variable 4S static int z 7 static initialized 46 const char xpText The Rain in Spain 47 48 Initialize the system 49 Initialize set io pins for led P8 7 52 IODIR 8x88888888 pin P8 7 is an output everything else is input after reset 53 IOSET 6x66666686 led on 54 IOCLR 6x66666686 led off endless loop to toggle the red LED P8 7 while 1 for j 8 j lt 5888888 j ZZ wait 588 msec 61 IOSET 8x888888880 red led on 62 for j 8 j lt 5888888 j ZZ wait 588 msec IOCLR 8x88888880 red led off 78 Initialize 4 DOWNLOAD FINISHED 1088 bytes in 6 seconds 1450 bits per second F RUN the Application to MAIN Click on the RUN button The application will start and breakpoint at the main routine PPO E You may get either of these GDB windows just answer YES A A program is currently being debugged A Make breakpoint pending on Future shared library load Do ou wank to restart Mo A red box on line 46 indicates that the debugger stopped at main If you study the assembly language generated for
92. e and out of the price range of hobbyists A better solution might be an Olimex LPC P2106 board outfitted with one of those Spark Fun CP2106 USB to Serial converters to accept GDB debugger serial protocol from the PC and convert it into ARM JTAG signals The JTAG signals are documented at the ARM web site and the GDB serial protocol is fully specified at the GNU web site The LPC2106 could be programmed to know the device ID of the LPC2000 series microcontroller it is fitted to and convert any download files into flash programming commands if needed Even software breakpoints can be handled by reading an 8k block of code changing one word and flash programming it back into the target Just using parts from Olimex and Spark Fun this could cost less than 100 The software programming job would be rather extensive Still itd make a very nice open source project I m thinking about it I m not finished writing tutorials My next tutorial will involve using ARM interrupts and how to design and implement I2C port expanders to interface to LCD displays and keypads Later tutorials will go into motion control free real time operating systems and other hardware projects Stay tuned just like you I m just getting started 24 About the Author Jim Lynch lives in Grand Island New York and is a Project Manager for Control Techniques a subsidiary of Emerson Electric He develops embedded software for the company s industrial drives high power motor c
93. e pins have two or three possible uses For example pin P0 7 has three possible uses digital I O port SPI Slave Select and PWM output 2 Normally you select which function to use with the Pin Connect Block The Pin Connect Block is composed of two 32 bit registers PINSELO and PINSEL1 Each Pin Select register has two bits for each I O pin allowing at least three functions for each pin to be specified For example pin PO 7 is controlled by PINSELO bits 14 15 The following specification would select PWM 2 output PINSELO 0x00008000 set PINSELO bits 14 15 to 01 Fortunately the Pin Connect Block resets to zero meaning that all port pins are General Purpose I O bits So we don t have to set the Pin Select registers in this example We do have to set the I O Direction for port PO 7 this can be done in this way IODIR 0x00000080 set IO Direction register P0 7 as output 1 output 0 input The ARM I O ports are manipulated by register IOSET and register IOCLR You never directly write to the I O Port You set a bit in the IOSET register to set the port bit and you set a bit in the IOCLR register to clear the port bit This little nuance will trip up novice and experienced programmers alike Alert readers will ask What if both bits are set in IOSET and IOCLR The answer is Last one wins The last IOSET or IOCLR instruction will prevail To turn the LED P0 7 off we can write IOSET 0x00000080 turn PO
94. eckout See details 64 used amp new available from 20 00 Edition Paperback lank incida this hank Embedded System Design on a Shoestring Embedded Technology Series by Lewin Edwards There exist a large body of literature focused on teaching both general embedded systems principles and design techniques and tips and tricks for specific microcontrollers more SIPs current output section bss end gdb stubs sourcecode files clear bss more CH INSIDE List Price 49 95 E amp P Price 49 95 and this item ships for FREE with Super Saver Shipping See details Availability Usually ships within 24 hours Ships from and sold by amp mazan cam 11 used amp new available from 47 97 Edition Paperback The ARM documentation can be downloaded free from the ARM web site http www arm com documentation The Philips Corporation has extensive documentation on the LPC2000 series here http Awww semiconductors philios com pip LPC2106 html All the GNU documentation in PDF format is maintained by among others the University of south Wales in Sidney Australia found the GNU assembler and linker manuals very readable the GNU C compiler manuals are very difficult http dsl ee unsw edu au dsl cdrom gnutools doc Of course the bookstore is full of Eclipse books but they are all about the JAVA toolkit So far no one has published anything on the CDT plugin Finally avail yourself of the many di
95. ect 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 a fex Resource main c Eclipse Platform File Edit Navigate Search femal Run Window Help Hala aj ente Bs ES Rypesouce Close Project 2 S tS Navigator Z3 J S crt s K makefile A outline XN HB i aa Build All 3 TERRA ARRE a 5 Build Project X P I GO we y 2 15 demo2106 blink flash Build Working Set uM a Initialize i S a a a a a a a a a a a a a a a a a a a a a a a a a a cdtproject Clean feed project Build Automatically IRQ_Routine crt s t void FIQ Routine ES demo2106 blink fli Properties SWI_Routine C Ipc210x h UNDEF_Routine Gi main c void IRQ Routine void _a attribute_ interrupt IRQ SY LPC210x h K makefile void FIQ Routine void attribute interrupt FIQ amp q E f i 5 demo2106 blink ram void SUI Routine void _ attribute _ interrupt SWI Ar void UNDEF Routine void _ attribute interrupt UNDEF 5 amp h AAA A i Header files A
96. ected are being installed Please wait while the Install Wizard installs J25E Runtime Environment 5 0 Update 3 This may take 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 z Back Finish Cancel As a quick check go to the Windows Start menu and select Start Control Panel Add or Remove Programs Scroll down the list of installed programs and see if the Java J2SE Runtime Environment was indeed installed Add or Remove Programs Currently installed programs E Show updates Sort by Change or Remove Programs Size 117 00MB 3 9 Jasc Paint Shop Photo Album 5 Add Mew Jase Paint Shop Pro Studio Dell Editon Programs 34 Learnz Player Uninstall Only Size 0 68MB m BN Lec2000 Flash Utility AddiRemove ay PbS desc The Sun Microsystems web site is very dynamic changing all the time Don t be surprised if some of the example displays shown here are a bit different 4 Eclipse IDE The Eclipse IDE is a complete integrated development platform similar to Microsoft s Visual Studio Originally developed by IBM it has been donated to the Open Source community and is
97. ed please make sure you accept the workbench restart Installing from a zip file For those interested in the zip file distribution ofthe CDT select the appropriate release gt 1 HE dud 23 2005 T 7004 e CDT 2 0 2 Sept 20 2004 e CDT 2 0 1 Aug 31 2004 e CDT 2 0 0 June 30 2004 We can let Eclipse install the CDT plugins for us Start up Eclipse and click on Help Software Updates Find and Install Resource Eclipse Platform File Edit Navigate Search Project Run Window AE Welcome X Welcome 2 Help Contents Ml ips and Tricks Cheat Sheets Software Updates gt 12 Find and Install E About Eclipse Platform amp Manage Configuration eclipse Select the Search for new features to install radio button and click Next nstall Update Feature Updates Choose Ehe way you want to search Far Features to install Search For adas currently installed Features Search for new Features to install Back Finish Cancel We need to specify the CDT update site so click on New Remote Site Install Update sites to visit Select update sites to visit while looking For new Features Sites to include in search O Eclipse org update site New Remote Site Mew Local Site New Archived Site Edit Remove Import sites Export sites v Ignore Features no
98. ed 0 files O bytes Total 3 files 2 135KB Now you can see that the download directory has a setup utility and another zip file containing the LPC2000 Hex Utility Click on the setup exe application to start the installer scratch Fie Edit view Favorites Tools Help Q sack gt d JO search Folders EBk x a Folders BEI oc2000 Flash utility E ee Local Disk C z E es E a Click on setup to capture start the installer E DELL 5 Documents and Setti w lii B The LPC2000 Flash Utility setup now starts Click on OK to proceed LPC2000 Flash Utility Setup LPC2000 Flash Utility Setup x m Welcome to the LPC2O00 Flash Utility installation program ia Setup cannot install system Files or update shared Files if they are in use Before proceeding we recommend that you close any applications you may be running Take the default on this screen below and let it install the LPC2000 Flash Utility into the Program Files directory 2 LPC2000 Flash Utility Setup Begin the installation fw clicking the button below C Program Files LPC2106 ISP Change Directory Exit Setup In a very few seconds the installer will complete and you should see this screen LPC2000 Flash Utility Setup E LPE2000 Flash Utility Setup was completed successfully Here we see the utility residing in the Program Files directory just as promised LPC2106 ISP File Edit View Favo
99. elects 32 bit ARM function calling method O crt o create an object output file named crt o The GNU linker is used to prepare the output from the assembler and C compiler for loading into Flash and RAM as shown below main out crt o main o demo2106 blink flash cmd echo linking LD LFLAGS o main out crt o main o If the target output file main out is older than the two object files or the linker command file then the commands on the following lines are executed The Linker options being used are Map main map creates a map file T demo2106 blink flash cmd identifies the name of the linker script file Note that l ve kept this GNU makefile as simple as possible You can clearly see the assembler C compiler and linker steps They are followed by the objcopy utility that makes the hex file for the Philips ISP boot loader and an objdump operation to give a nice file of all symbols etc 18 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 t Resource main c cclipse Plan orm mj x File Edit Navigate 5 SEN Project Window Help NEP eu r eae E y R E Resource Close Project E H i H H i ener H Ta Navigator Ed 5 md Sets KA makefile C main c 8 S 01 82 outline 23 x H inj Build Al
100. elks in this case MAMCR x2 5 MAMT IM x4 Setting peripheral Clock pclk gt to System Clock Ccclk gt UPBDIU Bx1 B Problems El Console X Properties Search Il e Y amp Writable Smart Insert 90 16 CiC main c Ecli Ww ARM Cross Developm fm Print Docs E Calculator IG A qe 11 16PM We have to set up the Phased Lock Loop PLL and that takes some math Olimex LPC P2106 board has a 14 7456 Mhz crystal We d like the LPC2106 to run at 53 2368 Mhz has to be an even multiple of crystal in this case 3x According to the Philips LPC2106 manual M cclk Fosc where M PLL multiplier bits 0 4 of PLLCFG cclk 53236800 hz Fosc 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 0xAA followed 0x55 write seque
101. ely for all of us that have desktop Intel Microsoft PC platforms the GNU toolset was originally developed and implemented with the Linux operating system To the rescue came Cygwin a company that created a set of Windows dynamic link libraries that trick the GNU compiler toolset into thinking that it s running on a Linux platform If you install the GNU compiler toolset using the Cygwin system you can literally open up a DOS command window on your screen and type in a DOS command like this gt arm elf gcc g c main c The above will compile the source file main c into an object file main o for the ARM microcontroller architecture In other words if you install the Cygwin 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 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 t
102. embler file it is automatically assumed to be external The vector table is 32 bytes long and is required to be placed at address 0x000000 You will see later in this tutorial that the interrupt service routines referenced in the Vector Table are just endless loop stubs in the main c function and the interrupts are turned off The NOP instruction at address 14 is an empty spot to hold the checksum Page 179 of the Philips LPC2106 manual states The reserved ARM interrupt vector location 0x0000 0014 should contain the 2 s complement of the check sum of the remaining interrupt vectors This causes the checksum of all of the vectors together to be O Before you fall on your sword you ll be happy to know that the Philips Flash Loader will calculate that checksum and insert it for you That s why we show it as a NOP This part of the crt s file sets up the various interrupt modes and stacks Resource crt s Eclipse Platform File Edit Navigate Search Project Run Window Help Pi el BIQ 1 ES Resource i Ert 2 15 demoz106 blink Flash Reset Handler cdtproject PO project Reset Handler j crt Ist crto Setup a stack for each mode note that this only sets up a usable stack crt s for User mode lso each mode is setup with interrupts initially disabled e demo2106_blink_Flash cmd j d Ipc210x h r stack end CPSR c MODE UND E ACIN ET Undefined Instruction Mode sp r r r UND STA
103. er application Click on Stop to terminate execution CA K Looking at Assembler Code You can view the code as simple C Source assembler source or a mixed version On the upper right of the Insight main screen is a pull down list of these display formats Click on Mixed to see the combination C Source intermixed with Assembler source display e el SOURCE y The resultant display looks like this main c Source Window File Run wiew Control Preferences Help 4 37 0x4000b0298 6x40500629c 640000240 6x40000244 38 39 44 41 42 43 44 45 46 m 8400662 a8 Ox 400882 ac 47 48 49 6x406062b0 5g 51 52 6x400062b4 6x400062b8 6x4050062bc 6x406062c 6 6x4000682c4 6x406062c8 x4HBBH2 cc 53 640606200 640008204 640606208 AxA dec Ch VDD DO main c int main main 4 gt main 8 gt lt main 12 gt amp nain 16 lt main 20 gt amp nain 255 lt maint 8 gt main 32 gt main 36 gt lt maint46 gt lt maint44 gt main 548 gt main 52 gt main 56 gt main 60 gt main 64 gt main 68 gt Amo 8 m nain main void 4 mou stmdb sub sub int static static static static static static const int char int long x char int char ldr str SOURCE ASSEMBLY HIAED SROC ASH Find ri sp spf rit r12 lr pc r11 r12 Hh 0x4 5p sp H8 Hx8 ES ff Ss 1
104. ew Alt Shift M Import Select Import resources From the local File system po 10 BO Select an import source mF Checkout Projects From Cv5 Existing Ant Buildfile Li Existing Project into Workspace GS Print LrHEF Li External Features Switch Workspace Open External File eam Project Set E zip File ms lw 13 Export d demo2106_ bli 1 pc210x h demo2106 z main c demaz106 3 main map demoz106 4 demazi amp cmd demo2106 Exit When the Import File System window appears click on the Browse button Hunt for the sample project which is stored in the c scratch directory Click on the directory scratch and hit the OK button in the Import from directory window on the left below Import from directory El E Select a directory to import From B S Local Disk C Ez armlib E i ATI 5 capture l l E C3 cygwin Click on Select All in the Import window below right to E DELL get the source files selected for import into our project C Documents and Settings O download E 5 DRIVERS 5 eagle components E Easy Screen 3 eclipse E E foo 1386 O memo ca My Music 5 pictures 5 Program Files SEFSEER Please specify Folder Import File system y system downloads E WINDOWS 7 zclipse e From directory Exlscratch Browse Folder scratch s crt s Make New Folder v demoz106 cmd
105. gggGUUOUDUDOD DIUI B ER 3 3 03 020303 032 DI 9 T itii q p re nee Te ttii Bt Bi 4 T E 00001 MINA mani 20301 j ud i3090g3gry T gt if tT j iDgdagaggagnmp i s brit nk eh areas diem cdi a a 3 wu o A n af i U BORO ho mf EEN ty T a AI a ap uds E Ej L E i d 4 E E L L OK admit it this photo has the reliability of a Bigfoot video 20 Create a New Project to Run the Code in RAM Now we will create a new project that will run the blinker code in RAM Only minor modifications to three files are required We will show how to run the application using the Philips ISP flash utility Later we ll show how to use this very same RAM based application with the Insight graphical 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 Cueclipselworkspaceldemo2106_blink_ram Switch to the C C Perspective and you will see that there are now two projects although the new one contains no files C C Eclipse Platform File Edit Navigate Search Project Run Window Help Te B je 635 d G 3 O Q i 9 re ES Rdcice Of FRA os E amp 4n outline is no available 1 15 demo2106 blink Flash
106. ggler 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 maneuvering around the CMOS setup you can find the Parallel Port setup and see what mode it is set up as If it s ECP mode change it to EPP mode as did in the screen photograph below oave the CMOS setup and exit tuork Interface Controller mise POFL cajera SB Emulation SB Controller erial Port 1 1 0 Address Parallel Port Diskette Interfa Prinary Video Controller Onboard Video Buffer Report My printer is a USB device so this action didn t effect my printer operation Its disappointing to report that the Wiggler cannot set
107. he 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 In System Programming ISP utility is started within Eclipse and will download your hex file and program the flash memory through the standard COM1 serial cable The Boot Strap Loader BSL jumper must be shorted installed to run the ISP flash programming utility To execute the application you remove the BSL jumper and push the RESET button to start the application Unfortunately the Insight debugger cannot set a software breakpoint it can t program FLASH and it also doesn t support hardware breakpoints This effectively renders the debugger useless in this mode B Application programmed into RAM Olimex ARM JTAG Adapter WIGGLER LPT1 IL TL OS 20 pi n 4 JTAG Port o x M 0 0 0 0 9 0 0 0 0 50 0 9 0 0 0 9 0 0 0 5 0 0 0 0 0 9 0 0 8 SANA AAA AAA AAA BHEHBRHEHEERE HEHEHE EERE RRR RE eR eR eR eR ee eee ee ee BERBER RRR BERR REP RRR RRR RRR BER ERP RRR RRR RRR BERBER RRR BER RRR PPR BEEBE RRR SESE ERR BEER ERE EEE RRB RE ERB ERE EES SBE RRR REE BEEBE EB EERE BRE BREE BREE RSS e 6 HTTP HMH OLIMEX COM DEU E E a L NON a E a 1 e In this mode the Eclipse GNU development system assembles compiles and links your application for loading into RAM memory The output of the com
108. he license agreements Finish lt Back Cancel Take the defaults on the next screen and click Finish to start the CDT installation Install Install Location Choose the location where the Features will be installed Features to install i Eclipse C C Development Tools 2 1 1 94 ci eclipse MM Required space OKB Free space 06206464kB Available sites Add Site Remove Site The CDT installation will start up z Install Install Location Choose the location where the Features will be installed Features to install amp vailable sites A Eclipse C C Development Tools 2 1 c eclipse Add Site Remove Site EI lili Required space OKE Free space 20626464KE Downloading pluginsorg eclipse cot ui z 1 1 jar 1568K bytes OOOO E Next Cancel When the CDT download and installation completes a pop up window will advise you to restart Eclipse Answer yes and when Eclipse restarts it will have the CDT plugins properly installed Eclipse must be restarted for the CDT plugins to take effect Let s now test if the CDT Plugin installation was successful If Eclipse is not already running click on the desktop Eclipse icon to start up the Eclipse IDE Integrated Development Environment Resource Eclipse Platform File Edit Navigate Search Project Run Window Help i Welcome X Welcome to Eclipse 3 1 Now click on File New Pro
109. his tutorial It s worth mentioning that the GNUARM tool chain doesn t include the crucial MAKE utility it s in the Cygwin tool kit we re about to install This is why you have to add two path specifications to your Windows environment one for the c cygwin bin folder and one for the c programfiles gnuarm bin The Cygwin site that has the GNU toolset for Windows is www cyqwin com The Cygwin web site opens as follows A Cygwin Information and Installation Microsoft Internet Explorer File Edit View Favorites Tools Help Q ta E e x i2 P Search p Favorites E A x Lg y e t Address Es uec Cygwin Home Cymgwin X Home Red Hat Cygwin Product Commutity e Reporting Problems Wailing Lists e Dunoficial Hewsgroups e Gold Stars e Whrror Sites Donations Documentation FAQ e User s Guide e API Reference e Acronyms Contributing Snapshots oource in CVE GNU Cygnus Windows gum F Fi l j gi k GV WITI What Is Cygwin Cygwin is a Linux like environment for Windows It consists of two parts e A DLL feyewinl dil which acts as a Linux API emulation layer providing substantial Linux API functionality A collection of tools which promde 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 n
110. hoose a site from this list or add your own sites to the list Available Download Sites http ZI mirror mcs anl gov http mirrar pacific net au http mirrors dotsre org http mirrors kernel org tho mirrors ren net http mirrors theonlinerecordstore com planetmirror com p sources redhat rimar redeire ne http S0urceware mirrors tds net http fiw carfield com hk http we mirror ac ul http win signald 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 4 Default Database amp Default Devel amp Default Doc amp Default Editors 4 Default Games amp Default Gnome amp Default Al TE 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 Sele
111. ily find the Make utility etc Using the Start Menu go to the Control Panel and click on the System icon Then click on the Advanced tab and select the Environment Variables icon Highlight the Path line and hit the Edit button Add the addition to the path as shown in the dialog box shown below don t forget the semicolon separator The Cygwin FAQ advises putting this path specification before all the others but it worked for me sitting at the end of the list Edit System Variable variable value ccvguinibin c icygwinusrlacalbin 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 It is possible to use all this to build a custom GNU compiler suite for the ARM processor family The very informative book Embedded System Design on a Shoestring by Lewin A R W Edwards 2003 describes how to do this and it is rather involved Fortunately Pablo Bleyer Kocik and the people at gnuarm com have come to the rescue with pre built GNU compiler suite for the ARM processors Just download it with the included installer and you re ready to go Click on the following link to download the GNUARM package WWW qnuarmm com The GNUARM web site will display and you should click on the Fi
112. ime Environment JRE Click on Download JRE 5 0 Update 3 3 Download Java 2 Platform Standard Edition 5 0 Microsoft Internet Explorer File Edit View Favorites Tools Help Q tao leg x i2 A JJ Search S T Favorites 2 ba ki T E e SS Address El http ava sun comfj2se 1 5 O dowmnload jsp Sun Developer Network Products and Technologies Technical Topics Developers Home gt Products amp Technologies Java Technology J25E Core Java gt J2SE 5 0 J2SE 5 0 Download Java 2 Platform Standard Edition 5 0 m Downloads Confused ar having trouble downloading ar installing See the download help page Reference supported System Configurations API Specifications Documentation Compatibility NetBeans IDE JDK 5 0 Update 3 Community AU Bug Database nel Pans Forums A E This distribution af the J25E Development Kit JORJ includes NetBeans IDE which is a powerful integrated development enviror Learning platform Mare infa Tutorials amp Cade Camps Download JDK 5 0 Update 3 with Netbeans 4 1 Bundle Online Sessions amp Courses Instructor Led Courses Course Certification JDK 5 0 Update 3 includes the JVM technology The JZSE 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 includes the JVM technology In
113. ing both the GNUARM project and your customers Also note that we have ri purely comrmercial pointers in our projects section at our resc s page To be fair with everyone we wil be only adding links to projects that provide useful unbiased technical information online Contact us if you wish your site to be listed there The correct package to download is Binaries Cygwin GCC 4 0 toolchain Binaries 6CC 3 3 toolchain Mac US x binutils 2 14 gcc 3 3 2 c c newlib 1 12 0 gdb 6 0 PEG TGZ 35 2 MB GCC 3 4 toolchain Cygwin binutils 2 15 goc 3 4 5 c c jayva newlib 1 12 0 insight 6 1 setup exe 17 0MB GNU Linux x86 binutils 2 15 gec 3 4 3 c c java 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 VA QU Com ET While files from the Internet can be useful this File type car potentially harm pour computer IF veu do not trust the source do nat run or save this software What s the risk Once again our c scratch directory will suffice Save As Save in gt scratch hy Recent Documents hy Documents as hy Computer File
114. ion Wersion 2002 Service Pack 2 A a 0 Registered to Jim Lynch Manufactured and supported by DAL Dell Dimension DIM3000 Intel R Pentium R 4 CPU 2 80G Hz 2 79 GHz 512 MB of RAM Support Information 76477 DEM 0011903 00102 Apply Now click on the Environment Variables button System Properties System Restore Automatic Updates General Computer Mame Hardware Advanced rou must be logged on as an Administrator to make most of these changes Performance Visual effects processor scheduling memory usage and virtual memory Settings User Profiles Desktop settings related to pour logon Settings Startup and Recovery System startup system Failure and debugging information Settings Environment Variables Error Reporting Apply In the Environment Variables window find the line for Path in the System Variables box on the bottom click to select and highlight it and then click on Edit Environment Variables User variables Far Jim Lynch Variable Value TEMP Ci Documents and Settings Jim Lynch TMF C Documents and Settings Jim Lynch System variables variable PUMBER_ OF P ccyqwinibinic program Filesanuarmi PROCESSOR 4 xd e Take a very careful look at the Edit System Variable window the Path Edit in this case Edit System Variable variable value Euicygwinibinic program files gnuarmibin
115. ject This should display the new project window Resource Eclipse Platform EN Edit Navigate Search Project Run Window Help Alt Shift M P Open File C Folder Close Ctrl F4 a Close All coteshittera LI Fie NE Untitled Text File El Save Ctrl s El Save As Fj other Ctri N E Save Al Ctrl Shift 5 Revert New Project Move Select a wizard F2 F5 Rename Refresh Convert Line Delimiters To Create a Java project 3 Print Ctrl P Wizards Switch Workspace gag Import 2 ups Plug in Project py Export eS C Properties Alt Enter Ele C H cvs oss H E Java M H E Simple lt Back Finish Cancel If you see C and C as possible projects to select then you know that the CDT has been installed successfully Exit from Eclipse and we ll proceed to downloading the Cygwin GNU Toolkit 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 I m serious Unfortunat
116. lash Loader will use the very top 288 bytes of RAM for its internal stack and variables we ll start our application stacks at Ox4000FEEO Note 0x40010000 0x120 0x4000FEEO0 define a global symbol _stack_end placed at the very end of RAM minus 4 bytes stack end 0x4000FEEO 4 Working that out with the Windows calculator the _stack_end is placed at 4000FEDC The code snippet that sets up the stacks and modes is a bit complex so let s explain it a bit First we load RO with the address of the end of the stack as described above Idr r0 stack end Now we put the ARM into Undefined Instruction mode by setting the MODE UND bit in the Current Program Status Register CPSR The four modes undefined irq abort and svc all have their own private copies of R13 sp and r14 link return The FIQ mode has private copies of registers R8 R14 Thus by writing RO into the stack pointer sp R13 it will use Ox4000FEDC as the initial stack pointer if we ever have processing of an undefined instruction By subtracting the undefined stack size 4 bytes from RO we re limiting the stack for UND mode to just 4 bytes msr CPSR c ZMODE UNDII BIT F BIT This puts the CPU in undefined mode mov sp r0 stack pointer for UND mode is 0x40000FEDC sub r0 r0 ZUND 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
117. latile CxCCunlatile CxCCunlatile volatile uvolatile uvolatile uvolatile uvolatile uvolatile x Cuolatile uvolatile uvolatile uvolatile lt wolatile x wolatile x wolatile CxCtCunlatile x wolatile lt wolatile x wolatile lil Search unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned long long long long long long long long long lang lang lang lang long long long long long long long long long long long long long long long long Header file for Philips LPC21H4 LPC21H5 LPC21HB6 BxFFFFFHBBH gt BxFFFFFBB4A BxFFFFFHHBB gt gt BxFFFFFHBBC BxFFFFFH1H BxFFFFFH1 4 BxFFFFFH18 gt gt BxFFFFFH1C AxFFFFFA2B gt gt AxFFFFFA3B gt gt AxFFFFFA34 gt gt BxFFFFF1BHB BxFFFFF184 BxFFFFF18B8 BxFFFFF1BC BxFFFFF11BH BxFFFFF114 BxFFFFF118 BxFFFFFi11C BxFFFFF128 BxFFFFF124 BxFFFFF128 BxFFFFF12C BxFFFFF138 BxFFFFF134 xFFFFFi38 gt gt BxFFFFF13C BxFFFFF2B8H xFFFFF204 gt gt BxFFFFF2B8 gt gt xFFFFF20C gt gt BxFFFFF21H BxFFFFFE214 gt hd La w 9 v TN idt db
118. lay add a register to the watch window etc M Displaying the Contents of Memory A nice screen dump of the memory is available with the Memory toolbar button h Here l ve entered the address 0x400004B4 the address of the string The Rain in Spain Addresses Address EA Target is LITTLE endian ASCII 8x4 008844 8x2 8656854 Ax6e696152 Ax266e692B8 0696174853 The Rain in Spai x488BBhcA 6 50006b66e 6000350082 6000050006 0000000057 xhBBBBAdA 000000004 B 00000005 0x00000001 0000000006 x4888BheA x HAHAHAH 60000050600 000000000 000000006 xhBBBBAFA ax 00000000 Ox 00000000 Axddb 9d29 Ax573ad2d8 0x400005 BA 6x7dcb1f85 6xda14014c xc ach5ab5b 6x8ca084ba aia xhBBBB5 15 xzhz3dhae Ax 04001416 Axb2b0e27a Ax7a13b dc se 8x4 8880524 Bxb2b255b7 Ax4821cb42 Axc6995c65 Bx7b2148F2 JH xhBBBB535 Bx4eb09f 67 Ax4762 0862 Azae2dfbf xa55F1289 T x4BB8BB5AA Bzdab99bFF Ax4e 4958d AzBFbF7210c Ax8848fF170 8x4 0888554 Bx76b1fF9b9 Axe 11c111 Ax5fe94898 BzdaifF719c x4BBBB56A Bx283fF6e55 AxR0338feb Bx24FFA4CF3 Az361i1ecaa Un Click on the Addresses pull down menu and then select Preferences This will allow you to change to a byte display If you re confused remember that the byte display doesn t show the effect of little endian memory organization Addresses Address loxao0004b4 p Targetis LITTLE endian 1
119. les tab Steve is one of the brightest guys I ve ever worked with brilliant but when we decided to do a microprocessor on our own I made two great decisions I gave them Steve Puma and Sophie Wilson two things which National Inte and Motorola had never given their design teams the first was no money the second was no people The only way they could do it was to keep it really simple Hermann Hauser Last update 2004 07 05 18 01 GNU ARM toolchain for Cygwin Linux and MacOS Welcome In this page you will find a pre compiled binary distribution for the hopefully latest GNU ARM Newlib toolchain for Cygwin Linux and MacOS The toolchain consists of the GNU binutils compiler set GCC and debugger Insight for Windows and 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 help
120. lp 3000 me ASAA rin e d a nain c Feed y SOURCE 126 PLLCON 8x3 127 feed 128 129 7 Enabling MAM and setting number of clocks used for Flash memory fetch cclks in this case 130 MANCR 6x2 131 HRHTIH 0x4 132 133 Initialize MEMAP re map vector table to RAM 134 ZIMEMMAP 6x62 135 136 7 Setting peripheral Clock pclk to System Clock cclk 137 UPBDIU 8x1 138 139 140 141 void feed void 142 144 PLLFEED 6x55 145 gt 146 147 148 149 158 151 152 fx Stubs for various interrupts may be replaced later 153 154 155 void IRQ Routine void 156 while 1 157 gt 158 159 void FIQ Routine void 168 while 1 161 z jz Program is running 49998438 143 Click on the Stack Window toolbar button to inspect the call stack The Stack Window shows that main called Initialize Initialize then called feed Stack Ed main Initialize feed O Inspecting Local Variables In addition to just maneuvering the cursor over a variable name to see its value you can also bring up the Local Variables display box by clicking on the Local Variables toolbar button Remember that Local Variables are your stack based variables defined within a function There is no window for Global Variables you ll have to create Watch Windows for them Local Variables imj ES int 5000000 int B int 8 int B
121. mmunities Solaris Service Software Developer ooe Developers Download the Servers Solaris 10 ode System Administrators Latest Java Sun Fire v4 z StarOffice Bei ee UIDERI Partners Software from UltraSPARC Iv Storage New Downloads Investors java com Patches amp Updates Education Sun Store See All s Take me to Communities Get It Now Contact About Sun News amp Events Employment Privacy Terms of Use Trademarks powered by 4 Sun Copyright 1994 2005 Sun Microsystems Inc monien Select the latest and greatest Java runtime system by clicking on J2SE 5 0 Sun Developer Network lava Products and Technologies Technical Topics Developers Home Products amp Technologies Java Technology J25E J2SE Downloads A Downloads The links below will take you 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 m Documentation J2S5E 1 34 FAQS Code Samples amp Apps Download Archived Releases BluePrints Technical Articles amp Tips White Papers Third Party Compatibility Sun maintains a download site for previously released versions ofthe 125 platform and related prodi and are na langer covered by standard support contracts These downloads are made available as ac resolution Specifically we need only the Java Runt
122. name bu 2 15 good 0 0 c c nl 1 13 U My Network Save as hype Application v As you can see this download has a very long name This download is a 18 megabyte file and takes 30 seconds on a cable modem 32 of bu 2 15_gcc 4 0 0 c c _n1 1 13 0 m E Saving OCC nl 1 13 0 gi 6 1 exe from wi gnuarm cam Estimated time left 2 min 3 sec 7 25 MB of 23 0 MB copied Download Eo Abu 2 15 gec 4 0 0 c c 4 nl 1 13 0 gi 6 1 exe Transfer rate 131 KBfSec Close this dialog box 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 W scratch File Edit View Favorites Tools Help AN Bek O d po Search Ep roto Bee X ag Folders X Mame 3 pictures ES bu 2 15 gcc 4 D 0 c c nl 1 13 0 gi 6 1 9 Program Files 9 scratch L Lm TT i T The GNUARM installer will now start Click Next to continue am Setup GNUARM Welcome to the GNUARM Setup Wizard This will install GMEISRIM 4 0 0 an your computer It is recommended that you close all other applications before continuing Click Next to continue or Cancel to exit Setup RCM Accept the GNU license agreement don t worry it s still free Click Next to continue te Setup GNUARM Li
123. nce to the PLLFEED register this is done in the short function feed below With the math completed we can set the Phase Locked Loop Configuration Register PLLCFG Setting Multiplier and Divider values PLLCFG 0x23 feed To set values into the PLLCON and PLLCFG registers you have to write a two byte sequence to the PLLFEED register PLLFEED OxAA PLLFEED 0x55 This sequence is coded in a short function feed The net effect of the above setup is to run the ARM CPU at 53 2 Mhz Next we fully enable the Memory Accelerator module and set the Flash memory to run at 1 4 the clock speed Now you see why some people prefer to execute out of RAM where it s much faster Enabling MAM and setting number of clocks used for Flash memory fetch 4 cclks in this case MAMCR 0x2 MAMTIM 0x4 The clock speed of the peripherals is also run at 53 2 Mhz which is the full clock speed Setting peripheral Clock pclk to System Clock cclk VPBDIV 0x1 In the final snippet of the main code you can see the dummy interrupt service 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 Ims HSlgal J avFl eo o BuF ES Resource 8 amp demo2106 blink Flash c B edtproject po B project PLLFEED 0xAA crt lst PLLFEED 0x55 E ert o crt s E demo2106_
124. ni 42 static 1 static initialized u 43 static static initialized y 44 static Ju static initialized variable 45 static i static initialized u ff set io pins for led PB8 7 IDIR l AxAABABARA pin PH 7 is an output everything else is input after reset breakpoint at main c 5 0x400002b4 led off ENA breakpoint donttouch led on 56 57 endless loop to toggle the red LED PB 7 58 while 1 4 59 6 For j 8 j lt 5000000 j 3 ZZ wait 500 msec 61 IOSET 6x00000080 ff red led off 62 For j 8 j lt 5000000 j 3 wait 500 msec 63 IOCLR 62660600686 ff red led on 64 65 66 67 68 fai Initialize A 3E 3 P X 4 k Program Is runnind 888828 46 Now click on the Continue button to execute from main to the breakpoint The green highlight at line xx indicates that we ve hit a breakpoint The status line at the bottom left also indicates this Program stopped at line 52 main c Source Window AE File Run wiew Control Preferences Help IPPO me saos rima ea a nain c nain SOURCE an gt 37 int main void 4 38 39 int 4B static int 41 static char 42 static int 43 static long x 44 static char 45 static int 460 const char UTI 48 Initialize the system 49 Initialize c 51 set io pins for led P 7 static uninitialized static unini static initialized v static initialized v static initialized varia
125. o AS 9 main PLOCK Hinclude LPC210x h uic O Initialize feed IRQ Routine AAA o FIQ Routine Global Variables Q SWI Routine BURNCRCONCACACHCAONCh Ch AONCACh A CAOKCh Ch AONCACh Ch RARA AONCA Ch hONOKCh Ch AON CA Ch Ch AUN Ch Ch A KCN A S S S NN A o UNDEF Routine int 5 global uninitialized variable int global uninitialized variable int global uninitialized variable short short global initialized variable global initialized variable global initialized variable lt MM char a R e D rino El Console 23 N Problems C Build demo2106 blink Flash make k clean rm crt lst main lst crt o main o main out main hex main map rmain cdrmp rm cannot lstat crt lst No such file or directory rm cannot lstat main lst No such file or directory rm cannot lstat ert o No such file or directory rm cannot lstat main o No such file or directory rm cannot lstat main out No such file or directory rm cannot lstat main hex No such file or directory rm cannot lstat main map No such file or directory rm cannot lstat main dmp No such file or directory make clean Error 1 ignored writable Smart Insert 4 1 We can see the results in the Console Window at the bottom E3 Console JR Problems a Ex PI ULL Build demo2106_blink_Flash assembling arm elf as ahls mapc s 3z2 0 crt o crt s gt crt lst compilincdg arm elf qee I fno comm
126. oad the hex file into 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 LPC2000 Flash Utility RAM Buffer PRISES amp H4000 0000 18 FO OF ES 18 FO OF ES 18 FO OF ES 18 FO SF EB B3 N3 B3 N3 H4000 007 0 18 FO 8F ES O00 00 AO El 14 FO OF E5 14 FO SF E5 BN3 4 084 808 H4000 0020 00 02 OO 40 CO 02 OO 40 BC 02 00 40 CO 2 OO 40 4A A a H4000 0030 Co 2 OO 40 B4 02 OO 40 BS Of OO 40 OO OO OO OO A B amp H 4000 0040 00 00 OO OO o0 00 00 00 A 00 00 00 D D0 D0 H4000 0050 o0 OO 00 00 OO OO OO 00 o0 OO OO D OO OO DD LL Le eee eee ee H4000 0060 00 OO o OO 50 00 00 00 00 00 00 H 00 amp H 4000 0070 00 OO o OO OO 00 00 00 00 00 00 00 00 00 D0 H4000 0080 Oo OO 00 00 DO OO OO 00 oo OO OO OU 00 DD DD DD LL ee ee eee ee H4000 0090 00 OO OO OO OO OO OO OO OO OO OO 00 OO DO OO OO _ 22 H4000 0040 00 OO OO OO OO OO OO 00 O 00 GG OO 00 D0 H4000 006 0 Dy 00 00 OW OOo o0 OO 00 o0 OO OO 00 OO OO We LL Le ee eee ee ee H4000 OOCO 00 OO OO OO OO OO OO OO A 00 BG 00 D0 D0 H4000 00010 Oo OO 00 00 OOo OO OO 00 o0 OO OO 00 D OO DO Q LL Le ee ee eee ee H4000 00 0 00 0 4 00 00 O3 00 00 00 00 00 DD ee eee amp
127. ociated with each supported launch mode and can optionally be activated when a configuration is launched or when a breakpoint is encountered via the Debug preferences To indicate that a perspective switch should not occur select None RUN None Restore Defaults Q A 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 E Ant Build 3 Q Program Q New configuration E Main Refresh P Environment EJ Common Location to Browse Workspace Browse File System Variables J Working Directory Browse Workspace Browse File System Variables Arguments Variables Note Enclose an argument containing spaces using double quotes i External Tools Create manage and run configurations Create a configuration that will run a program Configurations Mame Lec2a00 Flash Utility
128. ode Execution Fill salue FF sH40000200 Selected Range Start feH 40000000 Hun fram Address SHADUBBZDO Thumb ARM t Entire Buffer End amp H4000043F LPC2000 Flash Utility Buffer Upload Successfully Completed You do NOT have to remove the BSL jumper Click on the Run from Address button to execute the program gt LPC2000 Flash Utility RAM Buffer amp H 4000 0000 amp H4000 0010 amp H 4000 00 20 amp H4000 0030 H4000 0040 H4000 0050 H4000 0060 amp H 4000 000 amp H4000 0080 amp H 4000 0090 H4000 006 0 amp H 4000 0080 amp H4000 DOCO amp H 4000 DOD amp H4000 O0E0 amp H 4000 OOFO amp H4000 0100 amp H 4000 0110 amp H4000 0120 amp H4000 0130 amp H 4000 0140 amp H4000 0150 amp H 4000 0760 amp H4000 0170 amp H 4000 0180 amp H4000 0190 amp H 4000 01 50 amp H 4000 0180 amp H 4000 01 CU amp H4000 0100 amp H 4000 O1E0 H4000 01F0 Uuuuuuyuuguuuuuuuy r Load Hex File Upload to RAM Download RAM i Fill Buffer Code Exscubian Address Range Fill value FF M4c000200 f Selected Range Start eH 40000000 Run from Address J Thumb tf ARM Entire Buffer End amp H40D0FFFF LPC2000 Flash Utility Your application should blink just like the Flash EPROM version did Time for the Bigfoot picture 2E A A AA aw wd al am wl Ml D d dal AQ OE M Ras RC LII Dm ai al uz ws mu oma dm dw S c e m e Ue In n un n n ual n nee Soe
129. oduction to GCC by Brian J Gough Richard M Stallman Foreword The purpose of this book is to explain the use of the GNU C and C compilers gcc and g more SIPs void hella math library libm default gcc object file containing options gec more List Price 44955 Price 13 57 and eligible for FREE Super Saver Shipping on orders over 25 See details You Save 6 50 32 Availability Usually ships within 24 hours Ships from and sold by Amazon com 14 used amp new available from 13 15 Edition Paperback ARM Architecture Reference Manual 2nd Edition by David Seal List Price 4529 Price 40 24 and this item ships for FREE with Super Saver Shipping See details You Save 17 75 3155 Availability Usually ships within 24 hours Ships from and sold by Amazon com ded t ARCHITECTURE EFERENCE or MANUAL Want it delivered Tuesday June 217 Order it in the next 44 hours and 57 minutes and choose B ue One Day Shipping at checkout See details 39 used amp new available from 26 00 fs Dean a 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 ch
130. on 3000 me RUN Step Step Step Continue Step Step Into Over Out of Into Over Func ASM ASM RUN otarts debugging breaks at main Note use this only after downloading STOP STEP INTO STEP OVER STEP Stops a running application oteps one C executable line If at a function call it will step INTO the function oteps one C executable line If at a function call it will step OVER the function oteps out of a C Function OUT OF FUNCTION CONTINUE Resumes execution to the next breakpoint watchpoint or exception If no breakpoints are encountered it will run continuously STEP oteps one Assembler instruction INTO ASM STEP OVER ASM If at a subroutine branch it will enter the subroutine oteps one Assembler instruction If at a subroutine branch it will step over the branch to the next instruction G Seta Breakpoint On the far left of the source screen you ll see a series of dashes These indicate C executable lines where you can set a breakpoint Just cursor over to one of them and the cursor will transform into a little circle Click on the dash and a breakpoint will be set a little red box indicates this Clicking again will remove the breakpoint main c Source Window Sele File Run View Control Preferences Help 3o o0dgw u PE ASAA rw e e al nain c main SOURCE an 37 int main void 4 ad 39 int 4 static i static uninitialized 41 static static uni
131. on 03 g main c linking arm elf ld w Map main map Tdemozi 6 blink flash cmd o main out crt o main o GMU ld version z 15 COpying arm elf objcopy O ihex main out main hex arm elf o0b3dump x syme main out gt main dmp 19 Setting Up the Hardware For this tutorial we ll be using the Olimex LPC P2106 Prototype Board Connect a straight through 9 pin serial cable from your computer s COM1 port to the DB 9 connector on the Olimex board Attach the 9 volt power supply to the PWR connector Install the BSL jumper and the JTAG jumper LPC2000 Flash Utility V2 2 0 mum qua M e Y oe 9 P a Y oe 2 3 gt Ciz GIL C9 BE EN EN da MINA Let EIE THE TA Ns LT mi cl 5 DEN momo e To run the Philips LPC2000 Flash Utility it s easiest to just click on the External Tools button and its down arrow to pull down the available tools Click on LPC2000 Flash Utility to start the Philips Boot Loader Resource demo 106_blink_flash cmd Eclipse Platform File Edit Navigate Search Project Run Window Help iri i alm Iq BS a T Ak 1LPC20D0 Flash Utility Flzsh cmd X hilips boot pplication I Y 3 Insight Run As E a demazi 6 blink f cdtpraject ae B project ee crt st QL External Tools mot loader 1 p erba Organize Favorites u crt s HAM used by boot Sri demozi06_blink_Flash cmd PEG c
132. ontrollers which are sold all over the world Mr Lynch has previously worked for Mennen Medical Calspan Corporation and the Boeing Company He has a BSEE from Ohio University and a MSEE from State University of New York at Buffalo Jim is a single Father and has two children who now live in Florida and Nevada He has two brothers one is a Viet Nam veteran in Hollywood Florida and the other is the Bishop of St Petersburg also in Florida Jim plays the guitar and is collecting woodworking machines for future projects that will integrate woodworking and embedded computers Lynch can be reached via e mail at lynchzilla aol com 24 Some Books That May Be Helpful The following is a short compendium of books that l ve found helpful on the subject of ARM microprocessors and the GNU tool chain l ve reproduced the Amazon com data on them GCC The Complete Reference by Arthur Griffith The GNU Compiler Collection GCC is the most important piece of open source software in the world more SIPs instruction scheduling parameters builtin apply execute the configure script release eqcs call insn more List Price 459399 Price 39 59 and this item ships for FREE with Super Saver Shipping See details You Save 20 40 14 Availability Usually ships within 24 hours Ships from and sold by Amazon com Only 5 left in stock order soon more on the way 57 used amp new available from 8 70 Edition Paperback An Intr
133. orld of embedded software development Take a deep breath and HERE WE GO If you are very new to ARM microcomputers there s no better introductory book than The Insider s Guide to the Philips ARM7 Based Microcontrollers by Trevor Martin Martin is an executive of Hitex a UK vendor of embedded microcomputer development software and hardware and he obviously understands his material PHILIPS gt SOFTWARE DEVELOPMENT TOOLS THE INSIDER S GUIDE TO THE PHILIPS ARM 7 BASED MICROCONTROLLERS An Engineers Introduction To The LPCz100 Series Trevor Martin Esc hons CEng MIEE www hitex co uk arm You can download this e book for free from the Hitex web site http www hitex co uk arm lpc2000book index html There is a controversial section in Chapter 2 with benchmarks showing that the GNU toolset is 4 times slower in execution performance and 3 5 times larger in code size than other professional compiler suites for the ARM microprocessors Already Mr Martin has been challenged about these benchmarks on the internet message boards see The Dhrystone benchmark the LPC2106 and GNU GCC at this web address http www compuphase com dhrystone htm Well we can t fault Trevor Martin for tooting his own horn In any case Martin s book is a magnificent work and it would behoove you to download and spend a couple hours reading it I ve used Hitex tools professionally and can vouch for their quality and value Read his book Better
134. ot put anything here DxX4000FEEO Fi Problems El console 23 Properties 4 console is not available writable Insert 3 54 Now the OCDremote doesn t always start You can tell when the console window at the bottom has a red error message that says lt terminated gt OCDremote Program C cvygwinustlocalbinfocdremote exe O Demon Initializela arget Error 39 en zEmBEDEEE ERI Just keep starting it over and over until you get this response in the console window b Properties imocdremote exe cygriniust local b 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 terminate all of them and start over e Keep trying I ve done it ten times before it started this is simply Voodoo e Goto bed let it win tonight D Start the Insight Graphical Debugger Assuming that it s now running start the Insight Graphical Debugger by clicking on the External Tools toolbar button and select Insight C C demo2106 blink ram cmd Eclipse Platform File Edit Mavigate Search Project Run Window Help LEX m ja e d 9g 55 OQ Q 4 e gt S Cict Pr E a demo2106_blink_ram cmd 3 oS Qh 1 LPC2000 Flash Utility IE T fe FETE ATTA a QL 2 OcDremote Sc iS demoz106_blink flash i dema
135. own private copies of R13 and R14 We now set the abort mode stack pointer to Ox4000FED8 Again by subtracting the abort stack size from RO we re limiting the stack for ABT mode to just 4 bytes msr CPSR c ZMODE ABT BIT F BIT this puts CPU in Abort mode mov sp r0 stack pointer for ABT mode is 0x4000FED8 sub r0 r0 ZABT STACK SIZE Register RO is now 0x4000FEDA Now we put the ARM into FIQ fast interrupt mode by setting the MODE FIQ bit in the CPSR As mentioned above FIQ mode has its own private copies of R14 through R8 We now set the abort mode stack pointer to Ox4000FED4 Again by subtracting the abort stack size from RO we re limiting the stack for FIQ mode to just 4 bytes We re not planning to support FIQ interrupts in this example msr CPSR c ZMODE FIQ L BIT F BIT this puts CPU in FIQ mode mov sp rd stack pointer for FIQ mode is 0x4000FED4 sub roO r0 ZFIQ STACK SIZE Register RO is now 0x4000FEDO Now we put the ARM into IRQ normal interrupt mode by setting the MODE_IRQ bit in the CPSR As mentioned above IRQ mode has its own private copies of R13 and R14 We now set the IRQ mode stack pointer to 0Ox4000FDEO Again by subtracting the IRQ 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
136. pecify the location of the Workspace choose to place the workspace within the Eclipse directory You are free to place this anywhere you can have multiple workspaces here is where you make that choice Workspace Launcher Select a workspace Eclipse Platform stores your projects in a directory called a workspace Select the workspace directory to use For this session Workspace Use this as the default and do not ask again When you click OK the Eclipse main screen will start up Resource Eclipse Platform AE File Edit Wavigate Search Project Run Window Help Welcome X Welcome to Eclipse 3 0 What s Mew Find out what is new in this release 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 However the point of this tutorial is to show how the Eclipse platform with the CDT plugins 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
137. piler 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 Insight debugger started from within Eclipse communicates with the Macraigor OCDRemote program that operates the JTAG port using the Wiggler With the Insight debugger you can connect to the Wiggler and load the GNU main out file into RAM From this point on you can set software breakpoints view variables and structures and of course run the application The drawback is that the application must fit within RAM memory on the LPC2106 which is 64 Kbytes Still it s better than nothing My purpose in this tutorial is to guide the student or hobbyist through the myriad of documentation and web sites containing the necessary component parts of a working ARM software development environment l ve devised a simple sample program that blinks an LED that is compatible in every way with the GNU assembler compiler and linker There are two variants of this program a FLASH based version and a RAM based version l ve substituted the GNU Insight graphical debugger instead of the Eclipse debugger because it is simpler to use and currently more reliable If you get this to work you are well on your way to the fascinating w
138. r will create a exact copy of the variables in flash with the correct initial values loaded The onus is on the programmer to copy this initialized flash copy of the data to RAM The location of the start of the data section in flash is defined by symbol etext defined in the linker command script demo2106 cmd Likewise the location of the start and end of the data section in destination RAM is given by the symbols data and edata Both of these symbols are defined in the linker command script The bss section contains all the uninitialized static and global variables All we have to do here is clear this area Likewise the location of the start and end of the bss section in destination RAM is given by the symbols bss start and bss end Both of these symbols are defined in the linker command script Two simple assembly language loops load the data section in RAM with the initializers in flash and clear out the bss section in RAM The GNU linker specifies two addresses for sections the Virtual Memory Address VMA and the Load memory Address LMA The VMA is the final destination for the section for the data section this is the RAM address where it will reside The LMA is where it will be loaded in Flash memory the exact copy with the initial values The GNU Linker will sort this out for us 15 Description of the Main Program main c Now let s look at the main program Resource main c Eclipse Platform File Edit Naviga
139. r Erratasheet date 2004 06 01 LPit2104 Erratasheet date 2003 12 10 LPEZ105 Erratasheet date 2005 17 10 LPE2106 Erratasheetidate 2003 12 10 Philips Microcontroller Line Card date 2004 03 05 LPE21042105 2106 Leaflet date 2004 02 24 Philips The Innovation Leader in Mocrocontrollers date 2004 06 30 FOF LE E I sr Manual date 2003 09 E vees Development Tools tar LPC 100 devicestidate 2005 05 71 As before we ll save the downloaded zip file in our empty c scratch directory This is a fairly short download only about 2 megabytes File Download You are downloading the File woe j Ipc2000_Flash_utilits zip From wiew semiconductors philips com Would you like to open the file ar save it to your computer Saving Ipc2000 Flash utiliby zip From vns semiconductors philips corn Estimated time left 26 sec 628 KB of 2 00 MB copied Download Ea Crscratchilpce000_Flash_ utility zip Transfer rate 54 8 KB Sec Close this dialog box when download completes Oper Open Folder We ll use WinZip to unzip this into the c scratch directory File Actions Options Help RS ew Open Favor ites e Wizard Extract Encryp View Install Mame Type Modified Size Ratio Packed Path Bj setup exe Install Applic 7 15 2000 12 00 AM 138 775 I2 57 174 CU PC210x ISP CAB Winzip File 3417 2004 11 21 AM 2 041 048 199 2 022 E setup Ist LST File 3 17 2004 11 22 AM 4001 79 B2 Select
140. ring Debug amp java d Java Browsing fel Java Type Hierarchy ai Plug in Development Resource default El Team Synchronizing Navigation Preferences D items i ES Description Resource Le Outline TO 7m An outline is not available Switching perspectives brings up the C C window perspective and this will be remembered when you re enter Eclipse C C Eclipse Platform File Edit Mavigate Search Project Run Window Help 5 Ee 8 86 8 G 0 Q amp e fy CCP X An outline is not available Problems ESO console Properties RH D errors O warnings O infos In Folder In a procedure similar to installing the Philips Flash Utility as an External Tool click on Run External Tools External Tools This will bring up the External Tools dialog C C Eclipse Platform Aa File Edit Mavigate Search Project MA window Help F3 E E 6 ej A Run Last Launched Ctrl Fii P 4 ES Be Cice c E UNE Sf Debug Last Launched Fil fae CIC Run As Run Debug History Debug s Debug F External Tools d O 1 LPC2000 Flash Utility E External Tools Organize Favorites D errors O warnings 0 infos In Folder Click on New and replace the name with OCDremote Use the browse file system to find it It should be in the directory c cygwin usr local bin The arguments needed to properly
141. rites Tools Help pack O l d JO Search Wey Folders BERN X 3 X Address D Program Files LPC2106 ISP Folders x Name 4 Size Type Date Modified girc2ins ISP 515 KB Application 3 17 2004 10 28 AM Program Files Lad E c Prag Sl E ST amp UNST SEB TextDocument 7 11 2004 1 55 AM EE 5 321Studios IC Adaptec e lO Adobe E E Almas el America Online 7 0 Bl America Online 8 0 El America Online 8 0a EE E 40D E i amp OL Companion e lO Applied Insights E lA ATI Multimedia e E ATI Technologies E Ej Autodesk EE c AWS e ll Common Files 9 ComPlus Applications 9 Futuris Imager E L3 Gemstar EE Ez GNUARM Google E E HP EE E MSI E G InstallShield Installatioi EE A Internet Explorer EE E iPod e gt Tunes al Java C3 LPC2106 ISP i Meccenner Now that the Philips LPC2000 Flash Utility is properly installed on our computer we d like to install it into Eclipse so that it can be invoked from the RUN pull down menu under the external tools option Start Eclipse by clicking on the desktop icon 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 r a Qe we me COo Y BUTTER SO We need to change it into the C C perspective In the Window pull down menu select Window Open Perspective Other C C and then
142. s LPC2000 Flash Utility ME eae Help LPC2000 Flash Utility W2 2 0 Erase Blank Communication Flash Programming Filename Connected To Fart C eclipse workspace demo2 E blink flas ea hee 6 Entire Device LUMT m Selected Sectors Use Baud Hate 19200 Execute Code Upload to Flash he after Upload Start Sector U End Sector 14 Time Out sec 2 Manual Heset Use DTR RTS E for Reset and Boot Loader Selection Device Device Lec 06 m Part ID ATAL Freq kHz 14746 Device ID Boot Loader ip Erased LPC2000 Flash Successtully The RAM Buffer screen now appears Click on Load Hex File This is just an operation that fetches the hex file and puts it into the Philips ISP Flash Utility Es LPC2000 Flash Utility RAM Buffer amp H 4000 0000 FF FF FF FF FF Haooo 007 0 amp H 4000 0020 amp H A000 0030 H4000 0040 amp H 4000 0050 H4000 0060 amp H 4000 0070 amp H 4000 0080 amp H 4000 0090 H4000 0040 amp H 4000 OB H4000 OOCO amp H 4000 QD H4000 00 0 H4000 OOFO H4000 0100 amp H 4000 0110 amp H 4000 0120 H4000 0130 amp H A000 0140 H4000 0150 amp H 4000 0160 H4000 0170 amp H 4000 0180 H4000 0190 amp H 4000 01 40 amp H 4000 0180 amp H 4000 1C0 H4000 01010 H4000 TEU H4000 OTFU FF FF FF Uuuuuuuuuuuuuuuuu w FR FPF FR FF Fr FF Load Hes File Upload to RAM Download RAM
143. s 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 I doubt you d save that much money after paying the shipping from Digikey and the gas to drive to Radio Shack The Olimex version is a fair deal Obviously the Macraigor Company is not happy about all these clones running about so recently they slipped an impediment into the works The latest version of OCDremote their free JTAG server for the Wiggler and other products is expecting a connection short circuit between pins 8 and 15 of the LPT1 printer port This has made a lot of people fail Olimex has said that they would revise their design and modify their 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 connector on the Wiggler to see if these two pins are connected If not you can easily disassemble the Olimex Wiggler and tack solder a jumper to do the job Again you must connect pin 8 to pin 15 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 Wi
144. s Tools Help 3 Qe wa po search lo Folders aas X ba Folders x Name de Size Type El d My Computer E configuration E Se Local Disk C features i E 3 armlib plugins File Folder me E ATI readme File Folder 5 23 2005 10 59 P ic capture L aclipsepraduct 1 KB ECLIPSEPRODLICT File 5 13 2005 2 55 P G DELL J az KB Application 513 2005 2 55 P D Documents and Settings 1 KB Configuration Settings 5 13 2005 2 55 P ic download 17 KB HTML Document 5 13 2005 2 55 P E ic DRIVERS KB HTML Document 513 2005 2 55 P Pin to Stark menu El iE eagle components 31KB Executable Jar File 5 13 2005 2 55 P icy EasvScreen Bi eclipse 3 configuration E Cy Features Scan For Viruses Send To d E Compressed zipped Folder plugins 2 Mail Recipient E readme Create Shortcut dg Musicmatch Burner Plus C foo Delete E My Documents iL gnu docs w Rename ARMLIB F Properties Eclipse 3 0 2 Now is a good time to test that Eclipse will actually run Click on the desktop icon to start the Eclipse IDE E Eclipse 3 0 2 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 Clipse FHE e CIRS ESEROJECT The first order of business is to s
145. scussion 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
146. sec 2 Use DTR RTS for Heset and p 85 m LPE2106 Read Part D r ga Device ID Boot Loader ID Selection Now click on Upload to Flash to start the download The Philips ISP Flash Utility will now ask you to reset the target system This is the tiny RST button near the CPU chip LPC2000 Flash Utility Reset Message Ed Please reset your LPC2000 board now and then press OK The download will now proceed youll see a blue progress bar at the bottom and then the status line will say File Upload Successfully Completed E LPC2000 Flash Utility File Buffer Help DHILIDS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Port Jworkspace demo2106_blink_flash main hex AN f Entire Device com Selected Sectors Use Baud Rate F Execute Code id F after Upload Start Sector Em 13200 Erase E Manual Reset tee zie See E Time Out sec z Use DTR RTS Device for Reset and LPC21 DE Read Fart ip E pace ATAL Freg kHz 14746 Device ID Boot Loader ip selection File Upload Successfully Completed Remove the BSL boot strap loader jumper and hit the RST button r B OLIMEX LTD MOE eje COPYRIGHT C 2883 Your application should start up and the LED will start blinking To prove that am as honest as the sky is blue here it is blinking away a A A AL S EACT ED EA ia fae eee rv Im iri I ge ARGA HA i uuu mac
147. stallation Tf z atte Bd sun License 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 search tips Search in Developers Site v mn 2 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 J2SE TM Runtime Environment 5 0 Update 2 Download In order to obtain J2SE TM Runtime Environment 5 0 Update 2 you must agree to the software license below amp Printer Friendly Page Sun Microsystems Inc Binary Code License Agreement for the JAVA 2 PLATFORM STANDARD EDITION RUNTIME ENVIRONMENT 5 0 SUN MICROSYSTEMS INC SUN IS WILLING TO LICENSE THE SOFTWARE IDENTIFIED BELOW TO YOU ONLY UPON THE CONDITION ITHAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS BINARY CODE LICENSE AGREEMENT AND SUPPLEMENTAL LICENSE TERMS COLLECTIVELY AGREEMENT PLEASE READ THE AGREEMENT CAREFULLY BY DOWNLOADING OR INSTALLING THIS SOFTWARE YOU ACCEPT THE TERMS OF THE AGREEMENT INDICATE ACCEPT
148. t armle j in erE Ist P demozin6 blink ram E fem main drop bn rain hex be main map pos kA makefile lij fv hok k ok e s aa a a JFK 2 OCDremote a ch k Ck ch hok ch hok i ie je ie je je Ez ES je je ie je ie jr Ez je je je ie je Ez Ez je je je ie je jr Ez je ie ie ie FA lt demoz106 blink rte IEEE SCRIPT The Linker Scrip Q External Tools gt and data emitted by the GNU C compiler and assembler are to be loaded int Organize Favorites ito FLASH variables go into RAM iny symbols defined in the Linker Script are automatically global and available to the rest of program To force the linker to use this LINKER SCRIPT just add the T demoz106 blink ram cmd directive to the linker flags in the makefile LFLAGS Map main map nostartfiles T demozi 6 blink rarm crmd Philips boot loader supports the ISF In System Programming via the serial port and the Ii Application Programming for flash programming from within your application boot loader uses RAM memory and we MUST NOT load variables or code in these areas used Hy boot loader O0x40000120 Ox400001FF 223 bytes for ISP variables Ox4000FFEO Ox4000FFFF 32 bytes for ISP and IAF variables Ox4000FEEO x4000FFDF 256 bytes stack for ISP and IAP MEMORY MAF 0x40010000 HSS HSS eee eme er erede mti Ox4000FFFF variables and stack for Philips boot loader aga bytes Do n
149. t applicable to this environment lt Back Mex gt Finish Cancel If you still have the CDT update URL saved above paste it into the URL text box below http download eclipse org tools cdt releases new Enter CDT into the Name text box and click OK New Update Site Name CDT URL http download eclipse arg tools cdt releases new Now check the CDT box and click Next to continue the CDT installation Install Update sites Eo visit Select update sites to visit while looking For new Features Sites bo include in search m v Mew Remote Site a x Eclipse org update site New Local Site New Archived Site Edit Remove e Ignore Features not applicable to this environment Check the box for Eclipse C C Development Tools 2 1 1 in the window below and click Next to continue the installation Install Search Results Select features to install From the search result list Select the features to install Select Al L Lx Eclipse C C Development Tooling SDK Eclipse org L Wt Eclipse C C Development Tooling SDK Eclipse org O Ll Eclipse C C Development Tooling SDK Eclipse org O Li Eclipse CI C4 Development Tooling SDE Eclipse org O eclipse C C Development Tooling SDK Eclipse org Properties L Wt Eclipse C C Development Tools Eclipse org L Ls Eclipse C C Development Tools Eclipse org Deselect All More Info Error Details
150. table Insert The first thing done within the SECTIONS command is to set the location counter The dot means right here and this sets the location counter at the beginning to 0x000000 z0 set location counter to address zero Now we create our first output section located at address 0x000000 This creates a output section named startup and it includes all sections emitted by the assembler and compiler named startup In this case there is only one such section created in crt s This startup output section is to go into FLASH at address 0x000000 Hemember that the startup section has the interrupt vectors must be placed at 0x000000 and the startup code also sets the stacks modes and copies the data and bss sections startup startup gt flash Now we can follow the vector table and assembler startup code with all code generated by the assembler and C compiler this code is normally emitted in text sections However constants and strings go into sections such as rodata and glue 7 so these are included for completeness These code bits 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
151. te Search Project Run Window Help Iii BEela Q S 9 Soe gt 1By 4 A Navigator X Y ZI s crt s main dmp demo2106_blink_flash cmd s crt s Bl mainc X p d v Fii Lad x x a s gt es demo2106 blink Flash Function declarations cdtproject KEES project crt lst void Initialize void crt o void feed void crt s 5 demo2106 blink Flash cmd void IRO Routine void _ amp ttribute interrupti IRQ Ipc210x h void FIQ Routine void attribute _ interrupt FIQ main c void SWI Routine void _ attribute interrupt S WI main dmp void UNDEF Routine void attribute interrupt UNDEF main hex main map JORCRORCRORC RRA ERRE RRA REE ERA AEREA REA OR RCROR RARA E GR A BG A rios Header kiles main out AAA kefil Es 9 mal i om ram include LPC210x h cdtproject project crt Ist JOWCRCNCECRONCAChChONCh Ch AONCh Ch a a AAT K AEREA CN Ch AONCh ACA ON CA A ON Ch Ch AUN CN UA UN crt o Global Variables s crt s WORChCh Ch ch A ACA TAHT AKHTAR a TAKA H Ch hh A AAA A HAHAHA ATTA HAHAH h A A A KCN A HAART FS demo2106 blink ram cmd int a global uninitialized variable Ipc210x h int r global uninitialized variable E main c int 3 7 global uninitialized variable main dmp main hex short h global initialized variable main map short j global initialized variable main o char j global initialized variable main out makefile
152. te the data initializer copy code in crt s to save space You might also ask Do we still clear the bss section The answer is absolutely yes RAM memory powers on into an unknown state We want all uninitialized variables to be zero ar start up Of course stupid programmers rely on uninitialized variables to be zero at boot up this is how they get into trouble with uninitialized variables not all compilers do this automatically At this point if you haven t cleaned and built the project do it now Make sure the BSL jumper is installed Now use the External Tools toolbar button to find the Philips ISP Flash Utility and start it To make sure that we are not fooling ourselves click on Erase to clear the flash memory Es LPC2000 Flash Utility File Buffer Help PHILIDS LPC2000 Flash Utility V2 2 0 Flash Programming Erase Blank Communication Filename Connected To Part C eclipse workspace demo2106_blink_flas a a Entire Device comt Selected Sectors Sosa Cade Use Baud Fate Upload to Flash e EET 5 19200 Compare Flash Manual Reset J E d Sector Time Out sec 2 Device Use DTR RTS Device Lec 06 ELT Part ip E for Reset and Boot Loader ATAL Freg kHz 14746 Device ID Boot Loader ip selection Erased LPC2000 Flash Successfully Now we can be sure that the blinking LED is not the Flash application running Click on Buffer RAM Buffer Operation
153. ted time left 24 sec 728 KB of 2 95 MB copied Download to Temporary Folder Transfer rate 97 6 KB 5ec Close this dialog bos when download completes Oper Open Folder The Macraigor installer should start up just click Next to continue Macraigor 5ystems Hardware Support Package 2 12 InstallShield Wizard E Welcome to the InstallShield Wizard for Macraigor Systems Hardware Support Package 212 The Install5 hield amp Wizard will install Macraigor Systems Hardware Support Package 2 12 on pour computer To continue click Next The next screen lets you choose where OCDRemote is installed OCDRemote normally installs in c cygwin usr local bin We ll have to make sure that this directory is on a Windows Path Click on Next to accept c cygwin usr local bin as the OCDRemote installation directory Macraigor Systems Hardware Support Package 2 12 InstallShield Wizard E Choose Destination Location 1 5 Select folder where setup will install Files Install M acraigor Systems Hardware Support Package 2 12 ta Scugwinsusrslacalbin Installshield Be joven Clicking on Install will complete the OCDRemote installation Macraigor Systems Hardware Support Package 2 12 InstallShield Wizard FS Ready to Install the Program la 4 The wizard is ready to begin installation Click Install to begin the installation IF you want to review or change any of your installation settings click Back
154. to be as simple and as straightforward as possible Click on our Eclipse desktop icon to start Eclipse Eclipse 3 0 2 Eclipse should start and present the C C perspective as shown below If not select Window Open Perspective Other C C to change to the C perspective C C Eclipse Platform Seles Fie Edit Navigate Search Project Run Window Help r1 lard 5 hd 6 l T si T Fr r O T FN r y P 7 E E Y E Hie C C Du gt mr 52 2 SL An outline is nat available Problems E console 22 Properties Search Console To create a project select File New New Project Standard Make C Project from the File pull down menu and click Next to continue C C Eclipse Platform ie Edit Navigate Search Project Run Window Help Al shift N P Mew Praject Select a wizard Create a new C Project which uses a simple makefile Wizards a5 Java Project med Plug in Project M Managed Make C Project a Standard Make C Project H E C H E cS H E Jawa gg Import H B Plug in Development 14 Export H E Simple SwiEch Workspace Open External File 1 Ipc210x h demo2106 2 main c demo2106 3 main map demoz106 4 demo2106 cmd demoz106 Exil Back Finish Cancel You should see the New Project dialog box and enter the project name demo2106 blink flash in the box as shown below Click on Next to continue New Project L Make
155. tup code goes into FLASH collect all sections that should go into FLASH after startup all text sections cade all radata sections iconstants strings etc w all rodata sections constants strings etc w all glue 7 sections no idea what these are all glue Yt sections no idea what these are define a global symbol etext just after the last code byte put all the above into FLASH collect all initialized data sections that go into RAM create a global symbol marking the start of the data section all data sections define a global symbol marking the end of the data section put all the above into RAM but load the LMA copy into FLASH collect all uninitialized bss sections that go into RAM define a global symbol marking the start of the bss section all bss sections put all the above in RAM it will be cleared in the startup code advance location counter to the next 32 bit boundary define a global symbol marking the end of the bss section define a global symbol marking the end of application RAM k ol fe E r Ej writable Insert 1 1 Above is the final part of the Linker Command Script Notice that everything is loaded into RAM You might ask Do we still copy the data section initializers left the copy operation intact in file CRT S but it now essentially copies over itself wasteful wanted to keep things very similar You could dele
156. ve Now the C C perspective shows a bona fide project in the C C projects box on the left As of now there are no source files created C C Eclipse Platform File Edit Mavigate Search Project Run Window Help Idemozi amp blink Flash Problems El Console 3 Properties Search Console ES meai m F 4n outline is nat available We can now use Eclipse CDT s import feature to copy the source files into the project Assuming that you successfully unzipped the demo2106 blink flash zip project files associated with this tutorial to an empty directory such as c scratch you should have the following source and make files in that directory scratch File Edit Back 7 J Folders Favorites Viel C Program Files f scratch 5 system downloads El D WINDOWS aclipse e Local Disk D Tools Help gt M p Search liz Folders X makefile A Tn EIX 6 BB Mame I ert demozin6 E Ipe210x E main Size 7 KE 4 KE 13 EB 4 EB 1 EB lt Tvpe 5 File Windows MT Command Script H File C File File ERK i Date Modified 5 14 2005 11 13 AM 5 12 2005 12 28 AM 5 14 2005 12 51 PM 5 14 2005 12 48 PM 513 2005 1 06 AM E Click on the File pull down menu and then click on Import Then in the Import window click on File System C C Eclipse Platform mim Edit Navigate Search Project Run Window Help M
157. w 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 eclipse eclipse downloads Your preferred mirror appears to have this file eclipse gt DK 3 0 2 w1n32 z1p United States United States University of Buffalo CSE Department Please select a mirror for this file amp clipse SDIl 3 0 2 win32 zip Africa south Africa University of Stellenbosch Asia Japan Japan Advanced Institute of Science and Technology Korea Republic Of amp reum Australia Oceania Australia Pacific Internat North America Canada Groupe d utilisateurs de Linux de lides Canada Reachable ca United States Calvin College ftp states University of Buffalo CSE Department United States VWivIVV VVEB inc South America Brazil EclipsegiRio PUC Rio Main Download Site Canada Main eclipse org downloads area When the mirror site starts the download process you have to select a destination directory to place the Eclipse zip file In my case created an empty C scratch directory on one of my hard drives you could use any other drive as well First click on Save below File Download Do you want to open or save this file a Mame eclipse 5DK 3 0 2 win3z zip Type Winzip File 85 4 MB From Ftp cs
158. wrote a similar tutorial for the New Micros TiniARM nine months ago and you can see it on their web site WWW newmicros com Olimex an up and coming electronics company in Bulgaria offers a family of Philips LPC2100 boards Specifically they offer three versions with the LPC2106 CPU You can buy these from Spark Fun Electronics in Colorado their web site is www sparkfun com The Olimex boards are also carried by Microcontroller Pros in California their web site is www microcontrollershop com This is the Olimex LPC H2106 header board You can literally solder this tiny board onto Radio Shack perfboard attach a power supply and serial cable and start programming It costs about 49 95 Obviously it requires some soldering to get started This is the Olimex LPC P2106 prototype board Everything is done for you There s a power connector for a wall wart power supply a DB 9 serial connector and a JTAG port It costs about 59 95 plus 2 95 for the wall wart power supply This is the Olimex LPT MT development board it has everything the prototype board above includes plus a LCD display and four pushbuttons to experiment with It costs about 79 95 plus 2 95 for the wall wart power supply For starting out would recommend the LPC P2106 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 H
159. xactly the same as arm elf gcc l c O3 g main c Likewise we can replace the compiler name arm elf gcc with a variable too CC arm elf gcc Now the command line becomes CC CFLAGS main c Now our rule for handling the main o and main c files becomes main o main c echo compiling CC CFLAGS main c Its worth emphasizing that forgetting to insert the TAB character before the commands is the most common rookie mistake in using the GNU Make system The compilation options being used are l specifies include directories to search first project directory in this case C do not invoke the linker we have a separate make rule for that fno common gets rid of a pesky warning 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 s
160. yet it s required reading 2 Installing the Necessary Components To set up an ARM cross development environment using Eclipse you need to download and install several components The required parts of the Eclipse ARM cross development system are 1 SUN Java Runtime 2 Eclipse IDE 3 Eclipse CDT Plug in for C C Development 4 CYGWIN GNU C C Compiler and Toolset for Windows 5 GNUARM GNU C C Compiler for ARM Targets 6 GNUARM Insight Debugger 7 Philips Flash Programmer for LPC2100 Family CPUs 8 Macraigor OCDremote for JTAG debugging 3 JAVA Runtime The Eclipse IDE was written entirely in JAVA Therefore you must have the JAVA runtime installed on your Windows computer to run Eclipse Most people already have JAVA set up in their Windows system but just in case you don t have JAVA installed here s how to do it The JAVA runtime is available free at www sun com The following screen will appear Click on Downloads Java 2 Standard Edition to continue Sun amp Microson Meet Again a A Future of Secure Desktops SERVICES Leverage the expertise of Sun and its partners with Sun Connection your gateway to intelligent Net based IT services Read More GD Sun Products Downloads Services amp Solutions Support Training Research milcnosystems What s New NetBeans 4 METERS TT m for 4 5 Million Developers News Shop for Products il Java 2 Standard Edition Co
161. ymbols defined in the Linker Script are automatically global and available to the rest of the Ipc210x h program main c ft main dmp To force the linker to use this LINKER SCRIPT just add the T demo2106 blink flash cmd directive main hex to the linker flags in the makefile main map pa n Map main map nostartfiles emo in ash cm E main o pa LFLAGS M fil T demo2106 blink flash cmd main out j na K makefile c E demo2106 blink ram ON pe The Philips boot loader supports the ISP In System Programming via the serial port and the IAP In Application Programming for flash programming from within your application The boot loader uses RAM memory and we MUST NOT load variables or code in these areas RAM used by boot loader Ox40000120 Ox400001FF 223 bytes for ISP variables Ox40D00FFEO Ox4000FFFF 32 bytes for ISP and IAP variables qe 0x4000FEE0 Ox4000FFDF 256 bytes stack for ISP and IAP ft 5 Ex GE et E riena lt terminated gt Insight Program C Program Files GNUARM bin arm elF insight exe Writable Insert Resource demo2106 blink flash cmd Eclipse Platform Sele File Edit Navigate Search Project Run Window Help Im HSlmM I a HPl eo o ES Resource 0 navigator HO Sas Cos O manc E manm E demoz106 birme A pa A e E B je i demo2106 blink Flash MEMORY MAP B cotproject 0x40010000 project gt tst Ox4000FFFF crt o
162. z 10 6 blink r F 3 Insight ela demo2106_blink_ram xd gt Binaries a i Includes o The Linker Scrip Q4 External Tools and H h Ipez1 x h m to be loaded int Organize Favorites ito FI m s crt s FU E d main c i Any symbols defined in the Linker Script ar H Ed crto armle i program E maino armle jt After a few seconds Insight will start up in its own window main c Source Window File Run View Control Preferences Help d amp eaoeuBrwp o 0 nain y SOURCE main void 4 e int static int static uninitializt static char E static unir static int static initialized static long x 5 static initialized static char static initialized variable static int static initialized Initialize the system Initialize ff set io pins for led PB8 7 IODIR x B BHBSB pin P6 7 is an output everything else is input after reset IUSET Ux BB8HB8B88H led off IOCLR 6000006808 led on endless loop to toggle the red LED PHB8 7 while 1 4 For j 8 j lt 5800000 j 3 ZZ wait 588 msec IOSET 6x60000008 B ff red led off For j 8 j lt 50800008 j 2 wait 500 msec IOCLR xHWdBBHBHS B red led on fOXRXX X3 x4 x x3 343343433 333 3 30303330 E3E 3E 3 0 E E 0 E E EE 0E 0E CE 0 C 0 0 0 0 9E EE QE EE QE E EE Initialize T 4 3E3E3E3EJE E E HEHE IEEE JE 3 06 06 3 3 3 3 3030 3E JE HEHE EI
Download Pdf Manuals
Related Search
Related Contents
(SAVE THESE INSTRUCTIONS) attenzione - Genialpix Versión PDF - sobre teléfonos celulares hasta la comodidad de tu AEMC - Advanced Test Equipment Rentals Ascaso Factory ESPRESSO COFFEE GRINDER User's Manual Canon MV4 Camcorder User Manual User's Manual - PLANET Technology Corporation. OPERATOR`S MANUAL Copyright © All rights reserved.
Failed to retrieve file