Skip to content

Commit

Permalink
k230 sdk release v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwentao committed Dec 8, 2023
1 parent 98e0c1d commit 3ade2d0
Show file tree
Hide file tree
Showing 360 changed files with 38,287 additions and 721 deletions.
1 change: 1 addition & 0 deletions Kconfig.board
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ config GEN_IMG_SCRIPT
generate image scripte;
default "board/common/gen_image_script/gen_image.sh"
config RTT_CONSOLE_ID
depends on SUPPORT_RTSMART
int "RTT console id"
default 3

Expand Down
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ prepare_sourcecode:prepare_toolchain
#ai
@echo "download nncase sdk"
@rm -rf src/big/utils/; rm -rf src/big/ai;
@wget -q --show-progress $(DOWNLOAD_URL)/downloads/kmodel/kmodel_v2.4.0.tgz -O - | tar -xzC src/big/
@wget -q --show-progress $(DOWNLOAD_URL)/downloads/nncase/nncase_k230_v2.4.0.tgz -O - | tar -xzC src/big/
@wget -q --show-progress $(DOWNLOAD_URL)/downloads/kmodel/kmodel_v2.5.1.tgz -O - | tar -xzC src/big/
@wget -q --show-progress $(DOWNLOAD_URL)/downloads/nncase/nncase_k230_v2.5.1.tgz -O - | tar -xzC src/big/

#big utils
@echo "download big utils"
Expand All @@ -138,6 +138,15 @@ prepare_sourcecode:prepare_toolchain
@wget -q --show-progress $(DOWNLOAD_URL)/downloads/dl/dl.tar.gz -O - | tar -xzC src/little/buildroot-ext/

@touch src/.src_fetched

#dictionary_pen
@if [ "k230_evb_usiplpddr4_dictionary_pen_defconfig" == "$${CONF}" ] ; then \
echo "download dictionary_pen" ; \
wget -q --show-progress $(DOWNLOAD_URL)/downloads/dictionary_pen/cidianbi_kmodel_v2.5.1.tar.gz -O - | tar -xzC src/reference/business_poc/dictionary_pen_poc/ ; \
cp src/reference/business_poc/dictionary_pen_poc/cidianbi_kmodel_v2.5.1/include src/reference/business_poc/dictionary_pen_poc/ -rf ; \
fi;


check_toolchain:
@if [ ! -f $(CONFIG_TOOLCHAIN_PATH_LINUX)/$(CONFIG_TOOLCHAIN_PREFIX_LINUX)gcc ] || \
[ ! -f $(CONFIG_TOOLCHAIN_PATH_RTT)/$(CONFIG_TOOLCHAIN_PREFIX_RTT)gcc ]; then \
Expand Down Expand Up @@ -255,6 +264,15 @@ peephole:check_src
make && make install; rm ./* -rf; \
cd -;

.PHONY: dictionary_pen
dictionary_pen:check_src
@export PATH=$(RTT_EXEC_PATH):$(PATH); \
export RTSMART_SRC_DIR=$(K230_SDK_ROOT)/$(RT-SMART_SRC_PATH); \
cd $(K230_SDK_ROOT)/src/reference/business_poc/dictionary_pen_poc; \
mkdir -p build; \
bash build.sh ;


.PHONY: cdk-kernel
cdk-kernel: linux
@export PATH=$(RTT_EXEC_PATH):$(LINUX_EXEC_PATH):$(PATH);export RTSMART_SRC_DIR=$(K230_SDK_ROOT)/$(RT-SMART_SRC_PATH);export LINUX_BUILD_DIR=$(LINUX_BUILD_DIR); \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ make prepare_sourcecode

1. 根据不同开发板或软件功能,选择不同的配置config进行编译,编译命令格式:`make CONF=xxx`,如:
> - 编译K230-USIP-LP3-EVB板子镜像,执行`make CONF=k230_evb_defconfig` 命令开始编译
> - 编译CanMV-K230板子的镜像,执行 `make CONF=CONF=k230_canmv_defconfig` 命令开始编译
> - 编译CanMV-K230板子的镜像,执行 `make CONF=k230_canmv_defconfig` 命令开始编译
> - 外部目录中自动下载的toolchain会映射至docker镜像中的`/opt/toolchain/`目录下。
> - 默认参数`-u root`指定docker以root用户执行,k230_sdk无需root权限即可编译
Expand Down
1 change: 1 addition & 0 deletions board/common/dev_firmware/ap6212a/config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android_msg_level=1
1 change: 1 addition & 0 deletions board/common/dev_firmware/ap6256/config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android_msg_level=1
73 changes: 73 additions & 0 deletions board/common/gen_image_cfg/genimage-sdcard-dictionary-pen.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
image app.vfat {
vfat {
files = {
"big-core/app",
}
}
# empty =true
size = 1024M
}

image sysimage-sdcard.img {
hdimage {
gpt = "true"
}

partition uboot_spl_1 {
#512k@1M 0x400@0x800
in-partition-table = false
offset = 1M
image = "little-core/uboot/fn_u-boot-spl.bin"
}
partition uboot_spl_2 {
#[email protected] 0x800@0xc00
in-partition-table = false
offset = 0x180000
image = "little-core/uboot/fn_u-boot-spl.bin"
}
partition uboot_env {
in-partition-table = false
offset = 0x1e0000
image = "little-core/uboot/env.env"
size = 0x20000
}
partition uboot {
#1.5m@2M 0xc00@0x1000
in-partition-table = false
offset = 2M
image = "little-core/uboot/fn_ug_u-boot.bin"
}
# partition env {
# #[email protected] 0x800@0x1c00
# in-partition-table = false
# offset = 0x380000
# #image = "../little/uboot/u-boot.img"
# }

partition rtt {
#20M@10M 0x800@0x800
offset = 10M
image = "big-core/rtt_system.bin"
size = 20M
}

partition linux {
#50M@30M 0x800@0x800
offset = 30M
image = "little-core/linux_system.bin"
size = 50M
}

partition rootfs {
offset = 128M
partition-type = 0x83
image = "little-core/rootfs.ext4"
}

partition fat32appfs {
#offset = 168M
partition-type = 0xc
# size = 32M
image = "app.vfat"
}
}
24 changes: 24 additions & 0 deletions board/common/gen_image_script/gen_image_comm_func.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@
source ${K230_SDK_ROOT}/.config
source ${K230_SDK_ROOT}/.last_conf

gz_file_add_ver()
{
[ $# -lt 1 ] && return
local f="$1"

local sdk_ver="v0.0.0";
local nncase_ver="0.0.0";

local sdk_ver_file="${K230_SDK_ROOT}/board/common/post_copy_rootfs/etc/version/release_version"
local nncase_ver_file="${K230_SDK_ROOT}/src/big/nncase/riscv64/nncase/include/nncase/version.h"




cat ${sdk_ver_file} | grep v | cut -d- -f 1 > /dev/null && \
sdk_ver=$(cat ${sdk_ver_file} | grep v | cut -d- -f 1)

cat ${nncase_ver_file} | grep NNCASE_VERSION -w | cut -d\" -f 2 > /dev/null && \
nncase_ver=$(cat ${nncase_ver_file} | grep NNCASE_VERSION -w | cut -d\" -f 2)

cp $f ${CONFIG_BOARD_NAME}_$(echo "$f" | sed -nE "s#[^-]*-([^\.]*).*#\1#p")_${sdk_ver}_nncase_v${nncase_ver}.img.gz;
}


#依赖 BUILD_DIR,K230_SDK_ROOT
copye_file_to_images()
Expand Down Expand Up @@ -271,6 +294,7 @@ gen_image()
rm -rf "${GENIMAGE_TMP}"
gzip -k -f ${image_name}
chmod a+rw ${image_name} ${image_name}.gz;
gz_file_add_ver ${image_name}.gz
}

gen_image_spinor_proc_ai_mode()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash

source ${K230_SDK_ROOT}/board/common/gen_image_script/gen_image_comm_func.sh


env_dir="${K230_SDK_ROOT}/board/common/env"

GENIMAGE_CFG_DIR="${K230_SDK_ROOT}/board/common/gen_image_cfg"
GENIMAGE_CFG_SD="${GENIMAGE_CFG_DIR}/genimage-sdcard-dictionary-pen.cfg"
GENIMAGE_CFG_SPI_NOR="${GENIMAGE_CFG_DIR}/genimage-spinor.cfg"
GENIMAGE_CFG_SPI_NAND="${GENIMAGE_CFG_DIR}/genimage-spinand.cfg"
GENIMAGE_CFG_SD_REMOTE="${GENIMAGE_CFG_DIR}/genimage-sdcard_remote.cfg"

cfg_data_file_path="${GENIMAGE_CFG_DIR}/data"
quick_boot_cfg_data_file="${GENIMAGE_CFG_DIR}/data/quick_boot.bin"
face_database_data_file="${GENIMAGE_CFG_DIR}/data/face_data.bin"
sensor_cfg_data_file="${GENIMAGE_CFG_DIR}/data/sensor_cfg.bin"
ai_mode_data_file="${BUILD_DIR}/images/big-core/ai_mode.bin" #"${GENIMAGE_CFG_DIR}/data/ai_mode.bin"
speckle_data_file="${GENIMAGE_CFG_DIR}/data/speckle.bin"
rtapp_data_file="${BUILD_DIR}/images/big-core/fastboot_app.elf"




gen_dictionary_pen_device_app()
{
#crop little-core
# rm -rf lib/modules/;
# rm -rf lib/libstdc++*;
#rm -rf lib/modules/
#rm -rf usr/bin/fio;
#rm -rf usr/bin/lvgl_demo_widgets;
#rm -rf usr/bin/ssh*
#find mnt/ -type f -not -name k_ipcm.ko -not -name sharefs | xargs rm -rf ;
# rm -rf app/;
rm -rf lib/tuning-server;
#rm -rf usr/bin/stress-ng bin/bash usr/sbin/sshd usr/bin/trace-cmd usr/bin/lvgl_demo_widgets;
#find . -name *.ko | xargs rm -rf ;

# fakeroot -- ${K230_SDK_ROOT}/tools/mkcpio-rootfs.sh;

#cp ${K230_SDK_ROOT}/src/reference/dictionary_pen_poc/cidianbi_kmodel_v2.5.1/include ${K230_SDK_ROOT}/src/reference/dictionary_pen_poc/
#rtapp and ai mode
cd ${K230_SDK_ROOT}; make dictionary_pen;
#creat dictionary_pen dir
mkdir -p ${BUILD_DIR}/images/big-core/app/dictionary_pen/
cp ${K230_SDK_ROOT}/src/reference/business_poc/dictionary_pen_poc/cidianbi_kmodel_v2.5.1/* ${BUILD_DIR}/images/big-core/app/dictionary_pen/ -rf
cp ${K230_SDK_ROOT}/src/reference/business_poc/dictionary_pen_poc/include ${BUILD_DIR}/images/big-core/app/dictionary_pen/ -rf
cp ${K230_SDK_ROOT}/src/reference/business_poc/dictionary_pen_poc/build/dictionary_pen.elf ${BUILD_DIR}/images/big-core/app/dictionary_pen/ -rf

# crop big-core
# find . -type f -not -name fastboot_app.elf -not -name init.sh -not -name doorbell.g711u -not -name person_detect_yolov5n.kmodel -not -name imx335-1920x1080_auto.json* -not -name imx335-1920x1080.bin -not -name imx335-1920x1080_manual.json* -not -name imx335-1920x1080.xml* -not -name imx335-2592x1944_auto.json* -not -name imx335-2592x1944.bin -not -name imx335-2592x1944_manual.json* -not -name imx335-2592x1944.xml* | xargs rm -rf

# rm ${BUILD_DIR}/images/big-core/app/* -rf;

cd ${RTSMART_SRC_DIR}/userapps/; python3 ../tools/mkromfs.py ${BUILD_DIR}/images/big-core/root/ ${RTSMART_SRC_DIR}/kernel/bsp/maix3/applications/romfs.c;
cd ${K230_SDK_ROOT};make rtt_update_romfs;

cp ${BUILD_DIR}/big/rt-smart/rtthread.* ${BUILD_DIR}/images/big-core/;
}

copye_file_to_images;
gen_dictionary_pen_device_app;
gen_version;
gen_uboot_bin;
gen_linux_bin;
gen_final_ext2;
gen_rtt_bin;
gen_env_bin;
copy_app;

if [ "${CONFIG_REMOTE_TEST_PLATFORM}" = "y" ] ; then
gen_image ${GENIMAGE_CFG_SD_REMOTE} sysimage-sdcard.img
else
gen_image ${GENIMAGE_CFG_SD} sysimage-sdcard.img
fi

if [ "${CONFIG_GEN_SECURITY_IMG}" = "y" ] ; then
gen_image ${GENIMAGE_CFG_SD_AES} sysimage-sdcard_aes.img
gen_image ${GENIMAGE_CFG_SD_SM} sysimage-sdcard_sm.img
fi

# gen_image_spinor
# gen_image_spinand;



cd ${BUILD_DIR}/images/
rm -rf sysimage-sdcard_aes.img sysimage-sdcard_sm.img *.vfat









20 changes: 10 additions & 10 deletions board/k230_evb_doorlock/gen_image_script/gen_doorlock_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ shrink_rootfs()
rm -rf usr/bin/k230_timer_demo
rm -rf usr/bin/gpio_keys_demo
rm -rf lib/modules/5.10.4+/kernel/drivers/gpu/
rm -rf /lib/modules/5.10.4+/kernel/drivers/net/wireless/aich/aiw4211lv10/aiw4211lv10.ko

find mnt/ -type f -not -name k_ipcm.ko -not -name sharefs | xargs rm -rf ;
# rm -rf app/;
rm -rf lib/tuning-server;
Expand Down Expand Up @@ -82,16 +82,16 @@ gen_env_bin;
copy_app;


if [ "${CONFIG_REMOTE_TEST_PLATFORM}" = "y" ] ; then
gen_image ${GENIMAGE_CFG_SD_REMOTE} sysimage-sdcard.img
else
gen_image ${GENIMAGE_CFG_SD} sysimage-sdcard.img
fi
# if [ "${CONFIG_REMOTE_TEST_PLATFORM}" = "y" ] ; then
# gen_image ${GENIMAGE_CFG_SD_REMOTE} sysimage-sdcard.img
# else
# gen_image ${GENIMAGE_CFG_SD} sysimage-sdcard.img
# fi

if [ "${CONFIG_GEN_SECURITY_IMG}" = "y" ] ; then
gen_image ${GENIMAGE_CFG_SD_AES} sysimage-sdcard_aes.img
gen_image ${GENIMAGE_CFG_SD_SM} sysimage-sdcard_sm.img
fi
# if [ "${CONFIG_GEN_SECURITY_IMG}" = "y" ] ; then
# gen_image ${GENIMAGE_CFG_SD_AES} sysimage-sdcard_aes.img
# gen_image ${GENIMAGE_CFG_SD_SM} sysimage-sdcard_sm.img
# fi

if [ "${CONFIG_SPI_NOR}" = "y" ]; then
cd ${BUILD_DIR}/;rm -rf images_bak;cp images images_bak -r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ gen_env_bin;
copy_app;


if [ "${CONFIG_REMOTE_TEST_PLATFORM}" = "y" ] ; then
gen_image ${GENIMAGE_CFG_SD_REMOTE} sysimage-sdcard.img
else
gen_image ${GENIMAGE_CFG_SD} sysimage-sdcard.img
fi

if [ "${CONFIG_GEN_SECURITY_IMG}" = "y" ] ; then
gen_image ${GENIMAGE_CFG_SD_AES} sysimage-sdcard_aes.img
gen_image ${GENIMAGE_CFG_SD_SM} sysimage-sdcard_sm.img
fi
# if [ "${CONFIG_REMOTE_TEST_PLATFORM}" = "y" ] ; then
# gen_image ${GENIMAGE_CFG_SD_REMOTE} sysimage-sdcard.img
# else
# gen_image ${GENIMAGE_CFG_SD} sysimage-sdcard.img
# fi

# if [ "${CONFIG_GEN_SECURITY_IMG}" = "y" ] ; then
# gen_image ${GENIMAGE_CFG_SD_AES} sysimage-sdcard_aes.img
# gen_image ${GENIMAGE_CFG_SD_SM} sysimage-sdcard_sm.img
# fi

if [ "${CONFIG_SPI_NOR}" = "y" ] ;then
cd ${BUILD_DIR}/;rm -rf images_bak;cp images images_bak -r;
Expand Down
Loading

0 comments on commit 3ade2d0

Please sign in to comment.