"applet" directory for build targets...

(this subject was originally brought up in the Arduino 0018 announcement, but that's not really a good place for feature/bug discussions!)

The Arduino IDE creates a directory in which to place the build targets (.o, .elf, .hex, etc)
In older versions of the IDE (pre 0018), "Verify" builds create a temporary directory (usually in a place like /tmp/build.; a standard unix-like thing to do), and "Upload" builds would create a subdirectory "Applet" in the Sketch directory that was permanent till the next build (remained despite exiting the IDE.)

In 0018, the behavior was changed to avoid read-only filesystem issues (unix installs of the IDE in shared non-writable directories (/usr/bin/...) and MacOS instances running from the distributed disk image) with the Example sketches; a temporary directory is always used.
I guess that partially this is inherited from Processing ?

About the same time (?) Java distributions began create "temporary filename" names that are more complex and obscure than they used to be (On a Mac I get: /var/folders/Xw/XwjZcQ842RWmnU+8ZSLT7U+++TI/-Tmp-/build9142969154033714507.tmp/ )

This combination has made it difficult and awkward to track down build files that are useful for "advanced" analysis of the Arduino sketch (.hex files for bulk programming, .elf files for objdump to look at code efficiency, even generated .cpp files for tracking down compile errors when the line-number translation fails.)

The use of a permanent "applet" directory is more useful and important with Arduino than with processing, and we'd like it back! (perhaps as an option.)

So... I don't understand the comment someone made about "you can't go back"?
When I run 0017 builds move back to the "sketch/applet" directory...

Thanks for creating the thread, I hope it will help drive a resolution to problems caused by the changed behaviour of the sketches/applet directory.

I wonder if having an option to set the path for a single permanent applet directory in preferences.txt would be a nice simple solution to this.

I wonder if having an option to set the path for a single permanent applet directory in preferences.txt would be a nice simple solution to this.

There is "build.path" in preferences.txt, but it's common to all sketches and relative to one of the app directories. If it were relative to the sketch directory, I think it would work fine with no other changes.

Spoofing build.path internally seems like the quickest solution in general, even if controlled by another preference.

There is "build.path" in preferences.txt

I had a look in the 0018 preferences and saw a "preproc.save_build_files=false" but did not see "build.path"

did not see "build.path"

For reasons I don't understand, it doesn't seem to appear in the preferences.txt file unless you put it there, but once you put it there, it is recognized. You can find it referenced in the java source code for the IDE, though. (weird...)

http://www.google.com/codesearch/p?hl=en#thaXon_DSGU/trunk/app/Base.java&q=build.path%20package:http://arduino\.googlecode\.com&sa=N&cd=1&ct=rc

(it also shows up in the "prototype" preferences.txt in the source tree.)

adding build.path did not work for me. I get an error reporting unable to locate directory, did you get this to work and what path did you try?

With "build.path=applet", I get:

/Applications/arduino/arduino-0018/Arduino-0018.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections
     -fdata-sections -mmcu=atmega168 -DF_CPU=16000000L -DARDUINO=18
     -I/Applications/arduino/arduino-0018/Arduino-0018.app/Contents/Resources
      /Java/hardware/arduino/cores/arduino /Applications/arduino/arduino-0018/Arduino-
      0018.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Tone.cpp
     -o/Applications/arduino/arduino-0018/applet/Tone.cpp.o

With "build.path=/tmp/applet" I see:

/Applications/arduino/arduino-0018/Arduino-0018.app/Contents/Resources
    /Java/hardware/tools/avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections
    -mmcu=atmega168 -DF_CPU=16000000L -DARDUINO=18 -I/Applications/arduino/arduino-
      0018/Arduino-0018.app/Contents/Resources/Java/hardware/arduino/cores/arduino
      /Applications/arduino/arduino-0018/Arduino-0018.app/Contents/Resources/Java/hardware
      /arduino/cores/arduino/WInterrupts.c -o/tmp/applet/WInterrupts.c.o

I had expected the build to create the 'applet' directory if it did not exist (as in prior releases) but the compile fails if it can't find an existing the directory in the build path.

It does work if the directory is created manually prior to the build but the behaviour would be more intitive if this was not necessary.

anyway, this does work better than using the default temp directory path. Thanks for posting.

I had expected the build to create the 'applet' directory if it did not exist ... but the compile fails if it can't find an existing the directory in the build.path

Interesting. It happily created non-preexisting directories on my Mac. In fact, the internal code claims to delete and re-create the directory for each build, so as to make sure it is "clean." I wonder if there is some protection or java run-time difference coming into play...

It could be a windows thing, but it fails with "Build folder disappeared or could not be written"
I was testing using XP.

Anyway, it works as long as the directory is created manually prior to the build.

mem - it works for me also. First create the applet folder under arduino-0018 and when the compile or upload is clicked, it works, uploads and all. The applet is filled with the files - easy to find and a reasonable name. MUCH better. Problem if the sketch is changed as I sometimes do in testing different version - you overwrite the previous files.

this is better - even better still would be if it would put the applet under the sketch folder as before. An option would be very good.

Thanks for the info.

Ken H>

Westfw - you did select the correct folder for moving the thread - a "bug" is the right name for what happened.

Give us an option and I'll be happy :slight_smile:
/me

I, too, would like to see the applet folder available as it was in 17. Things aren't so bad now, when you only have to revert from 18 to 17 to get the applet folder but as 17 gets more layers obsolete it will get worse.

There was a post detailing how to create a make file which I found last month and can't find now. a couple of times I spent an hour trying to get that to work without success. firing up 17 only takes a few minutes.

two more points: I'm a Mac user, and I can't see who would want to run the code from a .dmg file--just finish installing it!

I am a new user. It is now 4 months since I first heard of an Arduino. But I'm an old assembly language programmer and when C or C++ doesn't understand me, one of the most useful tools I have is the disassembly listing. I really miss this facility.

I have the same problem for create this applet directory from 0018 version, if someone fix it please post here. Yet not I understand why they eliminated this function from this version.I need it to integrate with the Proteus program for simulation.
Thanks!

As a work around you can also set the following flag in preferences.txt:

build.verbose=true

This will give you the location of the intermediate build files like core.a and any libs you need for building standalone. For instance, on my mac I was able to get this line (among very, very many:)

/var/folders/+M/+M4oTL7NFPKSM+wMKMXig++++TI/-Tmp-/build6286307593943555774.tmp/core.a

on version 0018 you can get the verbose output displayed in the IDE by holding down the shift key when compiling

I specify build.path and all is working fine.... BUT! When I close IDE, files deleted immediately :frowning: WHY? In preferences I uncheck [X] Delete files...., but it don't understand me :slight_smile:

I suppose, that preferences.txt file must allow wildcards and runtime parameters. It would be nice, if I can specify something like:
build.path=%PROJECT_PATH%\applet\

Okay, that for newbies. But "an old assembly language programmer" jrraines (and me too) can find Makefile in the same path, where bootloader lives:
[ Arduino-0018\hardware\arduino\bootloaders\atmega ]
It is simplier than run IDE and then searching, why problems are growing :slight_smile:
How to change makefile and execute, I hope you know. Then you can write your application in every text editor (WinAvr have Programmer's Notepad) and compile in command line or somehow else.

I use FAR manager with built-in text editor. I used it always, almost 15 years. So, I specified in FAR what I want to execute, when I press Enter on some file types, like .hex (avrdude sends it to arduino), .asm (compile using make), .pde (compile using make) - for all projects in assembler, or C, or modified C like Arduino IDE uses you can create Makefile and then copy to simila projects and change only filenames...

When I purchase Arduino Duemilanova, my friend said - IDE is for newbies. I didn't agree with him, but now I agree.

And there is another reason. Big REASON, why not to use IDE. I saw it today, when trying to use applet directory. My code compiled in 0017 and stored in the projects's applet directory and then without changes compiled in 0018 - second one is bigger. Why? It adds Tone library and you cannot include nor exclude it in project. I think it is nonsense. Arduino is not PC with at least 1 MB memory. So better is to write in C or ASM. I find on Internet some mathematical functions for asm and it is great to program in pure processor's language.

Including Tone library was not so necessary. IMHO. It is good - you can output more than 1 line at the same time. But for small projects it is better to write ~5 rows of code, what gives you ability to output specified frequency and length.

Simplest way - get back your copy of 0017 :slight_smile:

Best wishes to all!
I love arduino!

It adds Tone library and you cannot include nor exclude it in project

I am surprised to hear you are seeing tone functions being linked if your sketch does not reference them.

I just had a look at the object dump for the blink example sketch and there is no sign of a tone function. The code size of blink is 870 bytes, which leaves almost 30k bytes of code space free.

I do agree with you that there should be an ability to build a sketch on the command line instead of through the IDE. This has been proposed to the Arduino team and I hope that it will be available in future.

Take a look on applet (or what you specified as build.path) directory. There is Tone.cpp.o as well as Print.cpp.o, but I dont use them in test compilation. There is Wiring library compiled too, which I don't use. And few rows of .pde compiled are about 5 KB (.hex file).

I disassembled this test.hex and there is one interrupt starting with PUSH registers and before RETI it POPs all registers back. I didn't defined in my code any interrupts. And there is another function. I don't dig deeper yet.

Please take AVR Simulator IDE (trial) and disassemble .hex compiled with Arduino IDE. I surprised that there is 5 KB (.hex or 2,3 KB binary) of nothing I used in my code. Okay, some of them was in 0017 too. But not Tone.