Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1345, Support adding default flags at task creation #1347

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions default_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,14 @@ set(OSAL_CONFIG_MAX_CMD_LEN 1000
set(OSAL_CONFIG_QUEUE_MAX_DEPTH 50
CACHE STRING "Maximum depth of message queue"
)

# Flags added to all tasks on creation
#
# Some OS's use floating point under the hood, this supports
# adding the floating point flag on creation of all tasks instead of
# just when OS_FP_ENABLED flag is passed in to OS_TaskCreate
#
# Set to 0 to not add any
set(OSAL_CONFIG_ADD_TASK_FLAGS 0
CACHE STRING "Flags added to all tasks"
)
9 changes: 9 additions & 0 deletions osconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,15 @@
*/
#define OS_PRINTF_CONSOLE_NAME "@OSAL_CONFIG_PRINTF_CONSOLE_NAME@"

/**
* \brief Flags added to all tasks on creation
*
* Added to the task flags on creation
*
* Supports adding floating point support for all tasks when the OS requires it
*/
#define OS_ADD_TASK_FLAGS @OSAL_CONFIG_ADD_TASK_FLAGS@

/*
* OSAL fixed resource limits
*
Expand Down
3 changes: 3 additions & 0 deletions src/os/shared/src/osapi-task.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry f
task->entry_function_pointer = function_pointer;
task->stack_pointer = stack_pointer;

/* Add default flags */
flags |= OS_ADD_TASK_FLAGS;

/* Now call the OS-specific implementation. This reads info from the task table. */
return_code = OS_TaskCreate_Impl(&token, flags);

Expand Down