Home
AN-13 Building a Salvo Application with Keil`s C51 C Compiler and
Contents
1. File name timer c delay c ewent c init c inittask c me Add Files of type C Source file c Close Figure 8 Adding Salvo Source Files to the Project Click on Close when finished Your project window should now look like this i x 44 Target 1 ay Source Group 1 km 2 main c 4 Salvo Configuration File ue amp Salvo Libraries oven Salvo Sources timer c delay c event A inite 4 inittask c a 2 mem c port8051 c 4 qins c sched c binsem c Files Figure 9 Project Window for a Source Code Build AN 13 Building a Salvo Application with Keil s C51 C Compiler and uVision IDE Application Note 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 for this project contains only define OSBYTES OF DELAYS 1 define OSENABLE IDLING HOOK TRUE define OSENABLE BINARY SEMAPHORES TRUE define OSEVENTS 1 define OSTASKS 3 FOeTINeG OSLOC ALL data 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 We also recommend adding it to the project s Salvo Configuration File group using Project gt Targets Groups Files gt Groups Add Files etc Note To add a header file
2. Application Note 750 Naples Street San Francisco CA 94112 415 584 6360 htto www pumpkininc com Building a Salvo Application with Keil s C51 C Compiler and LVision IDE Introduction This Application Note explains how to use Keil s http www keil com C51 compiler and u Vision IDE to create a multitasking Salvo application for the 8051 family of microcontrollers We will show you how to build the Salvo application contained in salvo ex exl main c for a generic 8051 microcontroller using the Keil tools For more information on how to write a Salvo application please see the Sa vo User Manual Before You Begin If you have not already done so install the C51 and u Vision tools With the uVision IDE you will be able to run and debug this application in the simulator or on real hardware if available Creating and Configuring a New Project Create a new uVision project using Project gt New Project In the Create New Project window navigate to your working directory in this case we ve chosen c temp and enter a name for the project we ll use myex1 in the File Name field created by Andrew E Kalman on Jul 27 2002 updated on Jul 27 2002 All trademarks mentioned herein are properties of their respective companies Application Note Project Files uv2 Z Figure 1 Creating the New Project Click on Save to continue The Select Devices for Target Target 1 window appears Under the CPU
3. n to a Group in the Get Filetype window you must specify that the file is of type Text Document file for it to be accepted Building the Project AN 13 Building a Salvo Application with Keil s C51 C Compiler and Vision IDE For a successful compile your project must also include a header file e g reg51 h for the particular chip you are using We recommend that you include it in your project s salvocfg h Fora library build your salvocfg h would look like this include lt reg51 h gt define OSUSE_LIBRARY TRUE define OSLIBRARY_TYPE Qiok define OSLIBRARY_GLOBALS OSD define OSLIBRARY_CONFIG OSA define OSLIBRARY_VARIANT OSB Listing 3 salvocfg h with Target specific Header File With everything in place you can now build the project using Project gt Build Target or Project gt Rebuild all target files The build results can be seen in the Build window Application Note Building targer Target 1 compiling timer c compiling delay c compiling event c compiling init c compiling inittask c compiling mem c compiling port8051 c compiling qins c compiling sched c compiling binsem c linking Program Size data 46 0 xdata 0 code 1028 myexl 0 Error s 0 Warning s Listing 4 Source Code Build Results This example uses a total of 46 bytes of RAM in the data space and 1028 bytes of ROM in the code space Note The library based projects supplied in the Salvo for 805
4. tab select and expand Generic J Use ExtendediAscenblen Axa1 instead of Ag H Atmel Wireless amp uC m Cybernetic Micro Systems m Cygnal Integrated Products H Cypress Semiconductor amp Daewoo Dallas Semiconductor H Domosys H Generic 8031 all Variants E 8032 all Variants 8052 all Variants E C166 all Variants E C16 all Variants m Honevwell Figure 2 pVision Device Selection Window with Generic 8051 Selected Select 8051 all Variants and click on OK to continue Now let s setup the project s options for Salvo s pathnames etc Choose Project gt Options for Target Target 1 gt C51 and define any symbols you may need for your project in the Preprocessor Symbols gt Define area In the Include Paths add salvo inc AN 13 Building a Salvo Application with Keil s C51 C Compiler and uVision IDE Application Note Options for Target Target 1 Target Output Listing C51 A51 BL51 Locate BL51 Misc Debug Preprocessor Symbols Define svsi Undefine Code Optimization Warnings Waminglevel2 ss Level 8 Reuse Common Entry Code Serie ree eee ps Emphasis Favorspeed F Global Register Coloring ae E pa E linker Gade Packing rex AJMP TACAN M ieapunnebies in erdir l Don tuse absolute register accesses S enable ANSI integer promatonriles Include eAsalvo inc Paths Misc Controls Compiler B
5. 1 family distributions use salvo src mem c and the appropriate entries in the salvocfg h header file to minimize the RAM usage See the Libraries chapter in the Salvo User Manual for more information Testing the Application You can test and debug this application using the wuVision simulator or real hardware You launch the debugger after a successful build by choosing Debug gt Start Stop Debug Session You can use all of the IDE s supported features when debugging and testing Salvo applications This includes breakpoints profiling watch windows tracing etc 8 AN 13 Building a Salvo Application with Keil s C51 C Compiler and uVision IDE PUMPKIN Application Note WW myexl pVision2 File Edit View Project Debug Peripherals Tools SVCS Window Help asugih e E EA AA j ulsa ma ie ORO gt 80 AlBrROED HHH HHH HHH HHH HHH HAHAH HHH HHRMA HHH HHH E E E E E E E E HHH if OSUSE_ARRAYS amp amp OSDISABLE_TASK_PRIORI OStypeErr OSInitPriolask OStypeTcbhP tcbhP EE OStypePrio prio a OStypeErr err intVec OSIncCallDepth prelate if prio gt OSLOWEST_PRIO i prio OSLOWEST_PRIO OSWarn OSInitPrioTask OSMakeStr incorrect task priorit OSLOWEST_PRIO CIOE Salvo the fre Files structtch union lt untaqged gt C 0x0C02 D 0x00 struct lt untaqqed gt m ea NM A PAA Figure 10 Testing a Salvo Application in Vision Debu
6. ROWSE INCDIR c salvo inc DEFINE SYS DEBUG OBJECTEXTEND control string ha OK Cancel Defaults Figure 3 C51 Options for Target Click on 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 gt Targets Groups Files gt Groups Add Files select Source Group 1 under Available Groups click on Add Files to Group navigate to your project s directory select your main c and click on Add Your project window should now look like this f Target Source Group 1 ES 4 main c B fies Figure 4 Vision Project Window with your Source File s Click on Close after you are adding source files to your project Creating Groups for Salvo Files For legibility and organizational purposes we recommend you add additional groups to your project to hold Salvo files They are Salvo Configuration File Salvo Libraries Salvo Sources AN 13 Building a Salvo Application with Keil s C51 C Compiler and Vision IDE 3 Application Note Add these groups now using Project gt Targets Groups Files gt Groups Add Files gt Group to Add When done your project window should look like this f Target 1 Source Group 1 km E main c A Salvo Configuration File A Salvo Libraries a Salvo Sources Files Figure 5 pVision Project Window with your Source File s and Salvo Groups Adding Salvo sp
7. ecific 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 C51 compiler is sfc51sdab 1lib Choose Project gt Targets Groups Files gt Groups Add Files select Salvo Libraries under Available Groups click on Add Files to Group choose Library file lib under Files of type navigate to the salvo lib directory and select sfc51sdab 1ib Add Files to Group Salvo Libraries 2x Lookin S lib gt amp al al stc51lxab lib sfc51 Ixma lib sfc51 sdae_lib sfc51sdmb lib feel Sf HE sfc51 kae lib HE sfc51 xmb lib Histchisddalib fstcSisdmelib fst HE sfc51 Ixda lib HE sfc51 Ixme lib HE sfc51 sddblib HE sfc51sata lib HE st Hy sfc51 Ixdb lib HE sfc51 Ixta lib HE sfc51 sdde lib HE sfc51 sdtb lib st HRY sfc Ixde lib HE sfc511 Ixtb lib HE sfc51 sdea lib HE sfc51 sate lib Hest HR sfc51 xea lib HE sfc51 Ixte lib HR sfc51 sdeb lib FE sfc51 siaa lib Hest HRY sfc51 Ixeb lib HE sfc51sdaa lib HE sfc51sdee lib HE sfc51 siab lib HE sf HRY sfc51 Ixee lib HE sfc51sdab lib HestcSisdmalib sfcStsiae lib He sf Pees gt File name sfc51 sdab lib Add Files of type Library file lib Close Figure 6 Adding the Library to the Project Click on Add then on Close when you a
8. gger Note uVision supports debugging at the source code level Only applications built from the Salvo source code 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 C51 Error can t open file salvo h If you fail to add salvo inc to the project s include paths see Figure 3 the compiler will generate errors like these AWBuild target Target 1 compiling main c main c 15 error C316 can t open file salvo h MAIN C 28 error C132 _ OSLabel not in formal parameter list MAIN C 28 error C141 syntax error near _OSLabel MAIN C 33 error C132 _ OS5Label not in formal parameter list MAIN C 33 error C141 syntax error near void MAIN C 34 error C132 Taskl not in formal parameter list MAIN C 34 error C141 syntax error near MAIN C 37 error C132 Pl not in formal parameter list MAIN C 38 error C132 O5_Delay not in formal parameter list MAIN C 39 error C141 syntax error near Figure 11 Compiler Error due to Missing salvo inc Include Path AN 13 Building a Salvo Application with Keil s C51 C Compiler and Vision IDE 9 Application Note 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 o
9. ld The application in salvo ex ex1 main c contains calls to the following Salvo user Services OS_Delay OST ii OS WaitBinSem OSSignalBinSem OSCreateBinSem OSSched OSCreateTask OSTimer OSEi Application Note 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 POLrcoUS L c event c gains sC Inre sched c inittask c timer c To add these files to your project choose Project gt Targets Groups Files gt Groups Add Files select Salvo Sources under Available Groups click on Add Files to Group choose C source file c under Files of type navigate to the salvo src directory select the c files listed above and click on Add Add Files to Group Salvo Sources 2x Look in a src gl c 3 array C destroy c inittask c msgqe c W binsem c HB eflag c HB inittch c FE msgqq3 c Hej binsern2 c HE etlag2 c HB intvi c HE port8051 c es SE Wi chk c E eid c W license c Fi portc18 c Bse HE debug c HB event c ey mem c HE portv c es St He delay c We idle c Fe msg c FE prio c Feta HE delay2 c W init c HE msg2 c HE qdel c Feta Pe delay3 c W initecb c He msgg c FE qins c a ta
10. re finished You can find more information on Salvo libraries in the Salvo User Manual Your project window should now look like this 4 AN 13 Building a Salvo Application with Keil s C51 C Compiler and uVision IDE Application Note x f Target1 Source Group 1 main c 3 Salvo Configuration File Salvo Libraries 4 sfc51sdab lib 3 Salvo Sources E Files GP Regs Figure 7 Vision Project Window for 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 6 your salvocfg h should contain only define OSUSE_LIBRARY TRUE define OSLIBRARY_TYPE OSF define OSLIBRARY_GLOBALS OSD define OSLIBRARY_CONFIG OSA define OSLIBRARY_VARIANT OSB Listing 1 salvocfg h for a Library Build Create this file and save it in your project directory e g c temp salvocfg h We also recommend adding it to the project s Salvo Configuration File group using Project gt Targets Groups Files gt Groups Add Files etc Note To add a header file n to a Group in the Get Filetype window you must specify that the file is of type Text Document file for it to be accepted Proceed to Building the Project below Adding Salvo Source Files AN 13 Building a Salvo Application with Keil s C51 C Compiler and Vision IDE If you have a Salvo distribution that contains source files you can do a source code build instead of a library bui
11. s includes salvo tut tul sysi and each project defines the syst symbol Complete projects using Salvo source code are contained in the project files salvo tut tul 6 sysi tul 6pro Uv2 Complete projects using Salvo standard libraries are contained in the project files salvo tut tul 6 sysi tul 6le Uv2 These projects also define the MAKE_WITH_STD_LIB symbol Complete projects using Salvo freeware libraries are contained in the project files salvo tut tul 6 sysi tul 6lite Uva These projects also define the MAKE_WITH_FREE_LIB symbol AN 13 Building a Salvo Application with Keil s C51 C Compiler and Vision IDE Ee Application Note This Salvo project supports a wide variety of targets and compilers For use with uVision and the C51 compiler it requires the SySI 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 library is slc51sdab lib 3 You can Ctrl select multiple files at once AN 13 Building a Salvo Application with Keil s C51 C Compiler and Vision IDE 11
12. ther included Salvo header files If you fail to create a salvocfg h header file in the project s own directory the compiler will generate errors like these x zi Build target Target 1 compiling main c C SALVONINCNSALVO H 279 error C316 can t open file salvocfg h MAIN C 37 error C202 Pl undefined identifier compiling timer c C SALVONINCNSALVO H compiling delay c C SALVONINCNSALVO H 279 error C316 can t open file salvocfg h 279 compiling event c error C316 can t open file salvocfg h C SALVONINCNSALVO H 279 error C316 can t open file salvocfg h compiling init c C N SALVONINCNSALVO H 279 compiling inittask c error C316 can t open file salvocfg h Figure 12 Compiler Error due to Missing salvocfg h By adding the project s own directory to the project s include path you enable the compiler to find the project specific header file sal vocrg n Cannot See Window Upon Opening Project Example Projects 10 If you can t see a particular window after opening an uVision project that s part of a Salvo distribution it may be because your display s resolution is less than that used to create the project Select Window gt Tile Horizontal to make all open windows visible Example projects for the C51 compiler and u Vision IDE are found in the salvo tut tul 6 sysi directories The include path for each of these project
Download Pdf Manuals
Related Search
Related Contents
Garantía de secadora GE. 2 - Migros 県域をカバーする広域地域医療連携普及促進実践事業 [PDF Ingersoll Rand 114GQC Use and Care Manual Captura, alocação e repasse de operações Relatório de Definições ficha técnica - Suministros Herco Cycles internationaux : éléments pour une problématique FORERUNNER ® 405 owner`s manual NetworXTM Series NX-1701E Proximity Card Reader Copyright © All rights reserved.
Failed to retrieve file