Pumpkin, Inc.

Pumpkin User Forums

OS_Delay Problem

For issues specific to Microchip's PICmicro® MCUs, including compilers (e.g. HI-TECH PICC & PICC-18, Microchip MPLAB®-C18) and IDEs (e.g. Microchip MPLAB®).

OS_Delay Problem

Postby kevin w » Thu Oct 03, 2002 1:22 am

We have been trying to utilize the delay features of Salvo with the PIC 16F877 using PIC-C's compiler version 8.00 PL3. We have checked the Salvo Manual as well as other sources and our code appears to be correctly using the OS_Delay function.

Our basic design is simple and straightforward. We have enabled interrupts and configured Timer2 and written an ISR that calls OSTimer(). Another task is configured to use OS_Delay(1, our_OSLabel_task_name) to wait for a specified number of ticks. All of our code is consistent with the examples and usage defined in the manual and found elsewhere.

Furthermore, we have tried to compile tutorial six in the manual and have encountered the same error.

The linking error that we receive is:

signatures do not match: _OSDelay (c:salvolibslp42caa.lib: delay.obj): 0x2078/0x1078 (error)

We have tried the various library options (i.e. all slp42c**.lib options).

Do you have any suggestions regarding this matter or knowledge of similar difficulties? Thank you in advance.

The University of Akron

kevin w
 
Posts: 3
Joined: Wed Oct 02, 2002 11:00 pm

Re: OS_Delay Problem

Postby aek » Thu Oct 03, 2002 1:38 am

Hi Kevin.

Your problem is that you are using an a-variant library (slp32caa.lib) but you probably haven't set OSLIBRARY_VARIANT to OSA in your salvocfg.h file ...

Also, unless you are calling named Salvo services like OSSignalSem() from both mainline code and ISR code, you don't need an a-varaint library and can get by with a b-variant library, e.g. slp42Cab.lib. You'll also need to set OSLIBRARY_VARIANT to OSB in your slavocfg.h if you do this ...

So, the rule to remember is that the OSLIBRARY_TYPE, OSLIBRARY_CONFIG and OSLIBRARY_VARIANT in your salvocfg.h must match the letter codes in the library you use ... See Chapter 5 and CHapter 8 of the User Manual for more info ...

Also, "from the factory", the tutorials use b-variant libraries, and the build w/out errors. So it seems like you've changed the library Node in the MPLAB project without changing the OSLIBRARY_VARIANT in the project's salvocfg.h.

Hope this helps,

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

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

Re: OS_Delay Problem

Postby kevin w » Sun Oct 06, 2002 12:25 am

Thanks for your prior suggestion, but that turned out not to be the problem. We had tried both the AB and AA library combinations as well as several others out of desperation. In each case we have been careful to ensure that the salvocfg.h file was consistently set. We went back and retried things with your suggestion in mind but have still encountered the same error message.

Do you have any other thoughts on what the problem may be? We have tried everything we can come up with. A copy of the compiler's output with the described linker error follows. The 3 compiler warnings are also unknown to us as well. They reference the following three lines of code (taken out of context):

// Create the Two Separate Processes
OSCreateTask(TaskADC, OSTCBP(1), 12); // line 36
OSCreateTask(TaskBargraph, OSTCBP(2), 10); // line 37

OS_WaitMsg(OSECBP(1), &value, OSNO_TIMEOUT, TaskBargraph1); // wait for and get message (line 95)

The compiler output with the described linker error follows. Thanks for any further assistance you may be able to provide.

The University of Akron

--

Compiling TU2.C:
Command line: "C:HT-PICBINPICC.EXE -FAKELOCAL -G -E -16F877 -C -IC:FRACKELTONTU2 C:FRACKE~1TU2TU2.C"
C:FRACKE~1TU2TU2.C: 36: illegal conversion between pointer types
(warning)
C:FRACKE~1TU2TU2.C: 37: illegal conversion between pointer types
(warning)
C:FRACKE~1TU2TU2.C: 95: illegal conversion between pointer types
(warning)
Enter PICC -HELP for help
Serial number: HCPIC-09530:E8
Licensed to : JAMES GROVER

Linking:
Command line: "C:HT-PICBINPICC.EXE -FAKELOCAL -G -E -16F877 -oTU2.HEX TU2.OBJ C:SALVOLIBSLP42CAB.LIB " C:SALVOLIBSLP42CAB.LIB(delay.obj):12:signatures do not match: _OSDelay (C:SALVOLIBSLP42CAB.LIB: delay.obj): 0x2078/0x1078 (error) Enter PICC -HELP for help Serial number: HCPIC-09530:E8 Licensed to : JAMES GROVER

MPLAB is unable to find output file "TU2.HEX". This may be due to a compile, assemble, or link process failure.

Build failed.

kevin w
 
Posts: 3
Joined: Wed Oct 02, 2002 11:00 pm

Re: OS_Delay Problem

Postby aek » Sun Oct 06, 2002 12:47 am

Go ahead and zip your entire project (source files, MPLAB project file, etc.) and email it to support@pumpkininc.com ... we'll figure out whats wrong ...

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

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

Re: OS_Delay Problem

Postby aek » Sun Oct 06, 2002 2:06 am

Something else occurred to me -- did you copy a salvocfg.h from a tutorial program?

If you did, and you left it relatively unmolested, the reason why you're having problems is that you haven't defined MAKE_WITH_STD_LIB so that the portion of the salvocfg.h that is for library builds is the one that the preprocessor actually sees ...

In the tutorials, the salvocfg.h's resolve to three distincty different sets of configuration options depending on whether you've defined MAKE_WITH_FREE_LIB, MAKE_WITH_STD_LIB, or neither ...

Below, you'll see better how it works (salvo ut u6sysasalvocfg.h):

code:
#if !defined (MAKE_WITH_FREE_LIB) && !defined (MAKE_WITH_STD_LIB)

#define OSBYTES_OF_DELAYS 1
#define OSCLEAR_WATCHDOG_TIMER() asm(" clrwdt")
#define OSENABLE_IDLING_HOOK TRUE
#define OSENABLE_MESSAGES TRUE
#define OSEVENTS 1
#define OSTASKS 3
#define OSLOC_ALL bank1

#else

#define OSUSE_LIBRARY TRUE
#ifdef MAKE_WITH_FREE_LIB
#define OSLIBRARY_TYPE OSF
#elif defined(MAKE_WITH_STD_LIB)
#define OSLIBRARY_TYPE OSL
#endif
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB


#define OSEVENTS 1
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 3

#endif


I suspect that perhaps you have almost exactly this file, but you haven't defined MAKE_WITH_STD_LIB as a defined symbol when compiling your source code, and so it's using the first couple of lines (not using the OSLIBRARY_XYZ stuff), and hence you get the errors you're talking about ...

[This message has been edited by aek (edited October 06, 2002).]

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

Re: OS_Delay Problem

Postby kevin w » Tue Oct 08, 2002 2:20 am

Your latest solution solved the problem. thank you so much for the help and responding so quickly both times. We really did not expect to get a responce within an hour of posting both times.

The University of Akron.

kevin w
 
Posts: 3
Joined: Wed Oct 02, 2002 11:00 pm

Re: OS_Delay Problem

Postby aek » Tue Oct 08, 2002 2:56 am

Hi Kevin.

You're welcome.

Here's a tip: When working with C code that uses the preprocessor extensively, like Salvo does, it can be a bit confusing as to which parts of the code are "active" at any one time.

One trick I use when I can't figure out why something isn't working as I expect is to insert

code:
#error BlahBlahBlah

right next to the code in question. If I then get a compile-time error "Error: BlahBlahBlah at line nnn" I know that the code I'm looking at is actually being compiled. If I don't get an error, I know that there's something I'm failing to appreciate about the way the file is setup and what symbols are active, etc.

Your problem demonstrates the danger of cut-and-pasting code when one doesn't yet fully understand / appreciate how it works. In the case of these defined symbols, since they're defined externally in a project's options and not anywhere in the source code, it can be a bit tricky if you don't have the full picture. If you peruse the project options settings in our sample projects, you'll find symbols like MAKE_WITH_STD_LIB defined when the project links to a standard library. Another way to do it is to look at the preprocessor output (file), but that takes more time ...

Tip: because these symbols don't begin with "OS", they're not part of Salvo per se (though they are documented in the manual). That's intended to be a tip-off that one has to look elsewhere (outside the source code, at least) for those symbols.

Anyway, I'm glad you're up and running.

Regards,

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

[This message has been edited by aek (edited October 08, 2002).]

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


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 2 guests

cron