Pages: [1] 2   Go Down
Author Topic: Ethernet Shield Prob with Eclipse  (Read 1343 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well i am using eclipse as shown on the subject. I bought an ethernet shield. i tried some examples to check how it is working on the Arduino Ide and there was no problem. I made a new project at Eclipse and i copied all the libraries from the Ethernet example in the folder that i keep my libraries in each project. I included the w5100 and the util  libraries and all inside the utilities folder so there is no problem with finding the .h files.

It is not the first project i have others that work without problems and there are identical.The only difference is that the Ethernet Shield libs does not "work".

Build has no problem but i think linker has. When i try to open any .cpp file of the libraries (almost everything) i get these errors many times:

1) for Dhcp.cpp:

Quote
Description   Resource   Path   Location   Type
Invalid arguments '
Candidates are:
int read()
int read(unsigned char *, unsigned int)
int read(char *, unsigned int)
'   Dhcp.cpp   /EthernetShield/lib   line 269   Semantic Error

and the line on the code is

Code:
_dhcpUdpSocket.read((uint8_t*)&fixedMsg, sizeof(RIP_MSG_FIXED));

2)For Dns.cpp i get

Quote
Description   Resource   Path   Location   Type
Invalid arguments '
Candidates are:
int read()
int read(unsigned char *, unsigned int)
int read(char *, unsigned int)
'   Dns.cpp   /EthernetShield/lib   line 382   Semantic Error

the code is :

Code:
iUdp.read((uint8_t*)&answerType, sizeof(answerType));

3) for EthernetUdp.cpp i get:

Quote
Description   Resource   Path   Location   Type
Invalid arguments '
Candidates are:
int recv(unsigned int, unsigned int *, int)
'   EthernetUdp.cpp   /EthernetShield/lib   line 173   Semantic Error


the code is:

Code:
got = recv(_sock, buffer, _remaining);


The problems are many and all the same type for each lib at the same functions each time.i just gave you one for each lib.

And final
4) for Ethernet.cpp i get

Quote
Description   Resource   Path   Location   Type
Symbol 'NULL' could not be resolved   Ethernet.cpp   /EthernetShield/lib   line 72   Semantic Error

code is :

Code:
  if(_dhcp != NULL){
    //we have a pointer to dhcp, use it
    rc = _dhcp->checkLease();
    switch ( rc ){
      case DHCP_CHECK_NONE:
        //nothing done
        break;
      case DHCP_CHECK_RENEW_OK:
      case DHCP_CHECK_REBIND_OK:
        //we might have got a new IP.
        W5100.setIPAddress(_dhcp->getLocalIp().raw_address());
        W5100.setGatewayIp(_dhcp->getGatewayIp().raw_address());
        W5100.setSubnetMask(_dhcp->getSubnetMask().raw_address());
        _dnsServerAddress = _dhcp->getDnsServerIp();
        break;
      default:
        //this is actually a error, it will retry though
        break;
    }
  }
  return rc;
}
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You work with Eclipse, but how have you set up the cross compilation environment? Which compiler do you use, what standard includes do you make?

Your first error: unsigned char * should be equal to uint8_t * and sizeof() should return an unsigned int. It looks like your compiler does not have that impression and gives you candidates for a function it should be able to assign itself. Same probably applies for the other errors.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well i do not know what is excactly the answer to the question of the compiler. If you want to help me out and tell me where do i see that i can tell you. I do not want to answer anything i do not know. I did the procedures of the sites about using the eclipse with arduino with avr plugin etc.There are 2 fixed projects that work on the sites the first for arduino core and the other for a blink project that i use to make new projects. I have added some other lib folder to store my own lib. So i do now know what is the answer in witch is the compiler. There is also a problem with null that it does not understand.

Well also in project -->properties --> C/C++ builder --> there is avr assempler ,avr compiler c/c++, avr linker (which i think the last has the problem cause when i open eclipse and build all withoutdoing anything else i get no errors, but when i try to open the .cpp files of the libraries then  the problems and the error starts then i get error.)

also inside project-->properties--->Builder i get : CDT builder and Scanner Configuration builder
« Last Edit: January 24, 2013, 10:15:41 am by kyrpav » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds like you haven't done the Eclipse setup yourself. Where have you got it from? It seems to be incomplete for Arduino. With some effort you can program around these deficiencies, it's your decision if you wanna fix the problem or live with it.

If you change the code to

Code:
_dhcpUdpSocket.read((unsigned char*)&fixedMsg, (unsigned int) sizeof(RIP_MSG_FIXED));

it probably compiles.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well i used all the tutorials  about the arduino and eclipse and everyone has his differences. At last there is a tutorial that gives the project of ArduinoCore and a blink project . I have made 6 more projects with other libraries for  a real time clock and etc with no problems.

Well is there any solution except trying to change the code?
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Basically i got  the projects ready from here .

http://playground.arduino.cc/code/eclipse#YourFirstArduinoProject


 there is  a section almost at the end of the page with the  name Eclipse Template Project that has a link to github with the projects. The only thin you have to do in order to make another project is to copy the Blink folder(that has the blink project) rename it, and rename the name at the .project (something like this ) file. So i have made several projects without any problem. Where exactly is this problem and who can i solve it without casting all variables?Also there is the problem that it does not understand NULL.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Show the code you're trying to compile. On which platform are you trying to compile this? Do you follow the steps in "Your second Arduino project" too?
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well i said this before but i can always repeat. I am using osx ,eclipse and  i use it to write for arduino. The code is all the libraries that Arduino Ide has on the example for Ethernet Shield there is nothing that i wrote. After all the steps at the playground they give the projects ready. So there is nothing i did wrong on this except if the playground have them wrong.Every .cpp file has some problems and in each .cpp file the problems are the same so i gave you in the first post what  error (in which function) every .cpp file gives. Please read it if you can help me. The compiler soes not give any error when i open eclipse and  build all for first time. Error begun when i try to open at the editor any of these .cpp files.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you said the correct problem at the first reply you did

Quote
Your first error: unsigned char * should be equal to uint8_t * and sizeof() should return an unsigned int. It looks like your compiler does not have that impression and gives you candidates for a function it should be able to assign itself. Same probably applies for the other errors.

if i cast all the differences it will propably  will be fixed except the last error that i do not know what to do with Null.

I would like not to cast which is easy but fix it in general.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem with NULL can be fixed easily:

Code:
#define NULL 0

Although if you correctly include the necessary headers this shouldn't be necessary.

I don't have an OS X machine, so I cannot give you instructions how to do it on that system.

Have you adapted the instructions on the playground page from the old IDE to the past-1.0 IDE? WProgram.h is now Arduino.h (just one example).

And you haven't answered my question: Have you followed the instructions for "Your second Arduino project" on the playground page too?

BTW: it's explicitly noted there that only on Linux it's possible to compile the same project under the IDE and Eclipse. I cannot find a sentence stating that every Arduino sketch should run unchanged under this Eclipse setup.
My interpretation of this is: If you wanna work under Eclipse you HAVE TO modify most of the sketches to compile correctly. This is probably also true for many libraries.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well yes i know that after version 1.00 the header WProgram.h is now Arduino.h.

I am also correcting problems about some libraries but i think these 2 type of problems are supposed to be solved in the ArduinoCore project.

I have answered that the ArduinoCore project and an example of another fixed project are uploaded at the official site at playground.So the only thing you need to change is the name of the folder and the name of the project inside the .project file. Because you asked i checked my project with every instruction in the guide for the second project and i did not find any difference.

I think that the problem of understanding NULL and that unint8_t*==unsigned char* are not problems of the project and should have been fixed in the ArduinoCore project.
Correct me if i am wrong.
and yes i could define Null =0 but i want it to be defined in general not in any specific project.

Also this topic is not about the sketch. i haven't tried to use the sketch yet i have just copy-paste the libraries of ethernet shield example in the eclipse project.
« Last Edit: January 28, 2013, 10:10:34 am by kyrpav » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have answered that the ArduinoCore project and an example of another fixed project are uploaded at the official site at playground.

Where on the referenced playground page have you found an ArduinoCore project for download? I found only a description how to make your own library project. Are we talking about the same page?

Quote
Also this topic is not about the sketch. i haven't tried to use the sketch yet i have just copy-paste the libraries of ethernet shield example in the eclipse project.

All examples in the Ethernet library folder are sketches.

Which of the examples are you trying to compile?

The NULL define is found here in the AVR cross compilation environment of the IDE:

hardware/tools/avr/lib/gcc/avr/4.3.2/include/stddef.h:#define NULL 0

Are you really correctly including this stuff? Show us the code you're compiling!
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you pylon for helping in general. every project i do not mean the ArduinoCore project has something with name INCLUDES(and i say something because it is not a folder tho it includes all the avr/4.3.2/include/ folders) inside that INCLUDES type of file  i  found the lib and it  exists. I can not add this  INCLUDES team of files (i use uppercase to make it different from the  word include) at the cc/c++ build/directories in order the program to read them cause it is not recognized as a folder (as i did with a folder named lib). So i can not include the  headers.Any idea? i could just copy paste them in the ArduinoCore /src/ folder probably but is there any other way?

I will give you a picture of this.in order to see the tree.

Well i told you that i do not use sketch . In my experience examples in arduino ide have  sketches(.ino .pde) and in the previous folder that sketches exist there are the libraries are needed for every sketch. I just copied the libraries to my /lib/ folder in my Eclipse project and  the compiler gives error. I did not try to write anything to the main.cpp. I did not tried to open the .ino or .pde file and choose the  part of the code i wanted on my main.cpp. I was going to write it myself. The problem starts before i go to main.cpp it is only about the way it does not understan the .h and .cpp files of the Ethernet Shield library. Main.cpp does  nothing at this point.


* Screen Shot 2013-01-29 at 11.50.34 AM.png (84.72 KB, 679x881 - viewed 32 times.)
« Last Edit: January 29, 2013, 05:01:32 am by kyrpav » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Well i told you that i do not use sketch . In my experience example in arduino ide have the sketch(.ino .pde) and in the previous folder that sketch exist there are the libraries are needed for every sketch. I just copied the libraries to my /lib/ folder in my Eclipse project and  the compiler gives error. I did not try to write anything to the main.cpp.

I guess this is exactly the problem you have. You think of the Arduino IDE as a lightweight version of Eclipse. It isn't. It's not a general IDE that you can configure to program in any language or for any target, it's for programming an Arduino. That's it.
Because of that specialization it does some magical stuff not easy to emulate with a traditional IDE like Eclipse. A sketch is rearranged and extended with "glue" code to form a .cpp file which is then compiled with a standard cross-compiler. This magical part of rearrangement and code addition has to be done manually when using another IDE (like Eclipse).
In your case it means: You have to create a main.cpp that does all the necessary includes before including the Ethernet library headers.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 159
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-confuse   smiley-cry Well ones more propably i do not understand you cause i  think that what you say is slightly different from what is happening. Even if i write all the #include "Ethernet.h"..... in my main.cpp the problem is not solved. Also in other projects i have done i did not have to write the main.cpp in order not to have problems to the libraries its self. I think that this is a different problem. I did not try to do something with the program yet and i failed. I tried to check if the libraries have any problems and i think that this does not have to do with my main cause then the problem would have been in my main with a sentence like "this variable is not defined" so i would have to check if i included  the correct .h from the Ethernet shield in the main.cpp.I do not have any error in main it just finds problems in the cpp of the libraries because it finds deferences.

If you check the photo you will see the INCLUDES type of folder with the icon that has the .h on it. How can i make the project use this type of folder in the directories of c and c++ compiler cause when i try to add  a directory there this INCLUDES does not appear as the /lib folder i have does. i will send  another photo of this in order to be more clear.

I understand that Arduino IDE is not a light version of Eclipse i know i have to make it work but in some things i do not know how. Fore example i have solved some problems on the libs that needed to include some header that was realy obvious what the problem was.

at the photo you can see the first lines of main that i have included some of the .h and that after compiling the problems still exist. I have opened project properties to see that i have included the folder /lib in the directories of the c and c++ compiler and i though that i could do the same with this INCLUDE "folder" that does not appear as you see by yourself inside the project.


* Screen Shot 2013-01-29 at 12.37.03 PM.png (330.57 KB, 1918x969 - viewed 33 times.)
Logged

Pages: [1] 2   Go Up
Jump to: