Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
wycwyhwyq authored Jan 14, 2023
2 parents 2c2c661 + 0cc008e commit ed9472d
Show file tree
Hide file tree
Showing 174 changed files with 511,920 additions and 9,851 deletions.
44 changes: 26 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ jobs:
export HW_MODEL=`echo ${{ matrix.cfg }}|awk -F '_' '{print $1}'`
export HW_VER=`echo ${{ matrix.cfg }}|awk -F '_' '{print $3"."$4}'`
test -d bin || mkdir ./bin
test -f ./bin/ai_dut && rm -rf ./bin/ai_dut
wget -qc https://ai.b-bug.org/k510_buildroot/github/ai_dut -O ./bin/ai_dut
chmod +x ./bin/ai_dut
available=$(./bin/ai_dut show --dest available --hw_type k510 --hw_model $HW_MODEL --hw_ver $HW_VER --format args)
test -f ./bin/ailab && rm -rf ./bin/ailab
wget -qc https://ai.b-bug.org/k510_buildroot/github/ailab -O ./bin/ailab
chmod +x ./bin/ailab
available=$(./bin/ailab show --dest available --hw_type k510 --hw_model $HW_MODEL --hw_ver $HW_VER --format args)
echo $available
echo "available=$available" >> $GITHUB_ENV
if [[ $available =~ "k510" ]]; then
Expand All @@ -152,7 +152,7 @@ jobs:
echo "Reserve DUT start"
echo "PR ID: $PULL_REQUEST_ID"
echo "Job ID: $GITHUB_RUN_ID"
reserved=$(./bin/ai_dut add ${{ env.available }} --site github-actions --source $PULL_REQUEST_ID --job $GITHUB_RUN_ID --format args)
reserved=$(./bin/ailab add ${{ env.available }} --time 15m --site github-actions --source $PULL_REQUEST_ID --job $GITHUB_RUN_ID --format args)
echo $reserved
echo "reserved=$reserved" >> $GITHUB_ENV
if [[ $reserved =~ "github-actions" ]]; then
Expand All @@ -161,12 +161,12 @@ jobs:
echo "ERROR: Reserve DUT failed"
exit 1
fi
power=$(./bin/ai_dut power --type=cycle ${{ env.available }})
power=$(./bin/ailab power --type=on ${{ env.available }})
echo $power
if [[ $power =~ "True" ]]; then
echo "Power Cycle DUT pass"
echo "Power on DUT pass"
else
echo "ERROR: Power Cycle DUT failed"
echo "ERROR: Power on DUT failed"
exit 1
fi
Expand All @@ -178,28 +178,28 @@ jobs:
echo "bbl md5: ${{needs.build_image.outputs.md5_bbl}}"
echo "dtb md5: ${{needs.build_image.outputs.md5_dtb}}"
test -d bin || mkdir ./bin
test -f ./bin/ai_load && rm -rf ./bin/ai_load
wget -qc https://ai.b-bug.org/k510_buildroot/github/ai_load -O ./bin/ai_load
chmod +x ./bin/ai_load
test -f ./bin/aiload && rm -rf ./bin/aiload
wget -qc https://ai.b-bug.org/k510_buildroot/github/aiload -O ./bin/aiload
chmod +x ./bin/aiload
echo $PULL_REQUEST_ID
echo $GITHUB_RUN_ID
./bin/ai_load --pr_id $PULL_REQUEST_ID --job_id $GITHUB_RUN_ID --md5_dtb ${{needs.build_image.outputs.md5_dtb}} --md5_bbl ${{needs.build_image.outputs.md5_bbl}} ${{ env.available }}
./bin/aiload --pr_id $PULL_REQUEST_ID --job_id $GITHUB_RUN_ID --md5_dtb ${{needs.build_image.outputs.md5_dtb}} --md5_bbl ${{needs.build_image.outputs.md5_bbl}} ${{ env.available }}
- name: Run Test
id: run_test
timeout-minutes: 10
run: |
echo "Run Test start"
test -d bin || mkdir ./bin
test -f ./bin/ai_robot && rm -rf ./bin/ai_robot
wget -qc https://ai.b-bug.org/k510_buildroot/github/ai_robot -O ./bin/ai_robot
chmod +x ./bin/ai_robot
test -f ./bin/airobot && rm -rf ./bin/airobot
wget -qc https://ai.b-bug.org/k510_buildroot/github/airobot -O ./bin/airobot
chmod +x ./bin/airobot
test -f ./k510.robot && rm -rf ./k510.robot
wget -qc https://ai.b-bug.org/k510_buildroot/github/k510.robot -O ./k510.robot
./bin/ai_dut convert --dest=script --format yaml --file_name=var.yml ${{ env.available }}
./bin/ailab convert --dest=script --format yaml --file_name=var.yml ${{ env.available }}
test -f var.yml || exit 1
echo "Run test case start"
./bin/ai_robot -m github -V var.yml -i github k510.robot
./bin/airobot -m github -V var.yml -i github k510.robot
echo "Run test case pass"
- name: Release DUT
Expand All @@ -208,11 +208,19 @@ jobs:
run: |
echo "Release DUT start"
test -d bin || mkdir ./bin
result=$(./bin/ai_dut delete ${{ env.reserved }})
result=$(./bin/ailab update ${{ env.reserved }})
echo $result
if [[ $result =~ "True" ]]; then
echo "Release DUT pass"
else
echo "ERROR: Release DUT failed"
exit 1
fi
power=$(./bin/ailab power --type=off ${{ env.available }})
echo $power
if [[ $power =~ "True" ]]; then
echo "Power off DUT pass"
else
echo "ERROR: Power off DUT failed"
exit 1
fi
1 change: 0 additions & 1 deletion Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ 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"
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
BR2_VERSION = 2020.02.11


RED=\e[1;31m
NC=\e[0m

Expand Down Expand Up @@ -106,11 +107,11 @@ clean:

dl:
rm -rf pkg-download/dl.tar.gz;
wget -c https://github.com/kendryte/k510_buildroot/releases/download/v1.6/dl.tar.gz -O pkg-download/dl.tar.gz;
wget -c https://kendryte-download.canaan-creative.com/k510/package/dl/v1.0.0/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.7/ai_kmodel_data.tar.xz -O dl/ai/ai_kmodel_data.tar.xz;
mkdir -p dl/ai/; wget -c https://kendryte-download.canaan-creative.com/k510/package/ai/v1.0.0/ai_kmodel_data.tar.xz -O dl/ai/ai_kmodel_data.tar.xz;
(set -xe; NNCASE_VER=v1.7.1 ;\
NNCASE_SITE=https://github.com/kendryte/nncase/releases/download;\
NNCASE_SITE=https://kendryte-download.canaan-creative.com/k510/nncase/release;\
NNCASE_PIP_VD=1.7.1.20220701 ; \
NNCASE_PIP_K510_VD=1.7.1.20220701 ;\
mkdir -p dl/nncase_linux_runtime; cd dl/nncase_linux_runtime; \
Expand Down
11 changes: 11 additions & 0 deletions board/canaan/k510/k510_rootfs_skeleton/etc/init.d/rc.sysinit
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ else
#udhcpc -b -i eth0 &
fi

ifconfig wlan0 up
if [ $? -eq 0 ];then
if [ -f /first_run_flag_file ];then
echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf
echo "update_config=1" >> /etc/wpa_supplicant.conf
echo "ap_scan=1" >> /etc/wpa_supplicant.conf
fi

wpa_supplicant -D nl80211 -i wlan0 -c /etc/wpa_supplicant.conf -B
fi

/sbin/ifup -a -f

#telnetd
Expand Down
4 changes: 0 additions & 4 deletions board/canaan/k510/k510_rootfs_skeleton/etc/init.d/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ if [ -d /lib/modules/$linux_ver/ ]; then
done</lib/modules/$linux_ver/modules.order
fi

sleep 0.5
ifconfig wlan0 up
wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B

#change SHELL default version
#if [ -f /bin/bash ]; then
# ln -sf /bin/bash /bin/sh
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#AP6212A_NVRAM_V1.0.2_20191121
# 2.4 GHz, 20 MHz BW mode

# The following parameter values are just placeholders, need to be updated.
manfid=0x2d0
prodid=0x0726
vendid=0x14e4
devid=0x43e2
boardtype=0x0726
boardrev=0x1101
boardnum=22
macaddr=00:90:4c:c5:12:38
sromrev=11
boardflags=0x00404201
xtalfreq=26000
nocrc=1
ag0=255
aa2g=1
ccode=ALL

pa0itssit=0x20
extpagain2g=0

#PA parameters for 2.4GHz, measured at CHIP OUTPUT
pa2ga0=-215,5267,-656
AvVmid_c0=0x0,0xc8
cckpwroffset0=5

# PPR params
maxp2ga0=80
txpwrbckof=6
cckbw202gpo=0x6666
legofdmbw202gpo=0xaaaaaaaa
mcsbw202gpo=0xbbbbbbbb

# OFDM IIR :
ofdmdigfilttype=18
ofdmdigfilttypebe=18
# PAPD mode:
papdmode=2

il0macaddr=00:90:4c:c5:12:38
wl0id=0x431b

#OOB parameters
hostwake=0x40
hostrdy=0x41
usbrdy=0x03
usbrdydelay=100
deadman_to=0xffffffff
# muxenab: 0x1 for UART enable, 0x10 for Host awake
muxenab=0x10
# CLDO PWM voltage settings - 0x4 - 1.1 volt
#cldo_pwm=0x4
glitch_based_crsmin=1
noccpwrlmt=1
4 changes: 2 additions & 2 deletions board/canaan/k510/uboot-emmc.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ipaddr=10.100.226.221
netmask=255.255.255.0
gatewayip=10.100.226.254
serverip=10.100.226.63
bootargs=root=/dev/mmcblk0p3 ro console=ttyS0,115200n8 debug loglevel=7 rootfstype=ext2
bootargs=root=/dev/mmcblk0p3 ro console=ttyS0,115200n8 debug loglevel=7 rootfstype=ext2 isolcpus=1

bootcmd=fatload mmc 0:2 0x600000 bootm-bbl.img;fatload mmc 0:2 0x2000000 k510.dtb;bootm 0x600000 - 0x2000000
bootcmd=while true ; do fatload mmc 0:2 0x600000 bootm-bbl.img && fatload mmc 0:2 0x2000000 k510.dtb && bootm 0x600000 - 0x2000000 ;done
bootcmd_nfs=tftp 0x600000 bootm-bbl.img;tftp 0x2000000 k510_nfsroot.dtb;bootm 0x600000 - 0x2000000
4 changes: 2 additions & 2 deletions board/canaan/k510/uboot-nand.env
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ipaddr=10.100.226.221
netmask=255.255.255.0
gatewayip=10.100.226.254
serverip=10.100.226.63
bootargs=root=ubi0:ubi_rootfs_part rootfstype=ubifs ubi.mtd=6,2048 console=ttyS0,115200n8 debug loglevel=7
bootargs=root=ubi0:ubi_rootfs_part rootfstype=ubifs ubi.mtd=6,2048 console=ttyS0,115200n8 debug loglevel=7 isolcpus=1

bootcmd=mtd read spi-nand0 0x600000 0x380000 0xf00000;mtd read spi-nand0 0x2000000 0x340000 0x40000;bootm 0x600000 - 0x2000000
bootcmd=while true ; do mtd read spi-nand0 0x600000 0x380000 0xf00000 && mtd read spi-nand0 0x2000000 0x340000 0x40000 && bootm 0x600000 - 0x2000000 ;done

bootcmd_nfs=tftp 0x600000 bootm-bbl.img;tftp 0x2000000 k510_nfsroot.dtb;bootm 0x600000 - 0x2000000
2 changes: 1 addition & 1 deletion board/canaan/k510/uboot-sdcard.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ipaddr=10.100.226.221
netmask=255.255.255.0
gatewayip=10.100.226.254
serverip=10.100.226.63
bootargs=root=/dev/mmcblk2p2 ro console=ttyS0,115200n8 debug loglevel=7 rootfstype=ext2
bootargs=root=/dev/mmcblk2p2 ro console=ttyS0,115200n8 debug loglevel=7 rootfstype=ext2 isolcpus=1

bootcmd=while true ; do fatload mmc 1:1 0x600000 bootm-bbl.img && fatload mmc 1:1 0x2000000 k510.dtb && bootm 0x600000 - 0x2000000 ;done
bootcmd_nfs=tftp 0x600000 bootm-bbl.img;tftp 0x2000000 k510_nfsroot.dtb;bootm 0x600000 - 0x2000000
1 change: 0 additions & 1 deletion configs/k510_crb_lp3_v0_1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ BR2_TARGET_K510_EVB_TEST_MAILBOX_FIRMWARE=y
BR2_TARGET_K510_EVB_TEST_SIMD_UMUL8_FIRMWARE=y
BR2_PACKAGE_DSP_LOG=y
BR2_PACKAGE_VENC_LIB=y
BR2_PACKAGE_ALSA_DEMO=y
BR2_PACKAGE_LIBRTMP=y
BR2_PACKAGE_OPENSSL=y
BR2_PACKAGE_LIBOPENSSL=y
Expand Down
3 changes: 1 addition & 2 deletions configs/k510_crb_lp3_v1_2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ BR2_TARGET_K510_EVB_TEST_MAILBOX_FIRMWARE=y
BR2_TARGET_K510_EVB_TEST_SIMD_UMUL8_FIRMWARE=y
BR2_PACKAGE_DSP_LOG=y
BR2_PACKAGE_VENC_LIB=y
BR2_PACKAGE_ALSA_DEMO=y
BR2_PACKAGE_FFMPEG_CANAAN=y
BR2_PACKAGE_AUDIO3A_LIB=y
BR2_PACKAGE_MEDIACTL_LIB=y
Expand All @@ -131,4 +130,4 @@ BR2_PACKAGE_WRITE_READ_FILE=y
BR2_PACKAGE_WIFI=y
BR2_PACKAGE_AWS_IOT_TEST=y
BR2_PACKAGE_GPIO_KEYS=y
BR2_PACKAGE_RAPIDJSON=y
BR2_PACKAGE_RAPIDJSON=y
1 change: 0 additions & 1 deletion configs/k510_evb_lp3_v1_1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ BR2_PACKAGE_K510_EVB_TEST=y
BR2_TARGET_K510_EVB_TEST_FFT_FIRMWARE=y
BR2_PACKAGE_DSP_LOG=y
BR2_PACKAGE_VENC_LIB=y
BR2_PACKAGE_ALSA_DEMO=y
BR2_PACKAGE_FFMPEG_CANAAN=y
BR2_PACKAGE_AUDIO3A_LIB=y
BR2_PACKAGE_MEDIACTL_LIB=y
Expand Down
3 changes: 2 additions & 1 deletion package/ai/ai.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ AI_SITE = $(AI_LOCAL_PATH)
AI_SOURCE = code.tar

AI_SITE_METHOD = file
AI_KMODEL_DATA_SITE = https://github.com/kendryte/k510_buildroot/releases/download/v1.7/ai_kmodel_data.tar.xz
AI_KMODEL_DATA_VERSION = v1.0.0
AI_KMODEL_DATA_SITE = https://kendryte-download.canaan-creative.com/k510/package/ai/$(AI_KMODEL_DATA_VERSION)/ai_kmodel_data.tar.xz
AI_EXTRA_DOWNLOADS = $(call qstrip,$(AI_KMODEL_DATA_SITE))
MODEL=$(AI_DIR)/ai_kmodel_data/kmodel_release

Expand Down
7 changes: 5 additions & 2 deletions package/ai/code/common/k510_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <media_ctl.h>
#include "k510_drm.h"

# define DRM_CARD "/dev/dri/card0"
Expand Down Expand Up @@ -55,7 +56,9 @@ struct drm_dev drm_dev;

int draw_frame(struct vo_draw_frame *frame)
{
return drmIoctl(drm_dev.fd, DRM_IOCTL_KENDRYTE_DRAW_FRAME, frame);
unsigned color = frame->draw_en ? 0xff0000 : 0xff000000;
mediactl_rect(ISP_F2K_PIPELINE, 1, frame->frame_num, frame->line_x_start, frame->line_y_start, frame->line_x_end - frame->line_x_start, frame->line_y_end - frame->line_y_start, 4, color, 0);
return 0;
}

static uint32_t get_plane_property_id(const char *name)
Expand Down Expand Up @@ -644,7 +647,7 @@ static int drm_allocate_dumb_argb(struct drm_buffer *buf)

/* create dumb buffer */
memset(&creq, 0, sizeof(creq));
creq.width = (drm_dev.width+15)/16*16;
creq.width = (drm_dev.width+7)/8*8;
creq.height = drm_dev.height; //* 4;
creq.bpp = 32; //8

Expand Down
1 change: 1 addition & 0 deletions package/ai/code/common/media_ctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ struct video_info

int mediactl_init(char *video_cfg_file,struct video_info *dev_info);
void mediactl_exit(void);
int mediactl_rect(enum isp_pipeline_e pipeline, unsigned layer, unsigned area, unsigned x, unsigned y, unsigned width, unsigned height, unsigned line_width, unsigned color, unsigned border_mask);
int mediactl_set_ae(enum isp_pipeline_e pipeline);
int mediactl_set_ae_single(enum isp_pipeline_e pipeline);
int mediactl_set_ae_sync(enum isp_pipeline_e pipeline);
Expand Down
4 changes: 3 additions & 1 deletion package/ai/code/face_alignment/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,9 @@ int main(int argc, char *argv[])

thread_ds0.join();
thread_ds2.join();

memset(drm_dev.drm_bufs_argb[0].map, 0xff, screen_width * screen_height * 4);
usleep(100000);
drm_dmabuf_set_plane(&drm_dev.drm_bufs[0], &drm_dev.drm_bufs_argb[0]);
/****fixed operation for drm deinit****/
for(uint32_t i = 0; i < DRM_BUFFERS_COUNT; i++)
{
Expand Down
8 changes: 5 additions & 3 deletions package/ai/code/face_detect/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void ai_worker(ai_worker_args ai_args)

for (auto p : points_to_clear[index])
{
cv::circle(img_argb, p, 8, cv::Scalar(0, 0, 0, 0), -1);
cv::circle(img_argb, p, 4, cv::Scalar(0, 0, 0, 0), -1);
}
}

Expand Down Expand Up @@ -242,7 +242,7 @@ void ai_worker(ai_worker_args ai_args)
{
int32_t x0 = l.points[2 * ll + 0] * screen_width * net_len / valid_width;
int32_t y0 = l.points[2 * ll + 1] * net_len / valid_height * screen_height;
cv::circle(img_argb, cv::Point(x0, y0), 8, cv::Scalar(0, 0, 255, 255), -1);
cv::circle(img_argb, cv::Point(x0, y0), 4, cv::Scalar(0, 0, 255, 255), -1);
points_to_clear[index].push_back(cv::Point(x0, y0));
}
}
Expand Down Expand Up @@ -629,7 +629,9 @@ int main(int argc, char *argv[])

thread_ds0.join();
thread_ds2.join();

memset(drm_dev.drm_bufs_argb[0].map, 0xff, screen_width * screen_height * 4);
usleep(100000);
drm_dmabuf_set_plane(&drm_dev.drm_bufs[0], &drm_dev.drm_bufs_argb[0]);
/****fixed operation for drm deinit****/
for(uint32_t i = 0; i < DRM_BUFFERS_COUNT; i++)
{
Expand Down
8 changes: 5 additions & 3 deletions package/ai/code/face_expression/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void ai_worker(ai_worker_args ai_args)

for (uint32_t cc = 0; cc < points_to_clear[index].size(); cc++)
{
cv::putText(img_argb, strs_to_clear[index][cc], points_to_clear[index][cc], cv::FONT_HERSHEY_COMPLEX, 2, cv::Scalar(0, 0, 0, 0), 2, 8, 0);
cv::putText(img_argb, strs_to_clear[index][cc], points_to_clear[index][cc], cv::FONT_HERSHEY_COMPLEX, 1, cv::Scalar(0, 0, 0, 0), 1, 8, 0);
}
}

Expand Down Expand Up @@ -283,7 +283,7 @@ void ai_worker(ai_worker_args ai_args)
std::string text = fexpre.labels[score_index] + ":" + std::to_string(round(score_max * 100) / 100.0).substr(0,4);
int x0 = std::max(0, std::min(int((b.x - b.w / 2) * fd_net_len / valid_width * screen_width), (int)screen_width));
int y0 = std::max(0, std::min(int((b.y - b.h / 2) * fd_net_len / valid_height * screen_height) + 60, (int)screen_height));
cv::putText(img_argb, text, cv::Point(x0, y0), cv::FONT_HERSHEY_COMPLEX, 2, cv::Scalar(255, 0, 0, 255), 2, 8, 0);
cv::putText(img_argb, text, cv::Point(x0, y0), cv::FONT_HERSHEY_COMPLEX, 1, cv::Scalar(255, 0, 0, 255), 1, 8, 0);
points_to_clear[index].push_back(cv::Point(x0, y0));
strs_to_clear[index].push_back(text);
}
Expand Down Expand Up @@ -687,7 +687,9 @@ int main(int argc, char *argv[])

thread_ds0.join();
thread_ds2.join();

memset(drm_dev.drm_bufs_argb[0].map, 0xff, screen_width * screen_height * 4);
usleep(100000);
drm_dmabuf_set_plane(&drm_dev.drm_bufs[0], &drm_dev.drm_bufs_argb[0]);
/****fixed operation for drm deinit****/
for(uint32_t i = 0; i < DRM_BUFFERS_COUNT; i++)
{
Expand Down
Loading

0 comments on commit ed9472d

Please sign in to comment.