From 56ec6edbe59c92588573b81af5ae92ec13c7f90d Mon Sep 17 00:00:00 2001 From: TXuian <1163589503@qq.com> Date: Thu, 16 May 2024 14:12:32 +0800 Subject: [PATCH] Add README.md --- Ubiquitous/XiZi_AIoT/README.md | 22 +++++++++++++++++- Ubiquitous/XiZi_AIoT/services/app/Makefile | 4 ++-- .../drivers/imx6q-sabrelite/clock/timer.c | 23 ++++++++++--------- .../drivers/imx6q-sabrelite/enet/enet_test.c | 1 - 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/Ubiquitous/XiZi_AIoT/README.md b/Ubiquitous/XiZi_AIoT/README.md index daf4cd253..caefb9738 100755 --- a/Ubiquitous/XiZi_AIoT/README.md +++ b/Ubiquitous/XiZi_AIoT/README.md @@ -1,2 +1,22 @@ -# XIZI_AIOT +### XiZi_AIoT Microkernel +XiZi_AIoT is a microkernel designed to facilitate task management, memory management, IPC, and various userland sample applications. + +### Building Instructions + +To build the XiZi_AIoT microkernel, navigate to the directory xiuos/Ubiquitous/XiZi_AIoT and run the command `make BOARD=$(BOARD)`. By default, running `make` is equivalent to `make BOARD=imx6q-sabrelite`. For building XiZi_AIoT specifically for the imx6q-sabrelite board, you'll need the gcc-arm-none-eabi toolchain. We recommend using version "arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q1-update) 6.3.1 20170215 (release)", as this version was used during development. If the build process is successful, the generated files can be found in the "build" directory. Use either XiZi-$(BOARD).elf or XiZi-$(BOARD).bin as the image to run on the board or QEMU. + +### Running on QEMU + +QEMU is a useful tool for emulating boards while testing or developing XiZi_AIoT. Use the following command: + +``` +qemu-system-arm -M sabrelite -m 1G -smp 4 -cpu cortex-a9 \ + -display none -serial null -serial stdio \ + -kernel xiuos/Ubiquitous/XiZi_AIoT/build/XiZi-imx6q-sabrelite.elf +``` +Replace "xiuos/Ubiquitous/XiZi_AIoT/build/XiZi-imx6q-sabrelite.elf" with the appropriate path in your directory. We recommend using version "QEMU emulator version 7.2.0" for successful emulation of the sabrelite board. + +### Makefile Usage + +XiZi_AIoT utilizes a Makefile to build all its files, including .c and .S files. The compiler.mk file enables the make tool to iterate through all sub-directories defined by *SRC_DIR* and compile files defined by *SRC_FILES* using parameters defined in config.mk. Each board independently defines its config.mk file in hardkernel/arch/.../config.mk. Additionally, path_kernel.mk defines all include paths needed by XiZi_AIoT, and link.mk manages the linking process after all .c and .S files are compiled. \ No newline at end of file diff --git a/Ubiquitous/XiZi_AIoT/services/app/Makefile b/Ubiquitous/XiZi_AIoT/services/app/Makefile index f564e4008..0fdf53553 100644 --- a/Ubiquitous/XiZi_AIoT/services/app/Makefile +++ b/Ubiquitous/XiZi_AIoT/services/app/Makefile @@ -26,7 +26,7 @@ INC_DIR = -I$(KERNEL_ROOT)/services/shell/letter-shell \ -I$(KERNEL_ROOT)/services/app ifeq ($(BOARD), imx6q-sabrelite) -all: init test_fs simple_client simple_server shell fs_server test_irq_hdlr test_irq_block test_irq_send eth_driver timer_server readme.txt | bin +all: init test_fs simple_client simple_server shell fs_server test_irq_hdlr test_irq_block test_irq_send eth_driver epit_server readme.txt | bin else all: init test_fs simple_client simple_server shell fs_server test_irq_hdlr readme.txt | bin endif @@ -47,7 +47,7 @@ eth_driver: enet_drv.o enet_test.o board_network.o enet_iomux_config.o imx6dq_gp @${ld} ${user_ldflags} -e main -o $@ $^ ${board_specs} @${objdump} -S $@ > $@.asm -timer_server: timer.o epit.o ccm_pll.o usyscall.o arch_usyscall.o libserial.o printf.o libipc.o session.o +epit_server: timer.o epit.o ccm_pll.o usyscall.o arch_usyscall.o libserial.o printf.o libipc.o session.o @${ld} ${user_ldflags} -e main -o $@ $^ ${board_specs} @${objdump} -S $@ > $@.asm endif diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/clock/timer.c b/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/clock/timer.c index 1f77c76c5..03ded2d27 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/clock/timer.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/clock/timer.c @@ -109,20 +109,21 @@ void system_time_init(void) int IPC_DO_SERVE_FUNC(Ipc_delay_us)(uint32_t* usecs) { - // uint32_t instance = g_system_timer_port; - // if (*usecs == 0) { - // return 0; - // } + uint32_t instance = g_system_timer_port; + if (*usecs == 0) { + return 0; + } - // /* enable the counter first */ - // epit_counter_enable(instance, *usecs, POLLING_MODE); + /* enable the counter first */ + epit_counter_enable(instance, *usecs, POLLING_MODE); - // /* wait for the compare event */ - // while (!epit_get_compare_event(instance)) - // ; + /* wait for the compare event */ + while (!epit_get_compare_event(instance)) { + yield(SYS_TASK_YIELD_NO_REASON); + } - // /* disable the counter to save power */ - // epit_counter_disable(instance); + /* disable the counter to save power */ + epit_counter_disable(instance); return 0; } diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/enet/enet_test.c b/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/enet/enet_test.c index c76d22ebe..2a1947e30 100755 --- a/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/enet/enet_test.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/imx6q-sabrelite/enet/enet_test.c @@ -145,7 +145,6 @@ void print_hw_enet(const hw_enet_t* enet) */ int enet_test() { - imx_enet_priv_t* dev0 = &enet0; int pkt_len_send = 0, pkt_len_recv = 0, ret = 0, i; unsigned int enet_events = 0;