Go Down

Topic: "applet" directory for build targets... (Read 9241 times) previous topic - next topic

westfw

(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.<procnum>; 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.)

westfw

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...

mem

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.

westfw

Quote
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.

mem

Quote
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"

westfw

Quote
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%5C.googlecode%5C.com&sa=N&cd=1&ct=rc

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

mem

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?


westfw

With "build.path=applet", I get:
Code: [Select]
/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:
Code: [Select]
/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

mem

#8
Mar 09, 2010, 11:35 am Last Edit: Mar 09, 2010, 11:36 am by mem Reason: 1
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.

westfw

Quote
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...

mem

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.


KenH

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>

KenH

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 :)
/me

jrraines

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.

darlanpj

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!

Go Up