Arduino 1.0 and Gentoo [Closed. Restating the question in another post]

Hello to everyone. I have installed arduino into my gentoo linux. I did it following the steps of the official page Arduino Playground - HomePage ... that allow install the old 0.22 version. Version that brings problems with the new SD.h library. I would like to use the new library from write a code that manages the SD card and therefore i need upgrade to the new Arduino v1.0. ¿But how can i do it? I don't have idea of how to do.

I have downloaded the arduino source but i don't know how to compile install ,and run it. The steps of the generic linux did not help enough for me or i did not undestand thems.

On the other hand, if i download the 64 bits binaries, i don't know how to do with thems too.

I can't use neither of both methods. I will preferred use the first method and build binaries for my system. But not idea

Please, Can anyone help me? Thanks in advance.

If your install of V0022 works, you should be able to download the Arduino IDE V1.0 from the Arduino site. Unpack it in a local directory and run the arduino program in that directory.

I use both IDE V0022 and V1.0, but I use Ubuntu.

Thank for reply SurferTim.

Well if I get the source code and decompress it, i can't see the arduino script as it says here: Arduino Playground - Linux

Otherwise, if I get the 64 bit binaries, I can execute the IDE, but when I try to compile code, for example the blink, I obtain the next error:

/home/enigma/Archivos/Programas/Arduino/bin-64-compilado/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp: En la función miembro ‘size_t Print::print(const __FlashStringHelper*)’:
/home/enigma/Archivos/Programas/Arduino/bin-64-compilado/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:44:9: error: ‘prog_char’ no nombra a un tipo
/home/enigma/Archivos/Programas/Arduino/bin-64-compilado/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:47:23: error: ‘p’ no se declaró en este ámbito

I don't speak spanish well anymore, but I do speak computer. I know that error. You must be using avr-libc v1.8.0. There is a typedef that has been deprecated, and no longer works in that version.

Here is the bug report and fix:
http://code.google.com/p/arduino/issues/detail?id=795&start=300

Here is the fix applied to the code in ../arduino-1.0/hardware/arduino/cores/arduino/Print.cpp

size_t Print::print(const __FlashStringHelper *ifsh)
{
  // old code. The typedef prog_char is no longer valid.
  // const prog_char *p = (const prog_char *)ifsh;
  // new code. Recommended usage is now in the variable declaration
  const char PROGMEM *p = (const char PROGMEM *)ifsh;
  size_t n = 0;
  while (1) {
    unsigned char c = pgm_read_byte(p++);
    if (c == 0) break;
    n += write(c);
  }
  return n;
}

Edit: Added comments.

Recently i discovered in the "code" sub directory a "make.sh" script, but when i run it like root i did obtain

./make.sh
updating PApplet with PGraphics api changes
..java:0:0:0:0: Semantic Error: The input file "*.java" was not found.

But i already jre installed. I can execute the old IDE ¿What could happen?

Ok Surfer. Thank you very much. I will try fix it

Try it. Let me know.

I did not need to recompile anything. I downloaded V1.0, unpacked it in a local directory named "arduino", and in that directory will be a file named "arduino". Run it and you get V1.0.

If you run the IDE like you did for V0022, you will get V0022. I do anyway.

Thank you very much again! that was the error. Finaly i could compile the blink!
But i have the same error that in the 0.22 version with the SD library. Error that don't appears in the windows version of arduino

Take a look to this code if you can please. It works perfectly wihout #include<SD.h>. It shows "Write if you can" once on the serial port.

but if i add the #include.h header to add SD support, the serial port shows an strange error. I don't now if i missed something or is an error of the linux IDE, cause on windows runs wihout problems

[EDITED THE ORIGINAL PROGRAM FOR ONE SIMPLY]

#include <stdlib.h>
#include <string.h>
//#include <SD.h> //If I uncomment the library the program don't works on linux. On windows continues running fine

const int chip_select=10;

void write_port(char *send);

void setup() {
Serial.begin(9600);
write_port("Write if you can\t\t");
}

void loop() {

}

//***************************** Functions
void write_port(char *send){
Serial.print(send);
}

Good to hear the fix worked.
Which MicroSD hardware are you using?

Arduino duemilanove. (i'm working on a simple code of the fail) Regards!

How is the microSD device connected to the duemilanove? Shield or jumper?

You could be running low on SRAM also. Not much there on some models. Looks like 1K to 2K, depending on the processor.

I have the standard SD shield with CS on pin 10 and VCC on 8, but i'm not touching the SD card yet. I only add #include <SD.h> to a simply program like this and dont work on linux

This simply program only write to serial port "Write if you can". It don't access to the SD card yet. Why then on linux, the serial port return trash if i uncomment the library?

#include <stdlib.h>
#include <string.h>
//#include <SD.h> //If I uncomment the library the program don't works on linux. On windows continues running fine

const int chip_select=10;

void write_port(char *send);

void setup() {
Serial.begin(9600);
write_port("Write if you can\t\t");
}

void loop() {

}

//***************************** Functions
void write_port(char *send){
Serial.print(send);
}

"not work" means doesn't compile? Or doesn't run?

If it doesn't run, and pushes trash out the serial port, you may have run out of SRAM.

Runs bad, like if the pointer was losted. I can upload the code but don't write "Write if you can" to the USB port, writes aleatory ascii sometimes, others don't write nothing.

note: i have
gcc 4.5.3-r1
binutils 2.22-r1 and the blink don't flashes too. I did read that with gcc 4.3.3 and binutils 2.20.1 blink works fine

Could be a gcc problem.

¿Use arduino gcc to compile the code?

The blink problem was in avr-libc versions prior to v1.7.1. You are on v1.8.0 by the typedef error you fixed.

If blink compiles and doesn't work with the "#include<SD.h>" and works without it, sounds like you are running out of memory. The new Linux avr-libc and avr-gcc may be using more memory than the Windows counterpart does.

No way!!! apart the problem on my code with #include<SD.h> (Yes I have avr-libc v1.8.0) the blink don't work.

The blink problem is another issue appart the SD library.

But if my program runs on windows with #include <SD.h> and not on linux where it behaves like if the pointers overflow, ok do you think that the memory is full.... ¿¿¿With a program of 10 lines and the library??.. ok. Well how can we fix this?

Thanks for the patience Surfer!

If blink doesn't run on its own, then you have other issues besides memory. I am not using v1.8.0. I am on v1.7.1 with Ubuntu mods.

I would try to find out why blink doesn't work. I don't have a duemilanove to try it on. Is the code something like this? Insure you have selected the correct model Arduino under Tools.

void setup()
{
   pinMode(13,OUTPUT);
   digitalWrite(13,HIGH);
}

void loop()
{
   delay(500);
   digitalWrite(13,LOW);
   delay(500);
   digitalWrite(13,HIGH);
}

Does the led blink? Or does it light up? Or stays dark?

Yes! your Blink code don't works

On the other hand, this simply code don't works too on my linux when I uncomment #include<SD.h>

//#include <SD.h>

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.print("Write if you can\t\t");
}

Is for become crazy, cause this program with the old libray and Arduino v0.22 works XDDDD...and sucks!

#include <SDuFAT.h>
#include <mmc.h>
#include <microfat.h>

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.print("Write if you can\t\t");
}

How about this? It does not use the delay() function. The timing may be off because it works on a Mega.

int loopCount,milliCount,secCount,minCount;
byte ledStat;
char outBuf[32];

void setup()
{
  Serial.begin(9600);
  pinMode(13,OUTPUT);  
  loopCount = 0;
  milliCount = 0;
  secCount = 0;
  minCount = 0;
  ledStat = 0;
}

void loop()
{
  loopCount++;
  
  if(loopCount > 582)
  {
    loopCount = 0;
    milliCount++;

    if(milliCount > 500)    
    {
      milliCount = 0;
      
      if(ledStat)
      {
        digitalWrite(13,LOW);
        ledStat = 0;
      }
      else
      {
        secCount++;
        Serial.println(secCount);
        digitalWrite(13,HIGH);
        ledStat = 1;
      }    
    }
  }
}

Does this blink? Any serial output?

There may be an issue with the delay() function again in avr-libc v1.8.0.