1、Ederson de SouzaOS Development Engineer20232 Footprint?Tools Common Hints Experiments Function pointers considered harmful Not really What about LTO?Ending thoughts Q&!A3 How big is the impact on some resource ROM/Disk/Flash RAM Power consumption Why do we care about it?Save resources Money EnergyWh
2、ere are we?4 But first,lets measure it Otherwise,improvements cant be proven Nor regressions detected Zephyr has a nice ROM report toolwest build-t rom_report56 Disable unused features/subsystems Avoid holes in structs west build-t pahole Limit number of threads Logging Power management Try differen
3、t toolchains78 Experimenting what we do So,we can ask if we do Not prescribing Some test were not checked on runtime So,things may be broken Used some open-source projects on the tests Not implying anything Focus on application size9 Compiler loses visibility on whats being used Dead code eliminatio
4、n misses Zephyr APIs extensively use them /Declaration _subsystem struct kscan_driver_api kscan_config_t config;kscan_disable_callback_t disable_callback;kscan_enable_callback_t enable_callback;/Driver instantiationstatic const struct kscan_driver_api kscan_npcx_driver_api=.config=kscan_npcx_configu
5、re,.enable_callback=kscan_npcx_enable_interface,.disable_callback=kscan_npcx_disable_interface,;10 Zephyr APIs extensively use them(II)/API usage _syscall int kscan_enable_callback(const struct device*dev);static inline int z_impl_kscan_enable_callback(const struct device*dev)const struct kscan_driv
6、er_api*api=(const struct kscan_driver_api*)dev-api;if(api-enable_callback=NULL)return-ENOSYS;return api-enable_callback(dev);11 What if we have something like C+templates?kscan?Could _Generic come to help?How to have the type at coding time?Maybe DTS can help here?Didnt explore this line further But