Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 8 Replies) - uploaded big programm for debug - Arduino Leonardo doesn't work anymore - (Read 8058 times)
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
- uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Nov 16th, 2013 at 12:51pm
Print Post  
Hello Arduino-Debugger,

I recognize an error when I try to upload a big program to my Leonardo.

Situation:
- Load a Programm of 28182 Bytes so, the Debugger
  add some more Bytes - AtmelStudio then says it
  tries to upload
  28544 (used 100% of a 28672 byte maximum)
And then - AtmelStudio raises this error:
---------------------
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: verification error, first mismatch at byte 0x7000
         0x00 != 0x55
avrdude: verification error; content mismatch
------------------------

After that, no further programs can be uploaded to the Leonardo - AtmelStudio Claims, that there is no connection to the serial port:
------------------
Uploading to I/O board using 'COM4'
Unable to 'touch' hardware serial port

-------------------
And the worse - Arduino doesn't boot/start up (due to the demanged Programm I think).

With the Arduino IDE it is not possible to upload either.
The only way I could recover is, by pressing the reset button while the arduino IDE was compiling the scetch.
Quick after the IDE tries to upload, you have to release the reset button on the arduino.

I can reproduce this behavour with arduino 1.05 or 1.5.4sp2 configured in VisualMicro.
The difference is, that with 1.05 the Programm code is much bigger from the beginning - so you have to reduce the programm code a bit to get the same error state.
You can play with the code length - and you will recognize, that from a certain point of length strange things will happen...

Can You reproduce this problem?
Is there a way to recover within AtmelStudio?
Is it a problem of the VisualMicro-Debugger and its connection to arduino 1.05/1.5.4sp2?
Is it a problem of the arduino 1.05/1.5.4sp2 that do not report the apropriate sizes?
In the end I guess - its something else...  Smiley

Kind regards
Thomas




  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #1 - Nov 17th, 2013 at 6:13pm
Print Post  
Hi there,

Thanks for the post this sounds like the Arduino AutoReset of the Leonardo was failing until a valid sketch had been uploaded again.

Visual Micro uses the same program to upload that the Arduino Ide uses so the manual reset also works with Visual Micro. Sometimes it's easier to use the menu item "Project>Upload Last Sketch" because it avoids the compile stage and allows the Reset button to be pushed just prior to clicking the menu item. (Less guess work as to when the reset needs to be pushed.)

All auto boards have the auto reset feature and every so often it can fail but fortunately this is rare.

The problem you describe is interesting. We will look into it thanks but my guess is that this is what can sometimes happen when an overly large program is uploaded to the Leonardo. I would be interested to see the compiler output when building with the 1.5.4 toolchain a program of this size. Visual Micro shows percentages of used ram etc when pointing to 1.5.x during compilation. Did we exceed a 100% mark? If so then Visual Micro should refuse the upload, if not this would be a bug to be fixed!

fyi: The Leonardo works differently to other Arduino boards for upload. We communicate with the Leonrado serial port at 1200 baud which forces the board to AutoReset. When the Leonardo "auto resets" it briefly appears as a different COM port number that is used specifically for program upload. You will see this happening in "Windows Device Manager" when you upload. It is this mechanism was was failing.
  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #2 - Nov 19th, 2013 at 7:01pm
Print Post  
Hello Tim,

I'm familiar with the Arduino upload mechanisme - thank's anyway.  Smiley
The Leonardo showed up normaly as an even port number.
(as in the state of an upload, it shows up as an uneven port number)...

I did some more testing on this - and think that you have to have a look at the kind how the sketches are built - there is a missmatch in the sizes between Arduino IDE and Atmel-Studio (and so - may be VisualMicro?):

I built the exactly same sketch in six different ways:
(first number: size of sketch, second: size of `RAM`)
Arduino IDE 1.0.5: 28108  - na
Arduino IDE 1.5.4: 28418  - 1109
Atmel/ArIDE 1.0.5 no Debug: 28108 - na
Atmel/ArIDE 1.5.4 no Debug: 27836 - 527
Atmel/ArIDE 1.0.5 with Debug: 28446 - na
Atmel/ArIDE 1.5.4 with Debug: 28158 - 578

-> compared to the maximal memory size of 28672 Bytes,
     the Debugger allways reports a percentage below 100%

Please note the difference between the sizes that are reported by the Arduino IDE and the Atmel/ArIDE  1.5.4...
The difference is 582bytes - the same for `RAM` and for `ROM`.

So the question is: who and why is not willing to fill my `ROM` and `RAM` ...  Smiley
(ok, it should tell me, that the debug-sketch is to big...)


Hope that helps to locate the problem...

Regards
Thomas


« Last Edit: Nov 19th, 2013 at 7:56pm by thjakob »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #3 - Nov 21st, 2013 at 3:23pm
Print Post  
Thanks for the great info. The non-debug 1.5.4 compile certainly needs looking at. 

Interesting that 1.5.4 uses the intelligent build system based on the new 1.5.x config structure so I would expect it to always be identical to the arduino ide. I suspect a library source path is not being included correctly.

Can you please email your sketch so I can see what is being used also please switch on tools>options>visual micro>compiler>verbose and email the compiler output. Same for the arduino ide "file>prefs>compile verbose".

When you have spare time please email to info [at] visualmicro.com

Thanks very much
« Last Edit: Nov 21st, 2013 at 3:23pm by Tim@Visual Micro »  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #4 - Nov 21st, 2013 at 5:40pm
Print Post  
... And I thought Arduino is simple...  Smiley

I played around to build a script for testing (well, I'm not realy used to program - so I don't dare sharing my `real code` with you...  Smiley  ) - as I discovered, that you should be able to reproduce the problem by using a script - that does nothing at all.
Simply compare the output of that script compiled by Atmel or ArduinoIDE:

void setup()
{

  /* add setup code here */


}


void loop()
{

  /* add main program code here */
  

}

Add some more code - it still shows different output, does it?

Best regards
Thomas

PS: as for the comparision of the verbose output of the debugger - I can't find any differeneces regarding paths...

« Last Edit: Nov 21st, 2013 at 6:59pm by thjakob »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #5 - Nov 23rd, 2013 at 10:51pm
Print Post  
Okay that is an easy test, I will experiment thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #6 - Nov 24th, 2013 at 4:13pm
Print Post  
It looks like Arduino 1.5.4 has some additional core sources which Visual Micro is supposed to be taking account of but is not.

This will be addressed in the next release, we are often a point release behind Arduino for a week or so after release but this month things have been more delayed.

For now I suggest using an earlier version of 1.5.x or any 1.0.x version.

Sorry for the hassle, you won;t have seen this in the verbose output due to caching in both the Arduino ide and Visual Micro.
  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Still little problem with big programm - Arduino 1.5.5-rc2 and VisualMicro 1401.24
Reply #7 - Jan 24th, 2014 at 9:04am
Print Post  
Hello Tim,

Not sure - but I think I've still the same problem with  Arduino 1.5.5-rc2 and  VisualMicro 1401.24.

Micro-Build-Output with Arduino IDE 1.05 selected:
Compiling 'TerrariumSteuerung_V009' for 'Arduino Leonardo'
Build folder: 009/leonardo
Binary sketch size: 28146 bytes (used 98% of a 28672 byte maximum) (8.58 secs)
Compiling debug version of 'TerrariumSteuerung_V009' for 'Arduino Leonardo'
Build folder: 009/leonardo
Binary sketch size: 28580 bytes (used 100% of a 28672 byte maximum) (1.51 secs)
Uploading to I/O board using 'COM6'
Done uploading via 'COM5'

-> Leonardo is up and running...

MicoBuild with Arduino IDE 1.5.5-rc2 selectd:
Compiling 'TerrariumSteuerung_V009' for 'Arduino Leonardo'
Build folder: 009/leonardo
Binary sketch size: 27902 bytes (used 97% of a 28672 byte maximum) (9.78 secs)
Minimum Memory Usage: 537 bytes (21% of a 2560 byte maximum)
Compiling debug version of 'TerrariumSteuerung_V009' for 'Arduino Leonardo'
Build folder: 009/leonardo
Binary sketch size: 28308 bytes (used 99% of a 28672 byte maximum) (1.73 secs)
Minimum Memory Usage: 588 bytes (23% of a 2560 byte maximum)
Uploading to I/O board using 'COM6'
Unknown upload error

... and my Leonardo is `corrupted`  - can only be `reenabled` by uploading via `Project/Upload last Sketch build` (of course, I have to Build a IDE 1.05 or a NO-Debug build first...)

May be you can adress that for me?   Roll Eyes

Thank you
Thomas
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #8 - Jan 24th, 2014 at 2:03pm
Print Post  
Hi,

Can we first check out your visual micro install. There are some new trace messages in the latest release and I don't see them in your useful output above (thanks)

Please try uninstall of visual micro with ide closed then re-install. The run the Ide and see what version and location is displayed under tools>options>visual micro>version>version and location

Thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #9 - Jan 24th, 2014 at 2:18pm
Print Post  
Oh, I think you have hit the ram limit. I just looked at your program size again and it's too big for the leonardo.

Arduino never runs well with more than approx. 90% memory used.

Unfortunately if you don't normally use things like Serial in your sketch the debugger will add too much overhead of your sketch is already close to the limit.

Binary sketch size: 28308 bytes (used 99% of a 28672 byte maximum) (1.73 secs)

or if you have lots of serial.prints in your sketch then pls remove a load of them
« Last Edit: Jan 24th, 2014 at 2:20pm by Tim@Visual Micro »  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #10 - Jan 24th, 2014 at 3:04pm
Print Post  
Hello Tim,

The version is 1.1401.24, located  in C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Visual.Micro.AS6.dll

Well - how should I say - I did the opposit of what you asked me to to - I added some more lcd.print statement till I got 100% - loading the sketch with VisualMicro-ArduinoIDE-1.0.x works well (without debugger enabled):
Compiling 'TerrariumSteuerung_V009' for 'Arduino Leonardo'
Build folder: 009/leonardo
Binary sketch size: 28670 bytes (used 100% of a 28672 byte maximum) (0.95 secs)
Uploading to I/O board using 'COM3'
Done uploading via 'COM4'

Then I deleted some lcd.print statements till I got 100% with VisualMicro-ArduinoIDE 1.0.x and debugger ON:
Compiling 'TerrariumSteuerung_V009' for 'Arduino Leonardo'
Build folder: 009/leonardo
Binary sketch size: 28238 bytes (used 98% of a 28672 byte maximum) (0.95 secs)
Compiling debug version of 'TerrariumSteuerung_V009' for 'Arduino Leonardo'
Build folder: 009/leonardo
Binary sketch size: 28672 bytes (used 100% of a 28672 byte maximum) (1.28 secs)
Uploading to I/O board using 'COM3'
Done uploading via 'COM4'

So - there is probably no problem to fill the Leonardo up to 100%...  Smiley

But there is still a difference betwen the calculation of used size (RAM and ROM) betwen VisualMicro-ArduinoIDE-1.5.x  and the nativ ArduinoIDE 1.5.5-rc2. 

The ArduinoIDE 1.5.5.-rc2 tells me:
Sketch uses 28,548 bytes (99%) of program storage space. Maximum is 28,672 bytes.
Global variables use 1,101 bytes (43%) of dynamic memory, leaving 1,459 bytes for local variables. Maximum is 2,560 bytes.

The VisualMicro-Arduino1.5.x-IDE tells me (for the exact same script):
Binary sketch size: 27986 bytes (used 98% of a 28672 byte maximum) (7.36 secs)
Minimum Memory Usage: 539 bytes (21% of a 2560 byte maximum)

-> VisualMicro calculates less RAM and ROM (ca. 500bytes each - and therefore is not aware that adding some more debuggin-code will overload the wagon...)

What are the differences in the calculation of the sizes?

Thank you for your assistenz.  Smiley
Thomas
« Last Edit: Jan 24th, 2014 at 3:13pm by thjakob »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #11 - Jan 24th, 2014 at 3:11pm
Print Post  
Hi,

I think the Arduino can be unpredictable with high memory usage however if you use the debugger it will take up more ram so you need to use less serial.print() to compensate. The different arduino versions will respond differently.

The debugger will keep the "when hit" text messages on the pc and not the Arduino, so if you switch serial.print() to debugger when hit messages (when possible) you will balance the ram and when not debugging leave more ram for code.

In 1.0 Visual Micro makes the memory size up manually. In 1.5 visual micro uses a regex expression to determine the amount of memory used. The regex is provided by the arduino 1.5 config however the result of the regex is about 10 different memory usage values. Arduino uses only some of the memory usage values to report total memory it sounds like vm isn't adding up enough or too many of the values.
  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #12 - Jan 24th, 2014 at 4:41pm
Print Post  
Hello Tim,

I did some more testing on this.
The difference in size between VM and ArduinoIDE depends on the size of the sketch - but is not related to the size (so it's not the bigger the more...).
It doesn't matter wich Arduino board I use (same problem on a Arduino Uno  - no need to upload - just build the solution...)

But the strangest thing is:
the difference between RAM and ROM is allways RAMDiff=ROMDiff.
(the value differs from sketch to sketch)

Maybe you will explain me, what regex you are using and what input you get...  Smiley

Best regards
Thomas
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #13 - Jan 24th, 2014 at 4:47pm
Print Post  
Hi,

Check out the arduino config in arduinoide/hardware/avr/platform.txt

The regex is provided by Arduino, if you read up about avr the calls to the avr programs to get memory returns a big lump of text with many different memory amounts.

I need to look at which memory properties the Arduino Ide adds together to get the result. Maybe Visual Micro is missing one or adding one to many Smiley
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #14 - Jan 24th, 2014 at 7:03pm
Print Post  
Would you be able to email your sketch to info [at] visualmicro.com. It would help to have a full sketch to test with. Thanks
  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #15 - Jan 24th, 2014 at 9:08pm
Print Post  
Hello Tim,

I had a look in the platform.txt

Took some time to figure out how that could work...  Smiley
Finaly I think I've found the difference.

AVR-Size can be launched in different ways.
VM  probabely uses the version with  -A:
avr-size.exe -A --mcu=atmega32u4 test.elf
This way you get:

section             size      addr
.data                 42   8388864
.text               5238         0
.bss                2113   8388906
.debug_aranges      1872         0
.debug_pubnames     4389         0
.debug_info        37441         0
.debug_abbrev       6601         0
.debug_line        18064         0
.debug_frame        3360         0
.debug_str          8757         0
.debug_loc         19506         0
.debug_ranges       2040         0
Total             109423

VM reports 5238b ROM and 2113b RAM...
But the ArduinoIDE reports  42b more for both...
It looks like VM should add the .data-Section to both values .text and .bss...

... or VM could use the avr-size with otion -C:
avr-size.exe -C --mcu=atmega32u4 test.elf

That would report (you see, that .data is added to the size...):

Program:    5280 bytes (16.1% Full)
(.text + .data + .bootloader)

Data:       2155 bytes (84.2% Full)
(.data + .bss + .noinit)

I've tested with several sketches - I'm quit sure you can take that for ^ok^ (reproduce with any sketch) - please let me know if we are on the right way.  Smiley

Best regards
Thomas
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #16 - Jan 24th, 2014 at 9:18pm
Print Post  
Nice work thanks. The size specification and calculation should be taken from the platform.txt file provided by the ArduinoIde. 

Below is the size instruction that Visual Micro should follow for avr processors (see arduinoIde/hardware/arduino/avr/platform.txt) 

Code
Select All
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
 



I notice the verbose compile option in the Visual Micro tools>options doesn't provide verbose detail for the size command. However if you switch on "compiler>show build properties" you should also find the recipe for the size routine in the output after compile.

You are right about the -A from the looks of things, I need to look at what is actually being returned. Maybe print the whole lot when verbose is on.

Thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #17 - Jan 24th, 2014 at 9:31pm
Print Post  
I suspect Visual Micro is using the regex expressions at the wrong time when reading the output stream from the [size].exe call.

I'll take a look.
  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #18 - Jan 24th, 2014 at 9:38pm
Print Post  
Hello Tim,

... you allready knew it - and let me do the work...  Smiley

I`not too familiar with regex. Since there are multiple lines in the output that are to be summarized - does VM iterate through the output but is not aware of the need to summarize the different hits?
(VM has to read the whole output with one regex and summarize all hints, then it has to reread the output with the other regex)

Thomas
« Last Edit: Jan 24th, 2014 at 9:43pm by thjakob »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: - uploaded big programm for debug - Arduino Leonardo doesn't work anymore -
Reply #19 - Jan 25th, 2014 at 12:44am
Print Post  
It's really useful having some help with this.

I think you are right, visual micro is performing the sequence you mention but for each line of the output. It doesn't make sense! Oops. 1.0.x is okay but 1.5.x is wrong.
« Last Edit: Jan 25th, 2014 at 1:16am by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint