]> begriffs open source - cmsis-freertos/blob - CMSIS/RTOS2/FreeRTOS/Examples/App/Hello/hello.c
Correct memory allocation and access in osMemoryPoolNew (#142)
[cmsis-freertos] / CMSIS / RTOS2 / FreeRTOS / Examples / App / Hello / hello.c
1 /*---------------------------------------------------------------------------
2  * Copyright (c) 2024 Arm Limited (or its affiliates). All rights reserved.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Licensed under the Apache License, Version 2.0 (the License); you may
7  * not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *---------------------------------------------------------------------------*/
18
19 #include <stdio.h>
20 #include "main.h"
21 #include "cmsis_os2.h"
22
23 /*---------------------------------------------------------------------------
24  * Application main thread
25  *---------------------------------------------------------------------------*/
26 static void app_main (void *argument) {
27   (void)argument;
28
29   for(int count = 0; count < 10; count++) {
30     printf("Hello World %d\r\n", count);
31     osDelay(1000U);
32   }
33   osDelay(osWaitForever);
34 }
35
36 /*---------------------------------------------------------------------------
37  * Application initialization
38  *---------------------------------------------------------------------------*/
39 void app_initialize (void) {
40   osThreadNew(app_main, NULL, NULL);
41 }