-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ac8dd7f
Showing
1,038 changed files
with
909,697 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dl/ | ||
buildroot-2020.02.11/ | ||
toolchain/[^.]* | ||
pkg-download/[^.]* | ||
*defconfig/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
source "$BR2_EXTERNAL_K510_PATH/package/riscv-pk-k510/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/riscv-tinymembench/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/video_lib/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/opencv4/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/nncase_linux_runtime/Config.in" | ||
#source "$BR2_EXTERNAL_K510_PATH/package/nncase_demo/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/libdisp/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/drm_demo/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/lvgl/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/twod_demo/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/encode_app/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/dsp_app_new/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/k510_evb_test/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/dsp_log/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/venc_lib/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/alsa_demo/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/ffmpeg_canaan/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/audio3a_lib/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/mediactl_lib/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/mailbox_demo/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/dsp_scheduler/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/live555_canaan/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/ai/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/client/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/server/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/crypto/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/trng/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/pwm/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/rtc/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/uart/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/watchdog/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/write_read_file/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/wifi/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/gpio_keys/Config.in" | ||
source "$BR2_EXTERNAL_K510_PATH/package/hello_world/Config.in" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Copyright (c) 2022, Canaan Bright Sight Co., Ltd | ||
|
||
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 HOLDER OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
BR2_VERSION = 2020.02.11 | ||
|
||
RED=\e[1;31m | ||
NC=\e[0m | ||
|
||
SHELL=/bin/bash | ||
|
||
BRW_ROOT = $(PWD) | ||
BRW_SITE = https://buildroot.org/downloads/buildroot-$(BR2_VERSION).tar.gz | ||
BRW_FILE = $(BR2_DL_DIR)/buildroot-$(BR2_VERSION).tar.gz | ||
BRW_DIR = $(BRW_ROOT)/buildroot-$(BR2_VERSION) | ||
BRW_PATCH_DIR = $(BRW_ROOT)/patches | ||
|
||
TOOLCHAIN_DIR = $(BRW_ROOT)/toolchain | ||
TOOLCHAIN_NAME = nds64le-linux-glibc-v5d | ||
TOOLCHAIN_DIR_SITE =https://github.com/andestech/Andes-Development-Kit/releases/download/ast-v3_2_1-release-linux | ||
|
||
TOOLCHAIN_NAME_MCU = nds64le-elf-mculib-v5d | ||
TOOLCHAIN_MCU_DIR_SITE =https://github.com/andestech/Andes-Development-Kit/releases/download/ast-v3_2_3-release-linux | ||
|
||
#DEMO_DIR = $(BRW_ROOT)/demo | ||
#ROOTFS_OVERLAY_PATH = $(BRW_ROOT)/board/canaan/k510/rootfs_overlay | ||
|
||
|
||
|
||
CONF ?= "k510_crb_lp3_v1_2_defconfig" | ||
O ?= $(CONF) | ||
BR2_DL_DIR ?= $(BRW_ROOT)/dl | ||
|
||
define DOWNLOAD | ||
set -e;\ | ||
if [ ! -d $(BR2_DL_DIR) ]; then \ | ||
[ -f pkg-download/dl.tar.gz ] && tar -zxf pkg-download/dl.tar.gz ;\ | ||
mkdir -p $(BR2_DL_DIR); \ | ||
fi; \ | ||
if [ ! -f $(BRW_FILE) ]; then \ | ||
wget -c $(BRW_SITE) -O $(BRW_FILE); \ | ||
fi; \ | ||
|
||
|
||
endef | ||
|
||
define COPYFILES | ||
set -e; \ | ||
if [ ! -d $(BRW_DIR) ]; then \ | ||
tar --no-same-owner -zxf $(BRW_FILE) -C $(BRW_ROOT); \ | ||
if [ "'ls $(BRW_PATCH_DIR)/*.patch'" != "" ]; then \ | ||
$(BRW_DIR)/support/scripts/apply-patches.sh $(BRW_DIR) $(BRW_PATCH_DIR); \ | ||
fi; \ | ||
fi; \ | ||
|
||
if [ ! -d $(TOOLCHAIN_DIR)/$(TOOLCHAIN_NAME) ]; then \ | ||
tar --no-same-owner -xf $(TOOLCHAIN_DIR)/$(TOOLCHAIN_NAME).txz -C $(TOOLCHAIN_DIR); \ | ||
fi; \ | ||
|
||
[ -d $(TOOLCHAIN_DIR)/$(TOOLCHAIN_NAME_MCU) ] || tar --no-same-owner -xf $(TOOLCHAIN_DIR)/$(TOOLCHAIN_NAME_MCU).txz -C $(TOOLCHAIN_DIR); | ||
|
||
endef | ||
|
||
define CLEAN | ||
set -e; \ | ||
cd $(BRW_ROOT); \ | ||
rm -rf $(CONF); \ | ||
rm -rf $(BRW_DIR); \ | ||
|
||
endef | ||
|
||
|
||
|
||
|
||
|
||
.PHONY: all | ||
all .DEFAULT: down_toolchain | ||
@$(call DOWNLOAD) | ||
@$(call COPYFILES) | ||
make -C $(BRW_DIR) $(CONF) O=$(BRW_ROOT)/$(O) BR2_EXTERNAL=$(BRW_ROOT) | ||
make -C $(BRW_ROOT)/$(O) | ||
|
||
.PHONY: source | ||
source: | ||
@$(call DOWNLOAD) | ||
@$(call COPYFILES) | ||
make -C $(BRW_DIR) $(CONF) O=$(BRW_ROOT)/$(O) BR2_EXTERNAL=$(BRW_ROOT) | ||
make -C $(BRW_ROOT)/$(O) source | ||
|
||
.PHONY: menuconfig | ||
menuconfig: | ||
make -C $(BRW_ROOT)/$(O) menuconfig | ||
|
||
.PHONY: build | ||
build: | ||
make -C $(BRW_ROOT)/$(O) | ||
|
||
.PHONY: savedefconfig | ||
savedefconfig: | ||
make -C $(BRW_ROOT)/$(O) savedefconfig | ||
|
||
.PHONY: clean | ||
clean: | ||
@$(call CLEAN) | ||
|
||
.PHONY:down_toolchain dl | ||
|
||
|
||
dl: | ||
rm -rf pkg-download/dl.tar.gz; | ||
wget -c https://github.com/kendryte/k510_buildroot/releases/download/v1.5/dl.tar.gz -O pkg-download/dl.tar.gz; | ||
tar -zxf pkg-download/dl.tar.gz; | ||
mkdir -p dl/ai/; wget -c https://github.com/kendryte/k510_buildroot/releases/download/v1.5/ai_kmodel_data.tar.xz -O dl/ai/ai_kmodel_data.tar.xz; | ||
|
||
|
||
down_toolchain: | ||
if [ ! -f toolchain/$(TOOLCHAIN_NAME).txz ] || [ "c87c87089fe2f0445a94054e8ae7b947" != "$(shell md5sum toolchain/$(TOOLCHAIN_NAME).txz | cut -d' ' -f1 )" ]; then \ | ||
rm -rf toolchain/$(TOOLCHAIN_NAME)* ;\ | ||
wget -c $(TOOLCHAIN_DIR_SITE)/$(TOOLCHAIN_NAME).txz -O toolchain/$(TOOLCHAIN_NAME).txz;\ | ||
tar --no-same-owner -xf $(TOOLCHAIN_DIR)/$(TOOLCHAIN_NAME).txz -C $(TOOLCHAIN_DIR);\ | ||
fi; | ||
if [ ! -f toolchain/$(TOOLCHAIN_NAME_MCU).txz ] || [ "d2dcf2729c2e6b654c4be197c2c75987" != "$(shell md5sum toolchain/$(TOOLCHAIN_NAME_MCU).txz | cut -d' ' -f1 )" ]; then\ | ||
rm -rf toolchain/$(TOOLCHAIN_NAME_MCU)* ;\ | ||
wget -c $(TOOLCHAIN_MCU_DIR_SITE)/$(TOOLCHAIN_NAME_MCU).txz -O toolchain/$(TOOLCHAIN_NAME_MCU).txz;\ | ||
tar --no-same-owner -xf $(TOOLCHAIN_DIR)/$(TOOLCHAIN_NAME_MCU).txz -C $(TOOLCHAIN_DIR);\ | ||
fi; | ||
|
||
#mkfs.ext4 -d $${dir} $(BR2_DL_DIR)/debian_rootfs.ext4 3G; | ||
|
||
#update_debian: SHELL=/bin/bash | ||
debian: | ||
@[ -f ${CONF}/images/sysimage-sdcard.img ] || { echo "please first use 'make CONF=${CONF}' command build sdk!"; exit 1; } | ||
echo "please change to root user or sudo -s make update_debian" | ||
(set -xe; dir=debian; debian_tar=$(shell pwd)/board/canaan/k510/debian.tar.gz; rm -rf $${dir} $${debian_tar}; \ | ||
wget http://ftp.cn.debian.org/debian/pool/main/d/debian-ports-archive-keyring/debian-ports-archive-keyring_2022.02.15_all.deb;\ | ||
dpkg -i debian-ports-archive-keyring_2022.02.15_all.deb;rm -rf debian-ports-archive-keyring_2022.02.15_all.deb;\ | ||
debootstrap --arch=riscv64 --keyring /usr/share/keyrings/debian-ports-archive-keyring.gpg \ | ||
--include=debian-ports-archive-keyring unstable $${dir} http://deb.debian.org/debian-ports; \ | ||
chroot $${dir} apt-get update; chroot $${dir} apt-get install -y ntpdate libgomp1 libatomic1; \ | ||
echo "root:root" | chroot $${dir} chpasswd;\ | ||
chroot "$$dir" adduser --gecos "Debian user,,," --disabled-password debian ;\ | ||
echo "debian:debian" | chroot $$dir chpasswd;\ | ||
echo "debian" > $${dir}/etc/hostname;\ | ||
echo -e '#!/bin/bash -e \nntpdate ntp.aliyun.com\n' >$${dir}/etc/rc.local; chmod +x $${dir}/etc/rc.local; \ | ||
echo -e "auto lo\niface lo inet loopback\n\n\nauto eth0\niface eth0 inet dhcp \n" > $${dir}/etc/network/interfaces;\ | ||
chroot $${dir} rm -rf /etc/localtime ; chroot $${dir} ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ;\ | ||
rsync -a --ignore-times --chmod=u=rwX,go=rX board/canaan/k510/debian_rootfs_overlay/ $${dir}; \ | ||
chroot $${dir} systemctl enable rootfs_fsck;\ | ||
tar -cjf $${debian_tar} $${dir} ; chmod a+rw $${debian_tar};rm -rf $${dir};\ | ||
echo "file is $${debian_tar} ";\ | ||
export CONF=${CONF} ; ./board/canaan/k510/debian.sh ;\ | ||
echo "debian image is ${CONF}/images/sysimage-sdcard-debian.img";\ | ||
) | ||
update_debian_from_last_version: | ||
(set -xe; dir=debian; debian_tar=$(shell pwd)/board/canaan/k510/debian.tar.gz; rm -rf $${dir}; tar -xf $${debian_tar}; \ | ||
rsync -a --ignore-times --chmod=u=rwX,go=rX board/canaan/k510/debian_rootfs_overlay/ $${dir}; \ | ||
chroot $${dir} systemctl enable rootfs_fsck;\ | ||
rm -rf $${debian_tar}; tar -cjf $${debian_tar} $${dir} ; chmod a+rw $${debian_tar};\ | ||
) | ||
help: | ||
@echo "debian---generate debian image,note:need root privileged " | ||
@echo "source---down all code " | ||
@echo "build---only build" | ||
@echo "all---default,example:make CONF=k510_crb_lp3_v1_2_defconfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# K510 SDK | ||
勘智K510是嘉楠公司推出的第二代AI边缘侧推理芯片,它为AI应用提供了高性能的图像及语音处理能力。K510搭载自主研发的第二代神经网络处理器KPU2.0, 采用独创计算数据流技术,算力较上一代提升3倍同时降低功耗。集成最新一代图像处理器ISP,支持TOF深度相机接入,支持2D/3D降噪、宽动态范围(WDR)、硬件3A等完备功能。3D ISP支持深度摄像头TOF sensor。可广泛应用于无人机、高清航拍、专业相机、视频会议、智能机器人、教育STEAM、自动辅助驾驶等不同应用领域。 | ||
|
||
|
||
K510 SDK是嘉楠公司提供的用于K510芯片应用研发的软件开发资料包,它的默认配置基于K510 CRB(客户参考平台),仓库内容包括用户在使用 K510 芯片进行开发中可能用到的工具链软件、PC工具包、Linux代码、bootloader、bbl、buildroot构建系统软件及相关的硬件资源文档。用户可以基于本套软件代码库,根据自己的需求进行定制更改开发,最终构建并编译生成部署使用的镜像文件。 | ||
## 资料内容说明和参考资源链接 | ||
| No | 链接地址 | 说明 | | ||
| :----: | ---- | ------------------------------------------------------------ | | ||
|1| / | 代码编译工作目录 | | ||
|2|[docs/](https://github.com/kendryte/k510_docs)| K510系统编译及应用开发文档;硬件资源介绍文档 | ||
|3|[package/](/package/)| 提供Linux系统外设开发应用示例;各种AI 演示应用源代码 | | ||
|4|[嘉楠勘智](https://canaan-creative.com/product/勘智k510)|嘉楠勘智官网| | ||
|5|[开发者社区](https://canaan-creative.com/developer)|嘉楠勘智论坛 | ||
|6|[演示视频](https://space.bilibili.com/677429436)|K510开发板开箱视频及多个 AI 应用展示视频| | ||
|7|[K510 CRB-KIT]()|K510 开板板套装在线购买链接| | ||
|8|即时沟通| 社区互助 QQ 群:790699378<br>Telegram:nncase community | | ||
## K510 CRB 开发者套装介绍 | ||
K510 CRB-KIT是基于K510芯片研发的开发者套装,它采用分级设计,以K510核心模组为基础,外设丰富,便于扩展。 支持USB 2.0 OTG+PHY、千兆以太网口、3xSDIO、3xSPI等高速通信接口,支持4xUART、GPIO、I2C和I2S等低速通信接口。使用简单、资料丰富、能够帮助客户快速实现创意评估、产品原型验证,缩短产品设计周期。 | ||
![canaan-board.png](https://github.com/kendryte/k510_docs/raw/v1.5/zh/images/hw_crb_v1_2/canaan-board.png) | ||
<center>K510 CRB 正面照 </center> | ||
|
||
![image-hw_1_3.png](https://github.com/kendryte/k510_docs/raw/v1.5/zh/images/hw_crb_v1_2/image-hw_1_3.png) | ||
<center>K510系统框图</center> | ||
|
||
![image-hw_3_1.png](https://github.com/kendryte/k510_docs/raw/v1.5/zh/images/hw_crb_v1_2/image-hw_3_1.png) | ||
<center>K510核心板模组图</center> | ||
|
||
## K510 软件开发入门 | ||
|
||
### 建立软件开发环境 | ||
K510 软件开发基于 Linux 环境。用户需要准备一台装有 Linux 操作系统的主机用于软件编译及部署,如果您工作在 windows 下,推荐安装 Windows WSL 以便进行软件开发工作。 | ||
### 源代码下载 | ||
```sh | ||
git clone https://github.com/kendryte/k510_buildroot.git | ||
``` | ||
### 启动docker | ||
```sh | ||
sh k510_buildroot/tools/docker/run_k510_docker.sh | ||
``` | ||
### 编译代码库 | ||
进入docker环境后,输入如下命令进行系统编译。 | ||
```sh | ||
make dl | ||
make | ||
``` | ||
`make dl`为可选步骤,用于加速源码下载。 | ||
第一次全新系统编译时间较长,请耐心等待(时间和主机CPU的性能和网络下载速度相关)。 | ||
### 烧写镜像文件 | ||
K510 支持sdcard和eMMC启动方式,用户可以通过改变开板上SW1拔码开关的设置切换不同启动模式。 | ||
出厂默认为从emmc启动。为方便开发,建议您准备一张TF卡,并将拔码开关切换至SD卡启动模式,后续可考虑将镜像文件固化至emmc中。 | ||
无论您工作在 Linux 还是 Windows系统下, 均可下载 [Etcher](https://www.balena.io/etcher/) 工具,将编译生成的镜像文件(k510_buildroot/k510_crb_lp3_v1_2_defconfig/image/sysimage-sdcard.img)烧录至 TF 卡中。 | ||
![balenaetcher.png](https://github.com/kendryte/k510_docs/raw/v1.5/zh/images/quick_start/balenaetcher.png) | ||
|
||
|
||
### 上电运行 | ||
确认SW1开关选择在SD卡启动模式下,将烧录完成的TF卡插入进开板板卡槽中,然后将电源开关K1拔到ON位置,系统可上电。您会看到屏幕显示 CANAAN logo 画面,如果您有接好串口,可在串口中看到启动日志输出。 | ||
![k510_boot.png](https://github.com/kendryte/k510_docs/raw/v1.5/zh/images/quick_start/k510_boot.png) | ||
|
||
### 更改默认启动程序 | ||
默认情况下,系统开机会自动运行 /app/mediactl_lib 路径下的示例程序(v4l2_drm.out)。你也可以手动更改配置程序,改成运行其它演示程序。更改方法如下: | ||
```sh | ||
vi /etc/init.d/rc.sysinit | ||
修改以下位置 | ||
cd /app/mediactl_lib/ | ||
./v4l2_drm.out -f video_drm_1080x1920.conf & | ||
cd / | ||
改为你想运行的 APP,例如改成人脸检测演示应用,可以改成: | ||
/app/ai/shell/face_detect.sh & | ||
``` | ||
|
||
## 联系我们 | ||
北京嘉楠捷思信息技术有限公司 | ||
网址:[canaan-creative.com](canaan-creative.com) | ||
商务垂询:[[email protected]](mailto:[email protected]) |
Oops, something went wrong.