My project will consist in a familly of many different device types for home automation based on esp mesh
My idea is to have a single project where main app code will do the common things (set up esp mesh, etc), and the functionality for specific device type will be in components.
Is this a good way?
So my question is : Can I select only one component during compile time?
I mean, supose my product family consist on "device type A", "device type B" and "device type C"
I will have a single project which has three subcomponents named "A", "B" and "C"
When I want to flash a device of type "B", I will compile the project without compiling "A" and "C"
Compile components selectively
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Compile components selectively
The standard way of doing things would be to always compile A, B and C, but to use e.g. preprocessor macros in your main program to not call any functions in them unless they're selected.
Re: Compile components selectively
Will code from unused components be present on the final image?
For me it's ok if they're compiled but do not consume space on device.
Also, is this a good architecture? Would be better to have actual separated projects?
For me it's ok if they're compiled but do not consume space on device.
Also, is this a good architecture? Would be better to have actual separated projects?
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Compile components selectively
No, code consumed as such will not use memory (as it doesn't get linked in if it's not referred anywhere). With regards to architecture... I'd personally prefer having a shared component that does all the overlapping functionality, then referring to that from each project using an EXTRA_COMPONENT_DIRS line in your project makefile.
Re: Compile components selectively
Hi,magnomp wrote: ↑Wed May 22, 2019 8:03 pmMy project will consist in a familly of many different device types for home automation based on esp mesh
My idea is to have a single project where main app code will do the common things (set up esp mesh, etc), and the functionality for specific device type will be in components.
Is this a good way?
So my question is : Can I select only one component during compile time?
I mean, supose my product family consist on "device type A", "device type B" and "device type C"
I will have a single project which has three subcomponents named "A", "B" and "C"
When I want to flash a device of type "B", I will compile the project without compiling "A" and "C"
I have one suggestion from my side like you can also use concept of Kconfig and Menuconfig related stuffs in which you can enable and compile components which are required as per your requirements with single source code.
Let me know if need any help regarding that.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 156 guests