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

Difference between V4.107 and V4.109

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



Joined: 25 Aug 2005
Posts: 16

View user's profile Send private message

Difference between V4.107 and V4.109
PostPosted: Fri Jul 23, 2010 5:02 pm     Reply with quote

I have successfully compiled a program in V4.107 but it fails in V4.109

The reduced version which shows the problem is:
Code:

#include <18lf26j11.h>
                       
typedef struct menu_struct
{
ROM char *ASCII_ptr;
} menu_select;

menu_select   test_ASCII;


void init_menu_structures()
{
#DEFINE MAX_MESSAGES 3
                       
ROM char ccs_ASCII_mess[MAX_MESSAGES][20] = {"Hello", "goodbye"};
       
test_ASCII.ASCII_ptr = &ccs_ASCII_mess;
}     
       

void main()
{                                                             
init_menu_structures();
       
while(1)         
  {                                                       
                       
  }     
}

The complaint is about the assignment:
Code:

test_ASCII.ASCII_ptr   = &ccs_ASCII_mess;

Quote:

*** Error 28 "ccs_data_structures.c" Line 48(37,51): Expecting an identifier

Has anyone else had this problem?
TimC



Joined: 12 Nov 2005
Posts: 7

View user's profile Send private message

PostPosted: Fri Jul 23, 2010 9:05 pm     Reply with quote

It looks like ALL your variables and pointers are in ROM, that would be a neat trick if you could do it.

The following is from the manual:

Attempt to create a pointer to a constant

Constant tables are implemented as functions. Pointers cannot be created to functions. For example CHAR CONST MSG[9]={"HI THERE"}; is permitted, however you cannot use &MSG. You can only reference MSG with subscripts such as MSG[i] and in some function calls such as Printf and STRCPY.

I don't think V4.107 would work even though it compiled

Regards
TimC
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 23, 2010 9:16 pm     Reply with quote

If you want the address of an array, you don't put an '&' in front of it.
You just give it the name of the array, like this:
Code:

test_ASCII.ASCII_ptr = ccs_ASCII_mess;

Then it compiles with vs. 4.109.

Look in your .SYM file to see the address of 'ccs_ASCII_mess'.
Then use a printf statement to display 'test_ASCII.ASCII_ptr',
using "%lx", after the assignment is done. You'll see that it's
loaded with the ROM address of the array as given in the .SYM file.
(That is, after you remove the '&').
pic_user



Joined: 25 Aug 2005
Posts: 16

View user's profile Send private message

PostPosted: Fri Jul 23, 2010 11:34 pm     Reply with quote

I tried removing the & operator previously, as an experiment, and saw that it compiled without producing an error message. But when I used MPLAB SIM, I did not get the address in the ROM, where the message is located. Instead it was in RAM area.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jul 24, 2010 12:32 am     Reply with quote

I couldn't test your code on a 18F26J11 on one PC here, so I tested the
18F25J10 and it worked. Now I switched to another PC and tested the
18F26J11 and it's not working. That's with the same basic program
too. It's getting late. I'll test this more on Sunday maybe.
pic_user



Joined: 25 Aug 2005
Posts: 16

View user's profile Send private message

PostPosted: Sat Jul 24, 2010 4:40 pm     Reply with quote

Thanks for the help.

Following your lead, I tried other devices, and sure enough they compile and simulate properly.

What is looks like is that the 64K ROM parts in the PIC18F46J11 are showing the problem - not the 16K or 32K parts.

It feels like a 16-bit address boundary problem.

I don't know what the workaround is, so I hope CCSINFO provides a fix.

As I said before, V4.107 works. The program fragment I posted was just to extract the isolated condition. In fact, the program is large and consists of multiple, complex structures. It works correctly. Only when I downloaded V4.109 did the problem show up.
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