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

#ROM

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



Joined: 28 Jun 2013
Posts: 5

View user's profile Send private message

#ROM
PostPosted: Fri Jun 28, 2013 9:54 am     Reply with quote

Hi Everyone, first time here! Very Happy

I get a warning after the second #ROM 'Memory not available at the requested location'. Should I just ignore it? Any suggestions?

Code:
#include <24EP512GU810.h>
#include <stdlib.h>
#include <math.h>

#fuses NOWDT,PUT64,NOBROWNOUT,ICSP1,NOJTAG,NODEBUG,NOAWRT,NOAPROTECT
#fuses NOWRT,NOPROTECT,FRC_PLL,PR_PLL,NOIESO,NOPR,NOCKSNOFSM

#use delay(clock=58960000)

void main()
{
   int8 ii = 0;
   setup_oscillator(OSC_INTERNAL);

   if(ii == 0) #ROM char 0x55000 = {'R','C','O'}
   else #ROM char 0x55000 = {'r','C','O'}
}
stinky



Joined: 05 Mar 2012
Posts: 99
Location: Central Illinois

View user's profile Send private message

PostPosted: Fri Jun 28, 2013 10:26 am     Reply with quote

I don't have experience with this part, but I'd probably check the data sheet to see if that address is in fact open to use.
kenho



Joined: 28 Jun 2013
Posts: 5

View user's profile Send private message

PostPosted: Fri Jun 28, 2013 10:41 am     Reply with quote

Thanks Stinky!

It does appear as writable program memory in the data sheet. I do not get the warning if I use the #ROM at that address just once, only when repeated in the code.

It is a warning and not an error so perhaps the warning algorithm only looks for repeats but does not take context into account.
Ttelmah



Joined: 11 Mar 2010
Posts: 19350

View user's profile Send private message

PostPosted: Fri Jun 28, 2013 10:41 am     Reply with quote

The problem is what you are doing.....

#ROM, is _not_ a program instruction. It can't be executed at run time.
It is a preprocessor directive, executed when the code is compiled.

You can't change #ROM at runtime.

You can have two versions changed when you compile:
Code:

#define II

#ifdef II
   #ROM char 0x55000 = {'R','C','O'}
#else 
   #ROM char 0x55000 = {'r','C','O'}
#endif


If you rem out the define, the second ROM directive will get compiled, but if you leave it defined, then the first will get compiled.

Best Wishes
kenho



Joined: 28 Jun 2013
Posts: 5

View user's profile Send private message

PostPosted: Fri Jun 28, 2013 2:12 pm     Reply with quote

Thanks Ttelmah!

Understood. Wink
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