Skip to content
Jim Tremblay edited this page Nov 19, 2016 · 2 revisions

Home

nOSConfig.h

File used to configure kernel and reduce memory footprint when not all features are required. A template is available in nOS/inc/nOSConfig_TEMPLATE.h for your convenience. Just copy the template with your other header files, rename it to nOSConfig.h and edit it to your needs.

NOS_CONFIG_DEBUG

Enable or disable debug code. Initialize thread's registers and stack to known values (useful to know how much space of the stack is used by the thread).

Notes:

  1. Can be disabled when application will be debugged to decrease flash space used.

NOS_CONFIG_SAFE

Enable or disable arguments checking in nOS API (useful for application development).

Notes:

  1. Can be disabled when application will be debugged to increase performance and decrease flash space used.
  2. Before disabling this option, ensure your application is not doing anything againts the rules by checking error code.

NOS_CONFIG_HIGHEST_THREAD_PRIO

Highest priority a thread can have (0 to 255 inclusively). Set to 0 to enable a cooperative scheduling with all threads at the same priority (preemptive scheduling need to be disabled).

0 = Lowest priority
255 = Highest priority

Notes:

  1. It is recommenced to set NOS_CONFIG_HIGHEST_THREAD_PRIO adjusted to the minimum required by the application to minimize memory used by the scheduler.

NOS_CONFIG_TICK_COUNT_WIDTH

Size of ticks counter for sleep/timeout in bits (can be 8, 16, 32 or 64).

Notes:

  1. Bits width directly affects the maximum timeout that the application can specify to nOS API.
  2. For maximum performance, it is recommenced to set width of a CPU register.

NOS_CONFIG_TICKS_PER_SECOND

Number of ticks per second. nOS_MsToTicks and nOS_SleepMs use this value to convert ms to ticks.

Notes:

  1. It is recommended to don't set value higher than 1000 ticks per second.
  2. For Unix and Win32 simulator, this value can't be set to value higher than 100 ticks per second.

NOS_CONFIG_SCHED_PREEMPTIVE_ENABLE

Enable or disable preemptive scheduler. When enabled, the scheduler will ensure it's always the thread with the highest priority that is ready to run that is running. If disabled, the running thread must relinquish the CPU when it allow other threads to run (cooperative scheduling) (round robin scheduling should be disabled).

Notes:

  1. Need to be disabled if NOS_CONFIG_HIGHEST_THREAD_PRIO is set to 0.

NOS_CONFIG_SCHED_ROUND_ROBIN_ENABLE

Enable or disable round-robin scheduler. If enabled, each tick will try to switch context to another thread of the same priority that is ready to run.

Notes:

  1. Need to be disabled if NOS_CONFIG_SCHED_PREEMPTIVE_ENABLE is disabled when NOS_CONFIG_HIGHEST_THREAD_PRIO is higher than 0.