uC/OS-II Resources

This section refers to the following sample application(s):

  • 00-uc_resources

As detailed in Resources section, the uC/OS-II library shipped with the 

On-Chip Software Development Kit

 defines the number of resource available to your application. uC/OS-II will not allow your application to allocate more resources than are available. For example, the OSSemCreate(0) returns NULL when no more semaphores can be created because uC/OS-II ran out of Event Control Blocks (ECBs).

The 00-uc_resources Sample Application

The 00-uc_resources sample application allows you to "see" the number of free resources, both the number of ECBs, and the number of timers. This sample application creates a single task called resourceTask which prints the remaining number of ECBs as it does the following operations:

  • create a semaphore
  • delete a semaphore
  • open the SPI device
  • open the I2C device
  • open the 1-Wire device
  • join a network
  • create a notification channel for GPIO events
  • create a notification channel for UART events
Each of these operations causes the 

SmartMesh library

 to allocate/free some number of ECBs and timers. The 00-uc_resources CLI output allows you to follow the allocation of these resources.
After doing the operations listed above, the 00-uc_resources sample application periodically prints the remaining number of ECBs and timers. Note that these numbers are larger than the ones listed in the Resources section.
uc_resources app, ver 1.0.0.2
waiting for part of boot...
SmartMeshIP stack, ver 1.2.1.6
initially:          43 ECBs available
create semaphore:   42 ECBs available (-1)
delete semaphore:   43 ECBs available (1)
Open SPI:           42 ECBs available (-1)
Open I2C:           40 ECBs available (-2)
Open 1-Wire:        38 ECBs available (-2)
join network:       28 ECBs available (-10)
GPIO notif chan.:   25 ECBs available (-3)
UART notif chan.:   22 ECBs available (-3)
 11052 : Joining
 12176 : Connected
                    22 ECBs available (0)
                    12 timers available
 18333 : Active
                    22 ECBs available (0)
                    11 timers available
                    22 ECBs available (0)
                    11 timers available