Wiring 1.0.1 ATMega2560 + EthernetShield build error

Today, while trying to build and ethenet enable ino for the ATMega 2560 using Ethernet.h I got the following error:

"C:\Users\Russ\AppData\Local\VMicro\Arduino\Builds\ScannerTest\mega2560\Ethernet\utility\w5100.cpp.o" "C:\Users\Russ\AppData\Local\VMicro\Arduino\Builds\ScannerTest\mega2560\core.a" -L"C:\Users\Russ\AppData\Local\VMicro\Arduino\Builds\ScannerTest\mega2560" -lm
crtm2560.o : In function `__vector_default'
(.vectors+0xc)* : \Users\Russ\AppData\Local\VMicro\Arduino\Builds\ScannerTest\mega2560\core.a(WInterrupts.c.o)

After frustrating myself for an hour with the following header includes:
#include <SPI.h>
#include <Ethernet.h>
#include <Dhcp.h>
#include <dns.h>

I open another file, copied and pasted but forgot to change boards and the project worked/compiled.
The only difference was a single include of SoftwareSerial.h

#include <SoftwareSerial.h> //Have to include this to get the Ethernet.h to compile
#include <SPI.h>
#include <Ethernet.h>
#include <Dhcp.h>
#include <dns.h>

Hope this helps someone.
Russ

#include <SoftwareSerial.h> //Have to include this to get the Ethernet.h to compile

I've never had to.

"C:\Users\Russ\AppData\Local<mark>VMicro\Arduino\Builds\ScannerTest\mega2560\Ethernet\utility\w5100.cpp.o"

Hmmm...

Hope this helps someone.

Without seeing the code you were trying to compile, and knowing the context, it won't.

/*
I tried to compile this using wiring 1.0.1 using both the Aduino IDE and Visual Micro for Visual Studio 2010 Ultimate.
The compilation threw the error described above. However, when SoftwareSerial.h is included the error goes away.
Originally was going to reduce the code for this post but then the error might change? So I've included the totall file
even though my coding skills suck :frowning:

If anyone has an explanation why I'm getting the error without the SofwareSerial header I would love to know.
My system is Windows 7, freshly installed with Arduino 1.0.1 and Visual Micro (latest beta: Sat Sep 15 2012 at 7:00 AM)

*/
#include <Arduino.h>
#include <PS2Keyboard.h>
#include <SPI.h>
//#include <SoftwareSerial.h> //Need for mega2560 to access ethernet.h
#include <Ethernet.h>
#include <Dhcp.h>
#include <dns.h>

//Web server IP Address object
IPAddress webServer(192,168,1,105); //local host/arduinoinput/clockin.aspx
//#define BASE_URI "GET /tm/Keyfob.asp?k=" //missing k={tag key}
#define BASE_URI "GET /arduinoinput/clockin.aspx?s=asdf&c=001&k=" //missing k={tag key}

#define DATA_PIN 5 // Data pin of Bar Code Scanner
#define CLOCK_PIN 2 // Clock pin of Bar Code Scanner
//char string[14];

//int i = 0;

PS2Keyboard barCode_Scanner;

// Enter a MAC address and IP address for your controller(mac address of your ethernet shield) below.
// The IP address will be dependent on your local network.
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x88, 0xB9 };

char buffer [32]; // buffer to hold definition of barcode

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP).
//TextFinder finder(client);

void setup() {
barCode_Scanner.begin(DATA_PIN, CLOCK_PIN);
// start the Ethernet connection:
//Ethernet.begin(mac, ip);
// start the serial library:
Serial.begin(9600);
// give the Ethernet shield a second to initialize:
delay(1000);
}

void loop()
{
CheckScanner();
}

String barCode="r:";
bool CheckScanner()
{

if(barCode_Scanner.available())
{
//reads the data from the Bar Code scanner using the PS2Keyboard library
byte dat = barCode_Scanner.read();
byte val = dat - '0';
if(val >= 0 && val <= 9)
{
//adds the code read from the scanner to the barCode string
barCode.concat((int)val);
}
else if(dat == PS2_ENTER)
{
Serial.println();
Serial.println(barCode);
SendUserKey(&barCode[0]);
barCode = "r:";
}
}
}

bool SendUserKey(char* userKey)
{

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):

EthernetClient client;

// start the Ethernet connection:
if (Ethernet.begin(mac) == 0)
{
Serial.println("Failed to configure Ethernet using DHCP");
return false;
}

char uriTarget[128];
sprintf(uriTarget,"%s%s",BASE_URI,userKey);
Serial.println(uriTarget);
if(client.connect(webServer,80))
{
client.println(uriTarget);client.println();
}
else
{
//Error light
}

//Need this delay to wait for server to respond or ethernet client buffer!!!
//REM: Modified May 1, 2012 -- Raised wait period from 100 to 250
// Was not getting a response from server
delay(250);

char result[2]; //Store web GET Result as string.
result[0]=NULL; //Store NULL to first position, actual responce character
result[1]=NULL; //Store NULL to last position, end of string terminator

//Outside timing loop to give the server time to send data back
unsigned long waitTimeStart = millis(); //Issue 2 fix, REM
while(millis() - waitTimeStart < 2000)
{
//indicates the client has received a response from the server
//if server does not respond then the outer loops falls out after SERVER_WAIT_PERIOD elapses
boolean endLoop = false;

char c; //Holder for Serial Read from Ethernet Shield
while(client.available())
{
endLoop = true;
c = client.read(); //Get first or next character from Ethernet Shield
delay(2); //Have to have this wait or next pass will fail!
//DEBUG_PRINT(c);
if(isprint(c)) //Disregard any info except printable characters
{
Serial.print(c);
//Really only want the last character in the stream so keep storing
//Each read character, the last character will be the correct one.
result[0] = c;
}
}
Serial.println("");

//Break out of outer loop if client processed return data from the server
if(endLoop) {break;}
}

//If the first character is not NULL we got a responce from the server
if(result[0] != NULL)
{
//DEBUG_PRINT("Result: ");DEBUG_PRINTLN(result);
//Check for '0' = Server denied the RFID, maybe unknown or not allowed
if(!strcmp("0",result)) //Deny --UNKNOWN TAG
{
Serial.println("Unknown Tag, Access Denied");
// FlashLightAmber();
}
//Check for '1' = Server granted Login Access for the RFID
else if(!strcmp("1",result)) //Grant--LOG-IN
{
Serial.println("Login, Access Granted: ");
//FlashLightGreen();
}
//Check for "2" = Server granted Logout Access for the RFID
else if(!strcmp("2",result)) // LOG-OUT
{
Serial.println("Logout, Access Granted: ");
//FlashLightRed();
}
//We don't understand any other chacter so show denied feed back
else
{
Serial.print("Unknown Responce, Access Denied: ");Serial.println((char*)result);
//FlashLightAmber();
}
}
//Close the connection or we'll run out of memory on the client object on the next call.
client.stop();
return (result[0] != NULL); //Return true if we got a result from the server
}

My system is Windows 7, freshly installed with Arduino 1.0.1 and Visual Micro

Have you tried compiling this using the IDE? If not, I'd suggest that YOU are the one that needs to.

If it compiles in the IDE, and not in Visual Micro, then the problem is with Visual Micro, not the Arduino tool chain.

Yes, I tried compiling from both environments and both gave the same error :frowning:

Perhaps it would work better from Studio 6?

Thanks for the help... :slight_smile:

I copied and pasted your code into 1.0.1. I tried to compile it. I got errors about the PS2Keyboard library missing. I shut down the IDE, downloaded and installed the library, and restarted the IDE, and pasted your code again.

Then I got this "error":

Binary sketch size: 21,272 bytes (of a 258,048 byte maximum)

OK...
I'll try this again, I'll re-install the Wiring IDE...
and try again :slight_smile:

I'll try this again, I'll re-install the Wiring IDE...

It would make a lot more sense to install the Arduino IDE.

If you are really trying to use Wiring, you're in the wrong forum to complain about it not working with your Arduino.

My bad, yes, the Arduino IDE, thx! No complaints here, just looking for solutions. Would really love to expanded my experiences into the micro controller market :slight_smile: Times are hard here.