From f1755006a429ca916ca6e29b99032ee61ea09602 Mon Sep 17 00:00:00 2001 From: bj <925836951@qq.com> Date: Thu, 26 Aug 2021 19:40:08 +0800 Subject: [PATCH] Add QEMU support for XiUOS based on Cortex-M4 --- Ubiquitous/XiUOS/Makefile | 2 +- Ubiquitous/XiUOS/arch/arm/Makefile | 4 +++ Ubiquitous/XiUOS/arch/arm/cortex-m4/boot.S | 3 ++- .../XiUOS/board/aiit-arm32-board/Kconfig | 2 +- .../Adapter/bluetooth/xs_adapter_bluetooth.c | 6 ++++- .../XiUOS/kernel/kernel_test/test_ch438.c | 5 ++++ Ubiquitous/XiUOS/path_kernel.mk | 26 +++++++++++++++++++ 7 files changed, 44 insertions(+), 4 deletions(-) diff --git a/Ubiquitous/XiUOS/Makefile b/Ubiquitous/XiUOS/Makefile index 2616f2a92..3435e20d6 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 cortex-m4-emulator ok1052-c SRC_DIR:= export BOARD ?=kd233 diff --git a/Ubiquitous/XiUOS/arch/arm/Makefile b/Ubiquitous/XiUOS/arch/arm/Makefile index 7697b0f46..2575f9444 100644 --- a/Ubiquitous/XiUOS/arch/arm/Makefile +++ b/Ubiquitous/XiUOS/arch/arm/Makefile @@ -5,6 +5,10 @@ ifeq ($(CONFIG_BOARD_CORTEX_M3_EVB),y) SRC_DIR +=cortex-m3 endif +ifeq ($(CONFIG_BOARD_CORTEX_M4_EVB),y) +SRC_DIR +=cortex-m4 +endif + ifeq ($(CONFIG_BOARD_STM32F407_EVB),y) SRC_DIR +=cortex-m4 endif diff --git a/Ubiquitous/XiUOS/arch/arm/cortex-m4/boot.S b/Ubiquitous/XiUOS/arch/arm/cortex-m4/boot.S index fe52785d7..9809c32a7 100644 --- a/Ubiquitous/XiUOS/arch/arm/cortex-m4/boot.S +++ b/Ubiquitous/XiUOS/arch/arm/cortex-m4/boot.S @@ -105,6 +105,7 @@ BSSInit: BSSInitEnd: bl SystemInit - bl stm32f407_start +# bl stm32f407_start + bl entry bx lr .size Reset_Handler, .-Reset_Handler \ No newline at end of file diff --git a/Ubiquitous/XiUOS/board/aiit-arm32-board/Kconfig b/Ubiquitous/XiUOS/board/aiit-arm32-board/Kconfig index 5ded0a288..6ede177c6 100644 --- a/Ubiquitous/XiUOS/board/aiit-arm32-board/Kconfig +++ b/Ubiquitous/XiUOS/board/aiit-arm32-board/Kconfig @@ -10,7 +10,7 @@ config KERNEL_DIR option env="KERNEL_ROOT" default "../.." -config BOARD_STM32F407_EVB +config BOARD_CORTEX_M4_EVB bool select ARCH_ARM default y diff --git a/Ubiquitous/XiUOS/framework/connection/Adapter/bluetooth/xs_adapter_bluetooth.c b/Ubiquitous/XiUOS/framework/connection/Adapter/bluetooth/xs_adapter_bluetooth.c index b652c1921..44332e8e4 100644 --- a/Ubiquitous/XiUOS/framework/connection/Adapter/bluetooth/xs_adapter_bluetooth.c +++ b/Ubiquitous/XiUOS/framework/connection/Adapter/bluetooth/xs_adapter_bluetooth.c @@ -29,8 +29,12 @@ #define SAMPLE_UART_NAME "/dev/uart3_dev3" #endif #ifdef BOARD_STM32F407_EVB -#define SAMPLE_UART_NAME "/dev/usart3_dev3" +#define SAMPLE_UART_NAME "/dev/usart3_dev3" #endif +#ifdef BOARD_CORTEX_M4_EVB +#define SAMPLE_UART_NAME "/dev/usart3_dev3" +#endif + static int serial_fd; static int32_t bluetooth_receive; diff --git a/Ubiquitous/XiUOS/kernel/kernel_test/test_ch438.c b/Ubiquitous/XiUOS/kernel/kernel_test/test_ch438.c index 6fe6f4aee..19ace73a2 100644 --- a/Ubiquitous/XiUOS/kernel/kernel_test/test_ch438.c +++ b/Ubiquitous/XiUOS/kernel/kernel_test/test_ch438.c @@ -27,8 +27,11 @@ #define EXT_UART_NO 2 #elif defined BOARD_STM32F407_EVB #define EXT_UART_NO 4 +#elif defined BOARD_CORTEX_M4_EVB +#define EXT_UART_NO 4 #endif + #define DATA_BUFF_SIZE 255 static struct Bus *bus; @@ -94,6 +97,8 @@ static void TestCh438Init(void) dev = BusFindDevice(bus, CH438_DEVICE_NAME_2); #elif defined BOARD_STM32F407_EVB dev = BusFindDevice(bus, CH438_DEVICE_NAME_4); +#elif defined BOARD_CORTEX_M4_EVB + dev = BusFindDevice(bus, CH438_DEVICE_NAME_4); #endif struct SerialCfgParam serial_cfg; diff --git a/Ubiquitous/XiUOS/path_kernel.mk b/Ubiquitous/XiUOS/path_kernel.mk index 60e208d3e..ce14432c2 100644 --- a/Ubiquitous/XiUOS/path_kernel.mk +++ b/Ubiquitous/XiUOS/path_kernel.mk @@ -132,6 +132,32 @@ KERNELPATHS :=-I$(BSP_ROOT) \ -I$(BSP_ROOT)/include # endif + + +ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/cortex-m4-emulator) +KERNELPATHS :=-I$(BSP_ROOT) \ + -I$(KERNEL_ROOT)/arch/arm/cortex-m4 \ + -I$(BSP_ROOT)/third_party_driver \ + -I$(BSP_ROOT)/third_party_driver/sdio \ + -I$(BSP_ROOT)/include \ + -I$(BSP_ROOT)/third_party_driver/include \ + -I$(BSP_ROOT)/third_party_driver/uart \ + -I$(BSP_ROOT)/third_party_driver/usb/STM32_USB_OTG_Driver/inc \ + -I$(BSP_ROOT)/third_party_driver/ethernet \ + -I$(KERNEL_ROOT)/include \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/compat \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/netif \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/apps \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/priv \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/include/lwip/prot \ + -I$(KERNEL_ROOT)/resources/ethernet/LwIP/arch \ + -I$(BSP_ROOT)/include # +endif + + ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/ok1052-c) KERNELPATHS :=-I$(BSP_ROOT) \ -I$(KERNEL_ROOT)/arch/arm/cortex-m7 \