# LiteOS Cortex-A ## Overview ### Porting Scenario LiteOS Cortex-A supports the ARMv7-a instruction set architecture. If you are porting the kernel to a chipset that uses ARMv7-a, you can directly perform basic adaptation. Otherwise, you need to add support for the architecture used by the chipset. This process is complex and not covered in this document. ### Directory Specifications For details about the LiteOS Cortex-A directory specifications, see [LiteOS Cortex-A Overview](https://gitee.com/openharmony/kernel_liteos_a). ## Adaptation Process LiteOS Cortex-A provides the system initialization process and custom configuration options required for system running. During porting, pay attention to the functions related to hardware configuration in the initialization process. The LiteOS Cortex-A initialization process consists of seven steps: 1. Add the **target\_config.h** file and compile the macros **DDR\_MEM\_ADDR** and **DDR\_MEM\_SIZE**, which indicate the start address and length of the board memory, respectively. The prelinker script **board.ld.S** creates the linker script **board.ld** based on the two macros. 2. Define **g\_archMmuInitMapping**, the global array of MMU mappings, to specify the memory segment attributes and the virtual-to-physical address mappings. The memory mapping will be established based on this array during kernel startup. 3. If there are multiple cores, define **struct SmpOps**, the handle to the slave core operation function. The **SmpOps-\>SmpCpuOn** function needs to implement the feature of waking up a slave core. Then, define the **SmpRegFunc** function and call the **LOS\_SmpOpsSet** interface to register the handle. The registration process is completed by starting the framework using **LOS\_MODULE\_INIT\(SmpRegFunc, LOS\_INIT\_LEVEL\_EARLIEST\)**. 4. Create a kernel image based on the linker script **board.ld**. 5. Perform operations such as initialization of the interrupt vector table and MMU page table are performed in the assembly files: **reset\_vector\_up.S** and **reset\_vector\_mp.S**, from which a single-core CPU and a multi-core CPU start, respectively. 6. Enable the assembly code in **reset\_vector.S** to jump to the **main** function of the C programming language to initialize the hardware clock, software timer, memory, and tasks. This process depends on the feature macro configuration in **target\_config.h**. Then, create the **SystemInit** task to be implemented in the board code, with **OsSchedStart\(\)** enabled for task scheduling. 7. Call the **DeviceManagerStart** function to initialize the HDF driver. This process is implemented by calling the driver configuration file **hdf.hcs** and drivers source code in the board code. The figure below shows the overall initialization process. **Figure 1** Overall initialization process ![](figures/overall-initialization-process.png "overall-initialization-process") As can be seen from preceding figure, kernel basic adaptation involves the following parts: - Adding the **target\_config.h** file, which contains board hardware parameters and feature parameters described in the following table: **Table 1** Parameters in the target\_config.h file