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) Disassembly View (Read 580 times)
Marc Jacobi
Junior Member
**
Offline


Posts: 28
Location: Netherlands
Joined: Feb 28th, 2012
Disassembly View
Mar 1st, 2012 at 8:13pm
Print Post  
Wouldn't it be nice to be able to look at the raw assembly code of your build, to see if the optimization you just did really worked?

I think so. So I hope you find the time and a way to make it real.

Thanx.
Marc Jacobi
  
Back to top
 
IP Logged
 
sixeyes2
Junior Member
**
Offline


Posts: 93
Location: Guildford, United Kingdom
Joined: Dec 19th, 2011
Re: Disassembly View
Reply #1 - Mar 4th, 2012 at 7:33am
Print Post  
I second this request. It would beat the hell out of looking for the .s file, or having to do a command line compile as I did two years ago when writing some time critical code.

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


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #2 - Mar 4th, 2012 at 10:03am
Print Post  
great. command example please??
  
Back to top
IP Logged
 
sixeyes2
Junior Member
**
Offline


Posts: 93
Location: Guildford, United Kingdom
Joined: Dec 19th, 2011
Re: Disassembly View
Reply #3 - Mar 5th, 2012 at 9:07am
Print Post  
Could it be on a context menu for a file in the solution explorer?

Once clicked it would compile the file in the background and then show the assembly window.

Iain
  
Back to top
 
IP Logged
 
Jo Sto
Ex Member
*


Re: Disassembly View
Reply #4 - Jul 31st, 2012 at 11:11am
Print Post  
Excuse for my bad english...

First a compliment to the doers of visual Micro. One can seriously program the Arduino first with that. The original IDE little a little rudimentarily anyway . . .

I think, first, one should amend the Make file of the arduino-Ide so that also *. lss files are produced. I am not good enough ( here, however. . ). It is possible in other AVR IDE's by switch (I use Atman AVR). This file then contains the produced assembler code with the original C code as a comment. The file then can for certain be shown on the IDE without great problems
  
Back to top
 
IP Logged
 
Jo Sto
Ex Member
*


Re: Disassembly View
Reply #5 - Aug 9th, 2012 at 7:55pm
Print Post  
After compiling arduino creats in a temporary folder a file named xxx.cpp.elf. In folder \arduino-1.0.1\hardware\tools\avr\bin is a tool named avr-objdump
This tool can create a disassembled view, mixed with sourcecode (using switch -S)

Code
Select All
E:\arduino\arduino-1.0.1\hardware\tools\avr\bin>avr-objdump
Usage: avr-objdump <option(s)> <file(s)>
 Display information from object <file(s)>.
 At least one of the following switches must be given:
  -a, --archive-headers    Display archive header information
  -f, --file-headers       Display the contents of the overall file header
  -p, --private-headers    Display object format specific file header contents
  -h, --[section-]headers  Display the contents of the section headers
  -x, --all-headers        Display the contents of all headers
  -d, --disassemble        Display assembler contents of executable sections
  -D, --disassemble-all    Display assembler contents of all sections
  -S, --source             Intermix source code with disassembly
  -s, --full-contents      Display the full contents of all sections requested
  -g, --debugging          Display debug information in object file
  -e, --debugging-tags     Display debug information using ctags style
  -G, --stabs              Display (in raw form) any STABS info in the file
  -W, --dwarf              Display DWARF info in the file
  -t, --syms               Display the contents of the symbol table(s)
  -T, --dynamic-syms       Display the contents of the dynamic symbol table
  -r, --reloc              Display the relocation entries in the file
  -R, --dynamic-reloc      Display the dynamic relocation entries in the file
  @<file>                  Read options from <file>
  -v, --version            Display this program's version number
  -i, --info               List object formats and architectures supported
  -H, --help               Display this information

E:\arduino\arduino-1.0.1\hardware\tools\avr\bin>avr-objdump -S C:\Users\storchi\
AppData\Local\Temp\build6297938879979629311.tmp\kaiman6x6_test.cpp.elf >d:\xx.tx
t 



output:
[code]
cpp.elf:     file format elf32-avr


Disassembly of section .text:

00000000 <__vectors>:
     return motor_r.steps;      
}      



void set_motor_power(int power_left,int power_right)
       0:      43 c1            rjmp      .+646         ; 0x288 <__ctors_end>

}


//der grundlegende Algorithmus wurde dem ct-bot entliehen...
void pid_left(void)
       2:      00 00            nop
  command(LCD_ENTRYMODESET | _displaymode);
}

// Allows us to fill the first 8 CGRAM locations
// with custom characters
void LiquidCrystal::createChar(uint8_t location, uint8_t charmap[]) {
       4:      0c 94 9e 0d      jmp      0x1b3c      ; 0x1b3c <__vector_1>
#endif
    }
  }
}

void detachInterrupt(uint8_t interruptNum) {
       8:      0c 94 cf 0d      jmp      0x1b9e      ; 0x1b9e <__vector_2>
     timer0_millis = m;
     timer0_overflow_count++;
}

unsigned long millis()
{
       c:      0c 94 00 0e      jmp      0x1c00      ; 0x1c00 <__vector_3>
{
     // can't actually set the register here because the default setting
     // will connect AVCC and the AREF pin, which would cause a short if
     // there's something connected to AREF.
     analog_reference = mode;
}
      10:      0c 94 31 0e      jmp      0x1c62      ; 0x1c62 <__vector_4>

     SREG = oldSREG;
}

int digitalRead(uint8_t pin)
{
      14:      0c 94 62 0e      jmp      0x1cc4      ; 0x1cc4 <__vector_5>

HardwareSerial::HardwareSerial(ring_buffer *rx_buffer, ring_buffer *tx_buffer,
  volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
  volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
  volatile uint8_t *udr,
  uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x)
      18:      0c 94 93 0e      jmp      0x1d26      ; 0x1d26 <__vector_6>
  size_t n = print(ifsh);
  n += println();
  return n;
}

size_t Print::print(const Printable& x)
      1c:      0c 94 c4 0e      jmp      0x1d88      ; 0x1d88 <__vector_7>
      20:      0c 94 f5 0e      jmp      0x1dea      ; 0x1dea <__vector_8>
      24:      5e c1            rjmp      .+700         ; 0x2e2 <__bad_interrupt>
   
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #6 - Aug 9th, 2012 at 8:28pm
Print Post  
Oh that's very cool thanks. Great timing, I was going to hunt down this thread over the weekend to put this in for the release next week.

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


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #7 - Aug 10th, 2012 at 5:21pm
Print Post  
This was quite easy to add in the end because it is almost identical to the "avr-size" method that computes the size of the HEX. So all we needed was your info about avr-objdump. Thanks again.

In the next release there is a new project properties section called "Micro Compile". 

It currently contains two settings:-

Disassembled View (true/false)
Disassembly Switches (String)

These settings are saved against the current configuration name. If no switches are supplied then the default switches are -s -S does this seem okay?

The "Disassembly View" is displayed in a new output window pane called "Micro Disassembly"
« Last Edit: Aug 10th, 2012 at 5:22pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Jo Sto
Ex Member
*


Re: Disassembly View
Reply #8 - Aug 11th, 2012 at 4:32am
Print Post  
This sounds good!

If you already are at work:
it would be nice, if in output window is not only shown the code size but also the memory usage (data+bss) and possibly eeprom usage (avr-size -C xxx.elf,  avr-size -A xxx.elf)


  
Back to top
 
IP Logged
 
Jo Sto
Ex Member
*


Re: Disassembly View
Reply #9 - Aug 11th, 2012 at 4:44am
Print Post  
possibly like this:
CPU: ATmega2561
Program memory usage: 12378 bytes, 4.72% full.
Eeprom memory usage: 0 bytes, 0.00% full.
Global variables usage: 515 bytes, Internal SRAM 6.29% full.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #10 - Aug 11th, 2012 at 11:49am
Print Post  
great thanks will do
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #11 - Aug 11th, 2012 at 1:51pm
Print Post  
I've got this coming through on a new "Detailed Memory Report" project compiler property

The first is a call to avr-size passing -C, .elf and --mcu

The second is just calling avr-size passing the .hex name

How can I get the memory stats in your example?

1)

AVR Memory Usage
----------------
Device: atmega328p

Program:     610 bytes (1.9% Full)
(.text + .data + .bootloader)

Data:         17 bytes (0.8% Full)
(.data + .bss + .noinit)

2)
text         data          bss          dec          hex      
      0          610            0          610          262
  
Back to top
IP Logged
 
Jo Sto
Ex Member
*


Re: Disassembly View
Reply #12 - Aug 12th, 2012 at 2:59am
Print Post  
Quote:
AVR Memory Usage
----------------
Device: atmega328p

Program:     610 bytes (1.9% Full)
(.text + .data + .bootloader)

Data:         17 bytes (0.8% Full)
(.data + .bss + .noinit)


Program = Program memory usage
Data     = Global variables usage

seehttp://www.rn-wissen.de/index.php/Speicherverbrauch_bestimmen_mit_avr-gcc (german language)
  
Back to top
 
IP Logged
 
Jo Sto
Ex Member
*


Re: Disassembly View
Reply #13 - Aug 12th, 2012 at 3:14am
Print Post  
Code
Select All
How can I get the memory stats in your example?
 


this is the output of atmanavr ide, it's only a more beautiful view of avr-size and was meaned as an example
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #14 - Aug 12th, 2012 at 4:54am
Print Post  
ok thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #15 - Aug 13th, 2012 at 1:24am
Print Post  
This applies to the beta debug system only...

The mem check example from arduino.cc has been integrated into the debugger (as an experiment). The source will ship with the next release of vm so you can change it to something else if need be.

The image below demonstrates how to configure automatic reporting of memory which is displayed in the watch expressions list and in an optional open source graph widget.  

All of the settings in the bottom right of the image show their default values, we only need to switch on "Free Memory" reporting to see the "real time" free memory graph.

fyi: When enabled, an "automatic free memory report" is sent from the arduino loop() every 30 or 40ms. The time period can be overridden. Alternatively free memory reports can be manually requested at certain execution points using the breakpoint "When Hit" property of:- {@ReportFreeMemory}
I hope that this is the start of some useful performance monitoring options Smiley Thanks for the help!

larger


« Last Edit: Aug 13th, 2012 at 1:35am by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #16 - Aug 20th, 2012 at 10:02pm
Print Post  
Released in 1208.19
  
Back to top
IP Logged
 
Jo Sto
Ex Member
*


Re: Disassembly View
Reply #17 - Aug 20th, 2012 at 10:48pm
Print Post  
Quote:
In the next release there is a new project properties section called "Micro Compile".

It currently contains two settings:-

Disassembled View (true/false)
Disassembly Switches (String)

These settings are saved against the current configuration name. If no switches are supplied then the default switches are -s -S does this seem okay?

The "Disassembly View" is displayed in a new output window pane called "Micro Disassembly"


Is this also in  1208.19 ? If yes, where can i find it?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Disassembly View
Reply #18 - Aug 20th, 2012 at 11:50pm
Print Post  
Yes it is. If you sign up/follow on http://visualmicro.codeplex.com you will receive notifications of new releases.

Go to codeplex and click the "Downloads" tab. 1208.19 is listed.

Question: Have you received two emails about the debug beta. They were sent today/yesterday? Can you check your junk mail please.
  
Back to top
IP Logged
 
Jo Sto
Ex Member
*


Re: Disassembly View
Reply #19 - Aug 21st, 2012 at 5:39am
Print Post  
I already have installed 1208.19 without debug upgrade. I find "Micro explorer", but i cannot find settings for "Micro Compile" or settings for disassembly output or memory usage
Quote:
Have you received two emails about the debug beta
yes
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint