CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

getting errors from manually locating function in ROM

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Dave the Coding Monkey



Joined: 10 Nov 2006
Posts: 2

View user's profile Send private message

getting errors from manually locating function in ROM
PostPosted: Fri Nov 10, 2006 11:08 pm     Reply with quote

Hi all,

I am currently using compiler v4.005, and I am having trouble figuring out a compiler error arising from trying to manually locate functions in my code.

The basic structure of my code looks something like this:
Code:

#include "header.h"

//forward declarations of functions:
void  function1(void);
void  function2(void);


void  main(void)
{
    //some code
    function1();
    function2();
}

void function1(void)
{
   //code and stuff
}

void function2(void)
{
   //more code and stuff
}


So that's all pretty basic, and worked just fine. For various reasons (that don't really pertain to the situation), I decided I needed to pin down the ROM locations of some of my functions. I did this my adding some #ORG directives:
Code:

#include "header.h"

//forward declarations of functions:
void  function1(void);
void  function2(void);


void  main(void)
{
    //some code
    function1();
    function2();
}

#ORG F1_BASE_ADDR, F1_BASE_ADDR + F1_SIZE
void function1(void)
{
   //code and stuff
}

#ORG F2_BASE_ADDR, F2_BASE_ADDR + F2_SIZE
void function2(void)
{
   //more code and stuff
}


Once I have done that, however, I start getting "No overload function matches" errors for any calls made to the functions from main(). (I have made sure that the reserved ROM locations are adequately sized, and do not overlap other reserved areas.)

To be honest, I do not really understand what that error message means. It sounds to me like the compiler is complaining that the functions are now somehow out of the main routine's calling scope (even though they've already been declared at the top of the code).

Does anyone have any insight to give me on this error? I hope so, because this situation has confused me terribly...

Thanks,
Dave
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Nov 11, 2006 12:20 am     Reply with quote

I can find only one instance of that error message in Google.
That's pretty rare.

My advice is to download a different version of the compiler, if you can,
and try it. Vs. 4.005 is a very early version of vs. 4.
Or, download vs. 3.249.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sat Nov 11, 2006 8:32 am     Reply with quote

Try declaring them like this

Code:

#include "header.h"

#ORG F1_BASE_ADDR, F1_BASE_ADDR + F1_SIZE
void function1(void)
{
   //code and stuff
}

#ORG F2_BASE_ADDR, F2_BASE_ADDR + F2_SIZE
void function2(void)
{
   //more code and stuff
}

void  main(void)
{
    //some code
    function1();
    function2();
}

Dave the Coding Monkey



Joined: 10 Nov 2006
Posts: 2

View user's profile Send private message

PostPosted: Sat Nov 11, 2006 7:54 pm     Reply with quote

Well, I went through my code and moved all child functions to appear in the code file before their parent functions (i.e. I removed all need for forward-declaring the functions), and now it compiles just fine. I basically had to invert my entire c-file, as I always write my code so that parents appear first (I think it makes it easier to read that way). I've been cutting and pasting for the last hour Rolling Eyes . I still don't understand why it makes a difference to the compiler, but important thing is that I have the code working again the way I want it to.

Thanks all,
Dave
Ttelmah
Guest







PostPosted: Mon Nov 13, 2006 3:45 am     Reply with quote

The key is what is included in the function prototype. If (for example), you declare a function as 'separate', this affects how the compiler generates the calls to the function, and has to be included in the prototype. Now, when you force an 'org' for a function, you also force it to be separate. This is implicit in the org declaration, but not stated. Your prototype version, should work, if you declare the prototypes as:
Code:

//forward declarations of functions:
#separate
void  function1(void);
#separate
void  function2(void);

The error, means that the prototype function it has found, does not 'match' the real function of the same name, so it has gone looking for other versions (since the compiler now partially supports function overloading), and has failed to find any that exactly match.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group