Pumpkin, Inc.

Pumpkin User Forums

Problem creating more than 3 tasks

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

Problem creating more than 3 tasks

Postby JohnT » Tue Jan 29, 2002 7:01 am

I've just recently upgraded to the full Salvo system, but I'm still having issues, creating more than 3 tasks.

Here's the situation...

In a header file, I have the following setup.

code:

#define Task1_BP OSTCBP(1)
#define Task2_BP OSTCBP(2)
#define Task3_BP OSTCBP(3)
#define Task4_BP OSTCBP(4)

And in the main startup code I have

code:

err=OSCreateTask(Task1,Task1_BP,Task1_Prio);
err=OSCreateTask(Task2,Task2_BP,Task2_Prio);
err=OSCreateTask(Task3,Task3_BP,Task3_Prio);
err=OSCreateTask(Task4,Task4_BP,Task4_Prio);


for the first three tasks, err returns a 0. for the fourth task though I get a return code of 0x10 which I believe is AN INVALID POINTER WAS PASSED TO THE USER SERVICE.

Here's my Salvocfg.h

code:

#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB
#define OSTARGET OSPIC18
#define OSTASKS 8
#define OSEVENTS 6
#define OSENABLE_SEMAPHORES TRUE
#define OSENABLE_BINARY_SEMAPHORES TRUE
#define OSENABLE_DELAYS TRUE
#define OSBYTES_OF_DELAYS 1


So, is there any obvious reason, why I can't activate more than 3 tasks?

[This message has been edited by JohnT (edited January 29, 2002).]

JohnT
 
Posts: 3
Joined: Tue Jan 29, 2002 12:00 am
Location: Troy, MI, USA

Re: Problem creating more than 3 tasks

Postby JohnT » Tue Jan 29, 2002 7:28 am

Hate doing this (answering my own question).

The issue was resolved by changing the type of library I was using in my makefile...

JohnT
 
Posts: 3
Joined: Tue Jan 29, 2002 12:00 am
Location: Troy, MI, USA

Re: Problem creating more than 3 tasks

Postby Salvo Tech Support » Tue Jan 29, 2002 10:13 am

Hi John.

Welcome to the Salvo User Forums!

Sounds like your makefile was still referencing a Salvo Lite (sf*) instead of a Salvo full version (sl*) library.

Well, that's easily remedied. :-)

Regards,

------------------
--------
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: Problem creating more than 3 tasks

Postby aek » Tue Jan 29, 2002 10:25 am

Re:

code:
#define OSUSE_LIBRARY               TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB
#define OSTARGET OSPIC18
#define OSTASKS 8
#define OSEVENTS 6
#define OSENABLE_SEMAPHORES TRUE
#define OSENABLE_BINARY_SEMAPHORES TRUE
#define OSENABLE_DELAYS TRUE
#define OSBYTES_OF_DELAYS 1

Just to clarify things -- this salvocfg.h won't have the results I think you intend. I'll expound on how to use libraries (see Libraries in Chapter 8 for more info):

Libraries are pre-compiled. This means that

code:
#define OSUSE_LIBRARY               TRUE
#define OSLIBRARY_TYPE OSL

#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT


are necessary to use the right library,

code:
#define OSTARGET                    OSPIC18

is optional (it's picked up automatically when you use picc-18), these
code:
#define OSTASKS                     8
#define OSEVENTS 6

will only have an effect if you add mem.c as a node to your project and link in the resulting mem.o before the Salvo library you're using, and
code:
#define OSENABLE_SEMAPHORES         TRUE
#define OSENABLE_BINARY_SEMAPHORES TRUE
#define OSENABLE_DELAYS TRUE
#define OSBYTES_OF_DELAYS 1

won't have any effect at all, because the library was already compiled with them set to TRUE. (BTW, OSENABLE_DELAYS is automatically set to TRUE whenever OSBYTES_OF_DELAYS or OSENABLE_TIMEOUTS are set to TRUE -- that's why OSENABLE_DELAYS is not listed in the Configuration chapter).

So, to get more tasks and events, you'll have to compile mem.c along with your source code and link in mem.o before sl*.lib. The a-variant library already has all the OSENABLE_XYZs for events set to TRUE, and has OSBYTES_OF_DELAYS set to 1, and changing them in your salvocfg.h won't affect the library.

Of course, since it's a library, you won't end up with any services that you're not using (e.g. event flag services), so you needn't worry about code bloat when using the libraries.

If you really do need a special configuration (like 16-bit delays), then you'll have to build entirely from source code, with all the necessary configuration options set to their non-default value. But I suggest you go as far as you can while linking to libraries before you try that.

Perhaps a good rule of thumb is to use the smallest salvocfg.h possible for any particular project. For yours right now, it would be

code:
#define OSUSE_LIBRARY               TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB
#define OSTASKS 8
#define OSEVENTS 6

where the presence of the last two requires that you add mem.c as a node to your project and link mem.o prior to sl*.lib in order for OSTASKS and OSEVENTS to have any effect.

Regards,

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

[This message has been edited by aek (edited January 29, 2002).]

-------
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 1 guest

cron