Who specifies the layout of FreeRTOSDebugConfig?

Two demo projects, CORTEX_MPU_LPC54018_MCUXpresso and Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso, declare a FreeRTOSDebugConfig byte array, which can be used by debuggers to introspect the OS version and various offsets into the TCB struct. I’ve also found a few projects on github that include this array. This structure is used by at least NXP MCUXpresso and SEGGER’s FreeRTOS plugin to improve TCB introspection.

I’ve run into a couple of problems with this array on FreeRTOS-MPU ports:

  1. Many of these offsets are > 256 bytes, so they can’t be represented correctly by FreeRTOSDebugConfig’s one-byte fields.
  2. A few additional fields are needed to properly handle FreeRTOS-MPU’s separate system call stack behavior.

In my project, I’ve added fields to this array to contain a high byte for the truncated offsets and 16-bit values for some additional offsets, and built a custom SEGGER FreeRTOS plugin that knows how to interpret these new 16-bit offsets. I’d love to have the newly added fields incorporated into a 1.5 version of the layout, but I haven’t found any information on who is in charge of specifying or revving FreeRTOSDebugConfig. Who I should send this proposal to, anybody have any idea?

The layout is versioned with the preprocessor symbols FREERTOS_DEBUG_CONFIG_MAJOR_VERSION and FREERTOS_DEBUG_CONFIG_MINOR_VERSION, and I’ve found projects on github with layouts 1.1, 1.2, 1.3, and 1.4. The specification seems to be:

v1.1:

    FREERTOS_DEBUG_CONFIG_MAJOR_VERSION,
    FREERTOS_DEBUG_CONFIG_MINOR_VERSION,
    tskKERNEL_VERSION_MAJOR,
    tskKERNEL_VERSION_MINOR,
    tskKERNEL_VERSION_BUILD,
    FREERTOS_MEMORY_SCHEME,
    offsetof(struct tskTaskControlBlock, pxTopOfStack),
#if (tskKERNEL_VERSION_MAJOR > 8)
    offsetof(struct tskTaskControlBlock, xStateListItem),
#else
    offsetof(struct tskTaskControlBlock, xGenericListItem),
#endif
    offsetof(struct tskTaskControlBlock, xEventListItem),
    offsetof(struct tskTaskControlBlock, pxStack),
    offsetof(struct tskTaskControlBlock, pcTaskName),
    offsetof(struct tskTaskControlBlock, uxTCBNumber),
    offsetof(struct tskTaskControlBlock, uxTaskNumber),
    configMAX_TASK_NAME_LEN,
    configMAX_PRIORITIES,

v1.2 adds:

#if (tskKERNEL_VERSION_MAJOR >= 10) && (tskKERNEL_VERSION_MINOR >= 2)
    configENABLE_MPU,
    configENABLE_FPU,
    configENABLE_TRUSTZONE,
	  configRUN_FREERTOS_SECURE_ONLY,
#else
    0, 0, 0, 0,

and v1.3 removes the #if making these fields mandatory.

v1.4 adds:

    configNUMBER_OF_CORES,
#if (configNUMBER_OF_CORES > 1)
    (uint8_t)sizeof(struct tskTaskControlBlock),
    (uint8_t)offsetof(struct tskTaskControlBlock, xTaskRunState),
#else
    0, 0,

for v1.5, I would like to add:

    // high bytes of v1.4 offsets
#if (configNUMBER_OF_CORES > 1)
    [22] = (uint8_t)(TCB_SIZE >> 8),
    [23] = (uint8_t)(RUN_STATE_OFFSET >> 8),
#else
    [22] = 0,
    [23] = 0,
#endif
    [24] = (uint8_t)(STATE_LIST_ITEM_OFFSET >> 8),
    [25] = (uint8_t)(EVENT_LIST_ITEM_OFFSET >> 8),
    [26] = (uint8_t)(STACK_OFFSET >> 8),
    [27] = (uint8_t)(TASKNAME_OFFSET >> 8),
    [28] = (uint8_t)(TCB_NUMBER_OFFSET >> 8),
    [29] = (uint8_t)(TASK_NUMBER_OFFSET >> 8),
    // new v1.5 offsets
    [30] = (uint8_t)PRIO_OFFSET,
    [31] = (uint8_t)(PRIO_OFFSET >> 8),
    [32] = (uint8_t)SP_OFFSET,
    [33] = (uint8_t)(SP_OFFSET >> 8),
    [34] = (uint8_t)LR_OFFSET,
    [35] = (uint8_t)(LR_OFFSET >> 8),

The forum won’t let me include links in my posts since I’m a new user. I found examples of the various layout versions in freertos_tasks_c_additions.h files in the Github projects openweave/openweave-core (1.1), ErichStyger/mcuoneclipse (1.2), and cesanta/mongoose (1.4). Some official FreeRTOS demo projects have the 1.3 layout in them.

Assuming you are talking about this, it comes from NXP (that is why it is in the NXP_Code subdirectory). So you should reach out to NXP.

You should now be able to include links.

1 Like