harmony(鸿蒙)Basic Kernel Adaptation
Basic Kernel Adaptation
The LiteOS Cortex-M kernel provides the system initialization process and customized configuration options required for system running. During kernel porting, you must pay attention to the functions related to hardware configuration in the initialization process and understand the kernel configuration options so that the minimum kernel that matches the board can be tailored.
Adaptation Process
Basic adaptation consists of the following steps:
- Modify the code in the startup.S and corresponding link configuration files.
- Initialize the serial port and register the handler function for the tick interrupt response in the main.c file
In the startup.S file, you must ensure that the entry function (for example, reset_vector) of the interrupt vector table is stored in the RAM start address specified by the link configuration files. The link configuration files of IAR, Keil, and GCC projects are xxx.icf, xxx.sct, and xxx.ld, respectively. The startup file provided by the vendor does not need to be modified if the startup.S file has initialized the system clock and returned to the main function. Otherwise, the preceding functions need to be implemented.
In the main.c file, you need to register the UartInit function used for initializing the serial port and the handler function used for the system tick.
- The UartInit function initializes the board serial port, and the function name can be defined based on the board. This function is optional. You can determine whether to call it based on whether the board supports the serial port. If the board supports the serial port, this function must enable TX and RX channels of the serial port and set the baud rate.
- You can call HalTickStart to set the OsTickHandler function for the tick interrupt response.
For the chip whose interrupt vector table cannot be redirected, you need to disable the LOSCFG_PLATFORM_HWI macro, and add the OsTickHandler function for the tick interrupt response in the startup.S file.
Feature Configuration
The los_config.h file defines both complete configuration and default configuration of liteos_m. All configuration items in this file can be customized for different boards as required.
You can define configuration items in the device/xxxx/target_config.h file of the corresponding board. For other undefined configuration items, default values in the los_config.h file will be used.
The following table shows some typical configuration items:
Table 1 Typical configuration items
你可能感兴趣的鸿蒙文章
harmony(鸿蒙)Combo Solution – ASR Chip Porting Case
harmony(鸿蒙)Mini-System Devices with Screens — Bestechnic SoC Porting Case
harmony(鸿蒙)Third-party Module Adaptation
harmony(鸿蒙)Board-Level Driver Adaptation
harmony(鸿蒙)Implementation of APIs at the HAL
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦