Go Down

Topic: Problem with using Bobuino 1284 bootloader as ArduinoISP (Read 2125 times) previous topic - next topic

oric_dan

I seem to have found another problem with the Bobuino variant pins_arduino.h
file created by maniacbug. I tried to use the Bobuino board selection as an
ArduinoISP, but got the following compile-time errors:
Quote
In file included from ArduinoISP.ino:66:
C:\...\Arduino\hardware\mighty-1284p-master\variants\bobuino/pins_arduino.h:38:
error: previous declaration of 'const uint8_t digital_pin_to_timer_PGM [32]' with
'C++' linkage
C:\...\Arduino\hardware\mighty-1284p-master\cores\standard/Arduino.h:133:
error: conflicts with new declaration with 'C' linkage ArduinoISP.ino:
In function 'void universal()':
ArduinoISP.ino:279: warning: unused variable 'w' ArduinoISP.ino:
In function 'int avrisp()':
ArduinoISP.ino:551: warning: no return statement in function returning non-void


I traced the first error to the following lines that were added to the
Bobuino\pins_arduino.h file, but which do "not" exist in the original maniacbug
standard\pins_arduino.h file. I don't know how to fix this myself, without possibly
mucking up something else.
Quote
extern const uint8_t digital_pin_to_pcint[NUM_DIGITAL_PINS];
extern const uint16_t __pcmsk[];
extern const uint8_t digital_pin_to_timer_PGM[NUM_DIGITAL_PINS];


Note that, since the same 1284P optibootloader is burned into both standard and
Bobuino version chips, I can compile the ArduinoISP sketch without errors when
using the "Mighty 1284P 16Mhz using Optiboot" board selection, and then I can
successfully use the 1284P to burn the bootloader into another chip [eg, UNO],
since the SPI port is on fixed pins.

So, the problem seems to be only in the Bobuino\pins_arduino.h file [I think].

retrolefty

#1
Feb 25, 2013, 12:26 am Last Edit: Feb 25, 2013, 12:30 am by retrolefty Reason: 1
I can verify the same error if trying to compile (verify only) arduinoISP sketch while Bobuino board selected but no error if mighty 1284P selected. I'll keep an eye out for comments on your findings.

Note: If I comment out those three lines in Bobuino variant pins_arduino.h you called out then there is no error and verify completes. Maybe just a case of being double declared?

Lefty

oric_dan

Quote
Note: If I comment out those three lines in Bobuino variant pins_arduino.h you called out then there is no error and verify completes. Maybe just a case of being double declared?

Yeah, but I don't know why the lines are in there, and what effect removing them
will have. Only maniacbug knows for sure why he included them, I imagine.

The other thing I noticed is, the following line near the end of Bobuino/pins_arduino.h
has PROGMEM in it, but the extern callout earlier in the file does not, but
I don't know enough about all this to be sure of fixing anything myself.
Quote
const uint8_t PROGMEM digital_pin_to_timer_PGM[NUM_DIGITAL_PINS] = {...}
...
earlier:
extern const uint8_t digital_pin_to_timer_PGM[NUM_DIGITAL_PINS];

retrolefty


Quote
Note: If I comment out those three lines in Bobuino variant pins_arduino.h you called out then there is no error and verify completes. Maybe just a case of being double declared?

Yeah, but I don't know why the lines are in there, and what effect removing them
will have. Only maniacbug knows for sure why he included them, I imagine.

The other thing I noticed is, the following line near the end of Bobuino/pins_arduino.h
has PROGMEM in it, but the extern callout earlier in the file does not, but
I don't know enough about all this to be sure of fixing anything myself.
Quote
const uint8_t PROGMEM digital_pin_to_timer_PGM[NUM_DIGITAL_PINS] = {...}
...
earlier:
extern const uint8_t digital_pin_to_timer_PGM[NUM_DIGITAL_PINS];



Can't comment on those questions, they are just beyond my software pay grade.  ;)

However just for grins I commented out those three lines, uploaded arduinoISP to my bobuino board and then used the board to burn a bootloader onto a 328p board, all worked fine.

Lefty

oric_dan

Sounds good, you might also try burning some of your regular sketches using
"Board > Bobuino" to verify they all work ok. I'll do the same.

Also, I wonder if sketches will run faster if PROGMEM is left out of the statements
in the pins_Arduino.h file. Any idea?
Quote
const uint8_t PROGMEM digital_pin_to_timer_PGM[NUM_DIGITAL_PINS] = {...}

retrolefty


Sounds good, you might also try burning some of your regular sketches using
"Board > Bobuino" to verify they all work ok. I'll do the same.

Also, I wonder if sketches will run faster if PROGMEM is left out of the statements
in the pins_Arduino.h file. Any idea?
Quote
const uint8_t PROGMEM digital_pin_to_timer_PGM[NUM_DIGITAL_PINS] = {...}



Again that's beyond my software pay grade. I'll just read along if anyone else has any further input on the topic. I just want the 1284P to be a viable board choice for people that want to continue to utilize DIP packaged chips and through hole components in their projects.

Lefty

oric_dan

I still find this whole thing bizarre. I got to wondering why the ArduinoISP sketch
would not compile using the Bobuino variant, while other sketches would. On
looking at the ArduinoISP sketch source code, the only statement that seemed
to explain anything was
Quote
#include "pins_arduino.h"

and I've never ever seen that used in another sketch, and assumed it was accessed
automatically [why the heck is it even in here?]. On commenting it out, the sketch
compiles with no problems.

So, that leaves 5 bizarrities.

1. why is the following statement even in the Bobuino variant pins_arduino.h file?
Quote
extern const uint8_t digital_pin_to_timer_PGM[NUM_DIGITAL_PINS];


2. Why don't the following statements even match each other in that file?
Quote
extern const uint8_t digital_pin_to_timer_PGM[NUM_DIGITAL_PINS];

const uint8_t PROGMEM digital_pin_to_timer_PGM[NUM_DIGITAL_PINS] = {...}


3. Why doesn't the extern statement in item 2 match the following line from
    Arduino.h in the IDE subdirectory?
Quote
extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];


4. why do all other sketches besides ArduinoISP compile properly considering the
    the 2 conflicting extern statements?

5. Why doesn't "fixing" the statement in Bobuino pins_arduino.h as follows fix the
    compile problem?
Quote
this:
extern const uint8_t digital_pin_to_timer_PGM[NUM_DIGITAL_PINS];
to this:
extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];


Sometimes I just don't understand any of this stuff, sigh.

CrossRoads

I tried this simple sketch using consecutive pairs of pins all around the board with attached Bobuino pins_arduino.h & IDE 1.0.3
I didn't get any compile errors, and the LED blinks away.
I need to put some leads on a pot so I can check out the analog pin ID thing that was previously discussed.
I don't know what's going on with the PROGMEM stuff.
The standard pins_arduino.h also uses similar statements.

Code: [Select]

byte highPin = 20;
byte lowPin  = 21;

void setup(){
  pinMode(highPin, OUTPUT);
  pinMode (lowPin, OUTPUT);
  digitalWrite (lowPin,LOW);
}
void loop(){
  digitalWrite (highPin, HIGH);
  delay (100);
  digitalWrite (highPin, LOW);
  delay (100);
}


Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

oric_dan

#8
Feb 26, 2013, 07:44 am Last Edit: Feb 26, 2013, 07:47 am by oric_dan Reason: 1
I found it compiled ok with all sketches except for the ArduinoISP sketch, and then
that would compile ok if I commented out the line that says #include "pins_arduino.h",
which seems to be completely superfluous, from what I can tell. IE, you never
need to include that line in any regular sketches.

Other than that, I didn't understand all the inconsistencies with PROGMEM, so ????

Also, I did leave a note in github summarizing all the errors so far,
https://github.com/maniacbug/mighty-1284p/issues/5

Go Up