Home
Application Note
Contents
1. Application Note 750 Naples Street San Francisco CA 94112 415 584 6360 htto www pumpkininc com Building a Salvo Application with Rowley Associates CrossStudio for MSP430 Introduction This Application Note explains how to use Rowley Associates http www rowley co uk CrossStudio for MSP430 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 CS430 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 CrossStudio for MSP430 Familiarize yourself with the CS430 IDE Related Documents The following Salvo documents should be used in conjunction with this manual when building Salvo applications with Rowley Associates CrossStudio for MSP430 Salvo User Manual Salvo Compiler Reference Manual RM CS430 Creating and Configuring a New Project Create a new CS430 solution under File New New Blank solution Navigate to your working directory in this case we ve chosen c temp and create a solution named myex1 created by Andrew E Kalman on Mar 19 2003 updated on Jul 23 2003 All trademarks mentioned herein are properties of their respective companies Application Note E New Solution X Project Types
2. Hj debug c HB event c W mem c HE prio2 c ta W delay c WB idle c W msg c HE qdel c ta WB init c HE msg2 c Wo gins c Feta File name meme Open Files of type al Files Cancel ZA Figure 11 Adding mem c to the Project Click Open when you are finished Your Project Explorer window will look like this Project Explorer HOX e i El ml Solution myex1 1 project FT myex1 9 Salvo Configuration File 0 Salvo Help Files El Salva Libraries _ libsfcs430 a hza FJ Salva Source Files eB memc El Source Files ib main c Figure 12 Project Manager Window for a Library Build The salvocfg h Header File You will also need a salvocfg h file for this project To use the library selected in Figure 10 your salvocfg h should contain only define OSUSE_LIBRARY TRUE define OSLIBRARY_TYPE OSF define OSLIBRARY_CONFIG OSA Listing 1 salvocfg h for a Library Build 6 AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 Application Note Create this file and save it in your project directory e g c temp salvocfg h Add it to the Salvo Configuration File folder in the Project Explorer Proceed to Building the Project below 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 salvo ex ex1 main c contains calls to the following Salvo user Services OS_
3. this Project Explorer Enx ade ae J Solution myex1 1 project a E myexl E Listings O Salva Configuration File Salvo Help Files G Salvo Libraries pa Ea Salo Source Files C Source Files Figure 4 Project Explorer Window with Folders Now let s setup the project s options for Salvo s pathnames etc Note We recommend that you do set of these options at the solution level unless it s imperative that they be set at the project level Select the solution by left clicking on the solution in the Project Explorer window In the Properties window under Preprocessor Options User Include Directories add the project s own include path and salvo inc User Include Directories t jemp salone cacel_ Figure 5 CS430 Options User Include Directories AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 3 Application Note Next define any symbols you may need for your project under Preprocessor Options Preprocessor Definitions Preprocessor Definitions n tt F SSX MAKE_WOITH_FREE_LIB canesl_ Figure 6 CS430 Options Preprocessor Definitions Lastly in the Properties window select the MSP430F149 under General Options Target Processor i 24 cl mea mame US myex1 Properties Properties E General Options Build Quietly YES Include Debug Yes Intermediate D fContiquratian J Optimize Output Ho Output Dire
4. Templates m Empty Solution Create an empty solution containing no projects Solution Name myex1 Location Etemp Browse Figure 1 Creating the New Solution Click OK to continue Now create a new CS430 project under File New New Project Again navigate to your working directory and create a standard project named myexi using the Executable template ie New Project Project Types Templates 2 Admin Projects J Standard Pro al Executable Library Object file project for creating an executable Project Name myex1 Location C itermp Browse Figure 2 Creating the New Project Click OK to continue CS430 will automatically save the project whenever you close it In order to manage your project effectively we recommend that you create a set of folders for your project They are Listings Salvo Configuration File Salvo Help Files Salvo Libraries AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 Application Note Salvo Source Files Source Files For each folder left click on the project in the Project Explorer window right click choose New Folder enter the desired name under Name of the new folder and click Ok E New Folder Mame of the new folder Salva Libraries File extensions Cancel Figure 3 Creating a Folder When finished your Project Explorer window should look like
5. temp mein c 14 error EL023 can t find include tile main h Ji Ssalvo incdg salvo h 3351 error Hl0Z3 included from c temp main C 15 can t find include file salvocfg n Figure 19 Compiler Error due to Missing Project Include Path By adding the project s own directory to the project s include path you enable the compiler to find the project specific header file salyvodig l Example projects for CS430 are found in the salvo tut tul 6 sysx directories The include path for each of these projects includes salvo tut tul sysx and each project defines the sysx symbol Complete projects using Salvo freeware libraries are contained in the project files salvo tut tul 6 sysx tul 6lite hzp These projects also define the MAKE_WITH_FREE_LIB symbol Complete projects using Salvo standard libraries are contained in the project files salvo tut tul 6 sysx tul 6le hzp These projects also define the MAKE_WITH_STD_LIB symbol Complete projects using Salvo standard libraries with embedded debugging information are contained in the project files salvo tut tul 6 sysx tul 6prolib hzp 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 sysx tul 6pro hzp These projects also define the MAKE_WITH_SOURCE symbol The Source Files folder is already present in a new project Use View Project Explorer if not visible Use View Pr
6. 9 24 H portcs430 asm H gins c H sched c m E timer c M 23 Symbol Browser C Project Explorer Figure 15 Symbol Browser Window In Figure 15 you can see that the application requires 44 bytes of RAM upatao and 1 364 instructions in ROM _ coDgE Additionally you can see the locations and the sizes of Salvo s global variables e g OSelig P the eligible queue pointer Note The CS430 projects supplied in the Salvo for TI s MSP430 distributions contain additional help files in each project s Salvo Help Files group One very useful feature of the CS430 IDE is the ability to view the assembly language output of the compiler directly inside the IDE To do this the project must have been successfully built Then select left click the C file of interest then right click and choose Disassemble A window will open displaying the C language source code along with the MSP430 instructions CS430 s Symbol Browser enables you to go directly to the source where functions and variables are defined This works with any source code project or Salvo specific and also with the i option Salvo libraries that include debugging information AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 PUMPKIN Application Note E CrossStudio for MSP430 sched c File Edit View Project Debug Tools Target Window Help S S S S O a B ts BAX O 0 ORB8 E
7. Delay OSInit OS_WaitBinSem OSSignalBinSem OSCreateBinSem OSSched OSCreateTask OSTimer OSE 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 Salvo 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 portcs430 asm event c Gi ns idle g sched c Init timer c INTEL ask c In the Project Manager window select the Salvo Sources folder right click to choose Add Files choose Files of type source Files c s h navigate to the salvo src directory and select the c files listed above Your Add Files window should look like this Add Existing Item 2x win fare aaae init c a MSq2 c qins c fel task3 c 3 HBinitech c W msgq c HE rptc HEtask4 c ev W inittask c W msgg2 c W sched c Htask5 c a M WB inittch c HE msqq3 c Fesem c HEitask6 c a M E int c W msggd c sem2 c Fitask c alta WB license c Wa prio c FE stop c Wa tick c Slm H mem c HE prio2 c Ftask c Fitid c im aj msq c HE qdel c Ftask2 c Wh timer c im 2e eee 2 File name timer c binsem c delay c event c Open Files of type fai Files Cancel Figure 13 Adding Salvo Source Files to the Project AN 23 Building a Salvo Application with Rowley Associates CrossStudio fo
8. ROGRAM FILES ROWLEY ASSOCIATES LIMITED CROSSWORKS MSP430 1 0 0 bin hld C PROGRAM FILES ROWLEY ASSOCIATES LIMITED CROSSWORKS MSP430 1 0 0 lib crt0 hzo Debug main hzo Debug mem hzo Debug timer hzo Debug binsem hzo Debug delay hzo Debug event hzo Debug idle hzo Debug init hzo Debug inittask hzo Debug gqins hzo Debug sched hzo Debug portcs430 hzo g LC PROGRAM FILES ROWLEY ASSOCIATES LIMITED CROSSWORKS MSP430 1 0 0 lib D__vfprintf __vfprintf_int D___vfscanf ___vfscanf_int GCODE L GCONST L TINTVEC ffe0O GINTVEC L TCODE CONST 1100 ffff T abs 0 G abs L TIDATAO UDATAO 200 9ff DRAM_Start_Address 512 DRAM_Size 2048 Fhzx o Debug myex1 hzx Build Complete Listing 3 Build Results for A Successful Source Code Build The Symbol Browser contains address symbol and other useful information AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 9 IDE Extras Disassembly Browsing 10 Application Note a ja Fields Name Range Size INTYEC frec 20 UDATAO 0200 022b de CODE 1100 1653 1364 1 E binsem c H E delay c H event c a E idle c H init c inittask c B main c E mem c OScTcbP 022a 022b 2 Fr OSdelayQP 0204 0205 2 i OSeligQP 0210 0211 2 OSframeP 0200 0201 2 Fr OSqg Stat 0202 0203 2 v OSsigQinP 0208 0209 2 v OSsigQoutP 0206 0207 2 OSecb4rea 020a 020f 6 OStcb rea 0212 022
9. ctory Configuration Suppress var Mo Target Processor IMSP4s0F 149 Treat Warning Mo E Linker Options r Figure 7 CS430 Options Target Processor Selection Adding your Source File s to the Project Now it s time to add files to your project In the Project Explorer window select the Source Files folder right click to choose Add Existing File choose Files of type C Files navigate to your project s directory select your main c and click Open Your Add Files window should look like this Add Existing Item 21x Look in Stem ic gl fai mja File name maine Open Files of type Ic Files Cancel Zi Figure 8 Project Files Window 4 AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 Application Note When finished your Project Manager window should look like this Project Explorer X ts ta amp g Solution myex1 1 project Fl myex1 E Salvo Help Files _ Salvo Libraries eo Source Files Mees t main c Figure 9 Project Manager 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 applications 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 for us
10. e with CS430 is libsfcs430 a hza Select the Salvo Libraries folder in the Project Explorer window right click choose Add Existing File choose Files of type All Files navigate to the salvo lib cs430 directory and select libsfes430 a iza Add Existing Item 2 x Look in i cs430 E l al ci a libsfes430 a hza ja libsfcs430 d hza ja libsfcs430 e hza la lipsfcs430 m hza a libsfcs430 thza File name flibsfcs430 a hza Open Files of type fai Files Cancel Zi Figure 10 Adding the Library to the Project Click Open when you are finished You can find more information on Salvo libraries in the Salvo User Manual and in the Salvo Compiler Reference Manual RM CS430 AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 5 Application Note Adding Salvo s mem c Salvo library builds also require Salvo s mem c source file as part of each project Select the Salvo Source Files folder in the Project Explorer window right click choose Add Existing File choose Files of type All Files navigate to the salvo sre directory and select mem c Add Existing Item 21x Look in S src j amp al c portcs430 asm fe delay3 c fe initecb c ej msSqq c us HP array c HE destroy c W initask c msgqe c St Fy binsem c W eflag c WB inittch c Fe msqq3 c HE se Fe binsem2 c W eflag2 c WB int c W msqq4 c HE se W chk c W eid c WB license c W prio c Fst
11. eader file e g include lt msp430x14x h gt for the particular chip you 8 AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 Application Note 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 Rebuild myex1 or Project Rebuild Solution The IDE s status window will reflect the hcc command lines Delete C temp Debug myexl hzx SNIP Delete C temp Debug portcs430 hzo Debug main hzo does not exist SNIP Debug portcs430 hzo does not exist Compiling main c Debug cd C temp C PROGRAM FILES ROWLEY ASSOCIATES LIMITED CROSSWORKS MSP430 1 0 0 bin hcc DSYSX DMAKE_WITH_SOURCE D__ CROSSWORKS D_ TARGET_PROCESSOR MSP430F149 g I temp I salvo inc JC PROGRAM FILES ROWLEY ASSOCIATES LIMITED CROSSWORKS MSP430 1 0 0 include main c o Debug main hzo mmpy D__ CROSSWORKS_MSP 430 SNIP Assembling portcs430 asm Debug cd C temp C PROGRAM FILES ROWLEY ASSOCIATES LIMITED CROSSWORKS MSP430 1 0 0 bin has DSYSX DMAKE_WITH_SOURCE D__ CROSSWORKS D_ TARGET_PROCESSOR MSP430F149 g I temp I salvo inc JC PROGRAM FILES ROWLEY ASSOCIATES LIMITED CROSSWORKS MSP430 1 0 0 include salvo src portcs430 asm o Debug portcs430 hzo D__CROSSWORKS_MSP 430 Linking myexl Debug cd C temp C P
12. gt Gi msp430_homehtm i DA Help mem c main c idle c inittask c delay c sehed e x Project Explorer vs endif 4 Banx i Sle E Solution myex1 1 projec NOTE this is incompatible with in lining OSSchec C myex1 if OSENABLE DELAYS amp amp OSUSE ARRAYS mi aa lstings l Salvo Configuration OStypeTcbP nextTcbP ch salvocfg h endif GO Salvo Help Files 3 Salvo Libraries a Salvo Source Files f binsem c this hook is here so that analysis can be done or BR delay c the scheduler It s not intended for general use event c if OSENABLE OSSCHED ENTRY HOOK fe dec OSSchedEntryHook E a M f endif E meme dn portes430 asm hit the watchdog timer now since startup may hav taken a while OSCLEAR_ WATCHDOG TIMER osBeginCriticalsection D jm Fields E Symbol Properties NEJ portcs430 a Name OSSched H qins c Code Range 14e8 15f3 Code Size 268 QJ Output F Tip of the Day Properties J MSP430F149 on MSP430 FET Ln 80 Col 1 Z E E sched c gt OSSched 14e8 15f3 Properties Figure 16 Browsing at the Source Code Level Testing the Application You can test and debug this application using the Flash Emulation Tool Choose Debug Start Debugging to begin a debugging session You can use all of the IDE s supported features when debugging and testing Salvo applications This includes breakpoints watch window
13. hed 14e8 15f3 Oe OScTchP 05cTcbhP O3e1lig P Ox0000 fe Execution Counts ouput GelwWatch 1 23 Symbol Browser ocals MSP430F149 on MSP430 FET Ln 565 Col 1 Yi Figure 17 Testing a Salvo Application in CS430 A Note CS430 supports debugging at the source code level Only Salvo Pro source code build or library build projects 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 the IDE debugger Troubleshooting Cannot find and or read include file s If you fail to add salvo inc to the project s include paths see Figure 5 the compiler will generate an error like this one error E1023 can t find h Cr Cemp main c 15 include file salvo Figure 18 Compiler Error due to Missing salvo inc Include Path By adding salvo inc to the project s include path you enable the compiler to find the main Salvo header file salvo h as well as other included Salvo header files 12 AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 Application Note Example Projects AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 If you fail to add the project s own directory to the project s include paths see Figure 5 the compiler will generate an error like this one ez
14. operties if not visible This App Note assumes you have selected Categorized View to arrange the properties You can type directory names separated by semicolons or you can click on the ellipsis button at the end of the user entry field which will 13 Application Note present you with the User Include Directories window which greatly facilitates user entry CS430 also supports pathnames relative to the project s home directory Using relative pathnames is recommended as it makes a project much more portable This Salvo project supports a wide variety of targets and compilers For use with CS430 it requires the SySx defined symbol as well as 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 This Salvo Lite library contains all of Salvo s basic functionality The corresponding Salvo LE and Pro libraries are libslcs430 a a and libslcs430ia a respectively You can Ctrl select multiple files at once Use View Symbol Browser if not visible 14 AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430
15. r MSP430 Click Open when finished The salvocfg h Header File You will also need a lication Note 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 for this project contains only define define define define define OSBYTES_OF_DELAYS it OSENABLE IDLING HOOK TRUE OSENABLE BINARY SEMAPHORES TRUE OSEVENTS L OSTASKS e Listing 2 salvocfg h for a Source Code Build Create this file and save it in your project directory e g c temp salvocfg h Add it to the Salvo Configuration File folder in the Project Explorer Your Project Manager window should now look like this Project Explorer l Solution myex1 1 project C myex1 C Listings a Salvo Configuration File Salvo Help Files Salvo Libraries Salvo Source Files men Source Files KEE hj salvocfg h t binsem c _ delay c tJ event c tj idle c tJ init c tj inittask c amp mem c dem portcs430 asm gins c t sched c t timer c amp main c Figure 14 Complete Project Manager Window for a Source Code 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 viewing editing etc Building the Project For a successful compile your project must also include a h
16. s etc AN 23 Building a Salvo Application with Rowley Associates CrossStudio for MSP430 11 Application Note M CrossStudio for MSP430 break sched c O x File Edit View Project Debug Tools Target Window Help O oe Mea a O OR Zoe 02 92 208 2 amp ov B QDOR _osschedo aw Project Project Explorer X Project Explorer X 3 Help mem c main c idle c inittask c delay c sched c employed so that we re able to run OSIdlingHook Ti x By interrupts enabled and without re testing OScTcek J solution XI I project a else myex1 C Listings 3 Salvo Configuration mark the fact that an idle ctxSw occurred h salvocfg h if OSGATHER STATISTICS amp amp OSENABLE COUNTS a pi Files alvo Libraries amp amp OSENABLE IDLE COUNTER d Salvo Source Files OSidleCtxSws EJ binsem c endif t delay c tJ event c done clean up ere if OSUSE INLINE OSSCHED FJ inittask c OSDecCallDepth t merc endif dsn portcs430 asm tj gins c i t sched c OSEndCriticalSection timer c 3 Source Files there was no eligible task so run the idling SHH if OS ENABLE IDLING HOOK OSIdlingHook a Symbol Browser X Browser a ja Girields ff Name ES Range mem c portcs430 a gins c sched c OSSc
Download Pdf Manuals
Related Search
Related Contents
user guide - Dometra Store Samsung HT-TZ312 User's Manual Tektronix TDS 540 User's Manual Samsung Cerami Cooktop C61RACN CARACTERÍSTICAS DVD Player E360K Manual del Propietario Copyright © All rights reserved.
Failed to retrieve file