forked from xuos/xiuos
suuport atti-riscv64-board onnuttx
This commit is contained in:
parent
316798e98c
commit
57e98cb8af
|
@ -0,0 +1,8 @@
|
||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see misc/tools/kconfig-language.txt.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ARCH_BOARD_AIIT_RISCV64
|
||||||
|
|
||||||
|
endif
|
|
@ -0,0 +1,47 @@
|
||||||
|
1. Download and install toolchain
|
||||||
|
|
||||||
|
$ curl https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
|
||||||
|
|
||||||
|
2. Build and install qemu
|
||||||
|
|
||||||
|
$ git clone https://github.com/qemu/qemu
|
||||||
|
$ cd qemu
|
||||||
|
$ ./configure --target-list=riscv64-softmmu
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
|
||||||
|
3. Modify defconfig
|
||||||
|
|
||||||
|
--- a/boards/risc-v/k210/aiit-riscv64-board/configs/nsh/defconfig
|
||||||
|
+++ b/boards/risc-v/k210/aiit-riscv64-board/configs/nsh/defconfig
|
||||||
|
@@ -25,6 +25,7 @@ CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
+CONFIG_K210_WITH_QEMU=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
|
||||||
|
4. Configure and build NuttX
|
||||||
|
|
||||||
|
$ mkdir ./nuttx; cd ./nuttx
|
||||||
|
$ git clone https://github.com/apache/incubator-nuttx.git
|
||||||
|
$ git clone https://github.com/apache/incubator-nuttx-apps.git
|
||||||
|
$ cd nuttx
|
||||||
|
$ make distclean
|
||||||
|
$ ./tools/configure.sh aiit-riscv64-board:nsh
|
||||||
|
$ make V=1
|
||||||
|
|
||||||
|
5. Run the nuttx with qemu
|
||||||
|
|
||||||
|
$ qemu-system-riscv64 -nographic -machine sifive_u -bios ./nuttx
|
||||||
|
|
||||||
|
NOTE: To run nuttx for kostest, gdb needs to be used to load both nuttx_user.elf and nuttx
|
||||||
|
|
||||||
|
$ qemu-system-riscv64 -nographic -machine sifive_u -s -S
|
||||||
|
$ riscv64-unknown-elf-gdb -ex 'target extended-remot:1234' -ex 'load nuttx_user.elf' -ex 'load nuttx' -ex 'c'
|
||||||
|
|
||||||
|
6. TODO
|
||||||
|
|
||||||
|
Support FPU
|
||||||
|
Support RISC-V User mode
|
|
@ -0,0 +1,42 @@
|
||||||
|
1. Download and install toolchain and openocd-k210
|
||||||
|
|
||||||
|
$ curl https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
|
||||||
|
$ export PATH=$PATH:/$TOOL_CHAIN_PATH/bin
|
||||||
|
|
||||||
|
2. Build openocd-k210
|
||||||
|
|
||||||
|
$ git clone https://github.com/kendryte/openocd-kendryte
|
||||||
|
$ cd openocd-kendryte
|
||||||
|
$ ./bootstrap & ./configure & make
|
||||||
|
|
||||||
|
3. Configure and build NuttX
|
||||||
|
|
||||||
|
$ mkdir ./nuttx; cd ./nuttx
|
||||||
|
$ git clone https://github.com/apache/incubator-nuttx.git nuttx
|
||||||
|
$ git clone https://github.com/apache/incubator-nuttx-apps.git apps
|
||||||
|
$ cd nuttx
|
||||||
|
$ make distclean
|
||||||
|
$ ./tools/configure.sh aiit-riscv64-board:nsh
|
||||||
|
$ make V=1
|
||||||
|
|
||||||
|
4. Download and run the nuttx from SRAM (not SPI-Flash)
|
||||||
|
|
||||||
|
$ picocom -b 115200 /dev/ttyUSB0
|
||||||
|
$ sudo ./src/openocd -s ./tcl -f ./tcl/kendryte.cfg -m 0
|
||||||
|
$ riscv64-unknown-elf-gdb ./nuttx
|
||||||
|
(gdb) target extended-remote :3333
|
||||||
|
(gdb) load nuttx
|
||||||
|
(gdb) c
|
||||||
|
|
||||||
|
5. Write nuttx.bin to SPI-Flash
|
||||||
|
|
||||||
|
$ pip3 install kflash
|
||||||
|
$ kflash -p /dev/ttyUSB0 -b 1500000 ./nuttx/nuttx.bin
|
||||||
|
|
||||||
|
NOTE: The kflash_gui is not recommended because it's unstable
|
||||||
|
|
||||||
|
6. TODO
|
||||||
|
|
||||||
|
Support peripherals such as GPIO/SPI/I2C/...
|
||||||
|
Support FPU
|
||||||
|
Support RISC-V U-mode including memory protection
|
|
@ -0,0 +1,53 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BOARDCTL=y
|
||||||
|
CONFIG_BOARDCTL_APP_SYMTAB=y
|
||||||
|
CONFIG_BOARDCTL_ROMDISK=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_ELF=y
|
||||||
|
CONFIG_ELF_ALIGN_LOG2=3
|
||||||
|
CONFIG_EXAMPLES_ELF=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_ROMFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_ENVPATH=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_PATH_INITIAL="/mnt/romfs"
|
||||||
|
CONFIG_PIPES=y
|
||||||
|
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=3072
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=5
|
||||||
|
CONFIG_START_MONTH=2
|
||||||
|
CONFIG_START_YEAR=2020
|
||||||
|
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="elf_main"
|
|
@ -0,0 +1,54 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_USE_MPU=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILD_PROTECTED=y
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_MM_KERNEL_HEAPSIZE=524288
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_NUTTX_USERSPACE=0x80100000
|
||||||
|
CONFIG_PASS1_BUILDIR="boards/risc-v/k210/aiit-riscv64-board/kernel"
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=12
|
||||||
|
CONFIG_START_MONTH=5
|
||||||
|
CONFIG_START_YEAR=2020
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_SYS_RESERVED=9
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_TESTING_GETPRIME=y
|
||||||
|
CONFIG_TESTING_OSTEST=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
|
@ -0,0 +1,60 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_USE_MPU=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILD_PROTECTED=y
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_MM_KERNEL_HEAPSIZE=524288
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_NSH_STRERROR=y
|
||||||
|
CONFIG_NUTTX_USERSPACE=0x80100000
|
||||||
|
CONFIG_PASS1_BUILDIR="boards/risc-v/k210/aiit-riscv64-board/kernel"
|
||||||
|
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SMP=y
|
||||||
|
CONFIG_SMP_NCPUS=2
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=9
|
||||||
|
CONFIG_START_MONTH=4
|
||||||
|
CONFIG_START_YEAR=2021
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_SYSTEM_SYSTEM=y
|
||||||
|
CONFIG_SYSTEM_TASKSET=y
|
||||||
|
CONFIG_SYS_RESERVED=9
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_TESTING_GETPRIME=y
|
||||||
|
CONFIG_TESTING_OSTEST=y
|
||||||
|
CONFIG_TESTING_SMP=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
|
@ -0,0 +1,49 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_USE_MPU=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILD_PROTECTED=y
|
||||||
|
CONFIG_DEBUG_ASSERTIONS=y
|
||||||
|
CONFIG_DEBUG_ERROR=y
|
||||||
|
CONFIG_DEBUG_FEATURES=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_MM_KERNEL_HEAPSIZE=524288
|
||||||
|
CONFIG_NUTTX_USERSPACE=0x80100000
|
||||||
|
CONFIG_PASS1_BUILDIR="boards/risc-v/k210/aiit-riscv64-board/kernel"
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=14
|
||||||
|
CONFIG_START_MONTH=2
|
||||||
|
CONFIG_START_YEAR=2020
|
||||||
|
CONFIG_SYS_RESERVED=9
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_TESTING_OSTEST=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="ostest_main"
|
|
@ -0,0 +1,55 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BOARDCTL=y
|
||||||
|
CONFIG_BOARDCTL_APP_SYMTAB=y
|
||||||
|
CONFIG_BOARDCTL_ROMDISK=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_ELF=y
|
||||||
|
CONFIG_ELF_ALIGN_LOG2=3
|
||||||
|
CONFIG_EXAMPLES_MODULE=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_ROMFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_ENVPATH=y
|
||||||
|
CONFIG_LIBC_EXECFUNCS=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_MODULE=y
|
||||||
|
CONFIG_PATH_INITIAL="/mnt/romfs"
|
||||||
|
CONFIG_PIPES=y
|
||||||
|
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=3072
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=5
|
||||||
|
CONFIG_START_MONTH=2
|
||||||
|
CONFIG_START_YEAR=2020
|
||||||
|
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="module_main"
|
|
@ -0,0 +1,56 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_DISABLE_LOSMART is not set
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BINFMT_DISABLE=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_DISABLE_IFUPDOWN=y
|
||||||
|
CONFIG_NSH_DISABLE_MKDIR=y
|
||||||
|
CONFIG_NSH_DISABLE_RM=y
|
||||||
|
CONFIG_NSH_DISABLE_RMDIR=y
|
||||||
|
CONFIG_NSH_DISABLE_UMOUNT=y
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_NSH_STRERROR=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=28
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2019
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_TESTING_GETPRIME=y
|
||||||
|
CONFIG_TESTING_OSTEST=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
|
@ -0,0 +1,52 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BOARDCTL=y
|
||||||
|
CONFIG_BOARDCTL_APP_SYMTAB=y
|
||||||
|
CONFIG_BOARDCTL_ROMDISK=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_ELF=y
|
||||||
|
CONFIG_EXAMPLES_POSIXSPAWN=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_ROMFS=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_ENVPATH=y
|
||||||
|
CONFIG_LIBC_EXECFUNCS=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_PATH_INITIAL="/mnt/romfs"
|
||||||
|
CONFIG_PIPES=y
|
||||||
|
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=28
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2019
|
||||||
|
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="posix_spawn_main"
|
|
@ -0,0 +1,61 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_DISABLE_LOSMART is not set
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BINFMT_DISABLE=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_PROCFS_REGISTER=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_DISABLE_IFUPDOWN=y
|
||||||
|
CONFIG_NSH_DISABLE_MKDIR=y
|
||||||
|
CONFIG_NSH_DISABLE_RM=y
|
||||||
|
CONFIG_NSH_DISABLE_RMDIR=y
|
||||||
|
CONFIG_NSH_DISABLE_UMOUNT=y
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_NSH_STRERROR=y
|
||||||
|
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SMP=y
|
||||||
|
CONFIG_SMP_NCPUS=2
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=8
|
||||||
|
CONFIG_START_YEAR=2020
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_SYSTEM_SYSTEM=y
|
||||||
|
CONFIG_SYSTEM_TASKSET=y
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_TESTING_GETPRIME=y
|
||||||
|
CONFIG_TESTING_OSTEST=y
|
||||||
|
CONFIG_TESTING_SMP=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
|
@ -0,0 +1,66 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_DISABLE_LOSMART is not set
|
||||||
|
# CONFIG_STANDARD_SERIAL is not set
|
||||||
|
CONFIG_ARCH="risc-v"
|
||||||
|
CONFIG_ARCH_BOARD="aiit-riscv64-board"
|
||||||
|
CONFIG_ARCH_BOARD_AIIT_RISCV64=y
|
||||||
|
CONFIG_ARCH_CHIP="k210"
|
||||||
|
CONFIG_ARCH_CHIP_K210=y
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||||
|
CONFIG_ARCH_RISCV=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_BINFMT_DISABLE=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=46000
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_DRIVER_NOTE=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_PROCFS_REGISTER=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
|
CONFIG_LIBC_STRERROR=y
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_NSH_STRERROR=y
|
||||||
|
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||||
|
CONFIG_PTHREAD_STACK_DEFAULT=3072
|
||||||
|
CONFIG_RAM_SIZE=6291456
|
||||||
|
CONFIG_RAM_START=0x80000000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_READLINE_CMD_HISTORY=y
|
||||||
|
CONFIG_SCHED_ATEXIT=y
|
||||||
|
CONFIG_SCHED_CHILD_STATUS=y
|
||||||
|
CONFIG_SCHED_HAVE_PARENT=y
|
||||||
|
CONFIG_SCHED_INSTRUMENTATION=y
|
||||||
|
CONFIG_SCHED_ONEXIT=y
|
||||||
|
CONFIG_SCHED_ONEXIT_MAX=32
|
||||||
|
CONFIG_SCHED_STARTHOOK=y
|
||||||
|
CONFIG_SMP=y
|
||||||
|
CONFIG_SMP_NCPUS=2
|
||||||
|
CONFIG_STACK_COLORATION=y
|
||||||
|
CONFIG_START_DAY=22
|
||||||
|
CONFIG_START_MONTH=4
|
||||||
|
CONFIG_START_YEAR=2021
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_SYSTEM_SYSTEM=y
|
||||||
|
CONFIG_SYSTEM_TASKSET=y
|
||||||
|
CONFIG_TASK_NAME_SIZE=20
|
||||||
|
CONFIG_TESTING_GETPRIME=y
|
||||||
|
CONFIG_TESTING_OSTEST=y
|
||||||
|
CONFIG_TESTING_SMP=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_USERMAIN_STACKSIZE=3072
|
||||||
|
CONFIG_USER_ENTRYPOINT="nsh_main"
|
|
@ -0,0 +1,92 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/maix-bit/include/board.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_K210_AIIT_RISCV64_INCLUDE_BOARD_H
|
||||||
|
#define __BOARDS_K210_AIIT_RISCV64_INCLUDE_BOARD_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "k210.h"
|
||||||
|
|
||||||
|
#include "k210_fpioa.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define BOARD_LED_PAD 14 /* Connected to red led */
|
||||||
|
|
||||||
|
/* Map pad 14 to gpiohs io 0 */
|
||||||
|
|
||||||
|
#define BOARD_LED_IO_FUNC K210_IO_FUNC_GPIOHS0
|
||||||
|
#define BOARD_LED_IO 0
|
||||||
|
|
||||||
|
#define LED_STARTED 0 /* N/C */
|
||||||
|
#define LED_HEAPALLOCATE 1 /* N/C */
|
||||||
|
#define LED_IRQSENABLED 2 /* N/C */
|
||||||
|
#define LED_STACKCREATED 3 /* N/C */
|
||||||
|
#define LED_INIRQ 4 /* N/C */
|
||||||
|
#define LED_SIGNAL 5 /* N/C */
|
||||||
|
#define LED_ASSERTION 6 /* N/C */
|
||||||
|
#define LED_PANIC 7 /* blink */
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: k210_boardinitialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void k210_boardinitialize(void);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __BOARDS_K210_AIIT_RISCV64_INCLUDE_BOARD_H */
|
|
@ -0,0 +1,103 @@
|
||||||
|
############################################################################
|
||||||
|
# boards/risc-v/k210/aiit-riscv64-board/kernel/Makefile
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
|
# The entry point name (if none is provided in the .config file)
|
||||||
|
|
||||||
|
CONFIG_USER_ENTRYPOINT ?= user_start
|
||||||
|
ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT))
|
||||||
|
|
||||||
|
# Get the paths to the libraries and the links script path in format that
|
||||||
|
# is appropriate for the host OS
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||||
|
# Windows-native toolchains
|
||||||
|
USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
|
||||||
|
USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld}"
|
||||||
|
USER_LDSCRIPT += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld}"
|
||||||
|
USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}"
|
||||||
|
USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}"
|
||||||
|
USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}"
|
||||||
|
else
|
||||||
|
# Linux/Cygwin-native toolchain
|
||||||
|
USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS)))
|
||||||
|
USER_LDSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld
|
||||||
|
USER_LDSCRIPT += -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld
|
||||||
|
USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex"
|
||||||
|
USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec"
|
||||||
|
USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin"
|
||||||
|
endif
|
||||||
|
|
||||||
|
USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT)
|
||||||
|
USER_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(USERLIBS))))
|
||||||
|
USER_LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
|
||||||
|
|
||||||
|
# Source files
|
||||||
|
|
||||||
|
CSRCS = k210_userspace.c
|
||||||
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
OBJS = $(COBJS)
|
||||||
|
|
||||||
|
# Targets:
|
||||||
|
|
||||||
|
all: $(TOPDIR)$(DELIM)nuttx_user.elf $(TOPDIR)$(DELIM)User.map
|
||||||
|
.PHONY: nuttx_user.elf depend clean distclean
|
||||||
|
|
||||||
|
$(COBJS): %$(OBJEXT): %.c
|
||||||
|
$(call COMPILE, $<, $@)
|
||||||
|
|
||||||
|
# Create the nuttx_user.elf file containing all of the user-mode code
|
||||||
|
|
||||||
|
nuttx_user.elf: $(OBJS)
|
||||||
|
$(Q) $(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) $(OBJS) --start-group $(USER_LDLIBS) --end-group $(USER_LIBGCC)
|
||||||
|
|
||||||
|
$(TOPDIR)$(DELIM)nuttx_user.elf: nuttx_user.elf
|
||||||
|
@echo "LD: nuttx_user.elf"
|
||||||
|
$(Q) cp -a nuttx_user.elf $(TOPDIR)$(DELIM)nuttx_user.elf
|
||||||
|
ifeq ($(CONFIG_INTELHEX_BINARY),y)
|
||||||
|
@echo "CP: nuttx_user.hex"
|
||||||
|
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex nuttx_user.elf $(USER_HEXFILE)
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_MOTOROLA_SREC),y)
|
||||||
|
@echo "CP: nuttx_user.srec"
|
||||||
|
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec nuttx_user.elf $(USER_SRECFILE)
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_RAW_BINARY),y)
|
||||||
|
@echo "CP: nuttx_user.bin"
|
||||||
|
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx_user.elf $(USER_BINFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(TOPDIR)$(DELIM)User.map: nuttx_user.elf
|
||||||
|
@echo "MK: User.map"
|
||||||
|
$(Q) $(NM) -n nuttx_user.elf >$(TOPDIR)$(DELIM)User.map
|
||||||
|
$(Q) $(CROSSDEV)size nuttx_user.elf
|
||||||
|
|
||||||
|
.depend:
|
||||||
|
|
||||||
|
depend: .depend
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(call DELFILE, nuttx_user.elf)
|
||||||
|
$(call DELFILE, "$(TOPDIR)$(DELIM)nuttx_user.*")
|
||||||
|
$(call DELFILE, "$(TOPDIR)$(DELIM)User.map")
|
||||||
|
$(call CLEAN)
|
||||||
|
|
||||||
|
distclean: clean
|
|
@ -0,0 +1,114 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/kernel/k210_userspace.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/mm/mm.h>
|
||||||
|
#include <nuttx/wqueue.h>
|
||||||
|
#include <nuttx/userspace.h>
|
||||||
|
|
||||||
|
#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_NUTTX_USERSPACE
|
||||||
|
# error "CONFIG_NUTTX_USERSPACE not defined"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_NUTTX_USERSPACE != 0x80100000
|
||||||
|
# error "CONFIG_NUTTX_USERSPACE must match the value in memory.ld"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* These 'addresses' of these values are setup by the linker script.
|
||||||
|
* They are not actual uint32_t storage locations!
|
||||||
|
* They are only used meaningfully in the following way:
|
||||||
|
*
|
||||||
|
* - The linker script defines, for example, the symbol_sdata.
|
||||||
|
* - The declaration extern uint32_t _sdata; makes C happy. C will believe
|
||||||
|
* that the value _sdata is the address of a uint32_t variable _data
|
||||||
|
* (it is not!).
|
||||||
|
* - We can recover the linker value then by simply taking the address of
|
||||||
|
* of _data. like: uint32_t *pdata = &_sdata;
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern uint32_t _stext; /* Start of .text */
|
||||||
|
extern uint32_t _etext; /* End_1 of .text + .rodata */
|
||||||
|
extern const uint32_t _eronly; /* End+1 of read only section */
|
||||||
|
extern uint32_t _sdata; /* Start of .data */
|
||||||
|
extern uint32_t _edata; /* End+1 of .data */
|
||||||
|
extern uint32_t _sbss; /* Start of .bss */
|
||||||
|
extern uint32_t _ebss; /* End+1 of .bss */
|
||||||
|
|
||||||
|
/* This is the user space entry point */
|
||||||
|
|
||||||
|
int CONFIG_USER_ENTRYPOINT(int argc, char *argv[]);
|
||||||
|
|
||||||
|
const struct userspace_s userspace locate_data(".userspace") =
|
||||||
|
{
|
||||||
|
/* General memory map */
|
||||||
|
|
||||||
|
.us_entrypoint = (main_t)CONFIG_USER_ENTRYPOINT,
|
||||||
|
.us_textstart = (uintptr_t)&_stext,
|
||||||
|
.us_textend = (uintptr_t)&_etext,
|
||||||
|
.us_datasource = (uintptr_t)&_eronly,
|
||||||
|
.us_datastart = (uintptr_t)&_sdata,
|
||||||
|
.us_dataend = (uintptr_t)&_edata,
|
||||||
|
.us_bssstart = (uintptr_t)&_sbss,
|
||||||
|
.us_bssend = (uintptr_t)&_ebss,
|
||||||
|
|
||||||
|
/* Memory manager heap structure */
|
||||||
|
|
||||||
|
.us_heap = &g_mmheap,
|
||||||
|
|
||||||
|
/* Task/thread startup routines */
|
||||||
|
|
||||||
|
.task_startup = nxtask_startup,
|
||||||
|
|
||||||
|
/* Signal handler trampoline */
|
||||||
|
|
||||||
|
.signal_handler = up_signal_handler,
|
||||||
|
|
||||||
|
/* User-space work queue support (declared in include/nuttx/wqueue.h) */
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIBC_USRWORK
|
||||||
|
.work_usrstart = work_usrstart,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */
|
|
@ -0,0 +1,95 @@
|
||||||
|
############################################################################
|
||||||
|
# boards/risc-v/k210/aiit-riscv64-board/scripts/Make.defs
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/.config
|
||||||
|
include $(TOPDIR)/tools/Config.mk
|
||||||
|
include $(TOPDIR)/arch/risc-v/src/rv64gc/Toolchain.defs
|
||||||
|
|
||||||
|
LDSCRIPT = ld.script
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||||
|
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
|
||||||
|
else
|
||||||
|
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
ARCHOPTIMIZATION = -g
|
||||||
|
ASARCHCPUFLAGS += -Wa,-g
|
||||||
|
endif
|
||||||
|
|
||||||
|
MAXOPTIMIZATION = -Os
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||||
|
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_HAVE_DPFPU),y)
|
||||||
|
ARCHCPUFLAGS = -march=rv64gc -mabi=lp64d -mcmodel=medany -mstrict-align
|
||||||
|
else
|
||||||
|
ARCHCPUFLAGS = -march=rv64imac -mabi=lp64 -mcmodel=medany -mstrict-align
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHCFLAGS = -fno-builtin -ffunction-sections -fdata-sections -fno-omit-frame-pointer
|
||||||
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
|
||||||
|
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||||
|
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||||
|
|
||||||
|
SDKINCLUDES = -I$(TOPDIR)/arch/risc-v/src/k210
|
||||||
|
|
||||||
|
CFLAGS := $(APPPATHS) $(SDKINCLUDES) $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
AFLAGS += $(CFLAGS) -D__ASSEMBLY__ $(ASARCHCPUFLAGS)
|
||||||
|
|
||||||
|
# NXFLAT module definitions
|
||||||
|
|
||||||
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||||
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||||
|
LDNXFLATFLAGS = -e main -s 2048
|
||||||
|
|
||||||
|
# Loadable module definitions
|
||||||
|
|
||||||
|
CMODULEFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
|
LDMODULEFLAGS = -r -e module_initialize
|
||||||
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||||
|
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
|
||||||
|
else
|
||||||
|
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ELF module definitions
|
||||||
|
|
||||||
|
CELFFLAGS = $(CFLAGS) -fno-common
|
||||||
|
CXXELFFLAGS = $(CXXFLAGS) -fno-common
|
||||||
|
|
||||||
|
LDELFFLAGS = -r -e main
|
||||||
|
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||||
|
LDELFFLAGS += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld}"
|
||||||
|
else
|
||||||
|
LDELFFLAGS += -T $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld
|
||||||
|
endif
|
||||||
|
|
||||||
|
# File extensions
|
||||||
|
|
||||||
|
LDFLAGS += --gc-sections -melf64lriscv
|
|
@ -0,0 +1,115 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/scripts/gnu-elf.ld
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text 0x00000000 :
|
||||||
|
{
|
||||||
|
_stext = . ;
|
||||||
|
*(.text)
|
||||||
|
*(.text.*)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.stub)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.jcr)
|
||||||
|
|
||||||
|
/* C++ support: The .init and .fini sections contain specific logic
|
||||||
|
* to manage static constructors and destructors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.init) /* Old ABI */
|
||||||
|
*(.fini) /* Old ABI */
|
||||||
|
_etext = . ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rodata :
|
||||||
|
{
|
||||||
|
_srodata = . ;
|
||||||
|
*(.rodata)
|
||||||
|
*(.rodata1)
|
||||||
|
*(.rodata.*)
|
||||||
|
*(.gnu.linkonce.r*)
|
||||||
|
_erodata = . ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
_sdata = . ;
|
||||||
|
*(.data)
|
||||||
|
*(.data1)
|
||||||
|
*(.data.*)
|
||||||
|
*(.gnu.linkonce.d*)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = . ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* C++ support. For each global and static local C++ object,
|
||||||
|
* GCC creates a small subroutine to construct the object. Pointers
|
||||||
|
* to these routines (not the routines themselves) are stored as
|
||||||
|
* simple, linear arrays in the .ctors section of the object file.
|
||||||
|
* Similarly, pointers to global/static destructor routines are
|
||||||
|
* stored in .dtors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.ctors :
|
||||||
|
{
|
||||||
|
_sctors = . ;
|
||||||
|
*(.ctors) /* Old ABI: Unallocated */
|
||||||
|
*(.init_array) /* New ABI: Allocated */
|
||||||
|
_edtors = . ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dtors :
|
||||||
|
{
|
||||||
|
_sdtors = . ;
|
||||||
|
*(.dtors) /* Old ABI: Unallocated */
|
||||||
|
*(.fini_array) /* New ABI: Allocated */
|
||||||
|
_edtors = . ;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
_sbss = . ;
|
||||||
|
*(.bss)
|
||||||
|
*(.bss.*)
|
||||||
|
*(.sbss)
|
||||||
|
*(.sbss.*)
|
||||||
|
*(.gnu.linkonce.b*)
|
||||||
|
*(COMMON)
|
||||||
|
_ebss = . ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/scripts/ld.script
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Reg Access Start addr End addr Size
|
||||||
|
* MEM0 CPU w/ cache 0x80000000 - 0x803fffff : 4MB
|
||||||
|
* MEM1 CPU w/ cache 0x80400000 - 0x805fffff : 2MB
|
||||||
|
* MEM0 CPU w/o cache 0x40000000 - 0x403fffff : 4MB
|
||||||
|
* MEM1 CPU w/o cache 0x40400000 - 0x405fffff : 4MB
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
progmem (rx) : ORIGIN = 0x80000000, LENGTH = 4096K /* w/ cache */
|
||||||
|
sram (rwx) : ORIGIN = 0x80400000, LENGTH = 2048K /* w/ cache */
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH("riscv")
|
||||||
|
|
||||||
|
ENTRY(_stext)
|
||||||
|
EXTERN(_vectors)
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.vectors)
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.* .srodata .srodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > progmem
|
||||||
|
|
||||||
|
.init_section : ALIGN(4) {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
KEEP(*(.init_array .init_array.*))
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > progmem
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : ALIGN(4) {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.sdata .sdata.* .sdata2.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
*(.gnu.linkonce.s.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > sram AT > progmem
|
||||||
|
|
||||||
|
.bss : ALIGN(4) {
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.sbss .sbss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(.gnu.linkonce.sb.*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
. = ALIGN(32);
|
||||||
|
_default_stack_limit = ABSOLUTE(.);
|
||||||
|
} > sram
|
||||||
|
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/scripts/memory.ld
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Reg Access Start addr End addr Size
|
||||||
|
* MEM0 CPU w/ cache 0x80000000 - 0x803fffff : 4MB
|
||||||
|
* MEM1 CPU w/ cache 0x80400000 - 0x805fffff : 2MB
|
||||||
|
* MEM0 CPU w/o cache 0x40000000 - 0x403fffff : 4MB
|
||||||
|
* MEM1 CPU w/o cache 0x40400000 - 0x405fffff : 4MB
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
kflash (rx) : ORIGIN = 0x80000000, LENGTH = 1024K /* w/ cache */
|
||||||
|
uflash (rx) : ORIGIN = 0x80100000, LENGTH = 1024K /* w/ cache */
|
||||||
|
xflash (rx) : ORIGIN = 0x80200000, LENGTH = 2048K /* w/ cache */
|
||||||
|
|
||||||
|
ksram (rwx) : ORIGIN = 0x80400000, LENGTH = 512K /* w/ cache */
|
||||||
|
usram (rwx) : ORIGIN = 0x80480000, LENGTH = 512K /* w/ cache */
|
||||||
|
xsram (rwx) : ORIGIN = 0x80500000, LENGTH = 1024K /* w/ cache */
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/scripts/user-space.ld
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* NOTE: This depends on the memory.ld script having been included prior to
|
||||||
|
* this script.
|
||||||
|
*/
|
||||||
|
|
||||||
|
OUTPUT_ARCH("riscv")
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.userspace : {
|
||||||
|
*(.userspace)
|
||||||
|
} > uflash
|
||||||
|
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > uflash
|
||||||
|
|
||||||
|
.init_section : {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
KEEP(*(.init_array .init_array.*))
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > uflash
|
||||||
|
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.sdata .sdata.* .sdata2.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > usram AT > uflash
|
||||||
|
|
||||||
|
.bss : {
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.sbss .sbss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > usram
|
||||||
|
|
||||||
|
/* Stabs debugging sections */
|
||||||
|
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
############################################################################
|
||||||
|
# boards/risc-v/k210/aiit-riscv64-board/src/Makefile
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
|
CSRCS = k210_bringup.c k210_boot.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BOARDCTL),y)
|
||||||
|
CSRCS += k210_appinit.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||||
|
CSRCS += k210_leds.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DEV_GPIO),y)
|
||||||
|
CSRCS += k210_gpio.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
CSRCS += k210_ostest.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(TOPDIR)/boards/Board.mk
|
|
@ -0,0 +1,36 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/src/aiit-riscv64-board.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __AIIT_RISCV64_BOARDS_K210_H
|
||||||
|
#define __AIIT_RISCV64_BOARDS_K210_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
int k210_bringup(void);
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEV_GPIO
|
||||||
|
int k210_gpio_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __AIIT_RISCV64_BOARDS_K210_H */
|
|
@ -0,0 +1,75 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/src/k210_appinit.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#include "k210.h"
|
||||||
|
#include "aiit-riscv64-board.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_app_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture specific initialization
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||||
|
* implementation without modification. The argument has no
|
||||||
|
* meaning to NuttX; the meaning of the argument is a contract
|
||||||
|
* between the board-specific initialization logic and the
|
||||||
|
* matching application logic. The value could be such things as a
|
||||||
|
* mode enumeration value, a set of DIP switch switch settings, a
|
||||||
|
* pointer to configuration data read from a file or serial FLASH,
|
||||||
|
* or whatever you would like to do with it. Every implementation
|
||||||
|
* should accept zero/NULL as a default configuration.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_app_initialize(uintptr_t arg)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||||
|
/* Board initialization already performed by board_late_initialize() */
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
|
/* Perform board-specific initialization */
|
||||||
|
|
||||||
|
return k210_bringup();
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/src/k210_boot.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: k210_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All K210 architectures must provide the following entry point.
|
||||||
|
* This entry point is called early in the initialization -- after all
|
||||||
|
* memory has been configured and mapped but before any devices have been
|
||||||
|
* initialized.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void k210_boardinitialize(void)
|
||||||
|
{
|
||||||
|
board_autoled_initialize();
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/maix-bit/src/k210_bringup.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <nuttx/fs/fs.h>
|
||||||
|
|
||||||
|
#include "k210.h"
|
||||||
|
#include "aiit-riscv64-board.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: k210_bringup
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int k210_bringup(void)
|
||||||
|
{
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
|
#ifdef CONFIG_FS_PROCFS
|
||||||
|
/* Mount the procfs file system */
|
||||||
|
|
||||||
|
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEV_GPIO
|
||||||
|
ret = k210_gpio_init();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -0,0 +1,173 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/src/k210_gpio.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
|
||||||
|
#include <nuttx/ioexpander/gpio.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "k210_fpioa.h"
|
||||||
|
#include "k210_gpiohs.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Pin 1 and 2 are used for this example as GPIO outputs. */
|
||||||
|
|
||||||
|
#define GPIO_OUT1 12
|
||||||
|
#define GPIO_OUT2 13
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
struct k210gpio_dev_s
|
||||||
|
{
|
||||||
|
struct gpio_dev_s gpio;
|
||||||
|
uint8_t id;
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if BOARD_NGPIOOUT > 0
|
||||||
|
static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value);
|
||||||
|
static int gpout_write(FAR struct gpio_dev_s *dev, bool value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if BOARD_NGPIOOUT > 0
|
||||||
|
static const struct gpio_operations_s gpout_ops =
|
||||||
|
{
|
||||||
|
.go_read = gpout_read,
|
||||||
|
.go_write = gpout_write,
|
||||||
|
.go_attach = NULL,
|
||||||
|
.go_enable = NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This array maps the GPIO pins used as OUTPUT */
|
||||||
|
|
||||||
|
static const uint32_t g_gpiooutputs[BOARD_NGPIOOUT] =
|
||||||
|
{
|
||||||
|
GPIO_OUT1, GPIO_OUT2
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct k210gpio_dev_s g_gpout[BOARD_NGPIOOUT];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gpout_read
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if BOARD_NGPIOOUT > 0
|
||||||
|
static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value)
|
||||||
|
{
|
||||||
|
FAR struct k210gpio_dev_s *k210gpio =
|
||||||
|
(FAR struct k210gpio_dev_s *)dev;
|
||||||
|
|
||||||
|
DEBUGASSERT(k210gpio != NULL && value != NULL);
|
||||||
|
DEBUGASSERT(k210gpio->id < BOARD_NGPIOOUT);
|
||||||
|
gpioinfo("Reading...\n");
|
||||||
|
|
||||||
|
*value = (int) k210_gpiohs_get_value(k210gpio->id + 1);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: gpout_write
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int gpout_write(FAR struct gpio_dev_s *dev, bool value)
|
||||||
|
{
|
||||||
|
FAR struct k210gpio_dev_s *k210gpio =
|
||||||
|
(FAR struct k210gpio_dev_s *)dev;
|
||||||
|
|
||||||
|
DEBUGASSERT(k210gpio != NULL);
|
||||||
|
DEBUGASSERT(k210gpio->id < BOARD_NGPIOOUT);
|
||||||
|
gpioinfo("Writing %d\n", (int)value);
|
||||||
|
|
||||||
|
k210_gpiohs_set_value(k210gpio->id + 1, !value);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: k210_gpio_init
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int k210_gpio_init(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int pincount = 0;
|
||||||
|
|
||||||
|
#if BOARD_NGPIOOUT > 0
|
||||||
|
for (i = 0; i < BOARD_NGPIOOUT; i++)
|
||||||
|
{
|
||||||
|
/* Setup and register the GPIO pin */
|
||||||
|
|
||||||
|
g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN;
|
||||||
|
g_gpout[i].gpio.gp_ops = &gpout_ops;
|
||||||
|
g_gpout[i].id = i;
|
||||||
|
gpio_pin_register(&g_gpout[i].gpio, pincount);
|
||||||
|
|
||||||
|
/* Configure the pins that will be used as output */
|
||||||
|
|
||||||
|
k210_fpioa_config(g_gpiooutputs[i],
|
||||||
|
(K210_IO_FUNC_GPIOHS1 + i) | K210_IOFLAG_GPIOHS);
|
||||||
|
k210_gpiohs_set_direction(i + 1, true);
|
||||||
|
k210_gpiohs_set_value(i + 1, true);
|
||||||
|
|
||||||
|
pincount++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_DEV_GPIO && !CONFIG_GPIO_LOWER_HALF */
|
|
@ -0,0 +1,59 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/src/k210_leds.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "k210_fpioa.h"
|
||||||
|
#include "k210_gpiohs.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_initialize(void)
|
||||||
|
{
|
||||||
|
k210_fpioa_config(BOARD_LED_PAD, BOARD_LED_IO_FUNC | K210_IOFLAG_GPIOHS);
|
||||||
|
k210_gpiohs_set_direction(BOARD_LED_IO, true);
|
||||||
|
k210_gpiohs_set_value(BOARD_LED_IO, true); /* LED off */
|
||||||
|
}
|
||||||
|
|
||||||
|
void board_autoled_on(int led)
|
||||||
|
{
|
||||||
|
if (led == LED_PANIC)
|
||||||
|
{
|
||||||
|
k210_gpiohs_set_value(BOARD_LED_IO, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void board_autoled_off(int led)
|
||||||
|
{
|
||||||
|
if (led == LED_PANIC)
|
||||||
|
{
|
||||||
|
k210_gpiohs_set_value(BOARD_LED_IO, true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/k210/aiit-riscv64-board/src/c906_ostest.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <syscall.h>
|
||||||
|
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
#undef HAVE_FPU
|
||||||
|
#if defined(CONFIG_ARCH_FPU) && \
|
||||||
|
!defined(CONFIG_TESTING_OSTEST_FPUTESTDISABLE) && \
|
||||||
|
defined(CONFIG_TESTING_OSTEST_FPUSIZE) && \
|
||||||
|
defined(CONFIG_SCHED_WAITPID)
|
||||||
|
# define HAVE_FPU 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_FPU
|
||||||
|
|
||||||
|
#if CONFIG_TESTING_OSTEST_FPUSIZE != (8 * FPU_XCPT_REGS)
|
||||||
|
# error "CONFIG_TESTING_OSTEST_FPUSIZE has the wrong size"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static uint64_t g_saveregs[XCPTCONTEXT_REGS];
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will
|
||||||
|
* return the current FPU registers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void arch_getfpu(FAR uint32_t *fpusave)
|
||||||
|
{
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
riscv_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
memcpy(fpusave, &g_saveregs[INT_XCPT_REGS], (8 * FPU_XCPT_REGS));
|
||||||
|
leave_critical_section(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Given two arrays of size CONFIG_TESTING_OSTEST_FPUSIZE this function
|
||||||
|
* will compare them and return true if they are identical.
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)
|
||||||
|
{
|
||||||
|
return memcmp(fpusave1, fpusave2, (8 * FPU_XCPT_REGS)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_FPU */
|
|
@ -10,5 +10,6 @@ find $top -name Kconfig -exec dos2unix -q {} \;
|
||||||
cp -rf $current/nuttx $nuttx
|
cp -rf $current/nuttx $nuttx
|
||||||
cp -rf $current/apps $nuttx
|
cp -rf $current/apps $nuttx
|
||||||
cp -rf $nuttx/aiit-arm32-board $nuttx/nuttx/boards/arm/stm32
|
cp -rf $nuttx/aiit-arm32-board $nuttx/nuttx/boards/arm/stm32
|
||||||
|
cp -rf $nuttx/aiit-riscv64-board $nuttx/nuttx/boards/risc-v/k210
|
||||||
|
|
||||||
cd ../nuttx
|
cd ../nuttx
|
||||||
|
|
|
@ -665,6 +665,14 @@ config ARCH_BOARD_MAIX_BIT
|
||||||
This is the board configuration for the port of NuttX to the
|
This is the board configuration for the port of NuttX to the
|
||||||
Sipeed Maix Bit board. This board features the RISC-V K210
|
Sipeed Maix Bit board. This board features the RISC-V K210
|
||||||
|
|
||||||
|
config ARCH_BOARD_AIIT_RISCV64
|
||||||
|
bool "aiit riscv64 k210 board"
|
||||||
|
depends on ARCH_CHIP_K210
|
||||||
|
select ARCH_HAVE_LEDS if !K210_WITH_QEMU
|
||||||
|
---help---
|
||||||
|
This is the board configuration for the port of NuttX to the
|
||||||
|
aiit-riscv64 board. This board features the RISC-V K210
|
||||||
|
|
||||||
config ARCH_BOARD_SMARTL_C906
|
config ARCH_BOARD_SMARTL_C906
|
||||||
bool "smartl evaluation board for C906"
|
bool "smartl evaluation board for C906"
|
||||||
depends on ARCH_CHIP_C906
|
depends on ARCH_CHIP_C906
|
||||||
|
@ -2396,6 +2404,7 @@ config ARCH_BOARD
|
||||||
default "lpcxpresso-lpc54628" if ARCH_BOARD_LPCXPRESSO_LPC54628
|
default "lpcxpresso-lpc54628" if ARCH_BOARD_LPCXPRESSO_LPC54628
|
||||||
default "lx_cpu" if ARCH_BOARD_LX_CPU
|
default "lx_cpu" if ARCH_BOARD_LX_CPU
|
||||||
default "maix-bit" if ARCH_BOARD_MAIX_BIT
|
default "maix-bit" if ARCH_BOARD_MAIX_BIT
|
||||||
|
default "aiit-riscv64-board" if ARCH_BOARD_AIIT_RISCV64
|
||||||
default "smartl-c906" if ARCH_BOARD_SMARTL_C906
|
default "smartl-c906" if ARCH_BOARD_SMARTL_C906
|
||||||
default "icicle" if ARCH_BOARD_ICICLE_MPFS
|
default "icicle" if ARCH_BOARD_ICICLE_MPFS
|
||||||
default "maple" if ARCH_BOARD_MAPLE
|
default "maple" if ARCH_BOARD_MAPLE
|
||||||
|
@ -3206,6 +3215,9 @@ endif
|
||||||
if ARCH_BOARD_MAIX_BIT
|
if ARCH_BOARD_MAIX_BIT
|
||||||
source "boards/risc-v/k210/maix-bit/Kconfig"
|
source "boards/risc-v/k210/maix-bit/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
if ARCH_BOARD_AIIT_RISCV64
|
||||||
|
source "boards/risc-v/k210/aiit-riscv64-board/Kconfig"
|
||||||
|
endif
|
||||||
if ARCH_BOARD_SMARTL_C906
|
if ARCH_BOARD_SMARTL_C906
|
||||||
source "boards/risc-v/c906/smartl-c906/Kconfig"
|
source "boards/risc-v/c906/smartl-c906/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue