Author Topic: Unable to upload sketch - Bad CPU type in executable  (Read 9542 times)

Delphy

  • Newbie
  • *
  • Posts: 2
Unable to upload sketch - Bad CPU type in executable
« on: February 07, 2013, 04:03:48 am »
Hi All,


I've recently gotten a digispark and grabbed the custom Arduino 1.0.3 software.  I'm running on a 2006 black MacBook which only has a Intel Core Duo and so has 32-bit OSX 10.6.8 on it.  I've previously programmed using an Arduino Uno and Nano successfully using the standard Arduino 1.0.3 (which works fine on this MacBook), but using the customised version of the software for the digispark doesn't work.


The specific error is:


java.io.IOException: Cannot run program "/Users/delphy/Downloads/Mac/Digispark Ready - Arduino 1.03/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude": error=86, Bad CPU type in executable


On comparing the 2 packages (original + digisketch) I noticed that the avrdude executable for digispark is 25KB but the original one is 848KB.


Does anybody know whats changed between the 2 packages?  What would happen if I was to put avrdude_original in place of avrdude and try programming my digisketch?


Thanks for any help!

semicolo

  • Full Member
  • ***
  • Posts: 137
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #1 on: February 07, 2013, 04:45:01 am »
I don't think it'd work because the digispark version has probably been altered to support the digispark but you can't break anything by trying that (worst case will be an error message telling you something like the digispark is not supported)

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #2 on: February 07, 2013, 06:03:35 pm »
The avrdude executable is replaced by a dummy program that routes the request to avrdude_original for regular arduinos and to the micronucleaus bootloader for others. I'm thinking this is related to your system being 32 bit - the sources are here: https://github.com/digistump/avr-dummy if you want to compile the dummy program yourself - otherwise I will look into this very soon and let you know what I find

tmessick

  • Newbie
  • *
  • Posts: 3
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #3 on: February 09, 2013, 12:18:23 pm »

Compiling avrdude locally works ok but then:


Running Digispark Uploader...
Plug in device now...
sh: /Users/Tom/Downloads/Mac/Digispark Ready - Arduino 1.03/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/micronucleus: Bad CPU type in executable


I grabbed the micronucleus source on github but it is not clear what to do.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #4 on: February 09, 2013, 07:28:22 pm »
For micronucleus you'll want to compile the tool under commandline/ folder in the repository - there is a makefile in there so it should be pretty easy to compile

tmessick

  • Newbie
  • *
  • Posts: 3
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #5 on: February 10, 2013, 01:30:24 pm »
It works now.  Thanks.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #6 on: February 11, 2013, 09:35:35 am »
tmessick - would you mind uploading the two binaries you had to compile - for others who run into this?

tmessick

  • Newbie
  • *
  • Posts: 3
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #7 on: February 12, 2013, 08:45:33 am »

Control-click on the Arduino app and pick "Show Package Contents"


Paste these files into [size=78%]Contents/Resources/Java/hardware/tools/avr/bin[/size]

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #8 on: February 12, 2013, 09:29:49 am »
tmessick - thanks! we'll make a 32-bit download as soon as we have a chance!

Delphy

  • Newbie
  • *
  • Posts: 2
Re: Unable to upload sketch - Bad CPU type in executable
« Reply #9 on: February 13, 2013, 12:41:21 am »
Thanks tmessick! I was going to do this myself but I got, well, sick, over the past few days so didn't get a chance.


Thanks again