Home

RM-HTARCLITE Salvo Compiler Reference Manual

image

Contents

1. define OSLIBRARY_VARIANT OSB Listing 1 Example salvocfg h for Library Build Using sfcv8ab lib Salvo LE amp Pro Library Build define OSUSE_LIBRARY TRUE define OSLIBRARY_ CONFIG OST define OSLIBRARY VARIANT OSA Listing 2 Example salvocfg h for Library Build Using sicv8ta lib Salvo Pro Source Code Build define OSENABLE IDLING _HOOK TRUE define OSENABLE_ SEMAPHORES RUE define OSEVENTS 1 define OSTASKS 3 Listing 3 Example salvocfg h for Source Code Build 6 RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C The RTOS that runs in tiny places Performance Memory Usage Reference Manual tutorial memory usage total ROM total RAM tullite 383 31 cu2lite 538 32 tu3lite 579 34 cudite 1183 48 tu5lite 1828 72 tu6lite 1994 72 tu6pro 1819 68 Table 4 ROM and RAM requirements for Salvo Applications built with HI TECH s ARClite C C Compiler Special Considerations Stack Issues For architectural reasons HI TECH s ARClite C C compiler does not pass parameters on the stack Nor does it allocate memory for auto local variables on the stack Instead it employs a static overlay model This has advantages in speed and memory utilization but it precludes recursion and has other impacts Multiple Callgraph Issues RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C By default it is expected that Salvo services will only be called from the background main loop task level
2. interrupts are enabled when I is cleared 0 and disabled when 1 RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C is set 1 Normally when an interrupt is acknowledged and 1 is automatically set the interrupt is processed with the alternate register set and then the normal register set is restored upon returning from the interrupt This implementation was designed to improve interrupt performance Unfortunately this scheme causes problems with any background task level code that wishes to explicitly disable interrupts e g for a critical code section that accesses global variables That s because it changes the register set in use which is at odds with the compiler s register allocation and use Most ARClite microRISC users change the default implementation to separate the register bank switching from the actions of the I bit In these implementations register bank switching requires an explicit action on the part of the programmer The result is that interrupts can be explicitly disabled without switching the register bank The only change made to the VS microRISC CPU core is that PSR 4 is used select the alternate bank of registers instead of PSR 3 I bit Using a PSR 4 allows software to decide when to select the alternate register bank Masking interrupts without switching register banks allows software to perform atomic operations without losing the contents of the registers Interrupts can use the a
3. This is the default configuration for source code builds b variant libraries allow service calls only from the background level Should you wish to call certain services from the foreground interrupt level you will need to set OSCALL_OSXYZ configuration options for source code builds or use a different library see Table 2 for library builds From Variant above we find that the f variant libraries allow you to call event reading and signaling services from the foreground Similarly the a variant libraries allow you to call the applicable services from anywhere in your code The RTOS that runs in tiny places Reference Manual The interrupt_level Pragma When using the a variant libraries each instance of an applicable service in use must be called from the foreground i e from an interrupt Also ARClite C s interrupt_level pragma must be set to 0 and placed immediately ahead of the application s interrupt routine like this pragma interrupt_level 0 void interrupt IntVector void OSStartTask TASK_P Listing 4 Setting the HI TECH ARClite C interrupt_level Pragma for an ISR when Using a variant Libraries ARClite C requires this in order to manage the parameter overlay areas for functions located on multiple call graphs Note This pragma has no effect if there aren t any functions located on multiple call graphs Therefore it s OK to add it to any application compiled with ARClite C Example Foregr
4. tul sysl salvo tut tu2 sysl salvo tut tu3 sysl salvo tut tu4 sysl salvo tut tu5 sysl salvo tut tu6 sysl directories of every Salvo for ARClite microRISC distribution Table 1 illustrates important features of Salvo s port to HI TECH s ARClite C C compiler RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C Sm dV 0 Reference Manual general Salvo Lite LE amp Pro available distributions for ARClite microRISC supported targets ARClite microRISC core header file s portv8c h other target specific file s portv8c as project subdirectory name s SYST salvocfg h compiler auto detected yes libraries salvo lib subdirectory htv8c context switching function based via anette OSDispatch amp OSCtxSw _OSLabel required yes size of auto variables and total size must not exceed 255 8 bit function parameters in tasks bytes interrupts controlled via I bit PSR 3 disabled in critical sections OSDisptach and OSCtxSw interrupt status preserved in oe no critical sections interrupts disabled on entry and method used enabled on exit of critical sections nesting limit no nesting permitted alternate methods possible yes debugging source level debugging with Pro library builds yes compiler bitfield packing support no printf p support yes yes va_arg support yes Table 1 Features of Salvo Port to HI TECH s ARClite C C Compiler Libraries Nomenclat
5. Reference Manual 750 Naples Street San Francisco CA 94112 415 584 6360 http www pumpkininc com Salvo Compiler Reference Manual HI TECH ARClite C J Salvo The RTOS that runs in tiny places created by Andrew E Kalman on Feb 23 2004 updated on Feb 23 2004 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 ARC International s http www arc com ARClite microRISC synthesizable 8 bit RISC core general purpose microprocessor with HI TECH Software s http www htsoft com ARClite C compiler Note The ARClite microRISC was originally developed and marketed by VAutomation as the V8 u RISC 8 bit synthesizable core At the time that Salvo was ported to this processor the HI TECH compiler was called V8C and HI TECH s IDE for the V8 was called HPDVS8 Currently the naming convention used within the Salvo for ARClite microRISC distribution contains references to ARClite and V8 Related Documents Example Projects Features The following Salvo documents should be used in conjunction with this manual when building Salvo applications with HI TECH s ARClite C C compiler Salvo User Manual Application Note AN 30 Example Salvo projects for use with HI TECH s ARClite C C compiler and the HI TIDE HPDV8 IDE can be found in the salvo tut
6. ble interrupts via setting and clearing the 1 bit respectively The V8C compiler was a DOS e g non Win32 application with certain runtime restrictions e g support for only DOS style 8 3 filenames and extensions This is done automatically through the HI_TECH_c and _v8 symbols defined by the compiler See Interrupt Control The lack of an addressable stack severely limits the scope of alternate methods Salvo v3 2 4 with V8C v7 85PLI1 In bytes as reported under total Program ROM In bytes as reported under total Data RAM Salvo always uses level 0 OSSignalBinSem like many other user services disables interrupts on entry and blindly re enables them on exit The re enabling of interrupts if placed inside an ARClite microRISC interrupt routine causes problems OSSignalBinSem in the f and a variant libraries control interrupts differently See ARClite C manual for more information VAutomation Inc V8 microRISC Synthesizable 8 bit RISC Microprocessor Core Reference Manual September 1999 s Correspondence with Salvo for V8 uRISC user 2003 O oNu RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C
7. he foreground you ll have to use the a variant library as explained above A complication arises when you need an a variant library for a particular event type and you also are using additional event types In this case each instance of an applicable event service in use must be called from the foreground If it s not called from the foreground the compiler issue this error message Error file function _OSSignalBinSem is not called from specified interrupt level Exit status 1 However it need not be called from the background If you have the opposite situation e g you are using an a variant library for one type of event and you need to call an event service for a different event type only from the background one solution is to place the required foreground call inside an interrupt handler with a conditional that prevents it from ever happening e g pragma interrupt_level 0 void interrupt IntVector void real code is here dummy to satisfy call graph if 0 OSSignalBinSem OSECBP 1 This creates a call graph acceptable to HI TECH s ARClite C C compiler and allows a successful compile and execution Interestingly the optimizer will remove the call from the final application In the original V8 core specification bit 3 in the Processor Status Register PSR 3 the I bit selects a second bank of registers which are used only during interrupt processing Additionally
8. lternate register bank by simply executing a STP 4 opcode which is considerably faster than pushing all of the registers Also upon the execution of the RTI opcode at the end of the interrupt service routine the PSR is reloaded with the value from the stack This automatically selects the register bank that was in use before the interrupt was taken Note that it is up to the software to very carefully manage which interrupts will use the alternate register bank by setting PSR 4 and which interrupts will simply push the required registers onto the stack Note that PSR 4 cannot be used for any other purpose 5 In order to be compatible with the original VAutomation Simulator which implements register bank switching when the I bit is changed the default definitions for Salvo s interrupt controlling macros OSDi and OSEi do not explicitly manipulate the I bit While appropriate for use in the simulator it is unlikely that these definitions will work for real target hardware RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C 11 The RTOS that runs in tiny places 12 Reference Manual When targeting real hardware Salvo Pro users should add the following definitions to their salvocfg h files and rebuild their projects and also use them when building custom libraries O di define OSDi Ei ei define OSEi where di and ei are defined by HI TECH s ARClite C C compiler to disable and ena
9. nction to prevent corruption of parameters and or return values Therefore you must call osProtect immediately before and oSUnprotect immediately after all background instances of every Salvo service that is called from both the background and foreground levels e g void TaskN void OSProtect OSSignalBinSem SEM_P OSUnprotect pragma interrupt_level 0 void interrupt IntVector void OSSignalBinSem SEM_P Tip Wrapping osprotect the affected Salvo service and OSUnprotect within another function can make your code more legible The wrapper may only be called from mainline code i e it can only have a single callgraph A wrapper function might look like this OSSignalBinSem_Wrapper OStypeEcbP ecbP OSProtect OSSignalBinSem ecbP OSUnprotect and a wrapper macro might look like this define OSSignalBinSem_Wrapper ecbP do OSProtect OSSignalBinSem ecbP OSUnprotect while 0 RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C 9 The RTOS that runs in tiny places Reference Manual Example Mixed Signaling of Multiple Event Types Interrupt Control 10 The library variants affect all event services equally that is an f variant library expects all applicable event services to be called from the foreground i e from within interrupts If you wish to call some services from the background and others from t
10. ound Signaling of One Event Type In a library build if you were to move a call to oSSignalBinSem from a Salvo task i e from the background to an interrupt handler i e to the foreground without changing the library variant you d find that the application crashes from a stack overflow almost immediately This is because the default interrupt control in OSSignalBinSem is incompatible with being placed inside an interrupt To circumvent this you must change OSLIBRARY_VARIANT to OSF and link an f variant library e g sfcv8af lib note the f for foreground in the variant field in order to properly support event service calls in the foreground Example Foreground and Background Signaling of One Event Type If we call oSSignalBinSem from a task and from within an interrupt handler without addressing the callgraph issues the compiler issues an error message Error file function _OSSignalBinSem appears in multiple call graphs rooted at intlevel0 and _main Exit status 1 RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C Sm dV 0 Reference Manual To resolve this add the interrupt_level 0 pragma to your interrupt handler see Listing 4 above and use the a variant library after setting OSLIBRARY_TYPE to OSA OSProtect and OSUnprotect HI TECH s ARClite C C compiler requires that when a function is contained in multiple callgraphs interrupts must be disabled around that fu
11. r HI TECH s ARClite C C compiler are provided in different variants as shown in Table 2 If your application does not call any Salvo services from within interrupts use the b variant If you wish to these services exclusively from within interrupts use the f variant If you wish to do this from both inside and outside of interrupts use the a variant In each case you must call the services that you use from the RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C The RTOS that runs in tiny places Build Settings RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C Reference Manual correct place in your application or either the linker will generate an error or your application will fail during runtime variant code description Applicable services can be called from anywhere i e from the Sas foreground and the background simultaneously b OSB Applicable services may only be called from the background default OSF Applicable services may only be called from the foreground Table 2 Variants for Salvo Libraries HI TECH s ARClite C C Compiler See the oOSCALL_osxyzZ configuration parameters for more information on calling Salvo services from interrupts See Special Considerations below for more information on using library variants Salvo s libraries for HI TECH s ARClite C C compiler are built using the default settings outlined in the Libraries chapter of the Salvo U
12. ser Manual Target specific settings and overrides are listed in Table 3 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 watchdog timer not affected system tick counter available 32 bits Table 3 Build Settings and Overrides for Salvo Libraries for HI TECH s ARClite C 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 Available Libraries There are 30 Salvo libraries for HI TECH s ARClite C C compiler Each Salvo for ARClite microRISC distribution contains the Salvo libraries of the lesser distributions beneath it salvocfg h Examples Below are examples of salvocfg h project configuration files for various different Salvo distributions and the ARClite microRISC Note When overriding the default number of tasks events etc in a Salvo library build ostasKs and OSEVENTS respectively must also be defined in the project s salvocfg h If left undefined the default values see Table 3 will be used Salvo Lite Library Build define OSUSE_LIBRARY TRUE define OSLIBRARY_TYPE OSF define OSLIBRARY_CONFIG OSA
13. ure The Salvo libraries for HI TECH s ARClite C C compiler follow the naming convention shown in Figure 1 RM HTARCLITE Salvo Compiler Reference Manual HI TECH ARClite C 3 The RTOS that runs in tiny places Reference Manual Type Target Configuration Variant sfcv8ab lib variant a fns called from anywhere Salvo library b fns called from background only f fns called from foreground only not applicable configuration type multitasking with delays and events f freeware multitasking with delays I standard multitasking with events multitasking only t multitasking with delays and events tasks can wait with timeouts target ARClite C ARClite microRISC formerly V8 u RISC 30a0fM Figure 1 Salvo Library Nomenclature HI TECH s ARClite C C Compiler Salvo Lite distributions contain freeware libraries All other Salvo distributions contain standard libraries See the Libraries chapter of the Sa vo User Manual for more information on library types No target specific identifiers are required 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 When using HI TECH s ARClite C C compiler the Salvo source code must be properly configured via the appropriate configuration parameters The Salvo libraries fo

Download Pdf Manuals

image

Related Search

Related Contents

Time Voice Box for Navigation- and Precision - Flying  TRANSVIDEO II MODE D`EMPLOI  3D 1280P HD Media Player user manual  Unger RubOut  Sanyo 42LM5R  Canon i470D Quick Start Manual  Milwaukee 6017 User's Manual  

Copyright © All rights reserved.
Failed to retrieve file