[riot-devel] Discussion of Power Management

Robert Hartung hartung at ibr.cs.tu-bs.de
Mon Aug 28 10:36:14 CEST 2017


Dear everyone,

I've worked on the power management for the atmega platform at the RIOT
Hackathon.
While creating PRs for the different parts, I stopped at a critial point
I would like to discuss here:

Several functions are used for the power management and stubs are
provided in drivers/periph_common/pm.c. However as mentioned in one
issue, the weak implementation did *not* work correctly.
Therefore we agreed on removing weak definitions for the module and use
some #ifdefs instead:

#if !defined( MODULE_PM_LAYERED )
void pm_set_lowest(void) { }
#endif

Unfortunately, this does not work because some platforms and especially
the stm32_common/kinetis_common/cortexm_common platforms define these
functions all over the place!

My first question is there for, is there a good system to
implementations for a module such as the PM module at different levels?

E.g. the CPU should always have the possibility to implement specific
pm_* functions. A fallback could be provided in the common CPU.
Additionally, the pm_layered module uses some of these CPU functions.
And finally, the fallback functions in pm.c should be used, if none exist.
Is it ok to use #define / #ifdef constructs for these? Any opinions?
I think we need a very fine-granular system here. I started to add
special features to handle this case:

makefiles/features.inc.mk

DEFAULT_FEATURES += periph_pm periph_pm_off periph_pm_set_lowest
periph_pm_reboot

cpu/cortexm_common/Makefile.features
FEATURES_PROVIDED += periph_pm_set_lowest

I thought that maybe features can be used to describe which functions
are provided. Later on based on include/compile order, missing functions
can be added if needed. Any opinions on this?

Best Regards,
Robert

-- 
Robert Hartung, M.Sc.

Technische Universität Braunschweig
Institut für Betriebssysteme und Rechnerverbund
Mühlenpfordtstr. 23, Raum 115
38106 Braunschweig

Fon: +49 (531) 391 - 3264
Fax: +49 (531) 391 - 5936
E-Mail: hartung at ibr.cs.tu-bs.de


More information about the devel mailing list