avr-rust / avrd

AVR device definitions
MIT License
46 stars 5 forks source link

Turn off uncommon mcu types by default #3

Open dylanmckay opened 7 years ago

dylanmckay commented 7 years ago

Compilation time is quite long because we generate modules for each and every mcu, even ones for the automotive-specific microcontrollers.

Look into disabling them by default, so that you must then use something like features = ["automotive"] to enable them.

shepmaster commented 7 years ago

like features = ["automotive"] to enable them.

Is there a reason to ever compile anything but the current one? It kind of seems like every mcu should be a feature. When you go to use this library, you'd say

[dependencies]
avrd = { version = "0.1.0", features = ["my-awesome-one"] }
shepmaster commented 7 years ago

Having said that, the use of features could prove to be very annoying in such a case. The user wants to set this configuration and then much lower-level code would presumably make decisions based on it... I'm not sure how the features would flow through the dependencies in that case.

dylanmckay commented 7 years ago

That's an interesting point.

I like the idea of easily being able to compile all boards.

I recently added a target_cpu cfg attribute to the AVR rust fork, which can be used to detect the current board.

Maybe we could edit the build script to default to compiling the pack for the current board, but allow something like features = ["all"] which includes everything.

dylanmckay commented 7 years ago

Is there a reason to ever compile anything but the current one?

Yes, I want this crate to also be used in tooling. I'd like to write a Rust flashing tool, which needs to know some of the MCU internals exposed in the packfiles that we have here. In this case, the tool would need to know of all possible mcus.