Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / lock-app / cc13x2x7_26x2x7 / main / main.cpp
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2020 Texas Instruments Incorporated
5  *
6  *    Licensed under the Apache License, Version 2.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://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,
14  *    WITHOUT 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 <stdbool.h>
20 #include <stdint.h>
21
22 #include <platform/CHIPDeviceLayer.h>
23
24 #include <AppConfig.h>
25 #include <AppTask.h>
26
27 #include <FreeRTOS.h>
28
29 /* Driver Header files */
30 #include <ti/drivers/Board.h>
31 #include <ti/drivers/GPIO.h>
32 #include <ti/drivers/NVS.h>
33 #include <ti/drivers/UART.h>
34
35 #include <ti/drivers/AESECB.h>
36 #include <ti/drivers/ECJPAKE.h>
37 #include <ti/drivers/SHA2.h>
38
39 #include <bget.h>
40 #define TOTAL_ICALL_HEAP_SIZE (0xf000)
41
42 using namespace ::chip;
43 using namespace ::chip::Inet;
44 using namespace ::chip::DeviceLayer;
45
46 __attribute__((section(".heap"))) uint8_t GlobalHeapZoneBuffer[TOTAL_ICALL_HEAP_SIZE];
47 uint32_t heapSize = TOTAL_ICALL_HEAP_SIZE;
48
49 // ================================================================================
50 // FreeRTOS Callbacks
51 // ================================================================================
52 extern "C" void vApplicationStackOverflowHook(void)
53 {
54     while (1)
55     {
56         ;
57     }
58 }
59
60 // ================================================================================
61 // Main Code
62 // ================================================================================
63 int main(void)
64 {
65     int ret = CHIP_ERROR_MAX;
66
67     Board_init();
68     bpool((void *) GlobalHeapZoneBuffer, TOTAL_ICALL_HEAP_SIZE);
69
70     GPIO_init();
71
72     NVS_init();
73
74     UART_init();
75
76     ECJPAKE_init();
77
78     AESECB_init();
79
80     SHA2_init();
81
82     ret = GetAppTask().StartAppTask();
83     if (ret != CHIP_NO_ERROR)
84     {
85         // can't log until the kernel is started
86         // PLAT_LOG("GetAppTask().StartAppTask() failed");
87         while (1)
88             ;
89     }
90
91     vTaskStartScheduler();
92
93     // Should never get here.
94     while (1)
95         ;
96 }