forked from xuos/xiuos
modify author description and fix bug of compiler errors,add readme for gap8
This commit is contained in:
parent
b22f9a3851
commit
6b7a233511
|
@ -27,10 +27,10 @@ static DoublelistType quant_table[SENSOR_QUANTITY_END];
|
|||
static DoublelistType sensor_device_list;
|
||||
|
||||
/* Sensor quantity list lock */
|
||||
static int quant_table_lock;
|
||||
static pthread_mutex_t quant_table_lock;
|
||||
|
||||
/* Sensor device list lock */
|
||||
static int sensor_device_list_lock;
|
||||
static pthread_mutex_t sensor_device_list_lock;
|
||||
|
||||
/**
|
||||
* @description: Init perception framework
|
||||
|
|
|
@ -61,6 +61,7 @@ extern "C" {
|
|||
// };
|
||||
|
||||
typedef int pid_t;
|
||||
// typedef int pthread_mutex_t ;
|
||||
|
||||
/* function in pthread.c */
|
||||
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
|
||||
|
|
|
@ -40,6 +40,24 @@
|
|||
* event unit, and then by the FC event unit or cluster event unit, and
|
||||
* finally to FC or cluster. Peripherals share the same IRQ entry.
|
||||
****************************************************************************/
|
||||
/**
|
||||
* @file arch_interrupt.h
|
||||
* @brief support gap8 interrupt
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
/*************************************************
|
||||
File name: arch_interrupt.h
|
||||
Description: support gap8 interrupt
|
||||
Others: take nuttx/arch/risc-v/include/gap8/irq.h for references
|
||||
https://github.com/apache/incubator-nuttx.git
|
||||
History:
|
||||
1. Date: 2021-09-02
|
||||
Author: AIIT XUOS Lab
|
||||
Modification: add interrupt function definition
|
||||
*************************************************/
|
||||
|
||||
#ifndef ARCH_INTERRUPT_H__
|
||||
#define ARCH_INTERRUPT_H__
|
||||
|
|
|
@ -35,6 +35,26 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file boot.s
|
||||
* @brief support gap8 interrupt and startup
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
/*************************************************
|
||||
File name: boot.s
|
||||
Description: support gap8 interrupt and startup
|
||||
Others: take nuttx/arch/risc-v/gap8/gap8_head.S for references
|
||||
https://github.com/apache/incubator-nuttx.git
|
||||
History:
|
||||
1. Date: 2021-09-02
|
||||
Author: AIIT XUOS Lab
|
||||
Modification: modify startup sequence and interrupt process
|
||||
*************************************************/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -172,8 +192,6 @@
|
|||
* External Variables and Functions
|
||||
*******************************************************************************/
|
||||
|
||||
# .extern _sbss
|
||||
# .extern _ebss
|
||||
.extern __bss_start
|
||||
.extern __bss_end
|
||||
.extern _idle_stack_end
|
||||
|
@ -219,21 +237,11 @@ zero_loop:
|
|||
|
||||
zero_loop_end:
|
||||
|
||||
/* TODO: initialize data section */
|
||||
|
||||
/* Initialize cache and clock */
|
||||
|
||||
|
||||
# jal x1, gapuino_sysinit
|
||||
|
||||
/* Directly call NuttX nx_start() */
|
||||
csrr a0, 0xf14 /* Cluster ID */
|
||||
andi a1, a0, 0x1f /* Core ID */
|
||||
|
||||
j GapuinoStart
|
||||
|
||||
/* If it ever returns, spin here forever... */
|
||||
|
||||
dead_loop:
|
||||
jal x0, dead_loop
|
||||
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/****************************************************************************
|
||||
* arch/risc-v/include/gap8/chip.h
|
||||
* Gapuino chip features
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: hhuysqt <1020988872@qq.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directly but, rather, only indirectly
|
||||
* through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_RISCV_INCLUDE_GAP8_CHIP_H
|
||||
#define __ARCH_RISCV_INCLUDE_GAP8_CHIP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_RISCV_INCLUDE_GAP8_CHIP_H */
|
|
@ -35,6 +35,25 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
/**
|
||||
* @file gap8.h
|
||||
* @brief support gap8 chip fetures
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
/*************************************************
|
||||
File name: gap8.h
|
||||
Description: support gap8 chip fetures
|
||||
Others: take nuttx/arch/risc-v/src/gap8/gap8.h for references
|
||||
https://github.com/apache/incubator-nuttx.git
|
||||
History:
|
||||
1. Date: 2021-09-02
|
||||
Author: AIIT XUOS Lab
|
||||
Modification:
|
||||
*************************************************/
|
||||
|
||||
#ifndef __ARCH_RISC_V_SRC_GAP8_GAP8_H
|
||||
#define __ARCH_RISC_V_SRC_GAP8_GAP8_H
|
||||
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/****************************************************************************
|
||||
* arch/risc-v/src/gap8/gap8_allocateheap.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 NuttX 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "riscv_arch.h"
|
||||
#include "riscv_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_allocate_heap
|
||||
*
|
||||
* Description:
|
||||
* This function will be called to dynamically set aside the heap region.
|
||||
*
|
||||
* For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and
|
||||
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
|
||||
* size of the unprotected, user-space heap.
|
||||
*
|
||||
* If a protected kernel-space heap is provided, the kernel heap must be
|
||||
* allocated (and protected) by an analogous up_allocate_kheap().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
{
|
||||
/* These values come from GAP8.ld */
|
||||
|
||||
extern uint8_t *_heap_start;
|
||||
extern uint8_t *_heap_end;
|
||||
uint32_t hstart = (uint32_t)&_heap_start;
|
||||
uint32_t hend = (uint32_t)&_heap_end;
|
||||
|
||||
*heap_start = &_heap_start;
|
||||
*heap_size = hend - hstart;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riscv_addregion
|
||||
*
|
||||
* Description:
|
||||
* RAM may be added in non-contiguous chunks. This routine adds all chunks
|
||||
* that may be used for heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_MM_REGIONS > 1
|
||||
void riscv_addregion(void)
|
||||
{
|
||||
/* TODO: add L1 memorie */
|
||||
}
|
||||
#endif
|
|
@ -1,84 +0,0 @@
|
|||
/****************************************************************************
|
||||
* arch/risc-v/src/gap8/gap8_idle.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 NuttX 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_idle
|
||||
*
|
||||
* Description:
|
||||
* up_idle() is the logic that will be executed when there is no other
|
||||
* ready-to-run task. This is processor idle time and will continue until
|
||||
* some interrupt occurs to cause a context switch from the idle task.
|
||||
*
|
||||
* Processing in this state may be processor-specific. e.g., this is where
|
||||
* power management operations might be performed.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_idle(void)
|
||||
{
|
||||
#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
|
||||
/* If the system is idle and there are no timer interrupts, then process
|
||||
* "fake" timer interrupts. Hopefully, something will wake up.
|
||||
*/
|
||||
|
||||
nxsched_process_timer();
|
||||
#else
|
||||
|
||||
/* GAP8 would sleep on software event #3, which would be triggered at
|
||||
* gap8_dispatch_irq().
|
||||
*/
|
||||
|
||||
gap8_sleep_wait_sw_evnt(1 << 3);
|
||||
|
||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||
irqstate_t flags = enter_critical_section();
|
||||
leave_critical_section(flags);
|
||||
#endif
|
||||
#endif
|
||||
}
|
|
@ -1,199 +0,0 @@
|
|||
/****************************************************************************
|
||||
* arch/risc-v/src/gap8/gap8_schedulesigaction.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Modified for RISC-V:
|
||||
*
|
||||
* Author: hhuysqt <1020988872@qq.com>
|
||||
*
|
||||
* 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 NuttX 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/gap8/irq.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "riscv_internal.h"
|
||||
#include "riscv_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_schedule_sigaction
|
||||
*
|
||||
* Description:
|
||||
* This function is called by the OS when one or more
|
||||
* signal handling actions have been queued for execution.
|
||||
* The architecture specific code must configure things so
|
||||
* that the 'sigdeliver' callback is executed on the thread
|
||||
* specified by 'tcb' as soon as possible.
|
||||
*
|
||||
* This function may be called from interrupt handling logic.
|
||||
*
|
||||
* This operation should not cause the task to be unblocked
|
||||
* nor should it cause any immediate execution of sigdeliver.
|
||||
* Typically, a few cases need to be considered:
|
||||
*
|
||||
* (1) This function may be called from an interrupt handler
|
||||
* During interrupt processing, all xcptcontext structures
|
||||
* should be valid for all tasks. That structure should
|
||||
* be modified to invoke sigdeliver() either on return
|
||||
* from (this) interrupt or on some subsequent context
|
||||
* switch to the recipient task.
|
||||
* (2) If not in an interrupt handler and the tcb is NOT
|
||||
* the currently executing task, then again just modify
|
||||
* the saved xcptcontext structure for the recipient
|
||||
* task so it will invoke sigdeliver when that task is
|
||||
* later resumed.
|
||||
* (3) If not in an interrupt handler and the tcb IS the
|
||||
* currently executing task -- just call the signal
|
||||
* handler now.
|
||||
*
|
||||
* Assumptions:
|
||||
* Called from critical section
|
||||
*
|
||||
****************************************************************************/
|
||||
irqstate_t flags;
|
||||
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
||||
{
|
||||
// uint32_t int_ctx;
|
||||
|
||||
sinfo("tcb=0x%p sigdeliver=0x%p\n", tcb, sigdeliver);
|
||||
|
||||
/* Make sure that interrupts are disabled */
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Refuse to handle nested signal actions */
|
||||
|
||||
if (!tcb->xcp.sigdeliver)
|
||||
{
|
||||
/* First, handle some special cases when the signal is
|
||||
* being delivered to the currently executing task.
|
||||
*/
|
||||
|
||||
sinfo("rtcb=0x%p g_current_regs=0x%p\n",
|
||||
this_task(), g_current_regs);
|
||||
|
||||
if (tcb == this_task())
|
||||
{
|
||||
/* CASE 1: We are not in an interrupt handler and
|
||||
* a task is signaling itself for some reason.
|
||||
*/
|
||||
|
||||
if (!g_current_regs)
|
||||
{
|
||||
/* In this case just deliver the signal now. */
|
||||
|
||||
sigdeliver(tcb);
|
||||
}
|
||||
|
||||
/* CASE 2: We are in an interrupt handler AND the
|
||||
* interrupted task is the same as the one that
|
||||
* must receive the signal, then we will have to modify
|
||||
* the return state as well as the state in the TCB.
|
||||
*
|
||||
* Hmmm... there looks like a latent bug here: The following
|
||||
* logic would fail in the strange case where we are in an
|
||||
* interrupt handler, the thread is signaling itself, but
|
||||
* a context switch to another task has occurred so that
|
||||
* g_current_regs does not refer to the thread of this_task()!
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
/* Save the return EPC and STATUS registers. These will be
|
||||
* restored by the signal trampoline after the signals have
|
||||
* been delivered.
|
||||
*/
|
||||
|
||||
tcb->xcp.sigdeliver = sigdeliver;
|
||||
tcb->xcp.saved_epc = g_current_regs[REG_EPC];
|
||||
|
||||
/* Then set up to vector to the trampoline with interrupts
|
||||
* disabled
|
||||
*/
|
||||
|
||||
g_current_regs[REG_EPC] = (uint32_t)up_sigdeliver;
|
||||
|
||||
/* And make sure that the saved context in the TCB
|
||||
* is the same as the interrupt return context.
|
||||
*/
|
||||
|
||||
up_savestate(tcb->xcp.regs);
|
||||
|
||||
// sinfo("PC/STATUS Saved: %08x/%08x New: %08x/%08x\n",
|
||||
// tcb->xcp.saved_epc, tcb->xcp.saved_int_ctx,
|
||||
// g_current_regs[REG_EPC], g_current_regs[REG_STATUS]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise, we are (1) signaling a task is not running
|
||||
* from an interrupt handler or (2) we are not in an
|
||||
* interrupt handler and the running task is signaling
|
||||
* some non-running task.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
/* Save the return EPC and STATUS registers. These will be
|
||||
* restored by the signal trampoline after the signals have
|
||||
* been delivered.
|
||||
*/
|
||||
|
||||
tcb->xcp.sigdeliver = sigdeliver;
|
||||
tcb->xcp.saved_epc = tcb->xcp.regs[REG_EPC];
|
||||
|
||||
/* Then set up to vector to the trampoline with interrupts
|
||||
* disabled
|
||||
*/
|
||||
|
||||
tcb->xcp.regs[REG_EPC] = (uint32_t)up_sigdeliver;
|
||||
|
||||
// sinfo("PC/STATUS Saved: %08x/%08x New: %08x/%08x\n",
|
||||
// tcb->xcp.saved_epc, tcb->xcp.saved_int_ctx,
|
||||
// tcb->xcp.regs[REG_EPC], tcb->xcp.regs[REG_STATUS]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,6 +41,25 @@
|
|||
* finally to FC or cluster. Peripherals share the same IRQ entry.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file interrupt.c
|
||||
* @brief support gap8 interrupt enable and disable
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
/*************************************************
|
||||
File name: interrupt.c
|
||||
Description: support gap8 interrupt enable and disable
|
||||
Others: take nuttx/arch/risc-v/gap8/gap8_interrupt.c for references
|
||||
https://github.com/apache/incubator-nuttx.git
|
||||
History:
|
||||
1. Date: 2021-09-02
|
||||
Author: AIIT XUOS Lab
|
||||
Modification: modify interrupt enable/disable function and add interrupt process function
|
||||
*************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
@ -73,7 +92,7 @@ void up_mdelay(unsigned int time)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_disable_irq
|
||||
* Name: ArchDisableHwIrq
|
||||
*
|
||||
* Description:
|
||||
* Disable the IRQ specified by 'irq'. Mind the Machine privilege.
|
||||
|
@ -85,7 +104,7 @@ int ArchDisableHwIrq(uint32_t irq_num)
|
|||
FCEU->MASK_IRQ_AND = (1UL << irq_num);
|
||||
}
|
||||
/****************************************************************************
|
||||
* Name: up_enable_irq
|
||||
* Name: ArchEnableHwIrq
|
||||
*
|
||||
* Description:
|
||||
* Enable the IRQ specified by 'irq'. Mind the Machine privilege.
|
||||
|
@ -98,124 +117,8 @@ int ArchEnableHwIrq(uint32_t irq_num)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ack_irq
|
||||
*
|
||||
* Description:
|
||||
* Acknowledge the IRQ
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_ack_irq(int irq)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: _current_privilege
|
||||
*
|
||||
* Description:
|
||||
* Get the current privilege mode. 0x0 for user mode, and 0x3 for machine
|
||||
* mode.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// static inline uint32_t _current_privilege(void)
|
||||
// {
|
||||
// uint32_t result;
|
||||
|
||||
// asm volatile ("csrr %0, 0xC10" : "=r" (result));
|
||||
|
||||
// return result;
|
||||
// }
|
||||
/****************************************************************************
|
||||
* Name: up_irq_restore
|
||||
*
|
||||
* Description:
|
||||
* Restore previous IRQ mask state
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// static inline void up_irq_restore(unsigned int pri)
|
||||
// {
|
||||
// if (_current_privilege())
|
||||
// {
|
||||
// /* Machine mode - mstatus */
|
||||
|
||||
// asm volatile("csrw 0x300, %0" : /* no output */ : "r" (pri));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /* User mode - ustatus */
|
||||
|
||||
// asm volatile("csrw 0x000, %0" : /* no output */ : "r" (pri));
|
||||
// }
|
||||
// }
|
||||
/****************************************************************************
|
||||
* Name: up_irq_save
|
||||
*
|
||||
* Description:
|
||||
* Disable interrupt and return the current interrupt state.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// x_base up_irq_save(void)
|
||||
// {
|
||||
// x_base oldstat;
|
||||
// x_base newstat;
|
||||
|
||||
// if (_current_privilege())
|
||||
// {
|
||||
// /* Machine mode: Unset MIE and UIE */
|
||||
|
||||
// asm volatile ("csrr %0, 0x300": "=r" (oldstat));
|
||||
// newstat = oldstat & ~(0x9);
|
||||
// asm volatile("csrw 0x300, %0" : /* no output */ : "r" (newstat));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /* User mode: Unset UIE */
|
||||
|
||||
// asm volatile ("csrr %0, 0x000": "=r" (oldstat));
|
||||
// newstat = oldstat & ~(1L << 0);
|
||||
// asm volatile("csrw 0x000, %0" : /* no output */ : "r" (newstat));
|
||||
// }
|
||||
|
||||
// return oldstat;
|
||||
// }
|
||||
/****************************************************************************
|
||||
* Name: up_irq_save
|
||||
*
|
||||
* Description:
|
||||
* Disable interrupt and return the current interrupt state.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
x_base DisableLocalInterrupt(void)
|
||||
{
|
||||
// x_base oldstat;
|
||||
// x_base newstat;
|
||||
|
||||
// if (_current_privilege())
|
||||
// {
|
||||
// /* Machine mode: Unset MIE and UIE */
|
||||
// asm volatile("nop");
|
||||
// asm volatile ("csrr %0, 0x300": "=r" (oldstat));
|
||||
// newstat = oldstat & ~(0x9);
|
||||
// asm volatile("csrw 0x300, %0" : /* no output */ : "r" (newstat));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /* User mode: Unset UIE */
|
||||
|
||||
// asm volatile ("csrr %0, 0x000": "=r" (oldstat));
|
||||
// newstat = oldstat & ~(1L << 0);
|
||||
// asm volatile("csrw 0x000, %0" : /* no output */ : "r" (newstat));
|
||||
// }
|
||||
|
||||
// return oldstat;
|
||||
|
||||
x_base level;
|
||||
asm volatile("nop");
|
||||
asm volatile ("csrrci %0, mstatus, 8" : "=r"(level));
|
||||
|
@ -226,7 +129,7 @@ x_base DisableLocalInterrupt(void)
|
|||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_irq_enable
|
||||
* Name: EnableLocalInterrupt
|
||||
*
|
||||
* Description:
|
||||
* Return the current interrupt state and enable interrupts
|
||||
|
@ -237,23 +140,6 @@ void EnableLocalInterrupt(x_base oldstat)
|
|||
{
|
||||
x_base newstat;
|
||||
|
||||
// if (_current_privilege())
|
||||
// {
|
||||
// /* Machine mode: Set MIE and UIE */
|
||||
// asm volatile("nop");
|
||||
// asm volatile ("csrr %0, 0x300": "=r" (oldstat));
|
||||
// newstat = oldstat | (0x8);
|
||||
// // asm volatile("csrw 0x300, %0" : /* no output */ : "r" (newstat));
|
||||
// asm volatile("csrw mstatus, %0" : /* no output */ : "r" (newstat));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// /* User mode: Set UIE */
|
||||
|
||||
// asm volatile ("csrr %0, 0x000": "=r" (oldstat));
|
||||
// newstat = oldstat | (1L << 0);
|
||||
// asm volatile("csrw 0x000, %0" : /* no output */ : "r" (newstat));
|
||||
// }
|
||||
asm volatile ("csrw mstatus, %0" :: "r"(oldstat));
|
||||
}
|
||||
|
||||
|
@ -273,25 +159,7 @@ void gap8_sleep_wait_sw_evnt(uint32_t event_mask)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
*
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_get_newintctx
|
||||
*
|
||||
* Description:
|
||||
* Return a value for EPIC. But GAP8 doesn't use EPIC for event control.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t up_get_newintctx(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_irqinitialize
|
||||
* Name: irqinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the IRQ on FC.
|
||||
|
@ -300,7 +168,6 @@ uint32_t up_get_newintctx(void)
|
|||
extern void gap8_udma_doirq(int irq, void *arg);
|
||||
void irqinitialize(void)
|
||||
{
|
||||
x_base level;
|
||||
/* Deactivate all the soc events */
|
||||
|
||||
SOC_EU->FC_MASK_MSB = 0xffffffff;
|
||||
|
@ -311,12 +178,6 @@ void irqinitialize(void)
|
|||
isrManager.done->registerIrq(GAP8_IRQ_FC_UDMA, gap8_udma_doirq, NONE);
|
||||
isrManager.done->enableIrq(GAP8_IRQ_FC_UDMA);
|
||||
|
||||
/* Attach system call handler */
|
||||
|
||||
// extern int up_swint(int irq, FAR void *context, FAR void *arg);
|
||||
// RegisterHwIrq(GAP8_IRQ_SYSCALL, up_swint, NULL);
|
||||
|
||||
// EnableLocalInterrupt(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -327,8 +188,6 @@ void irqinitialize(void)
|
|||
* or not.
|
||||
*
|
||||
****************************************************************************/
|
||||
extern void KTaskOsAssignAfterIrq(void *context);
|
||||
|
||||
void *gap8_dispatch_irq(uint32_t vector, void *current_regs)
|
||||
{
|
||||
/* Clear pending bit and trigger a software event.
|
||||
|
|
|
@ -0,0 +1,175 @@
|
|||
# 从零开始构建矽璓工业物联操作系统:使用risc-v架构的gapuino 开发板
|
||||
|
||||
[XiUOS](http://xuos.io/) (X Industrial Ubiquitous Operating System) 矽璓工业物联操作系统是一款面向工业物联场景的泛在操作系统,来自泛在操作系统研究计划。所谓泛在操作系统(UOS: Ubiquitous Operating Systems),是支持互联网时代人机物融合泛在计算应用模式的新型操作系统,是传统操作系统概念的泛化与延伸。在泛在操作系统技术体系中,不同的泛在计算设备和泛在应用场景需要符合各自特性的不同UOS,XiUOS即是面向工业物联场景的一种UOS,主要由一个极简的微型实时操作系统(RTOS)内核和其上的智能工业物联框架构成,支持工业物联网(IIoT: Industrial Internet of Things)应用。
|
||||
|
||||
|
||||
## 开发环境搭建
|
||||
|
||||
### 推荐使用:
|
||||
|
||||
**操作系统:** ubuntu18.04 [https://ubuntu.com/download/desktop](https://ubuntu.com/download/desktop)
|
||||
|
||||
**开发工具推荐使用 VSCode ,VScode下载地址为:** VSCode [https://code.visualstudio.com/](https://code.visualstudio.com/),推荐下载地址为 [http://vscode.cdn.azure.cn/stable/3c4e3df9e89829dce27b7b5c24508306b151f30d/code_1.55.2-1618307277_amd64.deb](http://vscode.cdn.azure.cn/stable/3c4e3df9e89829dce27b7b5c24508306b151f30d/code_1.55.2-1618307277_amd64.deb)
|
||||
|
||||
### 依赖包安装:
|
||||
|
||||
```
|
||||
$ sudo apt install build-essential pkg-config
|
||||
$ sudo apt install gcc make libncurses5-dev openssl libssl-dev bison flex libelf-dev autoconf libtool gperf libc6-dev git
|
||||
```
|
||||
|
||||
**源码下载:** XiUOS [https://forgeplus.trustie.net/projects/xuos/xiuos](https://forgeplus.trustie.net/projects/xuos/xiuos)
|
||||
|
||||
新建一个空文件夹并进入文件夹中,并下载源码,具体命令如下:
|
||||
|
||||
```c
|
||||
mkdir test && cd test
|
||||
git clone https://git.trustie.net/xuos/xiuos.git
|
||||
```
|
||||
|
||||
打开源码文件包可以看到以下目录:
|
||||
| 名称 | 说明 |
|
||||
| -- | -- |
|
||||
| application | 应用代码 |
|
||||
| board | 板级支持包 |
|
||||
| framework | 应用框架 |
|
||||
| fs | 文件系统 |
|
||||
| kernel | 内核源码 |
|
||||
| resources | 驱动文件 |
|
||||
| tool | 系统工具 |
|
||||
|
||||
使用VScode打开代码,具体操作步骤为:在源码文件夹下打开系统终端,输入`code .`即可打开VScode开发环境,如下图所示:
|
||||
|
||||

|
||||
|
||||
### 裁减配置工具的下载
|
||||
|
||||
裁减配置工具:
|
||||
|
||||
**工具地址:** kconfig-frontends [https://forgeplus.trustie.net/projects/xuos/kconfig-frontends](https://forgeplus.trustie.net/projects/xuos/kconfig-frontends)
|
||||
|
||||
```c
|
||||
mkdir kfrontends && cd kfrontends
|
||||
git clone https://git.trustie.net/xuos/kconfig-frontends.git
|
||||
```
|
||||
|
||||
下载源码后按以下步骤执行软件安装:
|
||||
|
||||
```c
|
||||
cd kconfig-frontends
|
||||
./xs_build.sh
|
||||
```
|
||||
|
||||
### 编译工具链:
|
||||
|
||||
RISC-V: riscv-none-embed-,默认安装到Ubuntu的/opt/,下载源码并解压。[下载网址 http://101.36.126.201:8011/gnu-mcu-eclipse.tar.bz2](http://101.36.126.201:8011/gnu-mcu-eclipse.tar.bz2)
|
||||
|
||||
```shell
|
||||
$ tar -xjf gnu-mcu-eclipse.tar.bz2 -C /opt/
|
||||
```
|
||||
|
||||
将上述解压的编译工具链的路径添加到board/hifive1-rev-B/config.mk文件当中,例如:
|
||||
|
||||
```
|
||||
export CROSS_COMPILE ?=/opt/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.1-20190425-1021/bin/riscv-none-embed-
|
||||
```
|
||||
|
||||
若已存在`export CROSS_COMPILE ?=xxxx` 应该将原有的语句注释,再写入上面的语句。
|
||||
|
||||
# 在gapuino board 上创建第一个应用
|
||||
|
||||
## 1.gapuino board 简介
|
||||
|
||||
| 硬件 | 描述 |
|
||||
| -- | -- |
|
||||
|芯片型号| gap8 |
|
||||
|架构| RV32IMAC |
|
||||
|主频| 200+MHz |
|
||||
|片内SRAM| 512KB |
|
||||
| 外设 | UART、SPI、I2C |
|
||||
|
||||
XiUOS板级当前支持使用UART。
|
||||
|
||||
## 2. 代码编写与编译说明
|
||||
|
||||
编辑环境:`VScode`
|
||||
|
||||
编译工具链:`riscv-none-embed-gcc`
|
||||
|
||||
使用`VScode`打开工程的方法有多种,本文介绍一种快捷键,在项目目录下将`code .`输入终端即可打开目标项目
|
||||
|
||||
修改`applications`文件夹下`main.c`
|
||||
|
||||
在输出函数中写入 Hello, world! \n 完成代码编辑。
|
||||
|
||||
|
||||
编译步骤:
|
||||
|
||||
1.在VScode终端下执行以下命令,生成配置文件
|
||||
|
||||
```
|
||||
make BOARD=gapuino menuconfig
|
||||
```
|
||||
|
||||
2.在menuconfig界面配置需要关闭和开启的功能,按回车键进入下级菜单,按Y键选中需要开启的功能,按N键选中需要关闭的功能,配置结束后选择Exit保存并退出
|
||||
|
||||

|
||||
|
||||
3.继续执行以下命令,进行编译
|
||||
|
||||
```
|
||||
make BOARD=gapuino
|
||||
```
|
||||
|
||||
4.如果编译正确无误,build文件夹下会产生XiUOS_gapuino.elf、XiUOS_gapuino.bin文件。
|
||||
|
||||
>注:最后可以执行以下命令,清除配置文件和编译生成的文件
|
||||
|
||||
```
|
||||
make BOARD=gapuino distclean
|
||||
```
|
||||
|
||||
## 3. 烧写及执行
|
||||
|
||||
gapuino支持jtag,可以通过jtag进行烧录和调试。
|
||||
调试烧写需要下载gap sdk和openocd,下载配置方法参见以下文档:
|
||||
https://greenwaves-technologies.com/setting-up-sdk/
|
||||
|
||||
在SDK 和openocd安装完成以后,按照如下步骤进行调试:
|
||||
|
||||
1、进入sdk目录路径下
|
||||
```
|
||||
cd ~/gap_sdk
|
||||
```
|
||||
|
||||
2、在当前终端输入
|
||||
```
|
||||
source sourceme.sh
|
||||
```
|
||||
出现如下图所示的界面,输入7选择单板名称;
|
||||

|
||||
|
||||
3、先按开发板的复位键,再在当前终端输入
|
||||
```
|
||||
gap8-openocd -f interface/ftdi/gapuino_ftdi.cfg -f target/gap8.tcl -f tcl/jtag_boot_entry.tcl
|
||||
```
|
||||
在当前终端连接openocd,连接如下图所示:
|
||||

|
||||
|
||||
4、打开一个新的终端,输入以下命令打开终端串口:
|
||||
```
|
||||
sudo apt install screen
|
||||
screen /dev/ttyUSB0 115200
|
||||
```
|
||||
|
||||
5、打开一个新的终端,进入编译生成的elf路径,输入例如:
|
||||
```
|
||||
riscv32-unknown-elf-gdb build/XiUOS_gapuino.elf -ex "target remote localhost:3333"
|
||||
```
|
||||
结果如下图所示:
|
||||

|
||||
|
||||
6、再输入load,最后输入continue命令即可在串口终端看到系统运行界面,如下图所示:
|
||||

|
||||
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
README
|
||||
======
|
||||
|
||||
gapuino is an evaluation board for GAP8, a 1+8-core DSP-like RISC-V
|
||||
MCU. GAP8 features a RI5CY core called Fabric Controller(FC), and a
|
||||
cluster of 8 RI5CY cores that runs at a bit slower speed. GAP8 is an
|
||||
implementation of the opensource PULP platform, a Parallel-Ultra-Low-
|
||||
Power design.
|
||||
|
||||
The port is currently very minimal, though additional support may be
|
||||
added in the future to address more of the board peripherals.
|
||||
|
||||
Supported:
|
||||
- USB UART (console port)
|
||||
- uDMA on SOC domain
|
||||
- FLL clock scaling
|
||||
|
||||
Not supported:
|
||||
- SPI, I2C, I2S, CPI, LVDS, Hyper-bus on the uDMA subsystem
|
||||
- the sensor board
|
||||
- the 8-core cluster
|
||||
- the Hardware convolution engine
|
||||
|
||||
See also:
|
||||
gapuino board and the sensor board:
|
||||
https://gwt-website-files.s3.amazonaws.com/gapuino_um.pdf
|
||||
https://gwt-website-files.s3.amazonaws.com/gapuino_multisensor_um.pdf
|
||||
GAP8 datasheet:
|
||||
https://gwt-website-files.s3.amazonaws.com/gap8_datasheet.pdf
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
- Environment Setup
|
||||
- Configurations
|
||||
- Execute
|
||||
|
||||
Environment Setup
|
||||
=================
|
||||
First, setup the gap_sdk from GreenwavesTechnologies' github repo.
|
||||
Follow the README to setup the toolchain and environment.
|
||||
https://github.com/GreenWaves-Technologies/gap_sdk/
|
||||
|
||||
Configurations
|
||||
==============
|
||||
Each gapuino configuration is maintained in a sub-directory and can
|
||||
be selected as follow:
|
||||
|
||||
tools/configure.sh gapuino:<subdir>
|
||||
|
||||
Where <subdir> is one of the following:
|
||||
|
||||
nsh
|
||||
---
|
||||
This is an NSH example that uses the UART connected to FT2232 as
|
||||
the console. Default UART settings are 115200, 8N1.
|
||||
|
||||
Execute
|
||||
=======
|
||||
You may download the ELF to the board by `plpbridge` in gap_sdk.
|
||||
Remember to first `cd` to the gap_sdk/ and `source sourceme.sh`, so
|
||||
that you have the $GAP_SDK_HOME environment variable.
|
||||
|
||||
Use the following command to download and run the ELF through JTAG:
|
||||
|
||||
$GAP_SDK_HOME/install/workstation/bin/plpbridge \
|
||||
--cable=ftdi@digilent --boot-mode=jtag --chip=gap \
|
||||
--binary=nuttx \
|
||||
load ioloop reqloop start wait
|
||||
|
||||
As for debugging, the following command download the ELF and opens
|
||||
a gdbserver on port 1234:
|
||||
|
||||
$GAP_SDK_HOME/install/workstation/bin/plpbridge \
|
||||
--cable=ftdi@digilent --boot-mode=jtag --chip=gap \
|
||||
--binary=nuttx \
|
||||
load ioloop gdb wait
|
||||
|
||||
And then launch the gdb on another terminal:
|
||||
|
||||
riscv32-unknown-elf-gdb nuttx
|
||||
...
|
||||
(gdb) target remote :1234
|
||||
Remote debugging using :1234
|
||||
IRQ_U_Vector_Base () at chip/startup_gap8.S:293
|
||||
293 j reset_handler /* 32 */
|
||||
(gdb)
|
||||
|
||||
And then enjoy yourself debugging with the CLI gdb :-)
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
/**
|
||||
* @file board.c
|
||||
* @brief support hifive1-rev-B-board init configure and start-up
|
||||
* @brief support gap8 init configure and start-up
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-04-25
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
|
@ -27,14 +27,10 @@ extern void entry(void);
|
|||
extern int InitHwUart(void);
|
||||
extern void irqinitialize(void);
|
||||
extern void timer_initialize(void);
|
||||
extern void up_serialinit(void);
|
||||
extern void gapuino_sysinit(void);
|
||||
|
||||
extern unsigned int __bss_end__;
|
||||
|
||||
extern void test_dma_txstart(char c, uint32_t size);
|
||||
extern void test_gap8_uartinit();
|
||||
extern void gapuino_sysinit(void);
|
||||
|
||||
void GapuinoStart(uint32_t mhartid)
|
||||
{
|
||||
gapuino_sysinit();
|
||||
|
@ -42,8 +38,6 @@ void GapuinoStart(uint32_t mhartid)
|
|||
}
|
||||
void InitBoardHardware(void)
|
||||
{
|
||||
x_base newstat;
|
||||
x_base oldstat;
|
||||
irqinitialize();
|
||||
|
||||
InitBoardMemory(MEMORY_START_ADDRESS, MEMORY_END_ADDRESS);
|
||||
|
@ -51,10 +45,6 @@ void InitBoardHardware(void)
|
|||
InitHwUart();
|
||||
InstallConsole("uart0", "uart0_drv", "uart0_dev0");
|
||||
|
||||
// asm volatile("nop");
|
||||
// asm volatile ("csrr %0, 0x300": "=r" (oldstat));
|
||||
// newstat = oldstat | (0x8);
|
||||
// asm volatile("csrw mstatus, %0" : /* no output */ : "r" (newstat));
|
||||
KPrintf("console init completed.\n");
|
||||
KPrintf("board initialization......\n");
|
||||
|
||||
|
|
|
@ -1,57 +1,40 @@
|
|||
/****************************************************************************
|
||||
* boards/risc-v/gap8/gapuino/include/board.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: hhuysqt <1020988872@qq.com>
|
||||
*
|
||||
* 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 NuttX 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file board.h
|
||||
* @brief define gapuino-board init configure and start-up function
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
/*************************************************
|
||||
File name: board.h
|
||||
Description: define gapuino-board init configure and start-up function
|
||||
Others:
|
||||
History:
|
||||
1. Date: 2021-09-02
|
||||
Author: AIIT XUOS Lab
|
||||
Modification:
|
||||
1. define gapuino-board InitBoardHardware
|
||||
2. define gapuino-board data and bss struct
|
||||
*************************************************/
|
||||
#ifndef BOARD_H__
|
||||
#define BOARD_H__
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <xsconfig.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
|
@ -1,39 +1,14 @@
|
|||
/****************************************************************************
|
||||
* boards/risc-v/gap8/gapuino/scripts/ld.script
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: hhuysqt <1020988872@qq.com>
|
||||
*
|
||||
* 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 NuttX 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* Not needed, but we need separate linker scripts anyway */
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH( riscv )
|
||||
SEARCH_DIR(.)
|
||||
|
@ -133,18 +108,6 @@ SECTIONS
|
|||
|
||||
.bss :
|
||||
{
|
||||
/* . = ALIGN(4);
|
||||
_sbss = .;
|
||||
__bss_start__ = .;
|
||||
_fbss = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
_ebss = .; */
|
||||
__bss_start = ABSOLUTE(.);
|
||||
_fbss = .;
|
||||
|
||||
|
|
|
@ -13,14 +13,6 @@ menuconfig BSP_USING_SYSCLOCK
|
|||
source "$BSP_DIR/third_party_driver/sys_clock/Kconfig"
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_HWTIMER
|
||||
bool "Using HWTIMER device"
|
||||
default n
|
||||
select RESOURCES_HWTIMER
|
||||
if BSP_USING_HWTIMER
|
||||
source "$BSP_DIR/third_party_driver/timer/Kconfig"
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_UART
|
||||
bool "Using UART device"
|
||||
default y
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
SRC_FILES :=
|
||||
|
||||
ifeq ($(CONFIG_BSP_USING_DMA),y)
|
||||
SRC_DIR += udma
|
||||
endif
|
||||
SRC_DIR := timer
|
||||
|
||||
ifeq ($(CONFIG_BSP_USING_GPIO),y)
|
||||
SRC_DIR += gpio
|
||||
|
@ -16,10 +13,6 @@ ifeq ($(CONFIG_BSP_USING_SYSCLOCK),y)
|
|||
SRC_DIR += sys_clock
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BSP_USING_HWTIMER),y)
|
||||
SRC_DIR += timer
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BSP_USING_UART),y)
|
||||
SRC_DIR += uart
|
||||
endif
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
* https://greenwavesdev2.wpengine.com/sdk-manuals/
|
||||
* @version 1.1
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-07-27
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -34,6 +34,25 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file: gap8_fll.c
|
||||
* @brief: support gap8 clk
|
||||
* @version: 1.0
|
||||
* @author: AIIT XUOS Lab
|
||||
* @date: 2021-09-02
|
||||
*/
|
||||
|
||||
/*************************************************
|
||||
File name: hardware_gpio.c
|
||||
Description: support gap8 clk
|
||||
Others:
|
||||
History:
|
||||
1. Date: 2021-09-02
|
||||
Author: AIIT XUOS Lab
|
||||
Modification:
|
||||
|
||||
*************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* FC can run up to 250MHz@1.2V, and 150MHz@1.0V. While the default voltage
|
||||
* of PMU is 1.2V, it's okay to boost up without considering PMU.
|
||||
|
|
|
@ -33,6 +33,25 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file: gapuino_sysinit.c
|
||||
* @brief: support gap8 clk
|
||||
* @version: 1.0
|
||||
* @author: AIIT XUOS Lab
|
||||
* @date: 2021-09-02
|
||||
*/
|
||||
|
||||
/*************************************************
|
||||
File name: gapuino_sysinit.c
|
||||
Description: support gap8 clk
|
||||
Others:
|
||||
History:
|
||||
1. Date: 2021-09-02
|
||||
Author: AIIT XUOS Lab
|
||||
Modification:
|
||||
|
||||
*************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
|
|
@ -34,6 +34,25 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file: hardware_hwtimer.c
|
||||
* @brief: support gap8 tick interrupt
|
||||
* @version: 1.0
|
||||
* @author: AIIT XUOS Lab
|
||||
* @date: 2021-09-02
|
||||
*/
|
||||
|
||||
/*************************************************
|
||||
File name: hardware_hwtimer.c
|
||||
Description: support gap8 tick interrupt
|
||||
Others:
|
||||
History:
|
||||
1. Date: 2021-09-02
|
||||
Author: AIIT XUOS Lab
|
||||
Modification:
|
||||
add tick interrupt isr
|
||||
*************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* FC core has a 64-bit basic timer, able to split into 2 32-bit timers,
|
||||
* with identicle memory map and 2 IRQ channels, for both FC core and
|
||||
|
@ -88,7 +107,7 @@ void gap8_timisr(int irq, void *arg)
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_timer_initialize
|
||||
* Name: timer_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the timer based on the frequency of source clock and ticks
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* @brief support gap8-board uart function and register to bus framework
|
||||
* @version 1.1
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-07-23
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
#include <xiuos.h>
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
* https://greenwavesdev2.wpengine.com/sdk-manuals/
|
||||
* @version 1.1
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-07-27
|
||||
* @date 2021-09-02
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
|
|
Loading…
Reference in New Issue