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 CCS Technical Support

soft reset does not clear ram

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



Joined: 20 Mar 2010
Posts: 193
Location: Auckland NZ

View user's profile Send private message

soft reset does not clear ram
PostPosted: Wed May 16, 2012 3:15 am     Reply with quote

Hi,
I have strange problem.

After hard reset my board is setting itself into proper state but on occasions after I use reset_cpu(); ram is not cleared and it remembers old values.

I set my vars in the beggining of the program like for example:
int var = 0;

inside file -> #include "variables.c"

and I zero ram in the start of program:

#zero_ram
void main() { // main program
}

Any one got an idea why it may be happening?

Thnx
_________________
Help "d" others and then you shell receive some help from "d" others.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 16, 2012 1:05 pm     Reply with quote

Always post your PIC and your compiler version.
The action taken by reset_cpu() is different, depending upon the PIC.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu May 17, 2012 2:23 am     Reply with quote

In addition, the question isn't quite clear.

#zero_ram can be expected to perform the (C standard) clearing of all global variables. It's performed in the main() preamble with CCS C.

int var = 0; defines an initialized local or global variables, for local ones the initialization is performed each time the function/block is entered. Local variables are not affected by #zero_ram, neither explicitely initialized global variables.

In my view, all of these variables would be initialized on a soft_reset(), because it's always executing main() a new.

For which kind of variable do you see missing initialization?
Linuxbuilders



Joined: 20 Mar 2010
Posts: 193
Location: Auckland NZ

View user's profile Send private message

PostPosted: Thu May 17, 2012 3:06 am     Reply with quote

Thank you for reply,
I need to narrow the fault and then I will be back with more data. It happens on occasions so I need to do more testing.

Thnx
_________________
Help "d" others and then you shell receive some help from "d" others.
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