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

Expression must evaluate to a constant

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



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

Expression must evaluate to a constant
PostPosted: Mon Jan 20, 2014 9:05 am     Reply with quote

Hi all,

I'm using the ccs usb HID code, and trying to save some RAM, I have added
Code:
#device CONST=ROM


This causes the above error in usb_desc_hid.h at this line:

Code:
USB_CLASS_SPECIFIC_DESC_LOOKUP_SIZE[0][0], 0x00, //length of report descriptor            ==26,27


Without the #device CONST=ROM, there is no error, but I run out of ram.

I am quite confused by this because the structure definition is

Code:
const char USB_CONFIG_DESC[] = {.... etc


CCS version 5.016
PIC 18F25K50
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Mon Jan 20, 2014 12:24 pm     Reply with quote

what bearing do you think this has on your shortage?

CONST by default are stored in program rom memory as it is.

what do you see in the .LST file ??
have U considered defining the array size explicitly?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 20, 2014 1:42 pm     Reply with quote

I made a new project for ex_usb_hid.c, and edited it for an 18F25K50 and
compiled it with vs. 5.016. I got the same error. I think it may be a
bug in the compiler. Maybe it doesn't like you re-declaring a configuration
that exists as the default, i.e., CONST=ROM.

Quote:
Without the #device CONST=ROM, there is no error, but I run out of ram

How ? The compiler reports only 10% or 11% ram usage:
Code:

CCS PCH C Compiler, Version 5.016, xxxxx       20-Jan-14 11:37

               Filename:   C:\Program Files\PICC\Examples\ex_usb_hid.lst

               ROM used:   5158 bytes (16%)
                           Largest free fragment is 27610
               RAM used:   197 (10%) at main() level
                           231 (11%) worst case
               Stack used: 13 locations (4 in main + 9 for interrupts)
               Stack size: 31

.................... #device PIC18F25K50
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