Mistake on this page?
Report an issue in GitHub or email us
mbed_boot.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2018-2018 ARM Limited
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef MBED_BOOT_H
18 #define MBED_BOOT_H
19 
20 #include "mbed_toolchain.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "mbed_rtx.h"
27 
28 /**
29  * \defgroup boot Boot sequence
30  * Boot sequence overview
31  *
32  * 1. Setup target
33  * - Configure clocks
34  * - Configure watchdog (if applicable)
35  * - Turn on RAM (if applicable)
36  * - Jump to setup toolchain
37  * 2. Setup toolchain
38  * - Initialize RAM
39  * - Initialize standard library
40  * - Call mbed_init
41  * - jump to start rtos
42  * 3. Start RTOS
43  * - Create main thread
44  * - Start scheduler
45  * - main thread calls start mbed
46  * 4. Start mbed
47  * - Call mbed_main
48  * - Call main
49  *
50  * @{
51  */
52 
53 /* Heap limits - only used if set */
54 extern unsigned char *mbed_heap_start;
55 extern uint32_t mbed_heap_size;
56 
57 /* Stack limits */
58 extern unsigned char *mbed_stack_isr_start;
59 extern uint32_t mbed_stack_isr_size;
60 
61 /**
62  * Perform low level init of mbed
63  *
64  * The toolchain calls this function as part of the boot
65  * sequence. This function does the following:
66  * - Sets up NVIC so interrupts can be used
67  * - Calls into the vendor SDK so it can be used
68  * - Initializes the RTOS so it can be used
69  *
70  * Preconditions:
71  * - Target is initialized
72  * - Ram is initialized
73  * - value set for mbed_heap_start
74  * - value set for mbed_heap_size
75  * - value set for mbed_stack_isr_start
76  * - value set for mbed_stack_isr_size
77  *
78  * The following events must not have happened yet:
79  * - global constructors must not be called yet
80  *
81  */
82 void mbed_init(void);
83 
84 /**
85  * Start the main mbed application
86  *
87  * This is the last stage of the boot sequence. This function must be
88  * called only after the RTOS has been fully initialized.
89  * This function does the following:
90  * - Initialize the toolchain
91  * - Run mbed_main
92  * - Run main
93  *
94  * Preconditions:
95  * - The RTOS has been started by a call to mbed_rtos_start
96  *
97  */
98 void mbed_start(void);
99 
100 /**
101  * Perform low level initialization of the RTOS
102  *
103  * Set the RTOS to a known state but don't start the scheduler. After
104  * the RTOS has been initialized it is safe to create RTOS primitives
105  * for file locks or other purposes.
106  *
107  * Preconditions:
108  * - Ram is initialized
109  * - NVIC is setup
110  * - Vendor SDK must be initialized by a call to mbed_sdk_init
111  */
112 void mbed_rtos_init(void);
113 
114 /**
115  * Start the RTOS
116  *
117  * Start the RTOS scheduler and call mbed_start on the
118  * main thread. This function does not return.
119  *
120  * Preconditions:
121  * - RTOS has been initialized by a call to mbed_rtos_init
122  */
123 MBED_NORETURN void mbed_rtos_start(void);
124 
125 /**
126  * Perform toolchain specific initialization
127  *
128  * Initialize locks if this has not been done already
129  * and call global C++ constructors.
130  *
131  * Preconditions:
132  * - The RTOS has been started by a call to mbed_rtos_start
133  */
134 void mbed_toolchain_init(void);
135 
136 /**
137  * SDK hook for running code before ctors or OS
138  *
139  * This is a weak function which can be overridden by a target's
140  * SDK to allow code to run after ram is initialized but before
141  * the OS has been started or constructors have run.
142  *
143  * Preconditions:
144  * - Ram is initialized
145  * - NVIC is setup
146  */
147 void mbed_sdk_init(void);
148 
149 /**
150  * Application hook for running code before main
151  *
152  * This is a weak function which can be overridden by an application
153  * to allow code to run before main is called.
154  *
155  * Preconditions:
156  * - The RTOS has been started by a call to mbed_rtos_start
157  * - The toolchain has been initialized by a call to mbed_toolchain_init
158  */
159 void mbed_main(void);
160 
161 /**@}*/
162 
163 #ifdef __cplusplus
164 }
165 #endif
166 
167 #endif /* MBED_BOOT_H */
MBED_NORETURN void mbed_rtos_start(void)
Start the RTOS.
void mbed_start(void)
Start the main mbed application.
void mbed_toolchain_init(void)
Perform toolchain specific initialization.
void mbed_rtos_init(void)
Perform low level initialization of the RTOS.
void mbed_init(void)
Perform low level init of mbed.
void mbed_main(void)
Application hook for running code before main.
#define MBED_NORETURN
MBED_NORETURN Declare a function that will never return.
void mbed_sdk_init(void)
SDK hook for running code before ctors or OS.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.