Home

RM-MCC18 Salvo Compiler Reference Manual

image

Contents

1. Note In cases where the effects of procedural optimization are otherwise beneficial to an application it is recommended that source code c modules be dedicated to holding Salvo tasks and no other functions Thus the scope of disabling the procedural abstraction optimizations can be limited to just Salvo tasks thereby allowing the use of this optimization on other functions where it is appropriate RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18 The RTOS that runs in tiny places Storage Classes Stack Issues Stack Size RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18 Reference Manual Microchip s MPLAB C18 C compiler supports three different default global storage classes for local variables and function parameters auto static and overlay The storage class for all modules in a project must match in order to avoid link time errors All of Salvo s libraries are built with the auto default storage class Should you wish to build a Salvo application with a different default storage class you ll need Salvo Pro to either do a source code build with the alternate default storage class in force or to create 2 custom Salvo library with the alternate default storage class The different storage classes are set at compile time via the sca scs and sco command line options For architectural reasons Microchip s MPLAB C18 C compiler passes parameters on a software stack and uses t
2. Limits on the Numbers of Tasks Events etc By default each of Salvo s larger global objects e g the array of task control blocks or tcbs is placed in its own data section This enables the use of the largest possible array size 256 bytes supported by the compiler and enables the compiler to efficiently pack all of Salvo s global objects into available RAM Note Because of this 256 byte limit on the size of arrays the numbers of Salvo tasks events message queues etc is limited not by the amount of total RAM on the PIC18 processor but by the number of elements that will fit within a 256 byte array i e within one bank For example the maximum value for OSTAsKS is 42 in a Salvo configuration that supports multitasking and events because 42 tasks require an array of OxFc 252 bytes The same application can also concurrently support up to 51 events Interrupt Service Routines 10 By default Microchip s MPLAB C18 C compiler preserves basic context in ISRs To properly declare an ISR that calls a Salvo service the save clause of the interrupt pragma should be used thusly RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18 The RTOS that runs in tiny places Reference Manual Interrupt Control pragma interrupt ISR save PROD section tmpdata void ISR void OSTimer Note Additional functions in the ISR may require additional arguments to the save clause See the M
3. C18 C Compiler The code required to access Salvo s global objects e g the task control blocks or tcbs will vary in size and speed depending on where the objects are located Since there are only 128 bytes of access RAM in the PIC18 architecture in larger applications it may be necessary to place Salvo s global objects in banked RAM RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18 5 The RTOS that runs in tiny places Configuration Build Settings Available Libraries Reference Manual Different library configurations are provided for different Salvo distributions and to enable the user to minimize the Salvo kernel s footprint See the Libraries chapter of the Sa vo User Manual for more information on library configurations Salvo s libraries for Microchip s MPLAB C18 C compiler are built using the default settings outlined in the Libraries chapter of the Salvo User Manual Target specific settings and overrides are listed in Table 4 compiled limits max number of tasks 3 max number of events 5 max number of event flags 1 max number of message 1 queues target specific settings delay sizes 8 bits idling hook enabled interrupt enable bits during critical sections GIEH GIEL 0 message pointers can point to ROM or RAM Salvo objects far system tick counter available 32 bits task priorities enabled watchdog timer cleared in OSSched Table 4 Build Settings and Overri
4. tiny places 12 Reference Manual Though the PIC18 architecture has a hardware call return stack depth limit of 32 levels Via either in line assembly or a function call As of MPLAB C18 v2 20 Le the non peripheral SFRs like TOSUIHIL STKPTR PCLATHIL PCL FSROHIL etc Each event flag has RAM allocated to its own event flag control block Each message queue has RAM allocated to its own message queue control block Salvo v3 2 1 with MPLAB C18 v2 2x In program addresses words In bytes all banks udata Does not include stack default 0x100 bytes Salvo global objects are in banked RAM far Salvo Pro build differs slightly from Salvo Lite build due to configuration see tutorial s salvocfg h By default all of MPLAB C18 s optimizations are enabled overlay applies only to local variables not function parameters Note that this may require changes to Salvo s makefile system since an additional command line argument will need to be passed to the compiler As of Salvo v3 2 4 E g with an e configuration library RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18
5. C18 C compiler RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18 Sm dV 0 Reference Manual general available distributions Salvo Lite LE amp Pro for Microchip PICmicro MCUs supported targets header file s other target specific file s PIC18 PlCmicro MCUs SOnaemic Cra Pontpierre RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18 project subdirectory name s SYSE salvocfg h compiler auto detected yes libraries salvo lib subdirectory mcc18 default storage class auto context switching via UTS OSCtxSw label _OSLabel required no size of auto variables and function parameters in tasks SITES memory memory models supported small and large stack models supported single bank and multi bank interrupts GIEL and or GIEH bits Controlled controlled via via OSPIC18_INTERRUPT_MASK configuration option interrupt status preserved in critical sections ees relevant GIE bits are saved to software stack on entry interrupts method used are disabled and relevant GIE bits are restored from software stack on exit nesting limit unlimited alternate methods possible yes debugging source level debugging only in source code builds compiler bitfield packing support no printf p support no no va_arg support yes Table 1 Features of Salvo Port to Microchip s MPLAB C18 C Compiler The RTOS that runs in tiny places Libraries Nomen
6. EUES 2 Listing 2 Example salvocfg h for Library Build Using slc18lfa lib Salvo Pro Source Code Build define OSENABLE IDLING _HOOK RUE define OSENABLE SEMAPHORES RUE define OSTASKS 9 define OSEVENTS 17 tdefine OSEVENT_FLAGS 2 define OSMESSAGE QUEUES 4 Listing 3 Example salvocfg h for Source Code Build RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C 18 7 The RTOS that runs in tiny places Performance Memory Usage Reference Manual tutorial memory usage total ROM total RAM tullite 644 34 cuz LCE 976 36 tu3lite 1026 38 tu4lite 1914 47 tu5lite 2708 59 tu lite 2988 62 tu6pro 2770 58 Table 5 ROM and RAM requirements for Salvo Applications built with Microchip s MPLAB C18 C Compiler Special Considerations Variables Inside Tasks Due to architectural limitations of the Salvo context switcher for Microchip s MPLAB C18 C compiler auto variables inside tasks are not supported and will lead to various runtime problems Therefore all variables inside tasks should be declared as static when using Microchip s MPLAB C18 C compiler to build a Salvo application Incompatible Optimizations The Microchip MPLAB C18 C compiler s procedural abstraction optimization is incompatible with Salvo tasks due to its potential effect on the Salvo context switcher osctxSw Therefore this optimization must be explicitly disabled Opa in any source file that contains Salvo tasks
7. PLAB C18 User s Guide for more information The PIC18 architecture supports two distinct priority levels When enabled two separate global interrupt enable bits GIEH and GIEL are used to control high and low priority interrupts respectively Interrupts are automatically disabled within Salvo s critical sections By default both GIEH and GIEL are reset i e made 0 during critical sections This is controlled by Salvo s OSPIC18_INTERRUPT_MASK configuration option default value OxC0 Salvo Pro users can reconfigure the way in which interrupts are disabled during critical sections by redefining OSPIC18_INTERRUPT_MASK in the project s salvocfg h For example if Salvo services e g OSTimer are called only from low priority interrupts then a value of 0x40 for OSPIC18_INTERRUPT_MASK ensures that only low priority interrupts are disabled during a Salvo critical section In this configuration high priority interrupts will therefore be unaffected by Salvo This is especially useful when high rate interrupts are present Note Salvo Pro users have the option of building custom libraries with interrupt disabling and re enabling controlled by non default values for OSPIC18_INTERRUPT_MASK See the Salvo User Manual for more information This is done automatically through the __18cxx symbol defined by the compiler RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C 18 11 The RTOS that runs in
8. Reference Manual 750 Naples Street San Francisco CA 94112 415 584 6360 http www pumpkininc com Salvo Compiler Reference Manual Microchip MPLAB C18 J Salvo The RTOS that runs in tiny places Copyright 2003 Pumpkin Inc last updated on Nov 26 2007 All trademarks mentioned herein are properties of their respective companies The RTOS that runs in tiny places Introduction Reference Manual This manual is intended for Salvo users who are targeting Microchip http www microchip com PIC18 PICmicro MCUs with Microchip s http www microchip com MPLAB C18 C compiler Related Documents Example Projects Features The following Salvo documents should be used in conjunction with this manual when building Salvo applications with Microchip s MPLAB C18 C compiler Salvo User Manual Application Note AN 12 obsolete Application Note AN 25 Note MPLAB C18 users are strongly advised to upgrade to Microchip s MPLAB IDE v6 30 or later Use AN 25 in place of AN 12 Example Salvo projects for use with Microchip s MPLAB C18 C compiler and the Microchip MPLAB IDEs v5 and v6 can be found in the salvo ex exl syse salvo tut tul syse salvo tut tu2 syse salvo tut tu3 syse salvo tut tu4 syse salvo tut tu5 syse salvo tut tu6 syse directories of every Salvo for Microchip PICmicro MCUs distribution Table 1 illustrates important features of Salvo s port to Microchip s MPLAB
9. clature Type Target Memory Model Reference Manual The Salvo libraries for Microchip s MPLAB C18 C compiler follow the naming convention shown in Figure 1 sfc18sna lib configuration multitasking with delays and events Salvo library multitasking with delays multitasking with events multitasking only multitasking with delays and events tasks can wait with timeouts 300 type memory type for global Salvo objects f freeware f far pointers are 16 bits l standard n near pointers are 8 bits memory model MPLAB C18 l large lt 2MB address space s small lt 64KB address space Figure 1 Salvo Library Nomenclature Microchip s MPLAB C18 C Compiler Salvo Lite distributions contain freeware libraries All other Salvo distributions contain standard libraries See the Libraries chapter of the Salvo User Manual for more information on library types The PIC18 s core architecture is consistent throughout the entire family Every Salvo library compiled under the small memory model can be used with any member of the PIC18 family provided that the size does not exceed 32K 64KB Salvo libraries compiled under the large memory model can be used with any member of the PIC18 family The Microchip MPLAB C18 C compiler s small and large memory models are supported In library builds the memory model applied to all of the source files must match that used in the library For source code builds the same m
10. des for Salvo Libraries for Microchip s MPLAB C18 C Compiler Note The compiled limits for tasks events etc in Salvo libraries can be overridden to be less all Salvo distributions or more all Salvo distributions except Salvo Lite than the library default See the Libraries chapter of the Salvo User Manual for more information There are 40 Salvo libraries for Microchip s MPLAB C18 C compiler Each Salvo for Microchip PICmicro MCUs distribution contains the Salvo libraries of the lesser distributions beneath it RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18 me dV 0 Reference Manual salvocfg h Examples Below are examples of salvocfg h project configuration files for different Salvo for PICmicro MCUs distributions targeting the PIC18C452 Salvo Lite Library Build define OSUSE_ LIBRARY TRUE define OSLIBRARY_TYPE OSF define OSLIBRARY_GLOBALS OSF define OSLIBRARY CONFIG OSA define OSTASKS 2 define OSEVENTS 4 define OSEVENT_FLAGS 0 define OSMESSAGE QUEUES ii Listing 1 Example salvocfg h for Library Build Using sfc18lfa lib Salvo LE amp Pro Library Build define OSUSE_LIBRARY TRUE define OSLIBRARY_TYPE OSL define OSLIBRARY_GLOBALS OSF define OSLIBRARY_CONFIG OSA define OSTASKS 7 define OSEVENTS 13 define OSEVENT_FLAGS 3 define OSMESSAGE QU
11. emory model must be applied to all of the source files RM MCC18 Salvo Compiler Reference Manual Microchip MPLAB C18 Sm dV 0 Reference Manual memory model code description Large memory model Program L OSE space is a maximum of 1M words 2MB Small memory model Program 3 099 space is a maximum of 32K words 64KB Table 2 Memory Models for Salvo Libraries Microchip s MPLAB C18 C Compiler Note Unlike the library configuration and variant options specified in the salvocfg h file for a library build none is specified for the selected memory model Therefore particular attention must be paid to the memory model settings used to build an application The memory model is usually specified on a node by node basis inside an IDE e g MPLAB Memory Type for Global Salvo Objects You can choose the memory type for Salvo s global objects in your application by choosing the appropriate library near type objects can be accessed the fastest but consume precious RAM in the Access Bank far type objects will be placed in banked RAM which will result in slower accesses The global object codes are listed in Table 3 memory type code description Salvo objects are declared as type ze OS s far and will be located in banked RAM Salvo objects are declared as type a f OSN near and will be located in the first 128 bytes of internal RAM i e in access RAM Table 3 Memory Types for Salvo Libraries Microchip s MPLAB
12. he PIC18 s hardware stack for call return addresses While the compiler supports both reentrant and static overlay models Salvo s implementation for this compiler is compatible only with the reentrant model By default Salvo is configured to work with MPLAB C18 s software stack of any size i e the single bank and multi bank Ls stack models If the single bank model is used MPLAB C18 s default then Salvo s OSMPLAB_C18_STACK_SIZE can be set to 256 or less and a minor savings in Salvo code size can be realized Warning If MPLAB C18 s multi bank stack model is chosen with Salvo s OSMPLAB_C18_STACK_SIZE set to 256 bytes or less errors will occur The RTOS that runs Reference Manual Salvo s Global Objects Locating Objects in Near Access or Banked RAM With Microchip s MPLAB C18 C compiler Salvo s global objects can be located en masse in one of two areas either in banked RAM or in access RAM With oOSMPLAB_C18_LOC_ALL_NEAR set to FALSE the default all of Salvo s objects are placed in banked RAM To locate all of the objects in access RAM in a Salvo Pro source code build set OSMPLAB_C18_LOC_ALL_NEAR tO TRUE Note Because of the small size of the PIC18 s access RAM locating Salvo s global objects in access RAM is rarely appropriate There are no provisions for uniquely placing selected Salvo global objects in access or banked RAM Salvo s osLoc_xyz configuration parameters do not apply

Download Pdf Manuals

image

Related Search

Related Contents

  Bedienungsanleitung Setup-Anleitung  11/7 H-4™ù`³  signes et manifestations d`appartenance religieuse  User Manual  Special Green All Purpose Cleaner Limpiador Brillante para Alfombras  KeepOut X8  200407003 93-2259 SMARTPROINT Owners Manual.qxd  ROF_Mission_Editor_U..  cx200s sliding table attachment for table saw  

Copyright © All rights reserved.
DMCA: DMCA_mwitty#outlook.com.