Implementing a preset option for targets in libraries#3185
Conversation
|
Interesting! |
|
The current state of this PR:
I think that should be the most important things that changed. |
|
Would it be possible to add a few tests? Maybe a synthetic lib or two in |
|
@ManuLinares Would that be enough testing or should I add more? If I should add more could you please provide one or two ideas of tests you'd like to see. And thanks a lot for the note :) |
|
This looks good. I would remove all of the weird dashes |
|
The en-Dashes are used quite a bit around the code base so I thought that they are fine. Of course I could of course remove them if wanted :) And yeah you are right they can look weird, but I like them quite a bit :3
|
|
compiler output is a tool interface, not prose, and should minimize encoding risk, ambiguity, and downstream parsing issues |
|
I removed all occurrences of the en-Dash in my pr and I'd b e open to also create a quick pr removing the other ones in error msgs etc. If this is wanted. |
This change is (for now) just a proposal: it implements a way to define presets for certain target configurations by the library authors. This is especially useful for developers working with libraries targeting microcontroller boards like the Arduino or ESP32 family. The user won't have to fiddle with those configurations, like what to enable, what to disable, what CPU architecture to use, or whether to not set an entry point.
This, at least in my opinion, provides a huge boost in ease of use without taking away from the customizability of C3 projects. Everything can be overridden by the user by just setting the configuration in the user's project.json file.
I just wanted to put this out here and get some feedback on whether this is wanted or not or how this could be changed for a better dx.
Example
manifest.json:{ "provides": "arduino", "presets": { "arduino_uno": { "cpu": "atmega328p", "target": "elf-avr", "opt": "Oz", "linker": "builtin", "use-stdlib": false, "link-libc": false, "no-entry": true } }, "targets": { ... } }Example
project.json:{ "dependencies": ["arduino"], "dependency-search-paths": ["lib"], "targets": { "pot_fade": { "type": "executable", "preset": "arduino:arduino_uno", "name": "pot_fade", "extension": ".elf" } } }