From 3e0541ae3e4b5d8fa1f6299ba8262434488b922e Mon Sep 17 00:00:00 2001 From: Gujinyu Date: Mon, 30 Aug 2021 21:10:44 +0800 Subject: [PATCH] add the option of building cortex-m0 in Makefile and add the build instructions in README --- Ubiquitous/XiUOS/Makefile | 2 +- .../XiUOS/board/cortex-m0-emulator/README.md | 16 ++++++++-------- Ubiquitous/XiUOS/path_kernel.mk | 11 +++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Ubiquitous/XiUOS/Makefile b/Ubiquitous/XiUOS/Makefile index 2616f2a92..323f235db 100644 --- a/Ubiquitous/XiUOS/Makefile +++ b/Ubiquitous/XiUOS/Makefile @@ -5,7 +5,7 @@ MAKEFLAGS += --no-print-directory .PHONY:COMPILE_APP COMPILE_KERNEL -support :=kd233 stm32f407-st-discovery maix-go stm32f407zgt6 aiit-riscv64-board aiit-arm32-board hifive1-rev-B hifive1-emulator k210-emulator cortex-m3-emulator ok1052-c +support :=kd233 stm32f407-st-discovery maix-go stm32f407zgt6 aiit-riscv64-board aiit-arm32-board hifive1-rev-B hifive1-emulator k210-emulator cortex-m3-emulator ok1052-c cortex-m0-emulator SRC_DIR:= export BOARD ?=kd233 diff --git a/Ubiquitous/XiUOS/board/cortex-m0-emulator/README.md b/Ubiquitous/XiUOS/board/cortex-m0-emulator/README.md index 25d61cc64..b8e80002f 100644 --- a/Ubiquitous/XiUOS/board/cortex-m0-emulator/README.md +++ b/Ubiquitous/XiUOS/board/cortex-m0-emulator/README.md @@ -6,11 +6,11 @@ ## 1. 简介 -Q‎EMU 是一个通用的开源模拟器和虚拟化工具。目前Q‎EMU已经可以较完整的支持ARM cortex-m3架构。XiUOS同样支持运行在Q‎EMU上 +Q‎EMU 是一个通用的开源模拟器和虚拟化工具。目前Q‎EMU已经可以较完整的支持ARM cortex-m0架构。XiUOS同样支持运行在Q‎EMU上 | 硬件 | 描述 | | -- | -- | -|芯片型号| lm3s6965evb | +|芯片型号| microbit nRF51 | |架构| cortex-m0 | |主频| 50MHz | |片内SRAM| 64KB | @@ -128,7 +128,7 @@ $ sudo apt install gcc-arm-none-eabi 1.在VScode命令终端中执行以下命令,生成配置文件 ```c - make BOARD=cortex-m3-emulator menuconfig + make BOARD=cortex-m0-emulator menuconfig ``` 2.在menuconfig界面配置需要关闭和开启的功能,按回车键进入下级菜单,按Y键选中需要开启的功能,按N键选中需要关闭的功能,配置结束后保存并退出(本例旨在演示简单的输出例程,所以没有需要配置的选项,双击快捷键ESC退出配置) @@ -142,7 +142,7 @@ $ sudo apt install gcc-arm-none-eabi 3.继续执行以下命令,进行编译 ``` -make BOARD=cortex-m3-emulator +make BOARD=cortex-m0-emulator ``` 4.如果编译正确无误,会产生XiUOS_cortex-m0-emulator.elf、XiUOS_cortex-m0-emulator.bin文件。 @@ -160,7 +160,7 @@ sudo apt install qemu-system-arm 通过以下命令启动Q‎EMU并加载XiUOS ELF文件 ``` -qemu-system-arm -machine lm3s6965evb -nographic -kernel build/XiUOS_cortex-m3-emulator.elf +qemu-system-arm -machine microbit -nographic -kernel build/XiUOS_cortex-m0-emulator.elf ``` QEMU运行起来后将会在终端上看到信息打印输出 @@ -177,11 +177,11 @@ sudo apt install gdb-multiarch 并通过以下命令启动Q‎EMU ``` -qemu-system-arm -machine lm3s6965evb -nographic -kernel build/XiUOS_cortex-m3-emulator.elf -s -S +qemu-system-arm -machine microbit -nographic -kernel build/XiUOS_cortex-m0-emulator.elf -s -S ``` -然后要重新开启另一个linux系统终端一个终端,执行`riscv-none-embed-gdb`命令 +然后要重新开启另一个linux系统终端一个终端,执行命令 ``` -gdb-multiarch build/XiUOS_cortex-m3-emulator.elf -ex "target remote localhost:1234" +gdb-multiarch build/XiUOS_cortex-m0-emulator.elf -ex "target remote localhost:1234" ``` diff --git a/Ubiquitous/XiUOS/path_kernel.mk b/Ubiquitous/XiUOS/path_kernel.mk index 60e208d3e..d0dd25482 100644 --- a/Ubiquitous/XiUOS/path_kernel.mk +++ b/Ubiquitous/XiUOS/path_kernel.mk @@ -121,6 +121,17 @@ KERNELPATHS :=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/include # endif +ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/cortex-m0-emulator) +KERNELPATHS :=-I$(BSP_ROOT) \ + -I$(KERNEL_ROOT)/arch/arm/cortex-m0 \ + -I$(BSP_ROOT)/third_party_driver \ + -I$(BSP_ROOT)/third_party_driver/Libraries/driverlib \ + -I$(BSP_ROOT)/third_party_driver/Libraries/ \ + -I$(BSP_ROOT)/third_party_driver/Libraries/inc \ + -I$(KERNEL_ROOT)/include \ + -I$(BSP_ROOT)/include # +endif + ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/cortex-m3-emulator) KERNELPATHS :=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/arch/arm/cortex-m3 \