XDK110
BCDS
© Bosch Connected Devices and Solutions GmbH reserves all rights even in the event of industrial property rights. We reserve all rights of disposal such as
copying and passing on to third parties. BOSCH and the symbol are registered trademarks of Robert Bosch GmbH, Germany.
Note: Specifications within this document are subject to change without notice.
General Information Guide XDK110
!
Page
!
37
Default Startup
The
Main()
function implemented in the SystemStartUp module will be the first C function
executed during power ON and it does the following:
1. EFM32 chip is configured to a proper state with the help of the library function exported by
emlib.
2. All interrupt sources are configured to maximum priority to ensure that ISR runs at highest
priority.
3. System peripherals like
GPIO, I2C and USB
are initialized to a proper state.
4. GPIO pins are configured to its default value.
5. The user page module is initialized. It is used to save configuration information like Wi-Fi
MAC address, Bluetooth MAC address, etc., in the user page area of flash.
6. Creates a default application specific initialization CmdProcessor and start it.
7. Gives control to the operating system by starting the task scheduler of FreeRTOS.
Custom Startup
The custom startup procedure will exclude steps 3 to 5 of the default startup procedure described
above, to give users the flexibility to have their own way of initializing system peripherals. Users
can choose to initialize and configure the peripherals which they want to use in their application. If
the custom start-up procedure is configured, users have to ensure that the GPIO pins they are
using are initialized to a proper default state. In both of the above configurations XDK's
SystemStartUp module will schedule a default application-specific initialization function
"appInitSystem" which will run in the
CmdProcessor
context with task priority 2.
Note: Operation System Tag Priority
When creating the OS task inside the place holder "ap
pInitSystem"
" the priority of OS tasks created
should be less than or equal to 2, because assigning a priority greater than 2 may block all timer
tasks having lower priority.
So all user applications are expected to have the implementation of the task "appInitSystem", and
this will be the place holder for the application-specific initialization function. The application-
specific initialization function can further create either "timers" or "OS tasks" as suitable for its
purpose.
Task Creation and Their Priority
Users can find configuration related to FreeRTOS in a file called FreeRTOSConfig.h and it is
present in path "xdk110\Common\config". This contains information like maximum task priority,
stack size, heap size, software timer configurations, CPU clock and interrupt priority configurations.
As explained, users can create "Timer" or "OS Task" for their application use. Since the creation of
OS task requires the user to specify the task priority and stack size, we expect the user to
understand the task priorities of FreeRTOS, if, they prefer to create and use OS task for their
application (see FreeRTOS documentation). The maximum priority of a task in XDK software is
presently configured to 5, which is controlled by the configMAX_PRIORITIES macro. Considering
the fact that the interrupt routines should run in the highest task priority, XDK assigns maximum
priority to its interrupt sources. So, any task running in XDK should have the priority less than the
configMAX_PRIORITIES that is 5. For a user who does not want to get into the complexities of
handling independent OS tasks, we suggest to use timers to realize their use cases.