Skip to content

.a linkage for libraries via library.properties #2800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NicoHood opened this issue Mar 20, 2015 · 5 comments
Closed

.a linkage for libraries via library.properties #2800

NicoHood opened this issue Mar 20, 2015 · 5 comments
Assignees
Labels
Component: Compilation Related to compilation of Arduino sketches Component: IDE The Arduino IDE feature request A request to make an enhancement (not a bug fix)
Milestone

Comments

@NicoHood
Copy link
Contributor

It would give developers a lot of more possibilities if libraries could be linked via an .a file.
So only the needed .cpp files get compiled like the core or the .ino file directory.

It would also break existing libraries. So my suggestion is just to only compile through .a if a special property was set.

You could add this perfect into such a file with an entry "linkage"
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/libraries/SoftwareSerial/library.properties

Also this link sais if i put the library into an "src/" folder it gets linked in the .ino path. This option is not working anymore. Also the import function is under "sketch" not "tools".
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#source-code
it would be cool to make it work like this though.

@matthijskooijman
Copy link
Collaborator

I like this idea of opting in to linking through a .a file through library.properties. It might even be a good idea if some source files can be linked through .a files and some directly included in the link, for maximum flexibility. The reason for wanting to go through a .a file, is so you can leave out a source file from the link when it is unused, including any ISRs (which are never removed by gc-sections once they're included, due to the used attribute).

Also this link sais if i put the library into an "src/" folder it gets linked in the .ino path. This option is not working anymore. Also the import function is under "sketch" not "tools".

I'm not sure what you are saying here, but the "also" suggests they are separate issues. Please don't complicate discussion by chunking together unrelated issues, better open multiple issues instead (or, for things like what option goes where, collect opinions on the developer mailing list first).

@NicoHood
Copy link
Contributor Author

NicoHood commented Apr 2, 2015

Has * Upgraded toolchains: statically compiled, ship with Link Time Optimization plugin (disabled by default) something to do with this issue? Any chance to see this in the future? With the new library system this would really make sense to include the .a linkage.

And I also like the idea of mathijs to link different files "normal" or via .a file.

@NicoHood
Copy link
Contributor Author

Any chance to see this soon? It would fix a lot of issues with 2 of my libraries and newer libs can be optimized better.

I'd do it myself but I dont know where to start with the whole Arduino IDE source and I also dont have enough knowledge about the linking process.

@NicoHood
Copy link
Contributor Author

I am currently trying to implement this feature myself.
After some time of research and the help of @matthijskooijman I finally got a working version that compiles the library via .a file instead. And it seems to work.

One quick question:
Why do you normally use recursiveCompileFilesInFolder() to compile libraries with a /src path?

Can't we use compileFiles() instead and pass a true instead of a false? Whats the difference?

If the recursive addition is somehow needed I'd need to add a 2nd version which returns the list of files again (instead of void and adding it to a global file list). Is there any header in java, or function prototype needed or can I just place a new function inside the .java file?

What I still need to figure out is how to read in a setting from the libraries.properties file (too keep compatibility with other, older libraries).

@ffissore
Copy link
Contributor

Issue moved to arduino/arduino-builder#10

@ffissore ffissore assigned ffissore and unassigned cmaglie Sep 23, 2015
@ffissore ffissore added this to the Release 1.6.6 milestone Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Compilation Related to compilation of Arduino sketches Component: IDE The Arduino IDE feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

No branches or pull requests

4 participants