|
|
View previous topic :: View next topic |
Author |
Message |
John Goss Guest
|
Can main() break the 2K barrier?? |
Posted: Fri Nov 16, 2001 5:15 pm |
|
|
I am now running into ROM constraints.
My project uses the PIC 16F877 chip
I have tried to break up my code into as many functions as possible. The functions take up apx 1 and a 1/2 of the (2K) block sections.
The problem is that my main() code which is mostly "if" statements and funtion calls has taken up 95\% of the space in the third block (0x1000 - 0x17FF). The fourth block is still empty.
As I add code to main() is crashes. Does anyone know a way around this limitation?
Thanks, John Goss
___________________________
This message was ported from CCS's old forum
Original Post ID: 1163 |
|
|
Dale Botkin Guest
|
Re: Can main() break the 2K barrier?? |
Posted: Fri Nov 16, 2001 9:12 pm |
|
|
:=The problem is that my main() code which is mostly "if" statements and funtion calls has taken up 95\% of the space in the third block (0x1000 - 0x17FF). The fourth block is still empty.
:=
:=As I add code to main() is crashes. Does anyone know a way around this limitation?
Just an idea, but... if your main() is mostly code that gets executed in line, could you make arbitrary chunks of it into functions and just call them sequentially? The down side is that you may have to make more variables global if they're used by more than one of the chunks, but it might help.
Dale
(obviously still self-learning C, I know...)
___________________________
This message was ported from CCS's old forum
Original Post ID: 1168 |
|
|
Tomi Guest
|
Re: Can main() break the 2K barrier?? |
Posted: Sat Nov 17, 2001 8:26 am |
|
|
Have you tried to use the #separate directive?
The CCS C is good enough and the PIC has limited stack space so if you try to brake your code e.g.:
void MyFunc()
{
.........
}
void main()
{
........
MyFunc();
.......
}
The compiler will translate your function as INLINE (the main() size is not affected).
:=I am now running into ROM constraints.
:=My project uses the PIC 16F877 chip
:=
:=I have tried to break up my code into as many functions as possible. The functions take up apx 1 and a 1/2 of the (2K) block sections.
:=
:=The problem is that my main() code which is mostly "if" statements and funtion calls has taken up 95\% of the space in the third block (0x1000 - 0x17FF). The fourth block is still empty.
:=
:=As I add code to main() is crashes. Does anyone know a way around this limitation?
:=
:=Thanks, John Goss
___________________________
This message was ported from CCS's old forum
Original Post ID: 1171 |
|
|
John Goss Guest
|
Re: Can main() break the 2K barrier?? |
Posted: Mon Nov 19, 2001 10:08 am |
|
|
Tomi & Dale,
Thanks for the ideas. Yes my code is executed inline. Over the weekend I came up with the same idea as you did Dale. I will seperate my main code into two seperate functions and then call the two functions in main() this should allow the code to locate properly in two blocks of code space.
Thanks, again
John
:=:=The problem is that my main() code which is mostly "if" statements and funtion calls has taken up 95\% of the space in the third block (0x1000 - 0x17FF). The fourth block is still empty.
:=:=
:=:=As I add code to main() is crashes. Does anyone know a way around this limitation?
:=
:=Just an idea, but... if your main() is mostly code that gets executed in line, could you make arbitrary chunks of it into functions and just call them sequentially? The down side is that you may have to make more variables global if they're used by more than one of the chunks, but it might help.
:=
:=Dale
:=(obviously still self-learning C, I know...)
___________________________
This message was ported from CCS's old forum
Original Post ID: 1229 |
|
|
|
|
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
|