rtos: uCOS-III: split struct ucos_iii_params
commit17f86fdedf03626eed545dcd69c6387a825e0b5d
authorAntonio Borneo <borneo.antonio@gmail.com>
Sun, 7 May 2023 13:50:26 +0000 (7 15:50 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Thu, 18 May 2023 10:17:18 +0000 (18 10:17 +0000)
tree4b35e26e425ab48e92215116bb901bc4c2f10d6a
parentaaa67f733df5ef29bfdc83e808434a23d6edb580
rtos: uCOS-III: split struct ucos_iii_params

The static analyser 'sparse' complains about using sizeof() on a
struct that has variable size:
src/rtos/uCOS-III.c:267:32: warning: using sizeof on a flexible structure
src/rtos/uCOS-III.c:269:41: warning: using sizeof on a flexible structure
src/rtos/uCOS-III.c:275:66: warning: using sizeof on a flexible structure
The struct ucos_iii_params contains either constants values for
different target type and variable fields. The last field is an
variable size array, always allocated to UCOS_III_MAX_THREADS
items. It's not practical to fix this size because we would get
too huge initialization in data segment.

Split away from struct ucos_iii_params all the variable fields and
put them in struct ucos_iii_private. Add in the new struct a
pointer to the selected element of ucos_iii_params_list[] and fix
the size of array threads[] to its maximum value; this would be
allocated at run-time, avoiding impacts to data segment.

Change-Id: I569011a257783d35a8795adbda06e942b4157f2a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7678
Tested-by: jenkins
src/rtos/uCOS-III.c