Pages: [1]   Go Down
Author Topic: New tool for Arduino IDE  (Read 809 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 3
Posts: 308
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Started work on a tool to be included in Arduino  code development.
Want to parse all 10000 plus lines of "code" to "automatically" delete unused code.
Not just commented out, deleted.
Something similar to "Auto Format". Be happy to build just a custom class, not necessary to include in IDE as menu option,
Maybe later.
Never done "parsing " application and any free contributions will be appreciated.
Cheers Vaclav

 
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 220
Posts: 13846
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

far from trivial.

Can you define unused code ?
how do you want to determine?

you might investigate a tool like LINT ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If I write the code in a sketch, I plan for that code to be used.
How would you determine that anything was unused?
Or are you thinking the IDE only?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Sr. Member
****
Karma: 3
Posts: 308
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I usually have basic  concept of the program defined, however, things change as I go.
At some point I find it prudent to replace / rename a function instead of  keeping it modified.
I find it handy to keep the old function just to remind myself what did and what did not work.
Of course I can comment the unused function  out when memory became an issue.
(The program memory is OK , but just found out the hard way to keep an eye on RAM usage! )
When the project is done I would like to clean it up automatically, just being lazy.

If compiler can "assemble " the used / working stuff, why it could not be modified to delete  unused function?

 I'll take a look at LINT.
Logged

Offline Offline
Full Member
***
Karma: 9
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If compiler can "assemble " the used / working stuff, why it could not be modified to delete  unused function?

The linker produces a list of discarded things, including function names , so this could be used to edit source files for specific cases. A completely general solution is impossible because of the macro preprocessor - the source code seen by the compiler may not correspond at all to the original input file.

If I want to keep old code for a bit I put it inside #ifdef OLD ... #endif. That guarantees it won't bloat the object code and is easy to tidy up later.
Logged

Please don't PM me asking for help. Ask questions in the forum.

Offline Offline
Sr. Member
****
Karma: 3
Posts: 308
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks,
I was just thinking similar way - the compiler builds a symbol table so if it is ASCII readable I could get started there.
All my processing is done in setup function by functions , four in the last project. I could just check the symbol file for them and just parse each function again , recursively.

As far as using preprocessor to bypass the unused stuff, I already have about 10 of them using selected code during  debug.

Seems as the best immediate solution,  just KISS.

Either way - where are the descriptions of all the files Arduino compiler builds and  where are they?
Or do I have to go all the way to GCC??


I guess I skip this project for now.
I have DDS output on "mother code" but zilch on the new  derived code.
 I need to find the missing piece, bug , first!
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50115
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the compiler builds a symbol table so if it is ASCII readable
It isn't. That would imply that it is written to a file.
Logged

Pages: [1]   Go Up
Jump to: