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

#org

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Trampas



Joined: 04 Sep 2004
Posts: 89
Location: NC

View user's profile Send private message MSN Messenger

#org
PostPosted: Sun Sep 26, 2004 5:59 pm     Reply with quote

OK, I read the f*!$ manual and I still can not get the #org to work

First off the manual does not state very well how the #org works. For example I have several functions I want to put in a specific address range. Do I have to calculate the function sizes for each? For example

Code:
#org 0xF000, 0xFFFF
void foo()
{
}

#org default
void main()
{
}

#org 0xF000
void foo2()
{
}


I tried the above and get all kinds of funny errors. I am not sure how the org is suppose to work, does anyone have a clue? Also what the heck is the auto=0 suppose to do all the manual I have says is "Add a AUTO=0 at the end of the #ORG line."

Trampas
Trampas



Joined: 04 Sep 2004
Posts: 89
Location: NC

View user's profile Send private message MSN Messenger

PostPosted: Sun Sep 26, 2004 6:34 pm     Reply with quote

Man the documentation sucks!!!

It appears that the compiler is about as stupid as the documenation...

The #org statement appears to require the function prototype to be declared as #separate. It also appears that the order which you place functions in the code makes a big difference with the #org. That is it appears the compiler is a stupid one pass compiler and linker. That is the compiler parses the #org in order of the ONE file. For example if you have multiple C files like I do then you have to put the #include the other source files into the ONE main file. Well be sure you place the #org in the correct order. Now a real compiler would compile the code to virutal memory locations then apply the #org statements in the final link, but not the CCS compiler. Also a real compiler would complie an execution graph in one pass to determine which functions to inline based on the function size, number of calls, and available ROM, but again it appears that the CCS compiler does not do any of these things.

I guess I should spend more time porting code to real compiler than reporting problems with the CCS compiler.

Trampas
Mark



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

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

PostPosted: Sun Sep 26, 2004 6:41 pm     Reply with quote

auto=0 gives this behavior

The RAM for a ORG'ed function may be reset to low memory so the local variables and scratch variables are placed in low memory. This should only be used if the ORG'ed function will not return to the caller. The RAM used will overlap the RAM of the main program.
Trampas



Joined: 04 Sep 2004
Posts: 89
Location: NC

View user's profile Send private message MSN Messenger

PostPosted: Sun Sep 26, 2004 6:56 pm     Reply with quote

Mark,

Thanks again...

I guess auto=0 is just in case you are low on RAM?

I have ported my next project from CCS to the C18. However I still have one project which has been done with CCS (95% ROM usage, over 10k lines of code). I guess I will start next week porting this one to the C18.

Mark, tell me if you are using the C18 for your project why do you still visit this forum?

Trampas
Mark



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

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

PostPosted: Sun Sep 26, 2004 8:27 pm     Reply with quote

I actually stopped for a while. But I like to help people so that is the main reason. I also like solving problems. Kind of hones my skills as well. So that's the reason. Take the pointer to functions problem that you had. I just loved the challenge of making it work. So that is the reason that I did it.
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