Pumpkin, Inc.

Pumpkin User Forums

OSENABLE_EVENT_READING

If you can't make Salvo do what you want it to do, post it here.

OSENABLE_EVENT_READING

Postby luben » Thu Jul 05, 2001 12:45 am

Hello,

I have some questions about OSENABLE_EVENT_READING.

In the manual you write that if it’s set to TRUE it enables (includes into the project) functions that make OSReadXYZ() of events like Msg, MsgQ, BinSem, Sem, etc.

But I don’t see any option to chose which one of them to include or not. I mean – if I have project with:
Semaphores, messages, message queues and binsemaphores and if I set this option to TRUE then SALVO will include all OSReadXYZ() into my file. And if I use only in one place this function, let’s say OSReadBinSem(), imagine how big over volume I can expect. I mean – setting this option to TRUE will generate all OSReadXYZ() for used events

And second – if I use calling functions OSReadXYZ() from interrupt (set OSCALL_OSRETURN_EVENT with OSFROM_ANYWHERE) #pragma directive will be set before to all of them. I’m not sure that this will not generate some errors into HiTech (especially when some function is not used). Well, it’s only my doubts…. Maybe I wrong.

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: OSENABLE_EVENT_READING

Postby aek » Thu Jul 05, 2001 9:29 am

1) Note that the effect of enabling some services depends on whether you're compiling with the source code or linking to existing libraries. If the former, then the size of your code is dependent on which modules (sem.o, binsem.o, msg.o, etc.) are included in your build. If the latter, then the linker only adds those functions that you actually use to your final executable (.hex) file.

So, when using the freeware libraries in Salvo Lite, which are compiled with OSENABLE_EVENT_READING, only those services that you actually use (e.g. OSReadBinSem()) will be included in your Salvo application. Even if you are using multiple event types with the freeware libraries (e.g. you call all the OSSignalXyz() routines), you'll still only have OSReadBinSem() added to your application if it's the only OSReadXyz() you call.

This illustrates how, for advanced users with the full version of Salvo, it's best to use a makefile to generate a "custom" library to which you link your application. This guarantees the smallest possible executable. The library need only be rebuilt when salvocfg.h is changed ... the alternative would be to put every single Salvo function in a separate source (.c) file, which we have chosen not to do ...

2) See AN-1 Example: Mixed Signaling of Multiple Event Types for an in-depth discussion of this issue

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: OSENABLE_EVENT_READING

Postby luben » Fri Jul 06, 2001 5:11 am

Hello,

So, the desired way of working with SALVO2.2 is to build libraries with options set in salvocfg.h . I mean - to obtain best code size.


Maybe from this view point demo users like me, have some advantage because they use only libraries and they get always very compact code. Including source files is maybe easier and faster, but this will produce not the best code.

By the way, if full version users try to compile project with include source files they will have some problems if they use only part of the functions (let's say - they use only OSReadBinSem, but they have Msg or Sem in addition). As I told you the #pragma directive can generate error messages for the uncalled functions (in this case OSReadMsg() and OSReadSem() will not be called at all). It's only up to you to check these doubts on full version.

Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: OSENABLE_EVENT_READING

Postby aek » Fri Jul 06, 2001 7:39 am

1) Users of the full version can also get the best code size by using the standard libraries ...

2) Under HI-TECH C, completely uncalled functions with the interrupt_level pragma must be called from an ISR -- you're correct. Library users will not encounter this problem, because they won't access uncalled functions at all. The solution for source code users is to either build libraries (best approach), or follow the examples in AN-1.

We limited the number of source files in v2.1 because it resulted in a large list of files having to be added to projects when adding source files as nodes. Now that standard libraries exist, perhaps we will separate those files into binsem2.c, msg2.c, etc.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: OSENABLE_EVENT_READING

Postby Salvo Tech Support » Fri Jul 06, 2001 7:43 am

Hi Luben.

Also note that OSReadXyz() and OSTryXyz() are all very small ...

------------------
-----------------------
Salvo Technical Support
Please request all tech support through the Forums.

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: OSENABLE_EVENT_READING

Postby luben » Fri Jul 06, 2001 7:54 am

Hello,

About uncalled functions, that have to be called in ISR (#pragma level 0 problem). What I immediately can imagine is to add them in ISR routine somewhere where they never could be called - let's say after impossible IF. Because they are not big size and because they will not be called at all (to consume time)- such approach is aceptable (it will add let's say 3 machine cycles more). By the way this is not a problem of SALVO, but of the HiTech.

About libraries. They are good thing and I agree that are very convenient for use. They have only one problem - every time when we make projects we need from different resources - sometimes 2 tasks, sometiomes 4, different number of different events. I mean, the size of all possible combinations is giant number of libraries.

I didn't understand - SALVO full version libraries are compiled with unlimited number of tasks, events and dalays? I didn't saw in the manual (well, from demo version) any word about this, or I skipped the right page.

And in the manual is not enough explanation about how the user can make own libraies. The way is good known - to compile project to LIB files. But I think that such explanation should be added into SALVO manual or at least some example from A to Z. I agree that SALVO is not for beginners at all, it's for experienced programmers and from this view point such explanation are not required.

Have you a nice weekend
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: OSENABLE_EVENT_READING

Postby aek » Fri Jul 06, 2001 8:54 am

1.
quote:
What I immediately can imagine is to add them in ISR routine somewhere where they never could be called - let's say after impossible IF.
This is the example in AN-1.

2.

quote:
every time when we make projects we need from different resources - sometimes 2 tasks, sometiomes 4, different number of different events.
This is also covered in AN-1, Reducing RAM Usage, and also in the Libraries chapter of the User Manual. You can reduce the RAM usage to the bare minimum when using libraries -- no RAM need be wasted.

3.

quote:
SALVO full version libraries are compiled with unlimited number of tasks, events and dalays?
Not exactly -- the libraries are compiled with the same number of tasks, events, etc., but the standard libraries can accept unlimited numbers of each, unlike the freeware libraries, which can only accept up to a maximum number of each. See Overriding Default RAM Settings in the Libraries chapter of the User Manual. The libraries must be compiled with default values for the number of tasks, events, etc. because of the lack of malloc() in PIC C.

4. Building libraries varies from compiler to compiler and is an advanced subject. Therefore it is not covered in the manual. We refer users to their compiler documentation (and to their make system documentation) if they want to generate libraries.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron