Pages: [1] 2   Go Down
Author Topic: Arduino 0014 (w/ updated AVR tools).  (Read 2096 times)
0 Members and 1 Guest are viewing this topic.
Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Arduino 0014 is now available from the software page: http://arduino.cc/en/Main/Software

There are only a few changes, mostly an updated version of the AVR tools:

[core / libraries]
* Fixing bug that prevented multiple outgoing Client connections with the ethernet library.
  
[environment]
* Clarifying ATmega168 vs. ATmega328 in the Tools > Boards menu.

[tools]
* Updating the Mac OS X AVR tools to AVR MacPack 20081213.  This includes avr-gcc 4.3.2, which should fix problems with functions called from within interrupts.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I know I shouldn't say this but: Congratulation!
Logged

Montreal
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Love your work!
i got a question?
if you try this code in Rev 0012 it compile perfectly, but since 0013 its doesn't.
i have a program that need the interrupt handling.
i was wondering why would the wiring_serial.c in include even if there is no call to it?

i actually just add the ISR to blink.pde (a safe program) that i was sure that was working properly.

Thank

Code:
/*
 * Blink
 *
 * The basic Arduino example.  Turns on an LED on for one second,
 * then off for one second, and so on...  We use pin 13 because,
 * depending on your Arduino board, it has either a built-in LED
 * or a built-in resistor so that you need only an LED.
 *
 * http://www.arduino.cc/en/Tutorial/Blink
 */
ISR(USART_RX_vect)
{
}
int ledPin = 13;                // LED connected to digital pin 13

void setup()                    // run once, when the sketch starts
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()                     // run over and over again
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}
Logged

Patgadget
Montreal

0
Offline Offline
God Member
*****
Karma: 1
Posts: 588
LumiNet rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are there differences to revision 557 of the (googlecode) svn trunk?
Logged


Indiana
Offline Offline
Full Member
***
Karma: 1
Posts: 234
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
if you try this code in Rev 0012 it compile perfectly, but since 0013 its doesn't. i have a program that need the interrupt handling.
i was wondering why would the wiring_serial.c in include even if there is no call to it?

The reason your compile is failing is because the preprocessor includes "WProgram.h" in every sketch.  WProgram.h includes "HardwareSerial". HardwareSerial uses the "USART_RX_vect" interrupt vector.  So even though the hardware serial would be optimized out since you didn't use it, the duplicate ISR definition is causing a compile error before the linker can get to the optimization stage.

So if you're just testing to see if you can define an ISR, use a different interrupt vector.  If you really need to use this vector, then you have a problem.  I don't know why you'd want to do this anyway unless you intended to write your own hardware serial implementation.

At least I think that's what's going on.  Why this changed after 0011 I don't know.
« Last Edit: March 11, 2009, 07:45:55 pm by etracer » Logged

Montreal
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is why,
i make a DMX Receiver and i need to monitor a break condition.

Code:
#include <Servo.h>

#define myubbr (16000000L/16/250000-1)
Servo servo1; Servo servo2;

char oldDMX;
volatile unsigned char DMX[64];
volatile int DMXChannel=0;


ISR(USART_RX_vect)
{
  char temp,temp1;
  temp1 = UCSR0A;
  temp = UDR0&0xFF;
  if ((temp1 & (1<<FE0))||temp1 & (1<<DOR0)) //Break
  {
    DMXChannel = 0;
    return;
  }
  else if (DMXChannel<(char)25)
  {
    DMX[DMXChannel++]=temp&0xFF;
  }
}

void setup()
{
  pinMode(5,OUTPUT);
  pinMode(0,INPUT);
  pinMode(8,INPUT);
  pinMode(13,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(9,OUTPUT);
  digitalWrite(5,HIGH);
  digitalWrite(8,HIGH);

  servo1.attach(9); //analog pin 0
  servo2.attach(10); //analog pin 1
  delay(100);
  UBRR0H = (unsigned char)(myubbr>>8);
  UBRR0L = (unsigned char)myubbr;
  UCSR0B |= ((1<<RXEN0)|(1<<RXCIE0));//Enable Receiver and Interrupt RX
  UCSR0C |= (3<<UCSZ00);//N81
 
}
void loop()
{
    servo1.write(map(DMX[1],0,255,25,125));
    servo2.write(map(DMX[2],0,255,30,120));
    analogWrite(11,255-DMX[3]);
    analogWrite(5,255-DMX[4]);
    analogWrite(6,255-DMX[5]);
}
« Last Edit: March 11, 2009, 07:48:29 pm by patgadget » Logged

Patgadget
Montreal

New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
if you try this code in Rev 0012 it compile perfectly, but since 0013 its doesn't.
Can you please post the exact error message?

It's likely to be a similar problem to: "Re: Collision:__vector_1 in WInterrupts.c, USBAVR, v13".

--Phil.
Logged

Indiana
Offline Offline
Full Member
***
Karma: 1
Posts: 234
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Starting with version 0012 a new major version of the avr-gcc compiler has been included (4.3).  Also I seem to recall some changes to the compiler flags to optimize for size rather than speed.  So between these things something has changed that is causing the duplicate vector to be detected before the unneeded HardwareSerial code is optimized out.

I suppose you could always alter wiring_serial.c and remove the interrupt signal definition. Of course your hardware serial would be broken until you changed it back. Maybe have two arduino installs, one with a working hardware serial and the other lobotomized so you can use the interrupt vector.
Logged

Indiana
Offline Offline
Full Member
***
Karma: 1
Posts: 234
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's the error:

Code:
tmp/build4061.tmp/wiring_serial.c.o: In function `__vector_18':

/Applications/arduino-0014/hardware/cores/arduino/wiring_serial.c:112: multiple definition of `__vector_18'

It's because wiring_serial.c is using the same vector.

Code:
#if defined(__AVR_ATmega8__)
SIGNAL(SIG_UART_RECV)
#else
SIGNAL(USART_RX_vect)
#endif
{
#if defined(__AVR_ATmega8__)
      unsigned char c = UDR;
#else
      unsigned char c = UDR0;
#endif

      int i = (rx_buffer_head + 1) % RX_BUFFER_SIZE;

      // if we should be storing the received character into the location
      // just before the tail (meaning that the head would advance to the
      // current location of the tail), we're about to overflow the buffer
      // and so we don't write the character or advance the head.
      if (i != rx_buffer_tail) {
            rx_buffer[rx_buffer_head] = c;
            rx_buffer_head = i;
      }
}

"USART_RX_vect" is vector 18.
« Last Edit: March 11, 2009, 08:18:46 pm by etracer » Logged

New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As pointed out in the thread I linked above, this is the change that breaks things: http://code.google.com/p/arduino/source/detail?spec=svn557&r=526

I am confused as to why there is a name clash though, because surely it's actually the same actual vector as before, even if the name was different. I haven't yet poked into the generated code to find out what exactly happens.

--Phil.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6637
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Patgadget:  I recently tracked this down as a result of other mysterious behavior (sketches not including Serial function still using 128+ bytes for the serial input buffer, which they didn't in 11 or 12.)

In 12 and earlier, Wiring_serial.cpp.o and the rest of the arduino core library are assembled into a "core library file" core.a, which is then searched during the final link for needed functions.

In 13 and later, new compiler switches are introduced that permit unused functions and data to be omitted from the finished sketch even if they weren't in a searchable library.  This was THOUGHT to do away with the need for building core.a as a separate step, but apparently there are some subtle differences.

Previously when you used your own serial code, you didn't reference the Serial.xxx functions, and the Wiring_serial.cpp.o module was not included in your sketch (from the core.a library) at all.  With 13, it is linked in explicitly and expected that most of it will go away as being unreferenced, but some global code like the ISR itself has to be included (called by the hardware, you know), and that references the serial buffering, and ...

I've requested that the core.a code be put back as well as the new stripping feature (assuming that they work together ok.)  We'll see what happens.

The relevant change was http://code.google.com/p/arduino/source/detail?r=520
It looks pretty easy to fix on your own, if you want to build from sources.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I still have to commit the latest version of the Windows AVR tools, but otherwise 557 is the same as the release.

Logged

Montreal
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank a lot to every one!
sorry that i had to post it here.
i knew that we had an issue in 0013 and was hoping that everithing would be fixe in 0014

Again thanks you
Logged

Patgadget
Montreal

New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
With 13, it is linked in explicitly and expected that most of it will go away as being unreferenced, but some global code like the ISR itself has to be included (called by the hardware, you know), and that references the serial buffering, and ...
Oh, that totally makes sense. Maybe that's why we weren't getting interrupt name clashes with AVRUSB before because the routines weren't being used. In which case it's only a coincidence that it happened with the change of name used.

Hmmm, which suggests there were previously scenarios in which the AVRUSB library would fail to compile if interrupts were used.

I should probably confirm all this. :-)

--Phil.
Logged

Montréal, QC
Offline Offline
Newbie
*
Karma: 0
Posts: 26
OBDuino developper
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Unfortunately, with gcc 4.3.2 from WinAVR20081205 instead of gcc 4.3.0 from 20080610, sketchs are now way bigger  :-[  :-[  :-[
Mine went from 15524 bytes to 16734 bytes (+1210 bytes!!!) so it does not fit the 16K (I am not using a bootloader), so I will stick with 0012 or 0013.
Logged

Pages: [1] 2   Go Up
Jump to: