Skip to content

Add missing configuration macros to FreeRTOSConfig.h template#1398

Open
anand16158 wants to merge 1 commit into
FreeRTOS:mainfrom
anand16158:feature/issue-65-add-missing-config-macros
Open

Add missing configuration macros to FreeRTOSConfig.h template#1398
anand16158 wants to merge 1 commit into
FreeRTOS:mainfrom
anand16158:feature/issue-65-add-missing-config-macros

Conversation

@anand16158
Copy link
Copy Markdown

Add 16 documented configuration macros to the existing `FreeRTOSConfig.h` template in `examples/template_configuration/`. These macros are supported by the kernel but were not represented in the template.

Macros added

Scheduling / Tick:

  • `configINITIAL_TICK_COUNT` - initial tick counter value (useful for overflow testing)
  • `configEXPECTED_IDLE_TIME_BEFORE_SLEEP` - minimum idle ticks for tickless mode
  • `configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING` (commented)
  • `configPRE_SLEEP_PROCESSING` / `configPOST_SLEEP_PROCESSING` (commented)
    Task / Debug:
  • `configRECORD_STACK_HIGH_ADDRESS` - debugger backtrace support
  • `configRUN_TIME_COUNTER_TYPE` - run-time stats counter type
  • `configPRINTF` - application printf wrapper (commented)
    TLS / C Library:
  • `configUSE_PICOLIBC_TLS` - picolibc TLS integration
  • `configUSE_C_RUNTIME_TLS_SUPPORT` - generic C runtime TLS
    ARM / FPU:
  • `configUSE_TASK_FPU_SUPPORT` - per-task FPU context management
    Misc:
  • `configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H`
    INCLUDE_ API toggles:*
  • `INCLUDE_uxTaskGetStackHighWaterMark2`
  • `INCLUDE_xQueueGetMutexHolder`
  • `INCLUDE_xSemaphoreGetMutexHolder`
  • `INCLUDE_xTimerGetTimerDaemonTaskHandle`

Context

Follows feedback from FreeRTOS/FreeRTOS#1402 (now closed) where a maintainer directed that additions to the config template should go in this repository.
Refs FreeRTOS/FreeRTOS#65

Test Steps

  1. Copy the updated template to a demo project as `FreeRTOSConfig.h`.
  2. Build for a 32-bit target (e.g. Posix_GCC or Cortex-M) — no new compiler errors or warnings.
  3. Verify all newly added macros are set to safe defaults (0 or commented out)."

#define INCLUDE_xTaskResumeFromISR 1
#define INCLUDE_xQueueGetMutexHolder 0
#define INCLUDE_xSemaphoreGetMutexHolder 0
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this macro is used anywhere. Other instances of macros look okay to me

Add 16 documented configuration macros that were missing from the
template: configINITIAL_TICK_COUNT, configEXPECTED_IDLE_TIME_BEFORE_SLEEP,
tickless idle hooks, configRECORD_STACK_HIGH_ADDRESS,
configRUN_TIME_COUNTER_TYPE, configUSE_PICOLIBC_TLS,
configUSE_C_RUNTIME_TLS_SUPPORT, configUSE_TASK_FPU_SUPPORT, configPRINTF,
configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H, and four INCLUDE_* API toggles.

Refs FreeRTOS/FreeRTOS#65
@AniruddhaKanhere AniruddhaKanhere force-pushed the feature/issue-65-add-missing-config-macros branch from 371686f to 4b51b12 Compare April 23, 2026 23:44
@sonarqubecloud
Copy link
Copy Markdown

Comment on lines +109 to +112
/* configEXPECTED_IDLE_TIME_BEFORE_SLEEP sets the minimum number of idle ticks
* that must pass before the kernel will consider entering tickless idle mode.
* Must be >= 2. Defaults to 2 if left undefined. Only meaningful when
* configUSE_TICKLESS_IDLE is set to 1. */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears incorrect. This page explains that this macro is the minimum number of ticks which must occur with all application tasks blocked for the scheduler to consider entering tickless idle mode.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further explanation:

When the idle task runs, FreeRTOS calculates how long the system is expected to remain idle (via prvGetExpectedIdleTime()).

If the expected idle time is greater than or equal to configEXPECTED_IDLE_TIME_BEFORE_SLEEP, the kernel will attempt to suppress ticks and enter low-power sleep (the tickless idle path).

If the expected idle time is shorter than this threshold, it's not considered worthwhile to go through the overhead of entering and exiting sleep mode, so the system just stays awake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants