Go Down

Topic: Complile error (Read 3038 times) previous topic - next topic

ozbrian

Hi,

I have built a shrimpkey board (fromScratchEd.nl) and Im using a cp2104 module and arduino to try and program it.

I am getting the errors detailed at the bottom of this post.
I get the same errors whether or not I have the module plugged in and the same errors when I try to program the board from a PC.

This is time critical for a project so any help would be greatly appreciated.

Thanks
Brian

------------------

Arduino: 1.6.8 (Mac OS X), Board: "Arduino/Genuino Uno"

In file included from /Users/brian/Desktop/shrimpkey/ShrimpKey-master/ShrimpKey/ShrimpKey.ino:3:0:
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/usbdrv.h:479:26: error: variable 'usbDescriptorDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 char usbDescriptorDevice[];
                          ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/usbdrv.h:485:33: error: variable 'usbDescriptorConfiguration' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 char usbDescriptorConfiguration[];
                                 ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/usbdrv.h:491:29: error: variable 'usbDescriptorHidReport' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 char usbDescriptorHidReport[];
                             ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/usbdrv.h:497:27: error: variable 'usbDescriptorString0' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 char usbDescriptorString0[];
                           ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/usbdrv.h:503:31: error: variable 'usbDescriptorStringVendor' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 int usbDescriptorStringVendor[];
                               ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/usbdrv.h:509:31: error: variable 'usbDescriptorStringDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 int usbDescriptorStringDevice[];
                               ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/usbdrv.h:515:37: error: variable 'usbDescriptorStringSerialNumber' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 int usbDescriptorStringSerialNumber[];
                                     ^
In file included from /Users/brian/Desktop/shrimpkey/ShrimpKey-master/ShrimpKey/ShrimpKey.ino:4:0:
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:36:39: error: variable 'usbDescriptorHidReport' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 PROGMEM char usbHidReportDescriptor[35] = { /* USB report descriptor */
                                       ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '161' from 'int' to 'char' inside { } [-Wnarrowing]
 };
 ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '224' from 'int' to 'char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '231' from 'int' to 'char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '149' from 'int' to 'char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '129' from 'int' to 'char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '149' from 'int' to 'char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '129' from 'int' to 'char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '192' from 'int' to 'char' inside { } [-Wnarrowing]
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

brenden_nerd_

can you show us the sketch please?
crater of focs os http://petitcomputer.wikia.com/wiki/Focs_operating_system

aarg

Did you try just making the variables const? :)
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

ozbrian

can you show us the sketch please?
I'm a noob, you may have to be more specific. Is the sketch the program itself? If so is that the settings.h file?

ozbrian

Did you try just making the variables const? :)
This is my first project. I am trying to build a makeymakey equivalent downloaded from 'fromScratchEd.nl and really have little  idea of what I am doing - just trying to follow instructions to the letter.

For each line of the error I tried a fix that I thought was logical. For example, as a result of the following error

/Users/brian/Documents/Arduino/libraries/UsbKeyboard/usbdrv.h:479:26: error: variable 'usbDescriptorDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 char usbDescriptorDevice[];

I opened the usbdrv.h program with a text editor and changed usbDescriptorDevice[] to usbDescriptorDevice[1]

I did this for each on the "const" messages and tried to load the program again but got the same error.

I really appreciate you guys helping me out with this.



TomGeorge

Hi,

Can you please post a copy of your sketch, using code tags?
Please use code tags.. See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html
You sketch is your program that you have written in the IDE.

A link to "shrimpkey board " would also be helpful.
What model arduino are you using.

Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

OldSteve

First thing is to remove your alterations from the "usbdrv.h" file.

Second, you could try what aarg suggests. ie add 'const' to the beginning to each of the offending lines in the library files.

....10 minutes later....
I just did that, and got it all to compile OK with the provided example.
(I compiled for UNO, with IDE V1.6.5)

Three files need to be modified:-
"usbdrv.h"
"usbdrv.c"
"UsbKeyboard.h"

There are no changes needed to the "Shrimpkey.ino" or "settings.h" files, just the above-mentioned files from the "UsbKeyboard" library.

In the three files I listed above, everywhere that there's a "PROGMEM", you need to add "const" before the variable type name.

Or, since I've already done it once, you could back up your current library files just in case, then replace them with the three modified ones that I've attached at the bottom of this post.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

OldSteve

#7
Apr 04, 2016, 05:25 am Last Edit: Apr 04, 2016, 05:30 am by OldSteve
For anyone else that's following this thread, here are the "Shrimpkey.ino" and "settings.h" files, (attached - they're too big to post).

And a link to the "Shrimpkey" files:- ShrimpKey

Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

OldSteve

What model arduino are you using.
Tom, it's not an Arduino as such, it's this board:-
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

ozbrian

Boy, the response in here is great. Each time I try to post it tells me that there are more posts.
I replaced the files with the modified ones (Thank you so much) and got past the first errors but had some others. I then downloaded definitions through the Boards Manager for 1.6.5 (I was using 1.6.10)

The program looks like it's uploading with 5 warning messages. It's been going 5 minutes. How long should it take?


OldSteve

#10
Apr 04, 2016, 06:43 am Last Edit: Apr 04, 2016, 06:53 am by OldSteve
Boy, the response in here is great. Each time I try to post it tells me that there are more posts.
I replaced the files with the modified ones (Thank you so much) and got past the first errors but had some others. I then downloaded definitions through the Boards Manager for 1.6.5 (I was using 1.6.10)

The program looks like it's uploading with 5 warning messages. It's been going 5 minutes. How long should it take?
I didn't mean "Arduino AVR Boards" version 1.6.5, I meant that I'm using Arduino IDE V1.6.5. (Looking back, that's exactly what I said:-
Quote
(I compiled for UNO, with IDE V1.6.5)
I'm using "Arduino AVR Boards" version 1.6.8.
(You shouldn't need to change your AVR boards version for the code to compile. I only mentioned the IDE version I'm using for your extra information. I didn't say you should change your AVR board definitions.)
Edit: It is possible that you're still experiencing a version problem, since this library code is very old. IDE versions V1.6.6, V1.6.7 and V1.6.8 have had some issues. That's why I've stuck with V1.6.5.

Rather than make more unnecessary changes, perhaps you should have simply posted your later error messages.

It shouldn't take more than a few seconds to upload.
I have no idea what you've done now. What are the warning messages?
I just re-compiled with "verbose outout" enabled, and still get no warnings or errors. It compiles exactly as it should:-
Code: [Select]
Sketch uses 3,772 bytes (11%) of program storage space. Maximum is 32,256 bytes.
Global variables use 214 bytes (10%) of dynamic memory, leaving 1,834 bytes for local variables. Maximum is 2,048 bytes.


This is becoming far harder than it should have been. Have you tested the "Blink" example with your board yet?
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

ozbrian

Please excuse my ignorance. I am sorry that this is frustrating and I know that is my fault.
This is a music assignment - I am not a programmer.

I am using Arduino 1.6.8
I am now using Arduino built in boards version 1.6.10 (board = Arduino\Genuino Uno)
I am using port /dev/cu.SLAB_USBtoUART that was created when I loaded drivers etc for the cp2104
The programmer defaulted to AVRISP mkII and there was no mention of this in the instructions so I left it as-is.

I'm not sure what you mean by the blink example. When I press the button on the pcb the LED blinks three times.

When I compile the program it returns a "done compiling" note with the warnings.
When I load the program I get the same warnings and the program just sits there "loading" I left it 5 minutes and it didn't finish.

here is the message I receive;


Code: [Select]

In file included from /Users/brian/Desktop/shrimpkey/ShrimpKey-master/ShrimpKey/ShrimpKey.ino:4:0:
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '161' from 'int' to 'const char' inside { } [-Wnarrowing]
 };
 ^
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '224' from 'int' to 'const char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '231' from 'int' to 'const char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '149' from 'int' to 'const char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '129' from 'int' to 'const char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '149' from 'int' to 'const char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '129' from 'int' to 'const char' inside { } [-Wnarrowing]
/Users/brian/Documents/Arduino/libraries/UsbKeyboard/UsbKeyboard.h:55:1: warning: narrowing conversion of '192' from 'int' to 'const char' inside { } [-Wnarrowing]

Sketch uses 3,772 bytes (11%) of program storage space. Maximum is 32,256 bytes.
Global variables use 214 bytes (10%) of dynamic memory, leaving 1,834 bytes for local variables. Maximum is 2,048 bytes.




OldSteve

#12
Apr 04, 2016, 07:38 am Last Edit: Apr 04, 2016, 07:45 am by OldSteve
Right. I suspect that you have two different problems at the same time.

I'm using Windows, so can't help at all with Mac-related issues.

The warnings are most likely because you're using the later version of the IDE. As I mentioned, there are some issues with the later versions. Once your other problem is fixed, you could possibly uninstall the IDE and install V1.6.5 if they become a real problem, but I think there's nothing to worry about there.
They are only warnings, not errors, and the code compiles, so ignore them for now. I think you have bigger problems right now. (Looking at line 55 of the "UsbKeyboard.h" file, I don't think the warning is anything to be concerned about.)

Have you ever successfully uploaded a sketch (program) to your new board?
"Blink" is a good place to start, rather than a complex example like you're trying.

The "Blink" sketch can be found in the examples included in the IDE, under >File >Examples >Basics "Blink"

It requires no additional hardware, and if it uploads OK and your board is OK, the onboard LED will blink once every 2 seconds.

Let us know how it goes. I suspect that it won't upload either.

Edit: And it shouldn't matter which programmer you have selected in the IDE since you're uploading using the USB to TTL converter. You need to click on the "Upload" button in the IDE to upload a program. Don't click on >Sketch >Upload using programmer. (Because you aren't using an ISP programmer.)
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

ozbrian

Right. I suspect that you have two different problems at the same time.

I'm using Windows, so can't help at all with Mac-related issues.

The warnings are most likely because you're using the later version of the IDE. As I mentioned, there are some issues with the later versions. Once your other problem is fixed, you could possibly uninstall the IDE and install V1.6.5 if they become a real problem, but I think there's nothing to worry about there.
They are only warnings, not errors, and the code compiles, so ignore them for now. I think you have bigger problems right now. (Looking at line 55 of the "UsbKeyboard.h" file, I don't think the warning is anything to be concerned about.)

Have you ever successfully uploaded a sketch (program) to your new board?
"Blink" is a good place to start, rather than a complex example like you're trying.

The "Blink" sketch can be found in the examples included in the IDE, under >File >Examples >Basics "Blink"

It requires no additional hardware, and if it uploads OK and your board is OK, the onboard LED will blink once every 2 seconds.

Let us know how it goes. I suspect that it won't upload either.

Edit: And it shouldn't matter which programmer you have selected in the IDE since you're uploading using the USB to TTL converter. You need to click on the "Upload" button in the IDE to upload a program. Don't click on >Sketch >Upload using programmer. (Because you aren't using an ISP programmer.)
I have not loaded anything to the board before.
Thank you for explaining the "blink" program.
I tried that and it does the same thing. After compiling, it just sits at the uploading stage and nothing else happens.
I will have to check if my led is on pin 13.
I will also have access to a pc tonight so I will try it on that.

Once again, thanks for your help.

OldSteve

#14
Apr 04, 2016, 07:59 am Last Edit: Apr 04, 2016, 08:19 am by OldSteve
I have not loaded anything to the board before.
Thank you for explaining the "blink" program.
I tried that and it does the same thing. After compiling, it just sits at the uploading stage and nothing else happens.
I will have to check if my led is on pin 13.
I will also have access to a pc tonight so I will try it on that.

Once again, thanks for your help.
No worries Brian. So that 'Shrimpkey' sketch is probably OK. Just put it aside for the moment until you get your board working properly.

Looking at your photo, the LED is correctly connected to pin 13, so it will blink when you eventually get "Blink" to load.

I think I just spotted your problem. It looks like your Tx and Rx lines are reversed. Tx on your board should go to Rx on the CP2104 module, and your board's Rx should go to the CP2104 Tx, I'm pretty sure. Edit: (Definitely - I just double-checked my CP2102 modules because I get confused sometimes too. :) )
Swap them around and try again.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Go Up