kopia lustrzana https://github.com/OpenRTX/OpenRTX
Narrowed down RAM usage
rodzic
e3285fee10
commit
8b877ed6d0
|
@ -29,8 +29,9 @@ int main(int argc, char *argv[]);
|
|||
/*
|
||||
* OS startup task, will call main() when all initialisations are done.
|
||||
*/
|
||||
static OS_TCB startTCB;
|
||||
static CPU_STK_SIZE startStk[APP_CFG_TASK_START_STK_SIZE];
|
||||
#define START_TSK_STKSIZE 512/4
|
||||
static OS_TCB startTCB;
|
||||
static CPU_STK startStk[START_TSK_STKSIZE];
|
||||
static void startTask(void *arg);
|
||||
|
||||
void systemBootstrap()
|
||||
|
@ -39,19 +40,19 @@ void systemBootstrap()
|
|||
|
||||
OSInit(&err);
|
||||
|
||||
OSTaskCreate((OS_TCB *)&startTCB,
|
||||
(CPU_CHAR *)" ",
|
||||
OSTaskCreate((OS_TCB *) &startTCB,
|
||||
(CPU_CHAR *) " ",
|
||||
(OS_TASK_PTR ) startTask,
|
||||
(void *) 0,
|
||||
(OS_PRIO ) APP_CFG_TASK_START_PRIO,
|
||||
(CPU_STK *)&startStk[0],
|
||||
(CPU_STK )startStk[APP_CFG_TASK_START_STK_SIZE / 10u],
|
||||
(CPU_STK_SIZE) APP_CFG_TASK_START_STK_SIZE,
|
||||
(CPU_STK *) &startStk[0],
|
||||
(CPU_STK ) startStk[START_TSK_STKSIZE / 10u],
|
||||
(CPU_STK_SIZE) START_TSK_STKSIZE,
|
||||
(OS_MSG_QTY ) 0,
|
||||
(OS_TICK ) 0,
|
||||
(void *) 0,
|
||||
(OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
||||
(OS_ERR *)&err);
|
||||
(OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
||||
(OS_ERR *) &err);
|
||||
|
||||
OSStart(&err);
|
||||
|
||||
|
|
|
@ -32,21 +32,35 @@
|
|||
/* Mutex for concurrent access to state variable */
|
||||
static OS_MUTEX state_mutex;
|
||||
|
||||
|
||||
/**************************** IMPORTANT NOTE **********************************
|
||||
* *
|
||||
* Rationale for "xx_TASK_STKSIZE/4": uC/OS-III manages task stack in terms *
|
||||
* of CPU_STK elements which, on a 32-bit target, are something like uint32_t,*
|
||||
* that is, one CPU_STK elements takes four bytes. *
|
||||
* *
|
||||
* Now, the majority of the world manages stack in terms of *bytes* and this *
|
||||
* leads to an excessive RAM usage if not properly managed. For example, if *
|
||||
* we have, say, xx_TASK_SIZE = 128 with these odd CPU_STK elements we end *
|
||||
* up eating 128*4 = 512 bytes. *
|
||||
* The simple workaround for this is dividing the stack size by four. *
|
||||
******************************************************************************/
|
||||
|
||||
/* UI task control block and stack */
|
||||
static OS_TCB ui_tcb;
|
||||
static CPU_STK ui_stk[UI_TASK_STKSIZE];
|
||||
static CPU_STK ui_stk[UI_TASK_STKSIZE/4];
|
||||
|
||||
/* State task control block and stack */
|
||||
static OS_TCB state_tcb;
|
||||
static CPU_STK state_stk[STATE_TASK_STKSIZE];
|
||||
static CPU_STK state_stk[STATE_TASK_STKSIZE/4];
|
||||
|
||||
/* Baseband task control block and stack */
|
||||
static OS_TCB rtx_tcb;
|
||||
static CPU_STK rtx_stk[RTX_TASK_STKSIZE];
|
||||
static CPU_STK rtx_stk[RTX_TASK_STKSIZE/4];
|
||||
|
||||
/* DMR task control block and stack */
|
||||
static OS_TCB dmr_tcb;
|
||||
static CPU_STK dmr_stk[DMR_TASK_STKSIZE];
|
||||
static CPU_STK dmr_stk[DMR_TASK_STKSIZE/4];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -193,7 +207,7 @@ void create_threads()
|
|||
(OS_PRIO ) 10,
|
||||
(CPU_STK *) &ui_stk[0],
|
||||
(CPU_STK ) 0,
|
||||
(CPU_STK_SIZE) UI_TASK_STKSIZE,
|
||||
(CPU_STK_SIZE) UI_TASK_STKSIZE/4,
|
||||
(OS_MSG_QTY ) 0,
|
||||
(OS_TICK ) 0,
|
||||
(void *) 0,
|
||||
|
@ -208,7 +222,7 @@ void create_threads()
|
|||
(OS_PRIO ) 30,
|
||||
(CPU_STK *) &state_stk[0],
|
||||
(CPU_STK ) 0,
|
||||
(CPU_STK_SIZE) STATE_TASK_STKSIZE,
|
||||
(CPU_STK_SIZE) STATE_TASK_STKSIZE/4,
|
||||
(OS_MSG_QTY ) 0,
|
||||
(OS_TICK ) 0,
|
||||
(void *) 0,
|
||||
|
@ -223,7 +237,7 @@ void create_threads()
|
|||
(OS_PRIO ) 5,
|
||||
(CPU_STK *) &rtx_stk[0],
|
||||
(CPU_STK ) 0,
|
||||
(CPU_STK_SIZE) RTX_TASK_STKSIZE,
|
||||
(CPU_STK_SIZE) RTX_TASK_STKSIZE/4,
|
||||
(OS_MSG_QTY ) 0,
|
||||
(OS_TICK ) 0,
|
||||
(void *) 0,
|
||||
|
@ -238,7 +252,7 @@ void create_threads()
|
|||
(OS_PRIO ) 3,
|
||||
(CPU_STK *) &dmr_stk[0],
|
||||
(CPU_STK ) 0,
|
||||
(CPU_STK_SIZE) DMR_TASK_STKSIZE,
|
||||
(CPU_STK_SIZE) DMR_TASK_STKSIZE/4,
|
||||
(OS_MSG_QTY ) 0,
|
||||
(OS_TICK ) 0,
|
||||
(void *) 0,
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
#define OS_CFG_H
|
||||
|
||||
/* --------------------------- MISCELLANEOUS --------------------------- */
|
||||
#define OS_CFG_APP_HOOKS_EN 1u /* Enable (1) or Disable (0) application specific hooks */
|
||||
#define OS_CFG_APP_HOOKS_EN 0u /* Enable (1) or Disable (0) application specific hooks */
|
||||
#define OS_CFG_ARG_CHK_EN 1u /* Enable (1) or Disable (0) argument checking */
|
||||
#define OS_CFG_CALLED_FROM_ISR_CHK_EN 1u /* Enable (1) or Disable (0) check for called from ISR */
|
||||
#define OS_CFG_DBG_EN 1u /* Enable (1) or Disable (0) debug code/variables */
|
||||
#define OS_CFG_DBG_EN 0u /* Enable (1) or Disable (0) debug code/variables */
|
||||
#define OS_CFG_TICK_EN 1u /* Enable (1) or Disable (0) the kernel tick */
|
||||
#define OS_CFG_DYN_TICK_EN 0u /* Enable (1) or Disable (0) the Dynamic Tick */
|
||||
#define OS_CFG_INVALID_OS_CALLS_CHK_EN 1u /* Enable (1) or Disable (0) checks for invalid kernel calls */
|
||||
|
@ -54,7 +54,7 @@
|
|||
|
||||
|
||||
/* ------------------------ MEMORY MANAGEMENT ------------------------- */
|
||||
#define OS_CFG_MEM_EN 1u /* Enable (1) or Disable (0) code generation for the MEMORY MANAGER */
|
||||
#define OS_CFG_MEM_EN 0u /* Enable (1) or Disable (0) code generation for the MEMORY MANAGER */
|
||||
|
||||
|
||||
/* ------------------- MUTUAL EXCLUSION SEMAPHORES -------------------- */
|
||||
|
@ -78,13 +78,13 @@
|
|||
|
||||
|
||||
/* -------------------------- TASK MANAGEMENT -------------------------- */
|
||||
#define OS_CFG_STAT_TASK_EN 1u /* Enable (1) or Disable (0) the statistics task */
|
||||
#define OS_CFG_STAT_TASK_STK_CHK_EN 1u /* Check task stacks from the statistic task */
|
||||
#define OS_CFG_STAT_TASK_EN 0u /* Enable (1) or Disable (0) the statistics task */
|
||||
#define OS_CFG_STAT_TASK_STK_CHK_EN 0u /* Check task stacks from the statistic task */
|
||||
|
||||
#define OS_CFG_TASK_CHANGE_PRIO_EN 1u /* Include code for OSTaskChangePrio() */
|
||||
#define OS_CFG_TASK_DEL_EN 1u /* Include code for OSTaskDel() */
|
||||
#define OS_CFG_TASK_CHANGE_PRIO_EN 0u /* Include code for OSTaskChangePrio() */
|
||||
#define OS_CFG_TASK_DEL_EN 0u /* Include code for OSTaskDel() */
|
||||
#define OS_CFG_TASK_IDLE_EN 1u /* Include the idle task */
|
||||
#define OS_CFG_TASK_PROFILE_EN 1u /* Include variables in OS_TCB for profiling */
|
||||
#define OS_CFG_TASK_PROFILE_EN 0u /* Include variables in OS_TCB for profiling */
|
||||
#define OS_CFG_TASK_Q_EN 1u /* Include code for OSTaskQXXXX() */
|
||||
#define OS_CFG_TASK_Q_PEND_ABORT_EN 1u /* Include code for OSTaskQPendAbort() */
|
||||
#define OS_CFG_TASK_REG_TBL_SIZE 1u /* Number of task specific registers */
|
||||
|
@ -106,8 +106,8 @@
|
|||
|
||||
|
||||
/* ------------------------- TIMER MANAGEMENT -------------------------- */
|
||||
#define OS_CFG_TMR_EN 1u /* Enable (1) or Disable (0) code generation for TIMERS */
|
||||
#define OS_CFG_TMR_DEL_EN 1u /* Enable (1) or Disable (0) code generation for OSTmrDel() */
|
||||
#define OS_CFG_TMR_EN 0u /* Enable (1) or Disable (0) code generation for TIMERS */
|
||||
#define OS_CFG_TMR_DEL_EN 0u /* Enable (1) or Disable (0) code generation for OSTmrDel() */
|
||||
|
||||
|
||||
/* ------------------------- TRACE RECORDER ---------------------------- */
|
||||
|
|
Ładowanie…
Reference in New Issue