• Home
Name Date Size #Lines LOC

..--

liteos_m/12-May-2024-1,8711,070

BUILD.gnD12-May-20241.6 KiB3129

README.mdD12-May-20243.7 KiB14293

README_zh.mdD12-May-20243.3 KiB14090

ohos.buildD12-May-2024183 1110

README.md

1### Qemu Arm Cortex-m55 mps3-an547 HOWTO
2
3#### 1. Brief introduction
4`arm_mps3_an547/` subdirectory contains part of the OpenHarmony LiteOS demonstration support for Qemu Arm Cortex-m55 mps3-an547 Platform, here called *arm_mps3_an547*.
5cortex-m55 Virtual platform is a `qemu-system-arm` machine target that provides emulation
6for a generic, arm-based board.
7
8Introduced functionality adds support for Cortex-m55 (1 CPU with security extensions), 16MB memory virtual platform.
9
10Note: System memory size is hard-coded to 16MB.
11
12#### 2. Setting up environment
13
14[Setting up a development environment](https://gitee.com/openharmony/docs/blob/HEAD/en/device-dev/quick-start/quickstart-lite-env-setup.md)
15
16Compiler install
17
181.Command to install
19
20Note: Command to install toolchain without arm-none-eabi-gdb, gdb cannot be debugged.
21
22```
23sudo apt install gcc-arm-none-eabi
24```
25
262.The installation package to install
27
28Note: The MVE feature of cortex-m55 processor can only be supported by installing the cross tool chain launched after 2020. If you have already passed the command to install gcc-arm-none-eabi, can through the command: `sudo apt remove
29gcc-arm-none-eabi` after unloading, install again.
30
31Download toolchain: [package](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2)32
33```
34chmod 777 gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
35tar -xvf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 install_path
36```
37
38Add the installation path to the environment variable:
39
40```
41vim ~/.bashrc
42```
43
44Add the following command line to the last line of ~/.bashrc:
45
46```
47export PATH=$PATH:install_path/gcc-arm-none-eabi-10.3-2021.10/bin
48```
49
50#### 3. Code acquisition
51
52[Code acquisition](https://gitee.com/openharmony/docs/blob/HEAD/en/device-dev/get-code/sourcecode-acquire.md)
53
54Note: One can use `repo` to fetch code in a straightforward manner.
55
56#### 4. Building from sources
57
58In the root directory of the obtained source code, run the following command:
59
60```
61hb set
62```
63
64Select `qemu_cm55_mini_system_demo` under **ohemu**.
65
66Run the following build command:
67```
68hb build -f
69```
70
71This will build `OHOS_Image` for Qemu Cortex-m55 mps3-an547 machine.
72
73
74After build is finished, the resulting image can be found in:
75```
76out/arm_mps3_an547/qemu_cm55_mini_system_demo/
77```
78#### 5. Running image in Qemu
79
80Note: The MVE feature of cortex-m55 processor can only be supported by installing QEMU version 6.2.0.
81
82a) If not installed, please install `qemu-system-arm`
83For details, please refer to the HOWTO: [Qemu installation](https://gitee.com/openharmony/device_qemu/blob/HEAD/README.md)
84
85b) Run
86
87Run the `./qemu-run --help` command. The following information is displayed:
88
89```
90Usage: qemu-run [OPTION]...
91Run a OHOS image in qemu according to the options.
92
93    Options:
94
95    -e, --exec file_name     kernel exec file name
96    -g, --gdb                enable gdb for kernel
97    -t, --test               test mode, exclusive with -g
98    -h, --help               print help info
99
100    By default, the kernel exec file is: out/arm_mps3_an547/qemu_cm55_mini_system_demo/OHOS_Image.
101```
102
103#### 6. gdb debug
104
105```
106cd device/qemu/arm_mps3_an547
107vim liteos_m/config.gni
108```
109
110In the modified `board_opt_flags` compiler options:
111
112```
113board_opt_flags = []
114```
115to:
116
117```
118board_opt_flags = [ "-g" ]
119```
120
121Save and exit, recompile under OHOS root directory:
122
123```
124hb build -f
125```
126
127In a window to enter the command:
128
129```
130./qemu-run -g
131```
132
133In another window to enter the command:
134
135```
136arm-none-eabi-gdb out/arm_mps3_an547/qemu_cm55_mini_system_demo/OHOS_Image
137(gdb) target remote localhost:1234
138(gdb) b main
139```
140
141More GDB related debugging can refer to [GDB instruction manual](https://sourceware.org/gdb/current/onlinedocs/gdb).
142

README_zh.md

1# Qemu Arm Cortex-m55 mps3-an547 教程
2
3## 1. 简介
4`arm_mps3_an547/` 子目录包含部分Qemu arm cortex-m55虚拟化平台验证的OpenHarmony kernel\_liteos\_m的代码,目录名为*arm_mps3_an547*。
5Arm Cortex-m55 虚拟化平台是一个 `qemu-system-arm` 的目标设备,通过它来模拟一个通用的、基于arm cortex-m55架构的单板。
6
7这次模拟的配置是:arm cortex-m55架构,1个CPU,16M内存。
8
9提示: 系统内存硬编码为16MB。
10
11## 2. 环境搭建
12
13[环境搭建](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md)
14
15编译器安装
16
171.命令安装
18
19提示:命令安装的工具链无 arm-none-eabi-gdb,无法进行gdb调试
20
21```
22sudo apt install gcc-arm-none-eabi
23```
24
252.安装包安装
26
27提示:安装2020年后推出的交叉工具链才能支持cortex-m55处理器的MVE特性。如果已经通过命令安装了gcc-arm-none-eabi, 可以通过命令:`sudo apt remove gcc-arm-none-eabi` 卸载之后,再进行安装。
28
29下载工具链[安装包](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2)30
31```
32chmod 777 gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
33tar -xvf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 install_path
34```
35
36将安装路径添加到环境变量中:
37
38```
39vim ~/.bashrc
40```
41
42在~/.bashrc最末尾加入:
43
44```
45export PATH=$PATH:install_path/gcc-arm-none-eabi-10.3-2021.10/bin
46```
47
48## 3. 获取源码
49
50[代码获取](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/device-dev/get-code/sourcecode-acquire.md)
51
52提示: 可以使用 `repo` 命令来获取源码。
53
54## 4. 源码构建
55
56在已经获取的源码根目录,请输入:
57
58```
59hb set
60```
61
62选择ohemu下的`qemu_cm55_mini_system_demo`选项。
63
64
65然后执行构建命令如下:
66```
67hb build -f
68```
69
70这个命令构建会产生 `OHOS_Image` 的镜像文件。
71
72在构建完成之后,对应的镜像文件在如下目录:
73```
74out/arm_mps3_an547/qemu_cm55_mini_system_demo/
75```
76## 5. 在Qemu中运行镜像
77
78提示:安装6.2.0版本的qemu才能支持cortex-m55处理器的MVE特性。
79
80a) 如果没有安装 `qemu-system-arm` ,安装请参考链接:[Qemu安装指导](https://gitee.com/openharmony/device_qemu/blob/HEAD/README_zh.md)
81
82b) 运行
83
84执行`./qemu-run --help`提示如下:
85
86```
87Usage: qemu-run [OPTION]...
88Run a OHOS image in qemu according to the options.
89
90    Options:
91
92    -e, --exec file_name     kernel exec file name
93    -g, --gdb                enable gdb for kernel
94    -t, --test               test mode, exclusive with -g
95    -h, --help               print help info
96
97    By default, the kernel exec file is: out/arm_mps3_an547/qemu_cm55_mini_system_demo/OHOS_Image.
98```
99
100## 6. gdb调试
101
102```
103cd device/qemu/arm_mps3_an547
104vim liteos_m/config.gni
105```
106
107将 `board_opt_flags` 中的
108
109```
110board_opt_flags = []
111```
112
113编译选项修改为:
114
115```
116board_opt_flags = [ "-g" ]
117```
118
119保存并退出,在OHOS根目录重新编译:
120
121```
122hb build -f
123```
124
125在一个窗口中输入命令:
126
127```
128./qemu-run -g
129```
130
131在另一个窗口中输入命令:
132
133```
134arm-none-eabi-gdb out/arm_mps3_an547/qemu_cm55_mini_system_demo/OHOS_Image
135(gdb) target remote localhost:1234
136(gdb) b main
137```
138
139更多gdb相关的调试可以查阅:[gdb指导手册](https://sourceware.org/gdb/current/onlinedocs/gdb)140