xref: /docs/en/device-dev/faqs/faqs-kernel.md (revision e41f4b71)
1e41f4b71Sopenharmony_ci# Kernel
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Basic Kernel
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci### What are the differences between APIs provided by LiteOS-A and LiteOS-M?
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciBasic kernel APIs are different. LiteOS-A provides the standard Portable Operating System Interface (POSIX), and LiteOS-M provides standard POSIX and Common Microcontroller Software Interface Standard (CMSIS) interfaces. To support cross-platform functions, standard interfaces such as POSIX are recommended for third-party adaptation.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci### How do I analyze thread stack overflow?
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**Symptom**
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ciThe system is abnormal, and the message "CURRENT task *ThreadName* stack overflow!" is displayed.
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci**Solution**
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci1. When creating the thread, double the thread stack size. If the problem does not recur after multiple attempts, the task stack size is insufficient and needs to be increased.
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci2. If the problem persists after the thread stack size is increased, check whether an ultra-large array is defined in the thread or whether recursive invoking exists in the process.
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci3. If the preceding causes are excluded, check whether memory corruption occurs.
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci## File System
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci### What should I do when the Hi3516 board fails to open the same file in write mode (LiteOS-A)?
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ciWhen a file is already open, it is not allowed to open the file in write mode again, because the Hi3516 board uses the FAT file system.
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci### What hardware platforms are supported by the LiteOS kernel?
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ciLiteOS-A supports the Hi3516 and Hi3518 development boards. LiteOS-M supports the Hi3861 development board, STM32F103, STM32F429IGTb, and Nucleo_f767zi. For details, see the **README.md** file in the **kernel/liteos_m** directory.
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci### What chip architectures are supported by the LiteOS kernel?
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ciLiteOS-M supports RISC-V, Cortex-M3, Cortex-M4, Cortex-M7, Cortex-M33, and Arm 9, and will support c-sky and Xtensa. LiteOS-A supports ARMv7-A and will support ARMv8-A. Any new update will be released in the OpenHarmony community.
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci## Third-party Components
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci### Which third-party components are supported?
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ciOpen-source components (such as mbedTLS and lwIP) and third-party libraries have been provided and can be directly used. In addition, standard POSIX is provided for adaptation.
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci### What should I do if the key length verification fails when OpenSSL is used?
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ciCheck whether the architecture type (such as ARM and x86) and the number of system bits (32-bit and 64-bit) are correctly selected in OpenSSL compilation options.
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci### Does setsockopt support SO_RCVBUF and SO_SNDBUF?
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ciNo. **setsockopt** does not support **SO_RCVBUF** or **SO_SNDBUF**.
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci## Compilation and Linking
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci### How do I run an application developed by ARM Linux on LiteOS-A?
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ciThe application must be recompiled using the cross-compiler provided before it can run.
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci### What operating system is used for compilation? What compiler is used?
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ciLiteOS-A is compiled in the Linux environment by using the LLVM compiler. LiteOS-M can be compiled in the Linux or Windows environment by using compilers such as IAR, Keil, and GCC.
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci### For a third-party component that is independently compiled into a static library and used on LiteOS-M, what should I do when the component's global variable value is incorrect or the system is suspended after the component's function is called?
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ciCheck whether address-irrelevant compilation options, such as **-fPIE**, **-fpie**, **-fPIC**, and **-fpic**, exist in the third-party component compilation options. If yes, delete them and recompile the third-party component into a static library.
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci### What should I do if the message "use VFP register arguments, xxx.o does not" is displayed when LiteOS-A generates a target executable file?
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ciCheck whether the **-mfloat-abi=xxx**, **-mcpu=xxx**, and **-mfpu=xxx** compilation options are added during the compilation of **xxx.o**. If not, add them.
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci### What should I do when calling clock_gettime obtains an incorrect time?
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ciIn **struct timespec**, **tv_sec** is **time_t**, which is of the long long type, and the print control character is **%lld**. Check whether the print control character in use is correct.
89