Sketch size - Error verifying during firmware load - How to flash bootloader

935 views
Skip to first unread message

Julien Dubois

unread,
Nov 16, 2013, 5:21:16 PM11/16/13
to drones-...@googlegroups.com
Hi all,

I've made some changes on the current code and wanted to try them on my copter.

I've compiled using arduino IDE as explained in this tutorial. I did it several times before from master code and everything worked fine.

But, this time, I've got an error message, the sketch size was around 261kB for a max of 258kB.

Leonard told me to disable some functionnalities in APM_Config.h and, this way, I could lower the sketch size under the limit.
Arduino log : Sketch size 255 620 bytes (max 258 048 bytes)

Well, I've started mission planner to load my new .hex file into the APM 2.5

Connection OK, loading complete, Verifying... and, here, an error message. I should have recorded it, it was something like :
exp B got GB at 253165, don't remember exactelly.

I cancelled to retry loading the firmware but, from this moment, I've got always the same error message :
Communication error - no connection

The COM port is enabled in device manager when I plug the USB.
When mission planner tries to connect, the APM orange LED is flashing once per try. Seems it receives communication data but doesn't answer.
The result is the same if I try to load the firmware with arduino.

That's not a software problem nor driver because I have another APM and I can connect it using the same USB port.

So, I wondered if I have not erased (even partially) the ATMega 2560 bootloader

Anybody had this kind of issue?

If that's the bootloader, someone could explain how to reinstall it?
This wiki has to be developped : http://dev.ardupilot.com/wiki/updating-the-apm2-x-bootloade/
I've found topics for flashing ATMega2560 here and here but I've just an USBASP not upgraded and no AVR ISP MKII :/

To finish, if the firmware size is the problem, we should fix a lower limit in arduino IDE or an alert in mission planner once hex file has been read.
BTW, what does that post mean?
https://groups.google.com/d/msg/drones-discuss/L9vlwqYGijo/OmUO3WpRiEYJ
Should we use that new GCC compiler?

In advance, thanks for any help.

Julien

Robert Lefebvre

unread,
Nov 16, 2013, 7:36:25 PM11/16/13
to drones-discuss

Julien, the sketch limit is actually about 241k. I don't know why it's lower than it says it is, but I've run into this before. You need to turn off a lot of functions.

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Julien Dubois

unread,
Nov 17, 2013, 7:26:33 AM11/17/13
to drones-...@googlegroups.com
Robert,

thanks for answering. How have you found the 241k, you've got errors loading larger code?

And about "how to repair my card", nobody here had similar issue? I plan to buy an AVR ISP MKII and flash bootloader.
Otherwise, i really don't know what could be the problem.

PS : You're right, firmwares here are almost all 655k hex (that represent 655/2,75 = 238k binary)
So I wonder how it is compiled with the current APM_Config.h in which nothing is disabled

Robert Lefebvre

unread,
Nov 17, 2013, 7:32:32 AM11/17/13
to drones-discuss
I discovered it when I was working on the code, and I was able to upload code that was 241k, but after I added a bit of code that brought it to 242k, it would no longer load.  Still took me the better part of a day trying to figure out what the problem was.  I thought it was a code problem.

The official firmware binaries are compiled using a different compiler than Ardruino IDE.  It results in more compact code.  I don't know why.

r. k.r

unread,
Nov 17, 2013, 8:15:09 AM11/17/13
to drones-...@googlegroups.com
Hi julien

That link have u in the first post (this tutorial http://dev.ardupilot.com/wiki/building-apm2xe-on-windowsdev_for_windows/) is the old compiler suite with gcc4.3,

from firmware version 3.1 >>  Use this tutorial http://dev.ardupilot.com/wiki/building-ardupilot-with-arduino-windows/ it make smaller code


Richard

john...@gmail.com

unread,
Nov 17, 2013, 9:40:13 AM11/17/13
to drones-...@googlegroups.com
The GCC version that comes standard with the Arduino IDE is like 5 years old. That's why.. :)

Julien Dubois

unread,
Nov 18, 2013, 5:32:04 PM11/18/13
to drones-...@googlegroups.com
Hi,

Nice tip Richard!
Indeed, the same sketch is now 230 576 bytes, about 10% smaller and now under the 240kB limit!

Just have to repair my APM, hope that's the bootloader issue (any help appreciated for flashing it)

Thanks everybody for the help.

PS : I reiterate my suggestion for checking the size limit of the .hex firmware in mission planner before trying to load it into the APM. Or at least give an alarm.

Robert Lefebvre

unread,
Nov 18, 2013, 7:03:44 PM11/18/13
to drones-discuss
Wait, I almost missed this, somebody shoehorned a new version of GCC into HALduino?  Cool!


--

Robert Lefebvre

unread,
Dec 5, 2013, 10:15:28 PM12/5/13
to drones-discuss
Just an FYI, I ran into an issue with this version.  I accidentally selected the wrong com port and compile/uploaded, and got the message "Done uploading" when it had in fact failed.  Not sure why.

Caused a problem where code changes were not being uploaded and I didn't know why they weren't having the desired effect.

Julien Dubois

unread,
Dec 6, 2013, 2:32:38 AM12/6/13
to drones-...@googlegroups.com
In case of somebody has the same issue, for my initial problem (couldn't load firmware anymore), , I've managed to reload the bootloader using AVR ISP MKII programmer and ATMEL Studio.
The .hex I used is located in the arduino folder and named stk500boot_v2_mega2560.hex

Hope this helps


2013/12/6 Robert Lefebvre <robert....@gmail.com>

--
You received this message because you are subscribed to a topic in the Google Groups "drones-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/drones-discuss/zLFmMlS02ME/unsubscribe.
To unsubscribe from this group and all its topics, send an email to drones-discus...@googlegroups.com.

Yass Ko

unread,
Mar 13, 2014, 12:26:24 PM3/13/14
to drones-...@googlegroups.com
Hi Sir,

I think I have the same problem, does the solution that you provided where you reload the bootload using AVR ISP MKII programmer and ATMEL Studio works.
If it's the case how did you connect your APM 2.5 (I assume that you are using this flight controller) with your AVR ISP MKII programmer.
Thank you in advance for your reply.

Regards,
Yass

Julien Dubois

unread,
Mar 13, 2014, 4:17:58 PM3/13/14
to drones-...@googlegroups.com
Hi,

yeah it worked well!
I've connected it as described on the following picture:

Images intégrées 1



For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages