Pumpkin, Inc.

Pumpkin User Forums

Keil C51 not recognizing OS_Delay macro

For issues specific to the 8051 family, including compilers (e.g. Keil C51) and IDEs (e.g. uVision2).

Keil C51 not recognizing OS_Delay macro

Postby sncuser » Tue May 13, 2014 8:03 pm

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".
sncuser
 
Posts: 22
Joined: Thu Feb 13, 2014 2:49 pm

Re: Keil C51 not recognizing OS_Delay macro

Postby aek » Tue May 13, 2014 9:02 pm

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.
-------
aek
aek
 
Posts: 1887
Joined: Sat Aug 26, 2000 11:00 pm

Re: Keil C51 not recognizing OS_Delay macro

Postby sncuser » Tue May 13, 2014 9:20 pm

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.
sncuser
 
Posts: 22
Joined: Thu Feb 13, 2014 2:49 pm

Re: Keil C51 not recognizing OS_Delay macro

Postby sncuser » Tue May 13, 2014 9:29 pm

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.
sncuser
 
Posts: 22
Joined: Thu Feb 13, 2014 2:49 pm

Re: Keil C51 not recognizing OS_Delay macro

Postby aek » Wed May 14, 2014 3:53 am

1. Undo the macro definition copy.

2. It's OSBYTES_OF_DELAYS, not OSBYTES_OF_DELAY ...
-------
aek
aek
 
Posts: 1887
Joined: Sat Aug 26, 2000 11:00 pm

Re: Keil C51 not recognizing OS_Delay macro

Postby sncuser » Wed May 14, 2014 6:05 am

Oh, thank you! I don't know how many more times I would have looked at that before realizing the mistake.
:oops:
sncuser
 
Posts: 22
Joined: Thu Feb 13, 2014 2:49 pm

Re: Keil C51 not recognizing OS_Delay macro

Postby sncuser » Wed May 14, 2014 8:21 am

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
sncuser
 
Posts: 22
Joined: Thu Feb 13, 2014 2:49 pm


Return to 8051 family

Who is online

Users browsing this forum: No registered users and 1 guest

cron