k_timer: Don't allocate dynamic timers by default

Most apps run fine with static k_timer objects.  Don't pay the cost
for the timer pool if no one asks for it.

Also turn off the allocate/free API in the header if it can't possibly
work at runtime as it's an obviously-detectable error that would
otherwise be visible only at runtime.

Change-Id: I492e6e01c4213e3544f707247eea6e4bc601fefd
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2016-09-23 10:08:54 -07:00 committed by Benjamin Walsh
commit 8d8b2acb26
3 changed files with 6 additions and 1 deletions

View file

@ -293,8 +293,12 @@ struct k_timer {
struct k_timer name = K_TIMER_INITIALIZER(name)
extern void k_timer_init(struct k_timer *timer, void *data);
#if (CONFIG_NUM_DYNAMIC_TIMERS > 0)
extern struct k_timer *k_timer_alloc(void);
extern void k_timer_free(struct k_timer *timer);
#endif
extern void k_timer_start(struct k_timer *timer,
int32_t duration, int32_t period,
void (*handler)(void *), void *handler_arg,