Get the compiled assembly file

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

I'm working on a project where I've added support for the ATtiny13 to Arduino IDE, including many of the "Arduino functions". 

Right now I'm working on improving the pulseIn() function, and I've gotten quite far I think. I've been using a DDS signal generator as a clock source and pulse generator, and I've tuned the code to measure the pulse length of the signal quite accurate (compared with my oscilloscope). This timing sensitive function works great when LTO is enabled, but measures the pulse length incorrectly when LTO is disabled. Since this Arduino add-on project may be compiled with and without LTO enabled, I'd like to implement the pulseIn() function in assembly to make sure it's always accurate.

 

What I want to do is to compile the function with LTO enabled, and used the compiled output to make an assembly implementation. An example of where this is done can be found in the official Arduino repo (Wiring_pulse.S) (Wiring_pulse.c). The easiest way for my current setup would be to edit the platform.txt file. Question is, which flags should I add (and where) in order for avr-gcc to compile the pulseIn function and output a usable .S file?

 

Thanks!

Last Edited: Wed. Sep 27, 2017 - 09:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MCUdude wrote:
Question is, which flags should I add
-save-temps

MCUdude wrote:
(and where)
compiler.c.flags and/or compiler.cpp.flags

or (probably better)

compiler.c.extra_flags and/or compiler.cpp.extra_flags in platform.local.txt

 

Stefan Ernst

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You usually get a cleaner assembly listing by dumping the .elf file with "avr-objdump -SC *.elf" in the build directory.

The temp or assembler output files generated by the compiler are full of pseudo-ops to generate the various meta-information used for debugging and linking.

(The objdump won't have internal labels, and the compiler-generated asm will have ugly internal labels.)

 

You know, there have already been several Arduino Cores written that support the ATtiny13.  One relatively recent version with back-references is here: https://github.com/MCUdude/Micro...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks! I'll test everything as soon as I get home from work.

 

You know, there have already been several Arduino Cores written that support the ATtiny13.  One relatively recent version with back-references is here: https://github.com/MCUdude/Micro...

I know, I'm the creator and maintainer of MicroCore. I'm always struggling to optimize it even more, so if any of you know how to optimize some of the "Arduino functions" even more, I'm all ears! 

Now flame proof blush

Last Edited: Thu. Sep 28, 2017 - 03:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Shameless self promotion = ON

 

If you use -save-temps to get the .s files (which I think are the best representation of the compilers ASM code) then you might want to take a look at:

 

https://spaces.atmel.com/gf/proj...

 

That "puts back source" into .s files.

 

The avr-objdump -S that westfw mentions is what creates .lss files but this is a disassembly of the binary (with added source annotation) rather than the source asm itself.

 

Oh and if using -save-temps you may want to explore -fverbose-asm too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MCUdude wrote:
I'm always striggling

I'm sure you can get some ointment for that ...

 

laugh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Shameless self promotion = ON

My favourite tracker summary:

Thrashing the spline shaft erases the widget

I think there's an ointment for that, too :)

 

After all these years, I have yet to try this.  Me like.

 

FYI, building with gcc:

$ gcc -std=c99 -Wall -Werror -O1 -g avr-source.c -o avr-source
cc1: warnings being treated as errors
avr-source.c: In function ‘main’:
avr-source.c:29: error: suggest parentheses around assignment used as truth value
avr-source.c:80: error: suggest parentheses around assignment used as truth value
avr-source.c:28: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
avr-source.c:49: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
avr-source.c:94: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result

A humbly proposed patch:

diff -rupN avr-source/avr-source.c avr-source.patched/avr-source.c
--- avr-source/avr-source.c	2013-03-10 11:13:32.000000000 -0400
+++ avr-source.patched/avr-source.c	2017-09-28 11:21:38.650771566 -0400
@@ -24,9 +24,8 @@ int main(int argc, char *argv[])
 		printf("No such file: %s\r\n", argv[1]);
 		return 1;
 	}
-	do {
-		fgets(buff, 1024, fin);
-		if (p=strstr(buff, ".file ")) {
+	while (fgets(buff, 1024, fin) != NULL) {
+		if ((p=strstr(buff, ".file "))) {
 			int i;
 			p += strlen(".file ");
 			fnum = atoi(p);
@@ -39,14 +38,13 @@ int main(int argc, char *argv[])
 			printf("file %u = %s\n", fnum, files[fnum]);
 			filefound = 1;
 		}
-	}while (!feof(fin));
+	}
 	if (filefound != 0) {
 		strcpy(fname, argv[1]);
 		strcat(fname, "ource.s");
 		fout = fopen(fname, "wt");
 		rewind(fin);
-		do {
-			fgets(buff, 1024, fin);
+		while (fgets(buff, 1024, fin) != NULL) {
 			if (strstr(buff, ".debug_info")) {
 				break;
 			}
@@ -77,7 +75,7 @@ int main(int argc, char *argv[])
 			if (strncmp(buff, ".LCF", strlen(".LCF"))==0) {
 				continue;
 			}
-			if (p=strstr(buff, ".loc ")) {
+			if ((p=strstr(buff, ".loc "))) {
 				p += strlen(".loc ");
 				fnum = atoi(p);
 				while(*p != ' ') p++;
@@ -90,8 +88,7 @@ int main(int argc, char *argv[])
 				}
 				else {
 					// waste the lines to get to the right place
-					while (lnum) {
-						fgets(buff, 1024, fsrc);
+					while (lnum && (fgets(buff, 1024, fsrc) != NULL)) {
 						lnum--;
 					}
 					fclose(fsrc);
@@ -105,7 +102,7 @@ int main(int argc, char *argv[])
 			else {
 				fputs(buff, fout);
 			}
-		}while (!feof(fin));
+		}
 		fclose(fout);
 	}
 	else {

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

By adding -save-temps to the compiler.c.flags no .S files are generated. However if I add -save-temps=obj instead they're now generated, but the contents doesn't make any sense..

 

    .file    "wiring_pulse.c"
__SP_L__ = 0x3d
__SREG__ = 0x3f
__tmp_reg__ = 0
__zero_reg__ = 1
    .text
.Ltext0:
    .section    .gnu.lto_.profile.e53232bbb94bea8e,"",@progbits
    .string    "x\234ca`d`a`"
    .string    "\222i\372"
    .string    "\001e"
    .ascii    "\240"
    .text
    .section    .gnu.lto_.icf.e53232bbb94bea8e,"",@progbits
    .string    "x\234ca`d"
    .string    "\001\016\006\004`d\3700\345\323$>\006"
    .ascii    "\017l\003%"
    .text
    .section    .gnu.lto_.jmpfuncs.e53232bbb94bea8e,"",@progbits
    .string    "x\234ca`d"
    .string    "\001A\006\004`d`fddb\257\257\257\207\n"
    .string    ""
    .ascii    "\020\354\001\243"
    .text
    .section    .gnu.lto_.inline.e53232bbb94bea8e,"",@progbits
    .string    "x\234ca`d"
    .string    "\001{\006\004"
    .string    "\212\030\256afdb\340"
    .string    "\262\030A\004\223\305\233\027\242\fl\013\344\231@\362\314<`\202\021\225\005\3432"
    .string    ""
    .ascii    "\313\312\004\203"
    .text
    .section    .gnu.lto_.pureconst.e53232bbb94bea8e,"",@progbits
    .string    "x\234ca`d`f`"
    .string    "\222R"
    .string    ""
    .string    "r"
    .ascii    "$"
    .text
    .section    .gnu.lto_pulseIn.e53232bbb94bea8e,"",@progbits
    .ascii    "x\234}\224]L\034U\024\307\357\271wv\366k\366\003\244\224\224"
    .ascii    "\305\022\312\262\024R\326\304\304G#\321\007_|1\032\037|\260\204"
    .ascii    "\022\273*\273dw\261\217\f\314.\325&5>\2101\266T\253ik[m)`)ju"
    .ascii    "\263\025\233\230\026c\243\261\037<P*\304XCXRM\354\207x\316\275"
    .ascii    "\303f\371\352${\356\271\3779\3773\367\376\346\316j\f\030]wu\306"
    .ascii    ":q\374\025\177\020d\300\337\235d\254\327\305AS\211\340\336\274"
    .ascii    "`\246'0\371#c\246\021Pz\253\306\205\024<:\3355\034v\225_U\371"
    .ascii    "\301\220U\272\032\301\340\016U\355\224\325Np\253\346.\333\346"
    .ascii    "S6\237\322[\335\334\245\312=\262\334\003^U\356\005\240\304t\001"
    .ascii    "\353\341\"\2409\374\272\341t\371\334\036/\364h\032S\227a\217"
    .ascii    "n{\374\233?\340\360sf\350\240\270\303\263\202\201\206\323\302"
    .ascii    "\345\017o\371i\nP\213\323\301\211\303ok\333\217\231f\2379=1\267"
    .ascii    "\263`f\253\262\202\263%\316\3403\b\3011\b\021\234\343\260\035"
    .ascii    "k\207\017\337\273\006\342%`\230_\236\232\035\326#G\310g\376\033"
    .ascii    "4EV\b8\001\202|\217\207\340\261\020C\201\301I\210`\355\361Of"
    .ascii    "\016\350\342e\351\2734zg\320k\373F\312\224\357\3635\276/\244"
    .ascii    "o\352\235\367f\375b\247\364M^\353?\261\374\274B\r\3718\234R\276"
    .ascii    "\345u\322\272\3414D\250|\344b\336\364\212\335\322:6tr\2773\374"
    .ascii    ")Ys\277\375P\261\327\314\365\326\222}h\245\235.\3423\377\313"
    .ascii    "}\237x]:\315\314\350!C9\315\363!\323z\212l\303\353\332f\316\374"
    .ascii    "7\340\3233&^\2650\002a8\003a\242\210\360FA\307\363\306\227\325"
    .ascii    "\323\317\347\314\245%\313\314\215\351\267\276\217G\201\326\355"
    .ascii    "bt\307\215\251\346\301\340\300\267\215\350\fJ}\024\374\024\002"
    .ascii    "\030\364 ee@\204\312)"
    .string    "\255\300\340\334D\241\022h\363\233\251G\025\335\331B\241\232\002\241\321k(\333J\205\265\024\352\030\255g\033U\327\323\2350\205\006\n\021\252n\244\254\211\n\233)\354\240\320\"\t\263\005\372\351\254\3009\016\342\017\260\246\263\267s@\273\264\204\013I\214\217\377u\303\331\363\300|\3134\203Y\341Z\342\270y\370\022z\320\355f3\300%\017\334-V#\235\002\027\f\017\274\354s\344\366U\207\352S\261Q\237\263v\2379\260>\350\377]W\325\233\320@\335nB\346\2525\307\213b\245|9\013<\300>\276\310\240\3005\206\237\220\230\203\374\335}\003\217\252*7>\350\375l\376''}\021\036\371\322\257\034\312]\262\247O\340\364\346\376\003\005\370\b\006{3\220\025^8\207\257}\214^;\214\243\212\353\350[\334;P\255\232y,\271\262\276E\247\232\033\226\360\322J\027\355u\372d\211A\322}[\362\243\n\315!\222\316\332\256"
    .ascii    "\252\320\024*m\024D\325~\324\223J)\267D\031\355\367\372\205}"
    .ascii    "\276bM\271\334o\201;\330@\203\004:Q\004\272u#\240_\255\007\264"
    .ascii    "\026\r6\320\311\"\320J\324m\240~6^\217<u\226\027@\0174\330\275"
    .ascii    "\b\254\340\272\371a\344\276^C\256\n\035\245\244\266Hi\005\251"
    .ascii    "jTW\221\n\241\272\212T\r\252\264\354\033\326kEP56\026'\026J,"
    .ascii    "\263\305\363Z\267\021\226oV\235\327\021:\257u\262\215\213]xD"
    .ascii    "\035\373\371e\272M\033\2659\277\036\335f4\254G\267\331\246\353"
    .ascii    "cW\312\221\256\233\235\253XyX\267=\f\352\267k\240\326\243\243"
    .ascii    "\024jXJ+\2406\240\272\nj\004\325UP\033Q\225\207\255\004j\243"
    .ascii    "\r\325\303\376\261?\336\371i\033\352\216\215h|WB\303^@\013\226"
    .ascii    "/\203\365\322\377\311\237\320\027d\026\035+\266\bP\372ub\013"
    .ascii    "\310AH\234\272\336?\t\2249\216N\3514\272\216.P'\317\301\261."
    .ascii    "\244\007\330\005\377\241^\210\276\230\352H\246\242\317\266\305"
    .ascii    "S\321g\022\355\335\235\035\361t*\332\232\334\325\035\213'\242"
    .ascii    "\273\333\222\273\366\264%;\242\317\305\332\223\211\247\023\230"
    .ascii    "\265\275\231\214\266c\222\212v\222FitO,\031\213\277\372JW\367"
    .ascii    "\033\251\216\226v&\272bq-\225nK;\323\261\316\216Dw\232\247\023"
    .ascii    "<\225\376\037\350\nVC"
    .text
    .section    .gnu.lto_.symbol_nodes.e53232bbb94bea8e,"",@progbits
    .string    "x\234ca`d\ba"
    .string    "\002&\221z\006\206\t\347\030\030\200\324\256\006E\006\006F\321zF\260"
    .string    "\003CC\203\002\003\0033P\345\222\007\377\030A\364\223\r\347t\301\364\361\367\353\230\301\022\347\216\261\200\005\316]\217\001\363'\037gb"
    .string    ""
    .ascii    "x\016\026\321"
    .text
    .section    .gnu.lto_.refs.e53232bbb94bea8e,"",@progbits
    .string    "x\234ca`\004B "
    .string    ""
    .string    ""
    .string    "9"
    .ascii    "\007"
    .text
    .section    .gnu.lto_.decls.e53232bbb94bea8e,"",@progbits
    .ascii    "x\234\255RKL\023Q\024\235;\035i\035\371\030dA\314,\210\033\330"
    .ascii    "\330\021Q\343R\324\370ID]\210[RJ\003\215\320j\247H\334=D#~\243"
    .ascii    ".\024\211\306\372C\020\225\372C~jU\300\177\004]\030CD\022?\321"
    .ascii    "\240\t&F\203J\360\2747S\246\304\230\270\360e\356{\367\3369s\316"
    .ascii    "\275w\236\"\221\304\227\241HR>\334m\360\307\261d\234\353%{\361"
    .ascii    "\270\003vC\372s\361|2,\035\226\001\213\302\256\3014\330Z\330"
    .ascii    "-X6\254\007\326\005\273\007\353\375\007\3361\231\276\235\031"
    .ascii    "\274\244\f\320K\222\311*T\"\212\037\304]\021\022wy \213\335\312"
    .ascii    "\220\271\233\300\t\210\345\332d\342\211\237\343\361%H\314\367"
    .ascii    "6\tO\311\t\025Z\214\250\016\236\375\251P\242x\336\224K 6\353"
    .ascii    "N\340\245\311\315Q\274\373#\325g\033\024\007Z\207\377z\264q\231"
    .ascii    "\373<\303\332\317\230<\323\036\321\253\373M\315\216\2572e\253"
    .ascii    "\242\2024\244Z>\265\217\246\230)\216h:}\340d\222c\206\360\373"
    .ascii    "\267E\217rt\272J\n\302/O\352\337\244\"\314P)kL\226?\334\334\331"
    .ascii    "\247R\216\332\300u\206F\0333.26\235\242\244\322yrP\023\271yu"
    .ascii    "\331*\366Z\306\266\262\021\306\322\353R%\272H\032] M\242\026"
    .ascii    "\312\341\242\034H\315H\236C\022*\315\273\007^$)\030\234\240*"
    .ascii    "Vx\256e\373\333&\027\2245\224M\t5kV\315\307\033\273S\034\265"
    .ascii    "\304\003\271\365\303p\237Lj\216\020\215EXR\246Dy\032\315\201"
    .ascii    "b+\0245K\361\n\024/CQT\037\373\345d2]\203\336U\273tM5g6"
    .string    "\3327\3663Y\024\304\001\227HT\324\363\261w\237:\221\274n&\017~>q\2252\017\tF\306\262Ht`jK\324N\231\330\333\200\024\254{\336\355)\230\025a\221(\033\352\337Up\373T5\213\342\263E\002G\215v\025p\371q\226\006\360\337;h\026>\035\354\356\274\2438\336\211vi\357\360\341\367\312\3374\273\204f\261%Y\363\243\267\316\005\315!\374\256\266\247\353\373Y$\223#\250\323V\353\024jpn\b\245'=\317\353\234\216.q\251\224\273\373~\326\247\320T\21509\312\331!\306\313\"Y\233&\306{\007\343\275ES\315\371\306\200\272\215\371\3263\027O\342\254\345\327\203\273\r\361\213)\t\370MK\223\313\"\346\303\035\377\036K3\357\235\214\360\331\310\343c\323\314{7\235_\303X\377\201\264\344]\\\277\2171\265.U4\321\r\275\273\304\233\356\241d\301\205\023\350G\017GZRUh\327\374\303e"
    .string    "\376\301\203\037\337\234\223\330{1P\233\375\236\305\316O\347\306\312r\303\2672\340Z\276\2720kIn\256\344\252\364\007\302ys\213\302\033\364B\303\0272\364\025\236\200\241\257\362\027\207<\241-z~\250\004\357\203\271\363\365\215\036\357\006O\251\317\320=fJ\017\007\203\345\2106\207f\227z\275\372|\367<\367\234\331\236p\205\257<\317\275\200\273\026\f"
    .ascii    "\335\037\360\226W\226\370t#\\\0021w\231\344\344\242\013\213\302"
    .ascii    "\353\0225\227\006\275\225\025\276@\330\210\253\352e \251\362"
    .ascii    "\204|z\201\337\033\n.\t\302\343t^8\206^\301s\334\325\253\374"
    .ascii    "!\177\240\264Ht\346\366JI\342\215\261\346\277p[p\324<\245h1:"
    .ascii    "\376\r$\017\251+"
    .text
    .section    .gnu.lto_.symtab.e53232bbb94bea8e,"",@progbits
    .string    "pulseIn"
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    "\272"
    .string    ""
    .string    ""
    .string    "micros"
    .string    ""
    .ascii    "\002"
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    ""
    .string    "\275"
    .string    ""
    .string    ""
    .text
    .section    .gnu.lto_.opts,"",@progbits
    .string    "'-fmath-errno' '-fsigned-zeros' '-ftrapping-math' '-fno-trapv' '-fno-openmp' '-fno-openacc' '-mn-flash=1' '-mno-skip-bug' '-mmcu=avr25' '-msp8' '-g' '-Os' '-ffunction-sections' '-fdata-sections' '-flto'"
    .text
    .comm    __gnu_lto_v1,1,1
    .comm    __gnu_lto_slim,1,1
    .ident    "GCC: (GNU) 5.4.0"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is just streamed lto (-ffat-lto-objects won't help as you want the asm from lto1, not from cc1plus).

 

Add -save-temps -v to the command line options and find the /last/ calls to as.  This is issued during the link stage as the linker plugin triggers lto.  lto combines the whole source tree and cuts it into manageable parts.  If you -o main.elf, then the asm files will be named something like main.elf.ltrans<N>.s.  Notice that the asm files during lto are named after the /output/ file, not according to the input.

 

Debug info in asm is disturbing to human readers, hence you may want to compile without debug info or with -g0.

 

And the compiler doesn't generate .S files.  It generates .s files which don't need to be piped through cpp.

 

avrfreaks does not support Opera. Profile inactive.

Last Edited: Thu. Sep 28, 2017 - 05:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm sorry, but I can't figure this out. The platform.txt fine I'm using can be found HERE. I tried to add -save-tems -v to all possible lines, but nothing happens except for this error when added to the end of line 58:

 

Using built-in specs.
Reading specs from /Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/avr/5.4.0/device-specs/specs-attiny13a
COLLECT_GCC=/Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/avr-gcc
Target: avr
Configured with: ../gcc/configure --enable-fixed-point --enable-languages=c,c++ --prefix=/Users/jenkins/jenkins/workspace/avr-gcc-staging/label/mac-mini/objdir --enable-long-long --disable-nls --disable-checking --disable-libssp --disable-libada --disable-shared --enable-lto --with-avrlibc=yes --with-dwarf2 --disable-doc --target=avr
Thread model: single
gcc version 5.4.0 (GCC) 
COLLECT_GCC_OPTIONS='-c' '-g' '-Os' '-Wall' '-std=gnu11' '-ffunction-sections' '-fdata-sections' '-MMD'  '-D' 'F_CPU=9600000L' '-D' 'ARDUINO=10800' '-D' 'ARDUINO_attiny' '-D' 'ARDUINO_ARCH_AVR' '-Wextra' '-flto' '-I' '/Users/Hans/Documents/Arduino/hardware/MicroCore/avr/cores/microcore' '-o' '/var/folders/2f/bk0yr6zx4290kvkss8ty0gxc0000gn/T/arduino_build_333465/core/WInterrupts.c.o' '-D' 'COMPILER_LTO' '-save-temps' '-v' '-specs=device-specs/specs-attiny13a' '-mmcu=avr25' '-msp8'
 /Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../libexec/gcc/avr/5.4.0/cc1 -E -quiet -v -I /Users/Hans/Documents/Arduino/hardware/MicroCore/avr/cores/microcore -imultilib avr25/tiny-stack -iprefix /Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/avr/5.4.0/ -MMD /var/folders/2f/bk0yr6zx4290kvkss8ty0gxc0000gn/T/arduino_build_333465/core/WInterrupts.c.d -MQ /var/folders/2f/bk0yr6zx4290kvkss8ty0gxc0000gn/T/arduino_build_333465/core/WInterrupts.c.o -D__AVR_ATtiny13A__ -D__AVR_DEVICE_NAME__=attiny13a -D F_CPU=9600000L -D ARDUINO=10800 -D ARDUINO_attiny -D ARDUINO_ARCH_AVR -D COMPILER_LTO /Users/Hans/Documents/Arduino/hardware/MicroCore/avr/cores/microcore/WInterrupts.c -mn-flash=1 -mno-skip-bug -mmcu=avr25 -msp8 -std=gnu11 -Wall -Wextra -ffunction-sections -fdata-sections -flto -g -fworking-directory -Os -fpch-preprocess -o WInterrupts.i
ignoring nonexistent directory "/Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/avr/5.4.0/../../../../avr/sys-include"
ignoring duplicate directory "/Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/../../lib/gcc/avr/5.4.0/include"
ignoring duplicate directory "/Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/../../lib/gcc/avr/5.4.0/include-fixed"
ignoring nonexistent directory "/Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/../../lib/gcc/avr/5.4.0/../../../../avr/sys-include"
ignoring duplicate directory "/Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/../../lib/gcc/avr/5.4.0/../../../../avr/include"
#include "..." search starts here:
#include <...> search starts here:
 /Users/Hans/Documents/Arduino/hardware/MicroCore/avr/cores/microcore
 /Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/avr/5.4.0/include
 /Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/avr/5.4.0/include-fixed
 /Users/Hans/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.0-arduino/bin/../lib/gcc/avr/5.4.0/../../../../avr/include
End of search list.
cc1: fatal error: opening output file WInterrupts.i: Permission denied
compilation terminated.
exit status 1
Error compiling for board ATtiny13.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried to add -save-temps -v to all possible lines

 I'm not sure where -save-temps tries to save the temp files TO, when you compile with the arduino IDE.   Normally I'd think that it would save them to the "current directory", but I'm not sure that the IDE *has* a well-defined "current directory" - it's pretty careful to use fully-specified path names for the input and output files.

 

Usually when I'm doing heavy-duty analysis of Arduino core files, I end up copying and pasting the compile commands from the Arduino IDE build window, and then modifying them to suit whatever I'm doing (replace -c with -E or -S, changing -Ox, etc)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
it's pretty careful to use fully-specified path names
Well it will attempt to write the .s and .i into the same directory where the .cpp file is, wherever that happens to be.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Well it will attempt to write the .s and .i into the same directory where the .cpp file is
Nope.

-save-temps
-save-temps=cwd

    Store the usual “temporary” intermediate files permanently; place them in the current directory and name them based on the source file.

    ...

 

Stefan Ernst

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> cc1: fatal error: opening output file WInterrupts.i: Permission denied

 

When you want these files you need write permissions, of course.  Maybe yuo had it open in some viewer and it was locked?

 

And I thought Ardiuno is C++, no?

 

avrfreaks does not support Opera. Profile inactive.

Last Edited: Fri. Sep 29, 2017 - 05:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I thought Ardiuno is C++, no?

The "Arduino core" includes S, C, and C++ files.  You sketch can too, theoretically - I'm not sure that the editor handles .S files.