diff options
Diffstat (limited to 'os')
| -rw-r--r-- | os/kernel/src/chsys.c | 4 | ||||
| -rw-r--r-- | os/kernel/src/chthreads.c | 3 | ||||
| -rw-r--r-- | os/kernel/templates/chconf.h | 17 | 
3 files changed, 22 insertions, 2 deletions
diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c index 29f4bdc7e..5d3c0bcf4 100644 --- a/os/kernel/src/chsys.c +++ b/os/kernel/src/chsys.c @@ -35,6 +35,7 @@  #include "ch.h"
 +#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__)
  /**
   * @brief   Idle thread working area.
   * @see     IDLE_THREAD_STACK_SIZE
 @@ -59,6 +60,7 @@ void _idle_thread(void *p) {      IDLE_LOOP_HOOK();
    }
  }
 +#endif /* CH_NO_IDLE_THREAD */
  /**
   * @brief   ChibiOS/RT initialization.
 @@ -93,11 +95,13 @@ void chSysInit(void) {    currp->p_state = THD_STATE_CURRENT;
    chSysEnable();
 +#if !CH_NO_IDLE_THREAD
    /* This thread has the lowest priority in the system, its role is just to
       serve interrupts in its context while keeping the lowest energy saving
       mode compatible with the system status.*/
    chThdCreateStatic(_idle_thread_wa, sizeof(_idle_thread_wa), IDLEPRIO,
                      (tfunc_t)_idle_thread, NULL);
 +#endif
  }
  /**
 diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c index 234cd6ae1..7df276bea 100644 --- a/os/kernel/src/chthreads.c +++ b/os/kernel/src/chthreads.c @@ -206,8 +206,7 @@ Thread *chThdCreateStatic(void *wsp, size_t size,  tprio_t chThdSetPriority(tprio_t newprio) {
    tprio_t oldprio;
 -  chDbgCheck((newprio >= LOWPRIO) && (newprio <= HIGHPRIO),
 -              "chThdSetPriority");
 +  chDbgCheck(newprio <= HIGHPRIO, "chThdSetPriority");
    chSysLock();
  #if CH_USE_MUTEXES
 diff --git a/os/kernel/templates/chconf.h b/os/kernel/templates/chconf.h index 04fa822cc..14109b635 100644 --- a/os/kernel/templates/chconf.h +++ b/os/kernel/templates/chconf.h @@ -90,6 +90,23 @@  #define CH_MEMCORE_SIZE                 0
  #endif
 +/**
 + * @brief   Idle thread automatic spawn suppression.
 + * @details When this option is activated the function @p chSysInit()
 + *          does not spawn the idle thread automatically. The application has
 + *          then the responsibility to do one of the following:
 + *          - Spawn a custom idle thread at priority @p IDLEPRIO.
 + *          - Change the main() thread priority to @p IDLEPRIO then enter
 + *            an endless loop. In this scenario the @p main() thread acts as
 + *            the idle thread.
 + *          .
 + * @note    Unless an idle thread is spawned the @p main() thread must not
 + *          enter a sleep state.
 + */
 +#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
 +#define CH_NO_IDLE_THREAD               FALSE
 +#endif
 +
  /*===========================================================================*/
  /* Performance options.                                                      */
  /*===========================================================================*/
  | 
