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

How to fill with goto statement ?

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



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

How to fill with goto statement ?
PostPosted: Tue Dec 06, 2011 10:52 pm     Reply with quote

Hi all,

I want to fill with GOTO 0x0000 statement after the end of program till the end of program memory.

How can I do this?

thanks and regards,
Jai.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Dec 07, 2011 6:31 am     Reply with quote

Back in the stone age we used to fill unused ROM with No-Ops so if the PC got there it would just run through them till it hit the reset vector at the top of memory.
I have not heard of anyone doing that in the last 25 years.
_________________
The search for better is endless. Instead simply find very good and get the job done.
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Wed Dec 07, 2011 7:15 am     Reply with quote

SherpaDoug wrote:
...we used to fill unused ROM with No-Ops so if the PC got there it would just run through them

It still does, but now by design. Unused flash reads, just like most ROM, as all 1s. PICs interpret all 1s, 0xFFFF on an 18F, as a NOP. Of course on PICs the reset vector is at the bottom of memory, so it'll get there after the PC (Program Counter, not Personal Computer) wraps round.

In short PICs will end up resetting (a warm start of course) if they try to execute unprogrammed code memory. You don't have to force them to do it by doing something special.

RF Developer
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Wed Dec 07, 2011 9:17 am     Reply with quote

The problem is that a goto, in PIC coding, is not a single word instruction.
CCS provides the instruction #FILL_ROM to put any single instruction into unused memory space if required. By default they put a sleep instruction as the word after the end of memory, and as RF_Developer says, unprogrammed cells will contain a NOP, so if the watchdog is enabled, the sleep will give a reset if you run out of the end of memory, and the NOP's will force a loop back to the bottom of memory if you end up anywhere else.

Best Wishes
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

PostPosted: Thu Dec 08, 2011 5:04 am     Reply with quote

Thanks all for the info.

regards,
jai.
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