Assembly temp files on mac

Anyone know where the assembly files are stored?

I assuming in some temp directory someowhere?

Im trying to learn some AVR assembly and trying to look at how the compiler is taking some simple adds and subtracts and compiles it to assembly code.

If anyone knows where the temp files are being placed on a mac please let me know. It would be helpful to see them

In the IDE, File->Preferences->Show Verbose Output … During Build will spew some logging that will let you find the build artifacts.

I use "avr-objdump" to dump the contents of the .elf file. I don't believe it's part of the Arduino install, but you can get it as part of Crosspack AVR at: http://www.obdev.at/products/crosspack/index.html

-br

lol wow that was a little over my head

when i do my compile i can see the files somewhere

It says ./var/temp/........... something and then ends with a .o

Ever seen where those end up?

Ever seen where those end up?

Yeah. They'd be in ./var/temp/........... something.

You know, cut and paste was a great invention. You should try it sometime.

Yes, copy and paste is your friend. You can open a Finder window on that path (the build path from the IDE), but it won't do much good. You need to open a terminal window and cd to that path, and explore the files there. One of them will be a .elf file. You feed the .elf file to the command line tool avr-objdump to see details like the assembler output you were looking for.

~ bill$ cd /var/folders/tp/d5d1fqfx415bm088d2xzmr440000gn/T/build3848891131546355106.tmp
:build3848891171546355106.tmp bill$ ls
CDC.cpp.d		Stream.cpp.o		bitlash			rollover.cpp.o
CDC.cpp.o		Tone.cpp.d		core.a			wiring.c.d
HID.cpp.d		Tone.cpp.o		main.cpp.d		wiring.c.o
HID.cpp.o		USBCore.cpp.d		main.cpp.o		wiring_analog.c.d
HardwareSerial.cpp.d	USBCore.cpp.o		new.cpp.d		wiring_analog.c.o
HardwareSerial.cpp.o	WInterrupts.c.d		new.cpp.o		wiring_digital.c.d
IPAddress.cpp.d		WInterrupts.c.o		rollover.cpp		wiring_digital.c.o
IPAddress.cpp.o		WMath.cpp.d		rollover.cpp.d		wiring_pulse.c.d
Print.cpp.d		WMath.cpp.o		rollover.cpp.eep	wiring_pulse.c.o
Print.cpp.o		WString.cpp.d		rollover.cpp.elf	wiring_shift.c.d
Stream.cpp.d		WString.cpp.o		rollover.cpp.hex	wiring_shift.c.o

:build3848891171546355106.tmp bill$ avr-objdump -S rollover.cpp.elf

rollover.cpp.elf:     file format elf32-avr


Disassembly of section .text:

00000000 <__vectors>:
	int entry = findKey(id);
	if (entry >= 0) erasestr(erasestr(entry));
}

// parsestring helpers
void countByte(char c) { expval++; }
       0:	0c 94 09 02 	jmp	0x412	; 0x412 <__ctors_end>
	SREG = oldSREG;

	return m;
}

unsigned long micros() {
       4:	0c 94 31 02 	jmp	0x462	; 0x462 <__bad_interrupt>
{
	// 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;
}
       8:	0c 94 31 02 	jmp	0x462	; 0x462 <__bad_interrupt>

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)
       c:	0c 94 31 02 	jmp	0x462	; 0x462 <__bad_interrupt>
    n += write(*buffer++);
  }
  return n;
}
...

-br

By default, GCC deletes the assembly files after the assembler is run. There is an option (-save-temps) that tells the compiler to not delete the intermediate files, but I suspect the IDE does not give you access to that switch. If you are familiar using the command line on your system, you could use the verbose option in the IDE to locate where the compiler is store, and then create a simple .c or .cpp file in the directory and execute the command /gcc -O -S .cpp and the compiler will compile to .s

This is the procedure I use on windows, maybe you can confirm if it works on mac as well -

Duane B

rcarduino.blogspot.com

That is a great post. Thanks.

-br