Help! strange problem with zero ram? or something else
Posted: Tue Mar 25, 2003 11:24 am
Hello,
I seem to be encountering a strange phenomenon. A while back we had added the #zero_ram directive into one of our projects. Now we have removed it but the compiler is still burning up memory by performing a CLRF instruction on every ram location (or so it seems)
I have pasted here the section of the LST file that contains the main program. It seems that this ram initialization occurs before executing anything else in the main program.
Any help would be greatly appreciated as we're currently trying to optimize our code and free up some ROM space. I've searched my included files and there are no other instances of #zero_ram anywhere... could there be something else that is causing this phenomenon?
Configuration Fuses:
Word 1: 2200 HS NOOSCSEN
Word 2: 0E0D NOBROWNOUT WDT128 NOWDT BORV20 NOPUT
Word 3: 0100 CCP2C1
Word 4: 0081 STVREN NODEBUG NOLVP
Word 5: C00F NOPROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTB NOWRTC
Word 7: 400F NOEBTR NOEBTRB
---------------------
___________________________
This message was ported from CCS's old forum
Original Post ID: 13054
Barry Gershenfeld Guest
Re: Help! strange problem with zero ram? or something else
Posted: Tue Mar 25, 2003 1:24 pm
:=the compiler is still burning up memory by performing a CLRF instruction on every ram location (or so it seems)
The way variables are declared in C can affect this. Obviously int x=0; will get zeroed. Global and static might get it automatically. Since the areas are big I would look at any buffers you have created. I don't see huge blocks of CLRFs in my object code but I never asked why.
Barry
___________________________
This message was ported from CCS's old forum
Original Post ID: 13058
btokarchuk Guest
Re: Help! strange problem with zero ram? or something else
Posted: Tue Mar 25, 2003 1:53 pm
Thanks for the reply Barry, I did also get a reply from CCS themselves saying:
Variables declared like this:
int x = 0;
Or like this:
static int x;
Will get the CLRF in main().
So considering i had a number of variables declared static and a 512 byte buffer declared static it is no wonder I received so many in my code. It's all better now
:=:=the compiler is still burning up memory by performing a CLRF instruction on every ram location (or so it seems)
:=
:=The way variables are declared in C can affect this. Obviously int x=0; will get zeroed. Global and static might get it automatically. Since the areas are big I would look at any buffers you have created. I don't see huge blocks of CLRFs in my object code but I never asked why.
:=
:=Barry
___________________________
This message was ported from CCS's old forum
Original Post ID: 13060
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