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

#rom statement bug 5.044

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



Joined: 12 Dec 2011
Posts: 8
Location: USA

View user's profile Send private message Visit poster's website

#rom statement bug 5.044
PostPosted: Fri Apr 10, 2015 12:51 pm     Reply with quote

i found a compiler bug in the 5.044 compiler when using the PIC24EP512GU810 processor but it may affect other processors.

I found that if i used a #rom statement like
#ROM char 0X3400 = {"AMC RACK 4.00 04/01/2015"}
the last two bytes in the statement can overwrite sections of the code.

This has been reported to CCS and they are fixing in the next release.

If you are using #rom statements check the listing file to see if this is happening.

As a work around I found that adding an extra space at the end of text string prevented the problem.
jeremiah



Joined: 20 Jul 2010
Posts: 1357

View user's profile Send private message

PostPosted: Fri Apr 10, 2015 4:20 pm     Reply with quote

Does this apply to all #rom statements or only ones with char strings?
rwalborn



Joined: 12 Dec 2011
Posts: 8
Location: USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Apr 10, 2015 10:15 pm     Reply with quote

I don't know. I found it while using text string. I have not tried it with anything else.
Ttelmah



Joined: 11 Mar 2010
Posts: 19550

View user's profile Send private message

PostPosted: Sat Apr 11, 2015 2:58 am     Reply with quote

It seems unlikely that it is behaving quiet as you describe. If it was, adding the spaces wouldn't solve anything, since the spaces would still be overwriting things....
I'd suspect it relates to the instruction word size, versus char. An instruction in the PIC24, is 24bits long, occupying 32bits in the memory space. So your 24 character (plus terminator) string, needs to use nine instructions (32bytes in the memory space) The next two bytes _will_ be part of the same instruction word, so 'of course' they will be overwritten. However the compiler itself will not use these. Are you attempting to put something else yourself there?. If so, you need to realise that things do need to be instruction aligned.
Adding two more characters, takes the total size to 27 bytes, which fills to the 9 instruction boundary accurately.
rwalborn



Joined: 12 Dec 2011
Posts: 8
Location: USA

View user's profile Send private message Visit poster's website

PostPosted: Mon Apr 13, 2015 2:26 pm     Reply with quote

I was doing the text string. One more space solved the problem (at least for now).

CCS support only took about 1/2 hour to identify the problem and correct it for the next release.
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