From 64c784bb46f41bdd18a7251bb1b0df0e19e25e42 Mon Sep 17 00:00:00 2001 From: zhushengle Date: Thu, 10 Dec 2020 17:48:32 +0800 Subject: [PATCH] move riscv32 qemu form liteos_m to /device/qemu --- kernel/arch/risc-v/los_exc.c | 2 +- targets/riscv_sifive_fe310_gcc/Liteos.ld | 62 ------ targets/riscv_sifive_fe310_gcc/Makefile | 132 ----------- targets/riscv_sifive_fe310_gcc/board.ld.S | 40 ---- .../riscv_sifive_fe310_gcc/compiler_dir.sh | 42 ---- .../riscv_sifive_fe310_gcc/driver/mtimer.c | 92 -------- .../riscv_sifive_fe310_gcc/driver/mtimer.h | 51 ----- targets/riscv_sifive_fe310_gcc/driver/plic.c | 126 ----------- targets/riscv_sifive_fe310_gcc/driver/plic.h | 53 ----- targets/riscv_sifive_fe310_gcc/driver/uart.c | 93 -------- targets/riscv_sifive_fe310_gcc/driver/uart.h | 51 ----- .../riscv_sifive_fe310_gcc/include/asm/soc.h | 66 ------ .../include/riscv_hal.h | 68 ------ targets/riscv_sifive_fe310_gcc/libc/dprintf.c | 175 --------------- targets/riscv_sifive_fe310_gcc/los_start.S | 79 ------- targets/riscv_sifive_fe310_gcc/main.c | 121 ----------- .../riscv_sifive_fe310_gcc/qemu_sifive_run.sh | 39 ---- targets/riscv_sifive_fe310_gcc/riscv_hal.c | 119 ---------- .../riscv_sifive_fe310_gcc/target_config.h | 205 ------------------ 19 files changed, 1 insertion(+), 1615 deletions(-) delete mode 100755 targets/riscv_sifive_fe310_gcc/Liteos.ld delete mode 100755 targets/riscv_sifive_fe310_gcc/Makefile delete mode 100755 targets/riscv_sifive_fe310_gcc/board.ld.S delete mode 100755 targets/riscv_sifive_fe310_gcc/compiler_dir.sh delete mode 100755 targets/riscv_sifive_fe310_gcc/driver/mtimer.c delete mode 100755 targets/riscv_sifive_fe310_gcc/driver/mtimer.h delete mode 100755 targets/riscv_sifive_fe310_gcc/driver/plic.c delete mode 100755 targets/riscv_sifive_fe310_gcc/driver/plic.h delete mode 100755 targets/riscv_sifive_fe310_gcc/driver/uart.c delete mode 100755 targets/riscv_sifive_fe310_gcc/driver/uart.h delete mode 100755 targets/riscv_sifive_fe310_gcc/include/asm/soc.h delete mode 100755 targets/riscv_sifive_fe310_gcc/include/riscv_hal.h delete mode 100755 targets/riscv_sifive_fe310_gcc/libc/dprintf.c delete mode 100755 targets/riscv_sifive_fe310_gcc/los_start.S delete mode 100755 targets/riscv_sifive_fe310_gcc/main.c delete mode 100755 targets/riscv_sifive_fe310_gcc/qemu_sifive_run.sh delete mode 100755 targets/riscv_sifive_fe310_gcc/riscv_hal.c delete mode 100755 targets/riscv_sifive_fe310_gcc/target_config.h diff --git a/kernel/arch/risc-v/los_exc.c b/kernel/arch/risc-v/los_exc.c index 23a7ec18..e0749c43 100755 --- a/kernel/arch/risc-v/los_exc.c +++ b/kernel/arch/risc-v/los_exc.c @@ -120,7 +120,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsHwiInit(VOID) } typedef VOID (*HwiProcFunc)(UINTPTR); -LITE_OS_SEC_TEXT_INIT VOID OsHwiInterruptDone(HWI_HANDLE_T hwiNum) +__attribute__((section(".interrupt.text"))) VOID OsHwiInterruptDone(HWI_HANDLE_T hwiNum) { g_intCount++; diff --git a/targets/riscv_sifive_fe310_gcc/Liteos.ld b/targets/riscv_sifive_fe310_gcc/Liteos.ld deleted file mode 100755 index f7e88326..00000000 --- a/targets/riscv_sifive_fe310_gcc/Liteos.ld +++ /dev/null @@ -1,62 +0,0 @@ -OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv", "elf32-littleriscv") -OUTPUT_ARCH("riscv") -ENTRY(_start) -INCLUDE board.ld.S -MEMORY -{ - ram(rwx) : ORIGIN = RAM_ADDR_START, LENGTH = RAM_ADDR_SIZE - flash(rwx) : ORIGIN = FLASH_LOAD_START, LENGTH = FLASH_LOAD_SIZE -} -SECTIONS -{ - .text : ALIGN(0x20) - { - __text_start = .; - . = ALIGN(0x10); - *(.start.text) - *(.interrupt.text) - *(.text.*) - . = ALIGN(0x20); - __rodata_start = .; - . = ALIGN(0x10); - *(.rodata.* .srodata.*) - . = ALIGN(0x20); - __text_end = .; - } > ram AT > flash - .data : ALIGN(0x20) - { - __global_pointer$ = . + 0x800; - __data_load_start = LOADADDR(.data); - __data_start = .; - . = ALIGN(0x10); - *(.data.* .sdata.*) - . = ALIGN(0x20); - __data_end = .; - } > ram AT > flash - __data_load_size = SIZEOF(.data); - .bss (NOLOAD): ALIGN(0x20) - { - __bss_start = .; - . = ALIGN(0x10); - *(.kernel.bss*) - *(.bss.* .sbss.*) - . = ALIGN(0x20); - __bss_end = .; - } > ram - .stack (NOLOAD): ALIGN(0x40) - { - __stack_bootom = .; - . += EXCEPT_STACK_SIZE; - __except_stack_top = .; - . += START_AND_IRQ_STACK_SIZE; - __start_and_irq_stack_top = .; - } > ram -/* - .heap (NOLOAD): ALIGN(0x40) - { - __heap_start = .; - . += HEAP_SIZE; - __heap_end = .; - } > ram -*/ -} diff --git a/targets/riscv_sifive_fe310_gcc/Makefile b/targets/riscv_sifive_fe310_gcc/Makefile deleted file mode 100755 index 5f334156..00000000 --- a/targets/riscv_sifive_fe310_gcc/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -LITEOSTOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) -export OS=$(shell uname -s) -LITEOSTOPDIR := ../../ -LITEOSTOPDIR := $(realpath $(LITEOSTOPDIR)) -export LITEOSTOPDIR - -# Selective compiler -COMPILE_NAME := riscv32-unknown-elf -#COMPILE_NAME = riscv-none-embed -ifeq ($(COMPILE_NAME), riscv-none-embed) -CROSS_COMPILE = riscv-none-embed- -VERSION_NUM = 8.1.0 -else -CROSS_COMPILE := riscv32-unknown-elf- -VERSION_NUM = 7.3.0 -endif - -# Select instruction set -MARCH := rv32imac -MABI := ilp32 - -LITEOS_PLATFORM := riscv_sifive_fe310_gcc - - - -# System default -CFLAGS := -I $(LITEOSTOPDIR)/utils \ - -I $(LITEOSTOPDIR)/kernel/include \ - -I $(LITEOSTOPDIR)/kernel/arch/risc-v \ - -I $(LITEOSTOPDIR)/kernel/arch/risc-v/asm \ - -I $(LITEOSTOPDIR)/components/cpup \ - -I $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/include \ - -I $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/include/asm \ - -I $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/driver \ - -I $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM) - -LOCAL_CSRCS := $(wildcard $(LITEOSTOPDIR)/kernel/src/*.c) \ - $(wildcard $(LITEOSTOPDIR)/kernel/src/mm/*.c) \ - $(wildcard $(LITEOSTOPDIR)/kernel/arch/risc-v/*.c) \ - $(wildcard $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/*.c) \ - $(wildcard $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/driver/*.c) \ - $(wildcard $(LITEOSTOPDIR)/components/cpup/*.c) \ - $(wildcard $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/libc/*.c) - -LOCAL_ASMSRCS := $(wildcard $(LITEOSTOPDIR)/kernel/arch/risc-v/*.S) \ - $(wildcard $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/los_start.S) \ - $(wildcard $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/libc/*.S) - -LOCAL_CSRCS += $(wildcard $(LITEOSTOPDIR)/components/bounds_checking_function/src/*.c) -CFLAGS += -I $(LITEOSTOPDIR)/components/bounds_checking_function/include - -CC = $(CROSS_COMPILE)gcc -AS = $(CROSS_COMPILE)as -AR = $(CROSS_COMPILE)ar -LD = $(CROSS_COMPILE)ld -GPP = $(CROSS_COMPILE)g++ -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump -SIZE = $(CROSS_COMPILE)size -NM = $(CROSS_COMPILE)nm -ARFLAGS = cr -OBJ_MKDIR = if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi - -HIDE = @ -RM = rm -rf -MAKE = make -OUT := out -OBJOUT := $(OUT)/obj -LIBA = $(OUT)/libs/libkernel.a -LITEOS_LIBS_DIR := -L$(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/$(OUT)/libs -LITEOS_GCCLIB := libgcc.a -LITEOS_TARGET = liteos -LITEOS_LIBDEP := -lkernel -lgcc -lc - -LITEOS_SSP = -fno-stack-protector -LITEOS_COPTS_BASE := -march=$(MARCH) -mabi=$(MABI) -static -fno-common -O2 $(LITEOS_SSP) -LITEOS_COPTS_EXTRA := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -Wall -Wno-format-truncation -LITEOS_ASOPTS := -march=$(MARCH) -mabi=$(MABI) -static -O2 -LITEOS_LD_OPTS := --build-id=none -static -nostartfiles --gc-sections - -LITEOS_COMPILER_PATH := $(realpath $(shell $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/compiler_dir.sh $(CC))) -LITEOS_COMPILER_CXX_PATH = $(LITEOS_COMPILER_PATH)/$(COMPILE_NAME)/include -LITEOS_COMPILER_CXXLIB_PATH = $(LITEOS_COMPILER_PATH)/$(COMPILE_NAME)/lib/$(LITEOS_GCCLIB) -ifeq ($(COMPILE_NAME), riscv-none-embed) -LITEOS_COMPILER_GCCLIB_PATH = -L$(LITEOS_COMPILER_PATH)/lib/gcc/$(COMPILE_NAME)/$(VERSION_NUM)/$(MARCH)/$(MABI)/ \ - -L$(LITEOS_COMPILER_PATH)/$(COMPILE_NAME)/lib/$(MARCH)/$(MABI)/ -LITEOS_LD_OPTS += -mcmodel=medany -melf32lriscv -else -LITEOS_COMPILER_GCCLIB_PATH = -L$(LITEOS_COMPILER_PATH)/lib/gcc/$(COMPILE_NAME)/$(VERSION_NUM)/ \ - -L$(LITEOS_COMPILER_PATH)/$(COMPILE_NAME)/lib/ -endif -LITEOS_COMPILER_GCC_INCLUDE = -I $(LITEOS_COMPILER_PATH)/lib/gcc/$(COMPILE_NAME)/$(VERSION_NUM)/include \ - -I $(LITEOS_COMPILER_PATH)/$(COMPILE_NAME)/include - -LITEOS_LD_SCRIPT := $(LITEOSTOPDIR)/targets/$(LITEOS_PLATFORM)/Liteos.ld -LITEOS_LDFLAGS := $(LITEOS_LD_OPTS) -T$(LITEOS_LD_SCRIPT) $(LITEOS_LIBS_DIR) $(LITEOS_COMPILER_GCCLIB_PATH) - -LITEOS_CFLAGS := $(LITEOS_COPTS_BASE) $(LITEOS_COPTS_EXTRA) -DLOSCFG_LIB_LIBC -LITEOS_ASFLAGS := $(LITEOS_ASOPTS) -LOCAL_FLAGS := $(CFLAGS) $(LITEOS_COMPILER_GCC_INCLUDE) -LOCAL_COBJS := $(patsubst %.c,$(OBJOUT)/%.o,$(LOCAL_CSRCS)) -LOCAL_ASMOBJS := $(patsubst %.S,$(OBJOUT)/%.o,$(LOCAL_ASMSRCS)) - -all: $(LITEOS_TARGET) - -$(LITEOS_TARGET): $(LIBA) - $(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) --start-group $(LITEOS_LIBDEP) --end-group -o $(OUT)/$@ - $(OBJCOPY) -S $(OUT)/$@ -Obinary $(OUT)/$@.bin - $(OBJDUMP) -hd $(OUT)/$@ >$(OUT)/$@.asm - $(OBJDUMP) -stD $(OUT)/$@ >$(OUT)/$@.map - -$(LOCAL_COBJS): $(OBJOUT)/%.o: %.c - $(HIDE)$(OBJ_MKDIR) - $(HIDE)$(CC) $(LITEOS_CFLAGS) $(LOCAL_FLAGS) -c $< -o $@ - -$(LOCAL_ASMOBJS): $(OBJOUT)/%.o: %.S - $(HIDE)$(OBJ_MKDIR) - $(HIDE)$(CC) $(LITEOS_ASFLAGS) $(LOCAL_FLAGS) -c $< -o $@ - -$(LIBA): $(LOCAL_COBJS) $(LOCAL_ASMOBJS) - $(HIDE)$(OBJ_MKDIR) - $(HIDE)$(AR) $(ARFLAGS) $@ $(LOCAL_COBJS) $(LOCAL_ASMOBJS) - -clean: - $(HIDE)$(RM) $(__OBJS) $(LITEOS_TARGET) $(OUT) $(BUILD) *.bak *~ - $(HIDE)echo "clean $(LITEOS_PLATFORM) finish" - -cleanall: - $(HIDE)rm -rf $(LITEOSTOPDIR)/out - $(HIDE)echo "clean all" - -.PHONY: all lib clean cleanall $(LITEOS_TARGET) diff --git a/targets/riscv_sifive_fe310_gcc/board.ld.S b/targets/riscv_sifive_fe310_gcc/board.ld.S deleted file mode 100755 index 06c3907d..00000000 --- a/targets/riscv_sifive_fe310_gcc/board.ld.S +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -RAM_ADDR_START = 0x80000000; -RAM_ADDR_SIZE = 128M; -FLASH_LOAD_START = RAM_ADDR_START; -FLASH_LOAD_SIZE = RAM_ADDR_SIZE; -EXCEPT_STACK_SIZE = 2K; -NMI_STACK_SIZE = 1K; -START_AND_IRQ_STACK_SIZE = 8K; -HEAP_SIZE = 100M; - diff --git a/targets/riscv_sifive_fe310_gcc/compiler_dir.sh b/targets/riscv_sifive_fe310_gcc/compiler_dir.sh deleted file mode 100755 index 58ceda00..00000000 --- a/targets/riscv_sifive_fe310_gcc/compiler_dir.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -#Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. -#Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. -# -#Redistribution and use in source and binary forms, with or without modification, -#are permitted provided that the following conditions are met: -# -#1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -#2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -#3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -set -e - -declare GCC="$1" -function compiler_dir() -{ - gcc_path=$(dirname $(which ${GCC}))/.. - echo "${gcc_path}" -} - -compiler_dir - diff --git a/targets/riscv_sifive_fe310_gcc/driver/mtimer.c b/targets/riscv_sifive_fe310_gcc/driver/mtimer.c deleted file mode 100755 index 8e6acd3a..00000000 --- a/targets/riscv_sifive_fe310_gcc/driver/mtimer.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "mtimer.h" -#include "los_reg.h" -#include "los_interrupt.h" -#include "los_tick.h" -#include "riscv_hal.h" -#include "soc.h" -#include "plic.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -VOID MTimerCpuCycle(UINT32 *contHi, UINT32 *contLo) -{ - READ_UINT32(*contLo, MTIMER); - READ_UINT32(*contHi, MTIMER + 4); - return; -} - -STATIC INLINE VOID UpdateMtimerCmp(UINT32 tick) -{ - unsigned long long timer; - unsigned timerL, timerH; - READ_UINT32(timerL, MTIMER); - READ_UINT32(timerH, MTIMER + 4); - timer = (UINT64)(((UINT64)timerH << 32) + timerL); - timer += tick; - WRITE_UINT32(0xffffffff, MTIMERCMP + 4); - WRITE_UINT32((UINT32)timer, MTIMERCMP); - WRITE_UINT32((UINT32)(timer >> 32), MTIMERCMP + 4); -} - -STATIC VOID OsMachineTimerInterrupt(UINT32 sysCycle) -{ - OsTickHandler(); - UpdateMtimerCmp(sysCycle); -} - -UINT32 MTimerTickInit(UINT32 period) -{ - unsigned int ret; - ret = LOS_HwiCreate(RISCV_MACH_TIMER_IRQ, 0x1, 0, OsMachineTimerInterrupt, period); - if (ret != LOS_OK) { - return ret; - } - - WRITE_UINT32(0xffffffff, MTIMERCMP + 4); - WRITE_UINT32(period, MTIMERCMP); - WRITE_UINT32(0x0, MTIMERCMP + 4); - - OsIrqEnable(RISCV_MACH_TIMER_IRQ); - return LOS_OK; -} - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ diff --git a/targets/riscv_sifive_fe310_gcc/driver/mtimer.h b/targets/riscv_sifive_fe310_gcc/driver/mtimer.h deleted file mode 100755 index d5204447..00000000 --- a/targets/riscv_sifive_fe310_gcc/driver/mtimer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MTIMER_H -#define _MTIMER_H - -#include "los_compiler.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -extern VOID MTimerCpuCycle(UINT32 *contHi, UINT32 *contLo); -extern UINT32 MTimerTickInit(UINT32 period); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ -#endif diff --git a/targets/riscv_sifive_fe310_gcc/driver/plic.c b/targets/riscv_sifive_fe310_gcc/driver/plic.c deleted file mode 100755 index 643cda55..00000000 --- a/targets/riscv_sifive_fe310_gcc/driver/plic.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "plic.h" -#include "soc.h" -#include "los_reg.h" -#include "los_interrupt.h" -#include "los_debug.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -static VOID OsMachineExternalInterrupt(UINT32 arg) -{ - volatile UINT32 *plicReg = (volatile UINT32 *)(PLIC_REG_BASE + 0x4); - UINT32 irqNum, saveIrqNum; - - READ_UINT32(irqNum, plicReg); - saveIrqNum = irqNum; - - if ((irqNum >= OS_RISCV_CUSTOM_IRQ_VECTOR_CNT) || (irqNum == 0)) { - OsHwiDefaultHandler(irqNum); - } - - irqNum += RISCV_SYS_MAX_IRQ; - - g_hwiForm[irqNum].pfnHook(g_hwiForm[irqNum].uwParam); - - WRITE_UINT32(saveIrqNum, plicReg); -} - -VOID PlicIrqInit() -{ - volatile UINT32 *plicPrioReg = (volatile UINT32 *)PLIC_PRIO_BASE; - volatile UINT32 *plicEnReg = (volatile UINT32 *)PLIC_ENABLE_BASE; - volatile UINT32 *plicReg = (volatile UINT32 *)PLIC_REG_BASE; - INT32 i; - UINT32 ret; - - for (i = 0; i < ((OS_RISCV_CUSTOM_IRQ_VECTOR_CNT >> 5) + 1); i++) { - WRITE_UINT32(0x0, plicEnReg); - plicEnReg++; - } - - for (i = 0; i < OS_RISCV_CUSTOM_IRQ_VECTOR_CNT; i++) { - WRITE_UINT32(0x0, plicPrioReg); - plicPrioReg++; - } - - WRITE_UINT32(0, plicReg); - - ret = LOS_HwiCreate(RISCV_MACH_EXT_IRQ, 0x1, 0, OsMachineExternalInterrupt, 0); - if (ret != LOS_OK) { - PRINT_ERR("Creat machine external failed! ret : 0x%x\n", ret); - } -} - -VOID PlicIrqSetPrio(UINT32 vector, UINT32 pri) -{ - volatile UINT32 *plicReg = (volatile UINT32 *)PLIC_PRIO_BASE; - - plicReg += (vector - RISCV_SYS_MAX_IRQ); - WRITE_UINT32(pri, plicReg); -} - -VOID PlicIrqEnable(UINT32 vector) -{ - UINT32 irqValue; - UINT32 locIrq = vector - RISCV_SYS_MAX_IRQ; - volatile UINT32 *plicReg = (volatile UINT32 *)PLIC_ENABLE_BASE; - - plicReg += (locIrq >> 5); - READ_UINT32(irqValue, plicReg); - irqValue |= (1 << (locIrq & 31)); - WRITE_UINT32(irqValue, plicReg); -} - -VOID PlicIrqDisable(UINT32 vector) -{ - UINT32 irqValue; - UINT32 locIrq = vector - RISCV_SYS_MAX_IRQ; - volatile UINT32 *plicReg = (volatile UINT32 *)PLIC_ENABLE_BASE; - - plicReg += (locIrq >> 5); - READ_UINT32(irqValue, plicReg); - irqValue &= ~(1 << (locIrq & 31)); - WRITE_UINT32(irqValue, plicReg); -} - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ - diff --git a/targets/riscv_sifive_fe310_gcc/driver/plic.h b/targets/riscv_sifive_fe310_gcc/driver/plic.h deleted file mode 100755 index 64285121..00000000 --- a/targets/riscv_sifive_fe310_gcc/driver/plic.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PLIC_H -#define _PLIC_H - -#include "los_compiler.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -extern VOID PlicIrqInit(VOID); -extern VOID PlicIrqSetPrio(UINT32 vector, UINT32 pri); -extern VOID PlicIrqEnable(UINT32 vector); -extern VOID PlicIrqDisable(UINT32 vector); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ -#endif diff --git a/targets/riscv_sifive_fe310_gcc/driver/uart.c b/targets/riscv_sifive_fe310_gcc/driver/uart.c deleted file mode 100755 index 355d2500..00000000 --- a/targets/riscv_sifive_fe310_gcc/driver/uart.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "uart.h" -#include "soc.h" -#include "los_reg.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -/******* uart register offset *****/ -#define UART_TX_DATA 0x00 -#define UART_RX_DATA 0x04 -#define UART_TX_CTRL 0x08 -#define UART_RX_CTRL 0x0C -#define UART_IN_ENAB 0x10 -#define UART_IN_PEND 0x14 -#define UART_BR_DIV 0x18 - -INT32 UartPutc(INT32 c, VOID *file) -{ - (VOID)file; - - while (GET_UINT32(UART0_BASE + UART_TX_DATA) & 0x80000000) { - - } - - WRITE_UINT32((INT32)(c & 0xFF), UART0_BASE + UART_TX_DATA); - - return c; -} - -INT32 UartOut(INT32 c, VOID *file) -{ - if (c == '\n') { - return UartPutc('\r', file); - } - - return UartPutc(c, file); -} - -VOID UartInit() -{ - UINT32 uartDiv; - - /* Enable TX and RX channels */ - WRITE_UINT32(1 << 0, UART0_BASE + UART_TX_CTRL); - WRITE_UINT32(1 << 0, UART0_BASE + UART_RX_CTRL); - - /* Set baud rate */ - uartDiv = UART0_CLK_FREQ / UART0_BAUDRAT - 1; - WRITE_UINT32(uartDiv, UART0_BASE + UART_BR_DIV); - - /* Ensure that uart IRQ is disabled initially */ - WRITE_UINT32(0, UART0_BASE + UART_IN_ENAB); -} - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ diff --git a/targets/riscv_sifive_fe310_gcc/driver/uart.h b/targets/riscv_sifive_fe310_gcc/driver/uart.h deleted file mode 100755 index 2b33df9c..00000000 --- a/targets/riscv_sifive_fe310_gcc/driver/uart.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _UART_H -#define _UART_H - -#include "los_compiler.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -extern INT32 UartPutc(INT32 c, VOID *file); -extern INT32 UartOut(INT32 c, VOID *file); -extern VOID UartInit(VOID); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ -#endif diff --git a/targets/riscv_sifive_fe310_gcc/include/asm/soc.h b/targets/riscv_sifive_fe310_gcc/include/asm/soc.h deleted file mode 100755 index 470c4b17..00000000 --- a/targets/riscv_sifive_fe310_gcc/include/asm/soc.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _SOC_H -#define _SOC_H -#include "soc_common.h" - -#define MSIP 0x2000000 -#define MTIMERCMP 0x2004000 -#define MTIMER 0x200BFF8 -#define CLOCK_CONTRAL_REG 0x10008000 - -/* interrupt base addr : 0xc000000 + 4 * interrupt ID - * [2:0] priority - * [31:3] reserved - */ -#define PLIC_PRIO_BASE 0xC000000 -#define PLIC_PEND_BASE 0xC001000 //interrupt 0-31 -#define PLIC_PEND_REG2 0xC001004 //interrupt 32-52 -#define PLIC_ENABLE_BASE 0xC002000 //interrupt 0-31 -#define PLIC_ENABLE_REG2 0xC002004 //interrupt 32-52 -#define PLIC_REG_BASE 0xC200000 - -#define UART0_BASE 0x10013000 -#define UART1_BASE 0x10023000 - -#define UART0_CLK_FREQ 0x32000000 -#define UART1_CLK_FREQ 0x32000000 -#define UART0_BAUDRAT 115200 - -#define RISCV_SYS_MAX_IRQ 11 -#define RISCV_WDOGCMP_IRQ (RISCV_SYS_MAX_IRQ + 1) -#define RISCV_RTCCMP_IRQ (RISCV_SYS_MAX_IRQ + 2) -#define RISCV_UART0_IRQ (RISCV_SYS_MAX_IRQ + 3) -#define RISCV_UART1_IRQ (RISCV_SYS_MAX_IRQ + 4) - -#define RISCV_PLIC_VECTOR_CNT 53 - -#endif diff --git a/targets/riscv_sifive_fe310_gcc/include/riscv_hal.h b/targets/riscv_sifive_fe310_gcc/include/riscv_hal.h deleted file mode 100755 index 7a021e5e..00000000 --- a/targets/riscv_sifive_fe310_gcc/include/riscv_hal.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _RISCV_HAL_H -#define _RISCV_HAL_H - -#include "los_compiler.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -/* - * backtrace - */ -extern CHAR *__except_stack_top; -extern CHAR *__start_and_irq_stack_top; -extern CHAR *__text_start; -extern CHAR *__text_end; -extern CHAR *__bss_end; - -extern BOOL OsBackTraceRaCheck(UINT32 value); -extern BOOL OsBackTraceFpCheck(UINT32 value); - -extern VOID OsIrqDisable(UINT32 vector); -extern VOID OsIrqEnable(UINT32 vector); -extern VOID OsSetLocalInterPri(UINT32 vector, UINT16 prior); - -extern VOID OsGetCpuCycle(UINT32 *cntHi, UINT32 *cntLo); -extern VOID SysClockInit(UINT32 period); - -#ifdef __cplusplus -#if __cplusplus -} -#endif -#endif - -#endif /* _RISCV_HAL_H */ diff --git a/targets/riscv_sifive_fe310_gcc/libc/dprintf.c b/targets/riscv_sifive_fe310_gcc/libc/dprintf.c deleted file mode 100755 index df7ffef2..00000000 --- a/targets/riscv_sifive_fe310_gcc/libc/dprintf.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "stdarg.h" -#include -#include "los_debug.h" -#include "uart.h" - -int putchar(int n) -{ - return UartOut(n, NULL); -} - -int puts(const char *string) -{ - int count = 0; - char *s = (char *)string; - while (*s != '\0') { - putchar(*s); - s++; - count++; - } - - return count; -} - -static int hex2asc(int n) -{ - n &= 15; - if(n > 9){ - return ('a' - 10) + n; - } else { - return '0' + n; - } -} - -static void dputs(char const *s, int (*pFputc)(int n, void *cookie), void *cookie) -{ - while (*s) { - pFputc(*s++, cookie); - } -} - -void __dprintf(char const *fmt, va_list ap, - int (*pFputc)(int n, void *cookie), - void *cookie) -{ - char scratch[256]; - - for(;;){ - switch(*fmt){ - case 0: - va_end(ap); - return; - case '%': - switch(fmt[1]) { - case 'c': { - unsigned n = va_arg(ap, unsigned); - pFputc(n, cookie); - fmt += 2; - continue; - } - case 'h': { - unsigned n = va_arg(ap, unsigned); - pFputc(hex2asc(n >> 12), cookie); - pFputc(hex2asc(n >> 8), cookie); - pFputc(hex2asc(n >> 4), cookie); - pFputc(hex2asc(n >> 0), cookie); - fmt += 2; - continue; - } - case 'b': { - unsigned n = va_arg(ap, unsigned); - pFputc(hex2asc(n >> 4), cookie); - pFputc(hex2asc(n >> 0), cookie); - fmt += 2; - continue; - } - case 'p': - case 'X': - case 'x': { - unsigned n = va_arg(ap, unsigned); - char *p = scratch + 15; - *p = 0; - do { - *--p = hex2asc(n); - n = n >> 4; - } while(n != 0); - while(p > (scratch + 7)) *--p = '0'; - dputs(p, pFputc, cookie); - fmt += 2; - continue; - } - case 'd': { - int n = va_arg(ap, int); - char *p = scratch + 15; - *p = 0; - if(n < 0) { - pFputc('-', cookie); - n = -n; - } - do { - *--p = (n % 10) + '0'; - n /= 10; - } while(n != 0); - dputs(p, pFputc, cookie); - fmt += 2; - continue; - } - case 'u': { - unsigned int n = va_arg(ap, unsigned int); - char *p = scratch + 15; - *p = 0; - do { - *--p = (n % 10) + '0'; - n /= 10; - } while(n != 0); - dputs(p, pFputc, cookie); - fmt += 2; - continue; - } - case 's': { - char *s = va_arg(ap, char*); /*lint !e64*/ - if(s == 0) s = "(null)"; - dputs(s, pFputc, cookie); - fmt += 2; - continue; - } - } - pFputc(*fmt++, cookie); - break; - case '\n': - pFputc('\r', cookie); - default: /*lint !e616*/ - pFputc(*fmt++, cookie); - } - } -} - -int printf(char const *str, ...) -{ - va_list ap; - va_start(ap, str); - __dprintf(str, ap, UartPutc, 0); - va_end(ap); - return 0; -} diff --git a/targets/riscv_sifive_fe310_gcc/los_start.S b/targets/riscv_sifive_fe310_gcc/los_start.S deleted file mode 100755 index d6a2420f..00000000 --- a/targets/riscv_sifive_fe310_gcc/los_start.S +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "soc.h" - -.macro PUSH_CALLER_REG - addi sp, sp, -(INT_SIZE_ON_STACK) - SREG t6, 16 * REGBYTES(sp) - SREG t5, 17 * REGBYTES(sp) - SREG t4, 18 * REGBYTES(sp) - SREG t3, 19 * REGBYTES(sp) - SREG a7, 20 * REGBYTES(sp) - SREG a6, 21 * REGBYTES(sp) - SREG a5, 22 * REGBYTES(sp) - SREG a4, 23 * REGBYTES(sp) - SREG a3, 24 * REGBYTES(sp) - SREG a2, 25 * REGBYTES(sp) - SREG a1, 26 * REGBYTES(sp) - SREG a0, 27 * REGBYTES(sp) - SREG t2, 28 * REGBYTES(sp) - SREG t1, 29 * REGBYTES(sp) - SREG t0, 30 * REGBYTES(sp) - SREG ra, 31 * REGBYTES(sp) -.endm - -.extern memset -.global _start -.section .start.text -.align 4 -_start: - li t0, RISCV_MSTATUS_MPP - csrw mstatus, t0 - csrw mie, zero - la t0, TrapVector - csrw mtvec, t0 # direct mode - - .option push - .option norelax - la gp, __global_pointer$ - .option pop - - la t0, __bss_start - la t1, __bss_end -2: - sw zero, 0x0(t0) - addi t0, t0, 0x4 - bgtu t1, t0, 2b - - la sp, __start_and_irq_stack_top - - tail main diff --git a/targets/riscv_sifive_fe310_gcc/main.c b/targets/riscv_sifive_fe310_gcc/main.c deleted file mode 100755 index 276c7a7d..00000000 --- a/targets/riscv_sifive_fe310_gcc/main.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "los_tick.h" -#include "los_task.h" -#include "los_config.h" -#include "los_interrupt.h" -#include "los_debug.h" -#include "uart.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cpluscplus */ -#endif /* __cpluscplus */ - -UINT8 g_memStart[OS_SYS_MEM_SIZE]; - -VOID TaskSampleEntry2(VOID) -{ - while(1) { - LOS_TaskDelay(1000); - printf("TaskSampleEntry2 running...\n\r"); - } -} - - -VOID TaskSampleEntry1(VOID) -{ - while(1) { - LOS_TaskDelay(1000); - printf("TaskSampleEntry1 running...\n\r"); - } - -} - -UINT32 TaskSample(VOID) -{ - UINT32 ret; - UINT32 taskID1, taskID2; - TSK_INIT_PARAM_S task1 = { 0 }; - task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry1; - task1.uwStackSize = 0x1000; - task1.pcName = "TaskSampleEntry1"; - task1.usTaskPrio = 6; - ret = LOS_TaskCreate(&taskID1, &task1); - - task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry2; - task1.uwStackSize = 0x1000; - task1.pcName = "TaskSampleEntry2"; - task1.usTaskPrio = 7; - ret = LOS_TaskCreate(&taskID2, &task1); - - return ret; -} - -/***************************************************************************** - Function : main - Description : Main function entry - Input : None - Output : None - Return : None - *****************************************************************************/ -LITE_OS_SEC_TEXT_INIT INT32 main(VOID) -{ - UINT32 ret; - - UartInit(); - - PRINTK("\n OHOS start \n\r"); - - ret = LOS_KernelInit(); - if (ret != LOS_OK) { - goto START_FAILED; - } - - TaskSample(); - - PRINTK("\n OHOS scheduler!!! \n\r"); - - LOS_Start(); - -START_FAILED: - while (1) { - __asm volatile("wfi"); - } -} - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cpluscplus */ -#endif /* __cpluscplus */ diff --git a/targets/riscv_sifive_fe310_gcc/qemu_sifive_run.sh b/targets/riscv_sifive_fe310_gcc/qemu_sifive_run.sh deleted file mode 100755 index 950b3acf..00000000 --- a/targets/riscv_sifive_fe310_gcc/qemu_sifive_run.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -#Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. -#Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. -# -#Redistribution and use in source and binary forms, with or without modification, -#are permitted provided that the following conditions are met: -# -#1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -#2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -#3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -set -e - -qemu-system-riscv32 \ - -m 128M \ - -kernel out/liteos \ - -machine sifive_u \ - -nographic \ - -append "root=/dev/vda or console=ttyS0" diff --git a/targets/riscv_sifive_fe310_gcc/riscv_hal.c b/targets/riscv_sifive_fe310_gcc/riscv_hal.c deleted file mode 100755 index ad4a7004..00000000 --- a/targets/riscv_sifive_fe310_gcc/riscv_hal.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "riscv_hal.h" -#include "los_debug.h" -#include "soc.h" -#include "plic.h" -#include "mtimer.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -VOID OsIrqDisable(UINT32 vector) -{ - if (vector <= RISCV_SYS_MAX_IRQ) { - CLEAR_CSR(mie, 1 << vector); - } else { - PlicIrqDisable(vector); - } -} - -VOID OsIrqEnable(UINT32 vector) -{ - if (vector <= RISCV_SYS_MAX_IRQ) { - SET_CSR(mie, 1 << vector); - } else { - PlicIrqEnable(vector); - } -} - -VOID OsSetLocalInterPri(UINT32 interPriNum, UINT16 prior) -{ - PlicIrqSetPrio(interPriNum, prior); -} - -VOID OsGetCpuCycle(UINT32 *cntHi, UINT32 *cntLo) -{ - if ((cntHi == NULL) || (cntLo == NULL)) { - return; - } - - MTimerCpuCycle(cntHi, cntLo); -} - -BOOL OsBackTraceFpCheck(UINT32 value) -{ - if (value >= (UINT32)(UINTPTR)(&__bss_end)) { - return TRUE; - } - - if ((value >= (UINT32)(UINTPTR)(&__start_and_irq_stack_top)) && (value < (UINT32)(UINTPTR)(&__except_stack_top))) { - return TRUE; - } - - return FALSE; -} - -BOOL OsBackTraceRaCheck(UINT32 value) -{ - BOOL ret = FALSE; - - if ((value >= (UINT32)(UINTPTR)(&__text_start)) && - (value < (UINT32)(UINTPTR)(&__text_end))) { - ret = TRUE; - } - - return ret; -} - -VOID SysClockInit(UINT32 period) -{ - UINT32 ret; - ret = MTimerTickInit(period); - if (ret != LOS_OK) { - PRINT_ERR("Creat Mtimer failed! ret : 0x%x \n", ret); - return; - } - - PlicIrqInit(); - - OsIrqEnable(RISCV_MACH_EXT_IRQ); -} - -#ifdef __cplusplus -#if __cplusplus -} -#endif -#endif diff --git a/targets/riscv_sifive_fe310_gcc/target_config.h b/targets/riscv_sifive_fe310_gcc/target_config.h deleted file mode 100755 index 04528d99..00000000 --- a/targets/riscv_sifive_fe310_gcc/target_config.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _TARGETS_CONFIG_H -#define _TARGETS_CONFIG_H - -#include "soc.h" -#include "los_compiler.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -#define OS_SYS_CLOCK 10000000UL - -#define LOSCFG_BASE_CORE_TICK_PER_SECOND 1000 - -/****************************** System clock module configuration ****************************/ -#define LOSCFG_BASE_CORE_TIMER_NUM 7 - -/****************************** Task module configuration ********************************/ -/** - * @ingroup los_config - * Default task priority - */ -#define LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO 10 - -/** - * @ingroup los_config - * Maximum supported number of tasks except the idle task rather than the number of usable tasks - */ -#define LOSCFG_BASE_CORE_TSK_LIMIT 20 // max num task - -/** - * @ingroup los_config - * Size of the idle task stack - */ -#define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE SIZE(0x500) // IDLE task stack - -/** - * @ingroup los_config - * Default task stack size - */ -#define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE SIZE(0x2D0) // default stack - -/** - * @ingroup los_config - * Minimum stack size. - */ -#define LOS_TASK_MIN_STACK_SIZE (ALIGN(0x130, 16)) - -/** - * @ingroup los_config - * Configuration item for task Robin tailoring - */ -#define LOSCFG_BASE_CORE_TIMESLICE YES // task-ROBIN moduel cutting switch - -/** - * @ingroup los_config - * Longest execution time of tasks with the same priorities - */ -#define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 10 - -/** - * @ingroup los_config - * Configuration item for task (stack) monitoring module tailoring - */ -#define LOSCFG_BASE_CORE_TSK_MONITOR YES - -/** - * @ingroup los_config - * Define a usable task priority.Highest task priority. - */ -#define LOS_TASK_PRIORITY_HIGHEST 0 - -/** - * @ingroup los_config - * Define a usable task priority.Lowest task priority. - */ -#define LOS_TASK_PRIORITY_LOWEST 31 - -/****************************** Semaphore module configuration ******************************/ -/** - * @ingroup los_config - * Configuration item for semaphore module tailoring - */ -#define LOSCFG_BASE_IPC_SEM YES - -/** - * @ingroup los_config - * Maximum supported number of semaphores - */ -#define LOSCFG_BASE_IPC_SEM_LIMIT 10 // the max sem-numb - -/****************************** mutex module configuration ******************************/ -/** - * @ingroup los_config - * Configuration item for mutex module tailoring - */ -#define LOSCFG_BASE_IPC_MUX YES - -/** - * @ingroup los_config - * Maximum supported number of mutexes - */ -#define LOSCFG_BASE_IPC_MUX_LIMIT 10 // the max mutex-num - -/****************************** Queue module configuration ********************************/ -/** - * @ingroup los_config - * Configuration item for queue module tailoring - */ -#define LOSCFG_BASE_IPC_QUEUE YES - -/** - * @ingroup los_config - * Maximum supported number of queues rather than the number of usable queues - */ -#define LOSCFG_BASE_IPC_QUEUE_LIMIT 10 //the max queue-numb - -/****************************** Software timer module configuration **************************/ -/** - * @ingroup los_config - * Configuration item for software timer module tailoring - */ -#define LOSCFG_BASE_CORE_SWTMR YES - -/** - * @ingroup los_config - * Maximum supported number of software timers rather than the number of usable software timers - */ -#define LOSCFG_BASE_CORE_SWTMR_LIMIT 10 // the max SWTMR numb - -/****************************** Memory module configuration **************************/ -/** - * @ingroup los_config - * Configuration module tailoring of mem node integrity checking - */ -#define LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK YES - -/** - * @ingroup los_config - * Configuration module tailoring of mem node size checking - */ -#define LOSCFG_BASE_MEM_NODE_SIZE_CHECK YES - -#define LOSCFG_MEMORY_BESTFIT YES - -#define LOSCFG_PLATFORM_EXC YES -/** - * @ingroup los_config - * Number of memory checking blocks - */ -#define OS_SYS_MEM_NUM 20 - -#define LOSCFG_KERNEL_MEM_SLAB NO - -#ifdef LITEOSCFG_EXTENDED_KERNEL -#define LOSCFG_KERNEL_TICKLESS NO -#define LOSCFG_BASE_CORE_CPUP YES -#endif - -#ifdef LITEOSCFG_CMSIS -#define CMSIS_OS_VER 1 -#define LOSCFG_COMPAT_CMSIS_FW YES -#endif - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ - - -#endif /* _TARGETS_CONFIG_H */