更换语言:
   Contact us
  • Follow CooCox
  •         
  • CooCox Market
  •         
  • Tech Support
  •     
Home  ›  CoOS › Memory Management

Static Memory Allocation

     Static memory allocation applies to the condition that you know how much memory you need to occupy while compiling, and the static memory can’t be released or redistributed while system running. Compared with the dynamic memory allocation, static memory allocation does not need to consume CPU resources. At the same time, it would not lead to allocate unsuccessfully (because allocating unsuccessfully will directly result in the failure of the compiler). Therefore it is faster and more secure.

     In CooCox CoOS, the memory that each module’s control block needs is allocated statically, such as the task control block(TCB)、event control block(ECB) 、flag control block(FCB)、flag node(FLAG_NODE)and so on.

Code 1 CooCox CoOS's space allocation of the TCB
  • config.h
        #define CFG_MAX_USER_TASKS  (8)       // Determine the largest number of                                                                    // user's task in the system
    task.h
        #define SYS_TASK_NUM               (1)     // Determine the number of system tasks
         task.c                                                  
                                                                     // Allocate TCB space statically
    OSTCB    TCBTbl[CFG_MAX_USER_TASKS+SYS_TASK_NUM];

CooCox CoOS

© 2009 -2011 CooCox - Terms of Use         Business Model         Market             About us             Terms and Conditions