Page 1 of 1

Keil C51 not recognizing OS_Delay macro

PostPosted: Tue May 13, 2014 8:03 pm
by sncuser
Any ideas why the Keil compiler would not be recognizing the OS_Delay() macro in a source code build? I just switched from a library build to a source code build, and this seems to be the only problem so far.

It says: "warning C206: 'OS_Delay': missing function-prototype".

Re: Keil C51 not recognizing OS_Delay macro

PostPosted: Tue May 13, 2014 9:02 pm
by aek
Most likely, you have not updated your salvocfg.h to be proper for a source-code build ... please refer to RM-KC51.PDF (http://www.pumpkininc.com/content/doc/m ... m-kc51.pdf) for guidance on the different forms of salvocfg.h for library builds and source-code builds.

Re: Keil C51 not recognizing OS_Delay macro

PostPosted: Tue May 13, 2014 9:20 pm
by sncuser
Thanks, but it appears that it must be something more fundamental than that. I removed all of the library stuff from the config file and added some additional stuff, including a couple of lines from the document you linked to, and it's still doing the same thing. My config file now looks like this:

#define OSENABLE_IDLING_HOOK TRUE
#define OSENABLE_SEMAPHORES TRUE
#define OSLOC_ALL data
#define OSMESSAGE_QUEUES 4 //define maximum number of message queues
#define OSTASKS 4 //define maximum number of tasks
#define OSEVENTS 1
#define OSBYTES_OF_DELAY 4

#define OSBYTES_OF_COUNTS 4
#define OSBYTES_OF_TICKS 4
#define OSENABLE_MESSAGE_QUEUES TRUE

It seems like OS_Delay must not be getting defined somehow. I looked in salvompt.h and saw that it is in an #if regarding the enabling of ticks and something else, but I think I have those things enabled.

Re: Keil C51 not recognizing OS_Delay macro

PostPosted: Tue May 13, 2014 9:29 pm
by sncuser
Well, this is interesting. I copied the macro definition
#define OS_Delay(delay) { \
OSDelay(delay, FALSE); \
OS_Yield(); }
out of the include file into my source file, and it compiled. But now I get a ton of linker errors to an erroneous external OSTIMERTICKS. Maybe I'm missing a source file that I need.

Re: Keil C51 not recognizing OS_Delay macro

PostPosted: Wed May 14, 2014 3:53 am
by aek
1. Undo the macro definition copy.

2. It's OSBYTES_OF_DELAYS, not OSBYTES_OF_DELAY ...

Re: Keil C51 not recognizing OS_Delay macro

PostPosted: Wed May 14, 2014 6:05 am
by sncuser
Oh, thank you! I don't know how many more times I would have looked at that before realizing the mistake.
:oops:

Re: Keil C51 not recognizing OS_Delay macro

PostPosted: Wed May 14, 2014 8:21 am
by sncuser
It builds now, but does not run correctly. I have these lines at the end of my main():

OSInit();

OSCreateTask(CmdProc, OSTCBP(1), 2);
OSCreateTask(TlmProc, OSTCBP(2), 2);

OSEi();

while (1)
{
OSSched();
}

It seems to get stuck on OSEi(), and I don't know where I originally got that from or if it's needed.

I'm alsao getting many linker warnings for references to unresolved externals _OSDELDELAYQ from salvotask3.obj, and OSCTXSW, OSEI from main.obj.


I've been changing my salvocfg.h all around, but it currently looks like this:

#define OSENABLE_IDLING_HOOK TRUE
//#define OSENABLE_MESSAGE_QUEUES TRUE
#define OSENABLE_SEMAPHORES TRUE
#define OSLOC_ALL data
//#define OSMESSAGE_QUEUES 4 //1 //define maximum number of message queues
#define OSTASKS 2 //define maximum number of tasks
#define OSEVENTS 1
#define OSBYTES_OF_DELAYS 4 //2

#define OSBYTES_OF_COUNTS 4
#define OSBYTES_OF_TICKS 4