Home

AN-15 Building a Salvo Application with IAR`s

image

Contents

1. Application Note 750 Naples Street San Francisco CA 94112 415 584 6360 http www pumpkininc com Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE Introduction This Application Note explains how to use IAR s http www iar com MSP430 C compiler and Embedded Workbench IDE to create a multitasking Salvo application for Texas Instruments http www ti com MSP430 ultra low power microcontrollers We will show you how to build the Salvo application contained in salvo ex exl main c for an MSP430F149 using IAR Embedded Workbench for MSP430 Note IAR Embedded Workbench underwent substantial changes between v1 EW 2 3 with the last version of the compiler being v1 25B and v2 EW 3 2 with v2 x compilers e g v2 10A The procedures and illustrations in this document are from JAR Embedded Workbench for MSP430 v1 and the associated JAR MSP430 C compiler v1 25B Where substantive differences exist they will be noted as such For more information on how to write a Salvo application please see the Salvo User Manual Before You Begin If you have not already done so install the IAR Embedded Workbench for the MSP430 If necessary you should also upgrade to the latest TI MSP430 simulator available from the TI website at http www ti com sc msp430 created by Andrew E Kalman on Apr 8 2002 updated on Jul 23 2003 All trademarks mentioned herein are properties of their res
2. 2 Creating a Group When finished your project window should look like this E myexl prj Iof x Targets Debug da S Debug Listings Salvo Configuration File E Salvo Help Files Salvo Libraries E Salvo Sources E Sources Figure 3 Project Window with Groups Now let s setup the project s options for Salvo s pathnames etc for your particular MSP430 microcontroller Select Project Options ICC430 define and define any symbols you may need for your project Select Project Options ICC430 Include and add the include paths PROJ_DIR and er salvyo ine AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE 3 Application Note c salvo inc TOOLKIT_DIR inc Figure 4 ICC430 Settings Project Include Paths Next select XLINK List Generate Linker listing This will create a useful map file with the applications ROM and RAM requirements etc Under XLINK Include select XCL file name Override default and select the xc1 linker filename that matches your target processor TOOLKIT DIRSALIBA M TOOLKIT_DIR icc430 msp430F149C xcl m Figure 5 XLINK Settings Project XCL File Name Lastly under C SPY Setup select the Driver Flash Emulation Tool ROM Monitor or Simulator and select Chip Description Use description file and select the appropriate description file for your MSP430 AN 15
3. Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE Application Note LI i ped Iv TOOLKIT_DIRS cw430 msp430F1 49 ddf I Figure 6 C SPY Settings Project Chip Description File Select OK to finish configuring your project Adding your Source File s to the Project Now it s time to add files to your project Choose Project Files C C Source Files c cpp cc under Files of type select Sources under Add to Group navigate to your project s directory select your main c and Add Your Project Files window should look like this AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE 5 Application Note Project Files 3 x Look in Gi temp pe al c File name main c Files of type C C Source Files c cpp cc Add to Group Sources Files in Group C temp main c Add Add All Remove Remove All Done Cancel Figure 7 Project Files Window When finished select Done and your project window should look like this iM ex lite_pry Targets Debug za a Debug Listings 9 Salvo Configuration File I Salvo Help Files SY Salvo Libraries E Salvo Sources I Sources E main c Figure 8 Project Window with Project Specific Source Files Adding Salvo specific Files to the Project Now it s time to add the Salvo files your project needs Salvo applica
4. C Source Files c cpp cc under Files of type select Salvo Sources under Add to Group navigate to salvo src select mem c and Add Your Project Files window should look like this AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE 7 Ee Application Note Project Files 2 xl Look in Cx src b amp Al ei E array c cyclic5 c amp eflag c amp inittcb c B binsem c IB cyclic6 c E eflag2 c E license c Epi E binsem2 c iB cyclic c E eid c B mem c E pi iR chk c iR debug c B event c B msg c E pi iE cyclic c iR delay c E idle c E msg2 c E qi iR cyclic2 c iR delay2 c E initc B msqq c E gi iB cyclic3 c iR delay3 c E initecb c B msqq2 c E iE cyclic4 c iB destroy c E inittask c B msgq3 c E s File name meme Files of type C C Source Files c cpp cc Y Add to Group Salvo Sources Files in Group C salvo src mem c Add Add All Remove Remove All Done Cancel Figure 10 Project Files Window When finished select Done and your project window should look like this iM ex lite_pry Targets Debug za Debug 3 Listings ZY Salvo Configuration File Salvo Help Files Salvo Libraries 8 sfiar430 a r43 amp 3l Salvo Sources m memc 5 3 Sources E main c Figure 11 Project Window with Library mem c and User Source File s The
5. Kumnsac Fi prio c Pita Be delay2 c W init c HE msg2 c Be gdel c Feta HE delay3 c Wi initecb c Be msgq c B gins c Feta File name Files of type fai Files Add to Group Salvo Sources Files in Group D salvo src binsem c Add D salvo src delay c D salvo src event c Add All D salvo src init c D salvo src inittask c Remove D salvo src mem c D salvo src portiar430 343 gt Remove All Done Cancel 10 AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE Application Note Figure 14 Adding Salvo Source Files to the Project Select Done when finished Your project window should now look like this ii myexl1 prj Mi x Targets Debug A Debug 9 Listings 34 Salvo Configuration File 3 salvoctg h Salvo Help Files 3 Salvo Libraries Salvo Sources binsem c E delay c H evente 2 init c 2 inittask c f mem c E portiar430 s43 E qins c f2 sched c E timer c Sources H main c 4 Fe EE D Figure 15 Project Window for a Source Code Build The salvocfg h Header File You will also need a salvocfg h file for this project Configuration files for source code builds are quite different from those for library builds see Listing 1 above For a source code build the salvocfg h fo
6. re CSTACK 0300 re NFO 1000 dse 0 CODE E000 E551 552 re CSTR E552 dse 0 CDATAO E552 re CCSTR E552 re CONST E552 dse 9 INTVEC FFEO FFFF 20 com ck CK cC 0k CC 00K 0k CK SC E Sk A x KR A x A Kk M i END OF CROSS REFERENCE kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 1 394 bytes of CODE memory 44 bytes of DATA memory Errors none Warnings none Listing 3 Source Code Build Results Abbreviated Note The Embedded Workbench for MSP430 projects supplied in the Salvo for TI s MSP430 distributions contain additional help files in each project s Salvo Help Files group Tip If you configure Embedded Workbench to display the memory utilization for individual source files and the complete application you won t have to look in the map file Select Options Settings Make Control Message Filtering Level and choose All 12 AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE Application Note Testing the Application You can test and debug this application using the C SPY debugger and either the simulator or the Flash Emulation Tool To launch C SPY choose Project Debugger You can use all of C SPY s supported features when debugging and testing Salvo applications This includes breakpoints profiling intelligent watch window cycle counting etc 6 CSPY myex1 d43 lof x File Edit View Execute Control Advanced Options Window Help Ssle z
7. salvocfg h Header File You will also need a salvocfg h file for this project To use the library selected in Figure 9 your salvocfg h should contain only define OSUSE LIBRARY IRUE define OSLIBRARY TYPE OSF define OSLIBRARY_CONFIG OSA Listing 1 salvocfg h for a Library Build AN 15 Building a Salvo Application with I AR s MSP430 C Compiler and Embedded Workbench IDE Application Note Select Project Files All Files under Files of type Salvo Configuration File under Add to Group navigate to your project s directory select salvocfg h and Add Praject Files 2 xj Look in Gi temp B je ei Be main c Be salvoctg h a myex dtp myexl prj File name salvoctg h Files of type all Files Add to Group Salvo Configuration File Files in Group C temp salvoctg h Add Add All Remove Remove All Done Cancel Figure 12 Adding the Configuration File to the Project Your project window should now look like this IM exl lite prj Targets Debug za Debug 4 Listings a Salvo Configuration File B salvoctg h SY Salvo Help Files 2 3 Salvo Libraries f sfiar430 a r43 5 3 Salvo Sources E mem c 5 3 Sources E main c Figure 13 Project Window for a Library Build Tip The advantage of placing the various project files in the groups shown above is that you can quickly navigate to them and open them for editing etc Proceed to Building the P
8. For use with IAR s MSP430 compiler it requires the svso defined symbol as well as 16 AN 15 Building a Salvo Application with I AR s MSP430 C Compiler and Embedded Workbench IDE m Application Note the symbols MAKE WITH FREE LIB Or MAKE WITH STD LIB for library builds When you write your own projects you may not require any symbols xcl filenames ending in C appear to be for C language projects Those ending in A appear to be for assembly language projects We recommend using the Embedded Workbench s argument variables like PROJ_DIR and TOOLKIT_DIR whenever possible This Salvo Lite library contains all of Salvo s basic functionality The corresponding Salvo LE and Pro libraries are sliar430 a r43 and sliar4301a r43 respectively You can Ctrl select multiple files at once We recommend that you add the project s map file to your project s Listings group This example was generated using the AR MSP430 C Compiler v1 26A with Salvo LE for TI s MSP430 v3 0 3 which was built using v1 25A Hence the 1 25 for v1 25 in the undefined external symbol In this example the major version number is 1 AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE 17
9. as4s3 4 G s 4 Bel noeaa aan e fal Watch al Status OS Delay 40 Task3a absolute relative PORE Ur NUN Cycles 503125 503125 Reset OSSignalBinSem BINSEM1 P Instructions 147258 147258 Reset Not used Hook must be defined because libraries inittaskyOSInitPrioTask qinsyOSInsPrioQ sched OSSched timer OSTimer maini Taski Ready Figure 16 Testing a Salvo Application in C SPY Note C SPY supports debugging at the source code level Only applications built from the Salvo source code or a Salvo Pro library enable you to step through Salvo services e g OSCreateBinSem at the source code level Regardless of how you build your Salvo application you can always step through your own C and assembly code in C SPY Migrating to Embedded Workbench for MSP430 v2 Existing Salvo applications built as projects pjt under IAR s Embedded Workbench for MSP430 v1 can be migrated to v2 using the following steps AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE 13 Application Note e n Embedded Workbench for MSP430 v2 choose File New Workspace to create a new workspace file eww e Choose File Insert Project into the Workspace select Files of type Old Project Files prj navigate to the old project and select Open then OK e Under Project Options select the device e g MSP430F149 under General Target Device Set the desired o
10. emp Debug Obj timer r43 temp Debug Obj main r43 o temp Debug Exe myex1l d43 rt 1 temp Debug List myexl map xms C IAR EW23 430 LIB f IAR EW23 430 icc430 msp430F123C xcl cMSP430 Z DATA UDATAO IDATAO ECSTR 0200 02FF DATA CSTACK 0200 0300 Z CODE INFO 1000 10FF Co 010060000000020 CODE CODE CONST CSTR CDATAO CCSTR EO000 FFDF CODE INTVEC FFEO FFFF e small write formatted write e medium read formatted read cl430 r43 Copyright 1987 2001 IAR Systems All rights reserved it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it FE E Ht He He E FE FE at aE HE AE HEHE FE FE AE AEE EAE aE aE EEE EEE EEE EEE it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it SNIP OC CK ck S C00 00K 0S S S E Sk Sk KS ok Kk Kk Ko Kk ko Kk ko Kk ko koX SEGMENTS IN ADDRESS ORDER p dir di dir di dir div di div di dir div div div di dir di div div di div di div div div div div dir div di div div div div dir div di div di dir d SEGMENT SPACE START ADDRESS END ADDRESS SIZE TYPE ALIGN UDATAO 0200 022B 2C re ECSTR 022C re DATAO 022C
11. ersion of the compiler you are using The library references this symbol because it was built with a different version of the IAR MSP430 C compiler The solution is simply to define this symbol at link time by using Project Options XLINK define and then assigning a value of 1 to the symbol Options For Target Debug Category Factory Settings Output define Diagnostics List Include Input Processing Defined symbols one per line CL430 1 25 L08 1 OK Cancel Figure 19 Setting the Link time Version Number External Symbol Once this symbol is defined you ll be able to build your application successfully Note This solution should work as long as the major version number of the IAR MSP430 C Compiler you re using matches that used to generate the Salvo libraries E g v1 23A can be used with Salvo libraries built with v1 26A Version mismatches like this will occur whenever Salvo users and the Salvo for TI s MSP430 distribution are at different versions of the IAR MSP430 C compiler While this solution is unlikely to AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE 15 Application Note cause any problems we strongly recommend that Salvo users keep their IAR MSP430 C compiler up to date to avoid any potential difficulties This type of linker error will not happen with source code builds e g when using Salvo Pro to build an application us
12. ing the Salvo source files as project nodes instead of linking to a Salvo library Application Crashes After Changing Processor Type Remember to include the appropriate header file for your MSP430 variant see Building the Project above While the common SFR locations are consistent across the entire MSP430 family the interrupt vectors are not Therefore mainline code may work correctly but the application will crash if interrupt vectors are not in the right locations Example Projects Example projects for IAR s MSP430 C compiler can be found in the salvo tut tul 6 sysq directories The include path for each of these projects includes salvo tut tul sysq and each project defines the svso symbol Complete projects using Salvo freeware libraries are contained in the project files salvo tut tul 6 sysq tul 6lite These projects also define the MAKE wrTH FREE LIB symbol Complete projects using Salvo standard libraries are contained in the project files salvo tut tul 6 sysq tul 6le These projects also define the MAKE_WITH_STD_LIB symbol Complete projects using Salvo source code are contained in the project files salvo tut tul 6 sysq tul 6pro These projects also define the MAKE_WITH_SOURCE symbol Note Tutorial projects are provided for IAR Embedded Workbench for MSP430 vl prj files IAR Embedded Workbench for MSP430 v2 ewp amp eww files This Salvo project supports a wide variety of targets and compilers
13. pective companies Application Note Related Documents The following Salvo documents should be used in conjunction with this manual when building Salvo applications with IAR s MSP430 C compiler Salvo User Manual Salvo Compiler Reference Manual RM IAR430 Creating and Configuring a New Project Create a new Embedded Workbench project under File New Project OK Select MSP430 as the Target CPU Family navigate to your working directory in this case we ve chosen c temp and create a project named myex1 pr j New Project 2 x Target CPU Family MSP430 Save in temp A Al ej other File name myext prj Create Save as type Project Files prj Cancel Figure 1 Creating the New Project Click Create to continue Choose File Save to save the project Note In Embedded Workbench for MSP430 v2 first you create a workspace and then you create one or more projects within that workspace In order to manage your project effectively we recommend that you create a set of groups for your project They are Listings Salvo Configuration File Salvo Help Files Salvo Libraries Salvo Sources Sources 2 AN 15 Building a Salvo Application with I AR s MSP430 C Compiler and Embedded Workbench IDE Application Note For each group choose Project New Group add in the Group Name and select OK New Group x Group Name OK Listings Add to Targets Cancel Figure
14. ptimizations under ICC430 Code Optimizations Under XLINK Include ensure that the XCL file name is not overridden and or a valid filename is used e Remove the existing Salvo library from the project and replace it with a same named one from salvo lib iar430 v2 When finished the new project window will look like this E lmyex1 Debug Lg Listings E myex map C Salvo Help Files L M abstract b 9 Salvo Libraries L 8 sfiar430 a r43 CJ Salvo Sources 2 mem c Ql Sources E main c myex Figure 17 Project Window for a Library Build in Embedded Workbench for MSP430 v2 Troubleshooting Linker Error Undefined External version number If you are doing a library build and your version of the IAR MSP430 C Compiler is different from that used to build the Salvo libraries the linker will issue an error like this one 14 AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE Application Note Build Find in Files Tool Output z Making target Debug Linking Error e45 Undefined external CL430 1 25 LOS referred in event D salvo lib sliar430 e r43 Total number of errors 1 Total number of warnings 0 Figure 18 Linker Error due to Version Mismatch This type of error occurs because the Salvo library in this case sliar430 e r43 references an external symbol here CL430_1_25_L08 which is not defined by the v
15. r this project contains only define OSBYTES OF DELAYS I define OSENABLE IDLING HOOK TRUE define OSENABLE BINARY SEMAPHORES TRUE define OSEVENTS 1 fdefine OSTASKS 3 Listing 2 salvocfg h for a Source Code Build Building the Project For a successful compile your project must also include a header file e g include lt msp430x14x h gt for the particular chip you are using Normally this is included in each of your source files e g main c or in a header file that s included in each of your source files e g main h With everything in place you can now build the project using Project Make or Project Build All The build results can be seen in the map file located in the projects Debug List subdirectory AN 15 Building a Salvo Application with I AR s MSP430 C Compiler and Embedded Workbench IDE 11 m Application Note FE E Het He He aE E FE at HE HE He AE AE a FE FE FE AE EEE AEE EEE EEE EEE TAR Universal Linker V4 53G WIN Link time Target CPU List file Output file 1 17 Apr 2002 10 33 44 MSP430 C temp Debug List myexl map C temp Debug Exe myexl d43 Format debug UBROF version 6 0 0 Using library modules for C SPY rt Command line C NtempNDebugNObjNoinsem r43 C temp Debug Obj delay r43 temp Debug Obj event r43 temp Debug Obj init r43 temp Debug Obj inittask r43 temp Debug Obj mem r43 NtempNDebugNObjNportiar430 r43 temp Debug 0bj qins r43 temp Debug 0bj sched r4 t
16. roject below AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE 9 m Application Note Adding Salvo Source Files If you have a Salvo distribution that contains source files you can do a source code build instead of a library build The application in NsalvoVexNex1 Wnain c contains calls to the following Salvo user services OS Delay OSIBRIT 0 OS WaitBinSem OSSignalBinSem OSCreateBinSem OSSched OSCreateTask OSTimer OSEi You must add the Salvo source files that contain these user Services aS well as those that contain internal Salvo services to your project The Reference chapter of the Sa vo User Manual lists the source file for each user service Internal services are in other Salvo source files For this project the complete list is binsem c mem c delay c portiar430 s43 event c CIS V IOle6 cC Sched 2c init timer inittask To add these files to your project select Project Files All Files under Files of type Salvo Sources under Add to Group navigate to the salvo src directory select the files listed above and Add Project Files 3 x pup fase s Bl gi e fes jj array c fe destroy c ed Inittask c umsggqe c jr B binsem c Be etlag c WB inittch c W msgq3 c in St B binsem2 c HE eflag2 c HB intvi c HE port8051 c BEL chk c Ee eid c W license c HE portc18 c B st Be debug c Be eventc W mem c HE portvs c gp Hu delay c We idle c
17. tions can be built by linking to precompiled Salvo libraries or with the Salvo source code files as nodes in your project Adding a Library For a library build a fully featured Salvo freeware library for the MSP430 is sfiar430 a r43 Select Project Files 6 AN 15 Building a Salvo Application with IAR s MSP430 C Compiler and Embedded Workbench IDE Application Note Library Object Files r under Files of type Salvo Libraries under Add to Group navigate to the salvo lib iar430 vl directory select sfiar430 a r43 and Add Project Files 2x Look in SieBot jo e a sfiar430 a r43 a sfiar430 d r43 ian sfiar430 e r43 a sfiar430 m r43 ia sfiar430 t r43 File name Files of type Library Object Files r Add to Group Salvo Libraries Files in Group CAsalvoMibXiard30 1 sfiard30 a r43 Add Add All Remove Remove All Done Cancel Figure 9 Adding the Library to the Project Note Salvo libraries for IAR s vl x MSP430 C compilers are located in salvo lib iar430 v1 Libraries for v2 x compilers are located in salvo lib iar430 v2 The libraries are not interchangeable Select Done when you are finished You can find more information on Salvo libraries in the Sa vo User Manual and in the Salvo Compiler Reference Manual RM IAR430 Adding Salvo s mem c Salvo library builds also require Salvo s mem c source file as part of each project Choose Project Files C

Download Pdf Manuals

image

Related Search

Related Contents

  Toshiba 5520c All in One Printer User Manual  OM 843: MicroTech II Unit Controller for Maverick II Rooftop Systems  Samsung YP-D1Z Felhasználói kézikönyv  Maple 7/7 エア駆動ポンプ 取扱説明書  RESUMEN DEL DECRETO -  Installation and User`s Manual for Cube Ice Machine - Ice-O  Manual - Engineering Electronics Shop  Mode d`emploi Xone  

Copyright © All rights reserved.
Failed to retrieve file