Common Troubleshooting#

Authentication#

Unable to create a user.#

  • Check that the maximum number of users defined in Auth_Init() by Auth_InitCfg.ResourceCfg.NbUserMax has not been reached.

  • Check that the user name and password fit in Auth_InitCfg. ResourceCfg.NameLenMax and Auth_InitCfg. ResourceCfg.PwdLenMax.

  • Check that the user name being submitted is unique: that there is no matching duplicate user name in the system.

Unable to get a user handle.#

  • Check if a user with that name has already been created.

Unable to get user right.#

  • Check that a valid AUTH_USER_HANDLE is passed. This can be obtained by using either Auth_GetUser() or Auth_ValidateCredentials().

Unable to grant or revoke user right.#

  • Check that the valid AUTH_USER_HANDLE is passed. This can be obtained by using either Auth_GetUser() or Auth_ValidateCredentials().

  • Check that the user described by the as_user_handle has the right(s) that need to be granted or revoked.

LIB#

LIB Memory Allocation#

A segment is not in the debug list when calling Mem_OutputUsage().#

  • If the segment has been created at compile-time using MEM_SEG_INIT(), make sure a corresponding Mem_SegReg() has been made.

A call to Mem_SegClr() does not clear the memory segment's data.#

  • Mem_SegClr() does not erase any data. It merely marks the memory segment as empty so that all of its data can be re-used by future calls. To erase data please use Mem_Clr().

Memory segment should have enough space to allocate data but returns RTOS_ERR_SEG_OVF .#

  • Make sure the right segment is referenced and that LIB's heap is not used by default.

  • See if the specified alignment is correct; it might cause blocks to need more data than expected.

  • If a padding alignment was specified, and some 'hardware' calls are made on it (Mem_SegAllocHW() or Mem_DynPoolCreateHW()), make sure to account for that padding.

  • Regularly call Mem_SegRemSizeGet() to see at which point the space used starts to be incorrect.

  • Call Mem_OutputUsage() to output information about every allocation of every memory segment, and diagnose which allocation creates a problem.

How can the memory usage be optimized?#

LIB String#

String function not working as expected.#

  • Check if the string needs to be NULL-terminated and if it really is.

RTOS_ERR#

The string obtained from an error using RTOS_ERR_STR_GET() or RTOS_ERR_DESC_STR_GET() is always "Error string unavailable."#

  • Check that the error strings are enabled. If not, set RTOS_ERR_CFG_STR_EN to DEF_ENABLED and re-build your application.

RTOS_ERR_CODE_GET() causes error when building a project.#

  • Check that the argument passed to RTOS_ERR_CODE_GET() is an error variable, and not an error code. For example, the argument should be my_err and not RTOS_ERR_NULL_PTR.

Unable to access a field within a RTOS_ERR variable.#

  • Macros are the recommended way of accessing the internal fields of a RTOS_ERR variable when they are available for a given field. Check if it is possible to use them instead of accessing the internal field directly.

  • If accessing a field other than the Code field, check that RTOS_ERR_CFG_EXT_EN is set to DEF_ENABLED.

  • Check if the corresponding configuration constant is correctly set:

    • RTOS_ERR_CFG_STR_EN must be set to DEF_ENABLED so that the CodeText and DescText are present in the RTOS_ERR structure.

    • For the FnctName field to be available, the application must be compiled in C99 or later.

Utilities#

Asserts should be enabled/disabled and are not for a particular source file.#

  • Make sure RTOS_MODULE_CUR is #define'd before including the <rtos/common/include/rtos_utils.h> to indicate which module the source file belongs to.

Shell#

Unable to add a command to the Shell module.#

  • Check the error returned by the Shell_CmdTblAdd() function:

    • If RTOS_ERR_NO_MORE_RSRC is returned, there is no more space left to add another command in the Shell module. That limit will need to be increased by calling Shell_ConfigureCmdUsage() before Shell_Init().

    • If RTOS_ERR_INVALID_ARG is returned, there is a problem with the command table name. See the Shell command add example (called ex_common_shell_cmd_add.c under examples/common/shell/) for a working example.

    • If RTOS_ERR_ALREADY_EXISTS is returned, either the module name or the command name are already part of the Shell module commands list.

A command has been added but fails to be executed.#

  • Check the error returned by the Shell_Exec() function:

    • If RTOS_ERR_SHELL_CMD_EXEC, the command was executed but indicated an error during execution. See that command's documentation.

    • If RTOS_ERR_NOT_FOUND is returned, check the error code returned by the call to Shell_CmdTblAdd() which was made to add the failing command and make sure it is RTOS_ERR_NONE, the command may not have been correctly added to Shell.

    • If RTOS_ERR_NO_MORE_RSRC is returned, make sure the command is well formed and that the number of argument is not higher to the maximum number of arguments passed to Shell_ConfigureCmdUsage(). If needed, this number could be increased, although memory usage will also increase.