TrampolineRTOS / trampoline

Trampoline is a static RTOS for small embedded systems. Its API is aligned with OSEK/VDX OS and AUTOSAR OS 4.2 standards.
GNU General Public License v2.0
615 stars 268 forks source link

Resource API always needed but not always included #27

Closed KamelHacene closed 8 years ago

KamelHacene commented 8 years ago

File os/tpl_os_kernel.c, lines 1215 & 1254 :

if ((TPL_KERN_REF(kern).running->resources) != NULL){
    tpl_release_all_resources((tpl_proc_id)TPL_KERN_REF(kern).running_id);
}

File goil/templates/tpl_app_config_c.goilTemplate :

tpl_resource_table[RESOURCE_COUNT] = {%
 foreach resource in REGULARRESOURCES
   before %
   %
   do
     %&% !resource::NAME %_rez_desc%
   between
     %,
   %
   after %,%
 end foreach
 %
   &res_sched_rez_desc
 };

The resource API is needed for the calls of tpl_release_all_resources function and for the use of res_sched_rez_desc resource, however in file goil/templates/api.goilTemplate :

if [RESOURCES length] > 0 | OS::USERESSCHEDULER then
   let APIUSED += APIMAP["resource"]
 end if

The Api resource is included only if we have some resources or if we're using the RES_SCHEDULER (set to TRUE by default).

Should we always use a part of the Resource API or can we just ignore the the function calls and the resource with if statments using WITH_USERESSCHEDULER and RESOURCE_COUNT definitions for tpl_os_kernel.c and [RESOURCES length] and OS::USERESSCHEDULER for tpl_app_config_c.goilTemplate ?