View previous topic :: View next topic |
Author |
Message |
oxo
Joined: 13 Nov 2012 Posts: 219 Location: France
|
Expression must evaluate to a constant |
Posted: Mon Jan 20, 2014 9:05 am |
|
|
Hi all,
I'm using the ccs usb HID code, and trying to save some RAM, I have added
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
|
|
Posted: Mon Jan 20, 2014 12:24 pm |
|
|
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
|
|
Posted: Mon Jan 20, 2014 1:42 pm |
|
|
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 |
|
|
|
|