From 62cd7ad961151975fdd5159ebc4fb8af781238b0 Mon Sep 17 00:00:00 2001 From: flyingcys Date: Tue, 9 Apr 2024 22:48:57 +0800 Subject: [PATCH] support cvitek bsp spinor flash --- bsp/cvitek/README.md | 4 ++ bsp/cvitek/board_env.sh | 45 ++++++++++++++ bsp/cvitek/c906_little/Kconfig | 8 +++ bsp/cvitek/c906_little/README.md | 2 + bsp/cvitek/c906_little/README_en.md | 2 + bsp/cvitek/combine-fip.sh | 39 +----------- bsp/cvitek/cv18xx_risc-v/Kconfig | 7 +++ bsp/cvitek/cv18xx_risc-v/README.md | 2 + bsp/cvitek/cv18xx_risc-v/README_en.md | 2 + .../cv1800b_milkv_duo_spinor.dtb | Bin 0 -> 19789 bytes .../dtb/milkv-duo-spinor/multi.its | 56 ++++++++++++++++++ .../cv1812cp_milkv_duo256m_spinor.dtb | Bin 0 -> 20475 bytes .../dtb/milkv-duo256m-spinor/multi.its | 56 ++++++++++++++++++ bsp/cvitek/drivers/SConscript | 2 +- bsp/cvitek/mksdimg.sh | 37 +++++++----- 15 files changed, 209 insertions(+), 53 deletions(-) create mode 100755 bsp/cvitek/board_env.sh create mode 100755 bsp/cvitek/cv18xx_risc-v/dtb/milkv-duo-spinor/cv1800b_milkv_duo_spinor.dtb create mode 100755 bsp/cvitek/cv18xx_risc-v/dtb/milkv-duo-spinor/multi.its create mode 100755 bsp/cvitek/cv18xx_risc-v/dtb/milkv-duo256m-spinor/cv1812cp_milkv_duo256m_spinor.dtb create mode 100755 bsp/cvitek/cv18xx_risc-v/dtb/milkv-duo256m-spinor/multi.its diff --git a/bsp/cvitek/README.md b/bsp/cvitek/README.md index 2bb196c3df..f1bb1ee3ce 100755 --- a/bsp/cvitek/README.md +++ b/bsp/cvitek/README.md @@ -32,7 +32,9 @@ $ scons --menuconfig ```shell Board Type (milkv-duo) ---> ( ) milkv-duo + ( ) milkv-duo-spinor (X) milkv-duo256m + ( ) milkv-duo256m-spinor ``` 2. 编译 @@ -75,6 +77,8 @@ $ wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1u $ sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb ``` +3. 如发现切换开发板编译正常,但无法正常打包,请切换至自动下载的 `cvi_bootloader` 目录,并手工运行 `git pull` 更新,或删除该目录后重新自动下载。 + ## 联系人信息 维护人:[flyingcys](https://github.com/flyingcys) diff --git a/bsp/cvitek/board_env.sh b/bsp/cvitek/board_env.sh new file mode 100755 index 0000000000..dcd4572702 --- /dev/null +++ b/bsp/cvitek/board_env.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +function get_board_type() +{ + BOARD_CONFIG=("CONFIG_BOARD_TYPE_MILKV_DUO" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINOR" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINAND" "CONFIG_BOARD_TYPE_MILKV_DUO256M" "CONFIG_BOARD_TYPE_MILKV_DUO256M_SPINOR" "CONFIG_BOARD_TYPE_MILKV_DUO256M_SPINAND") + BOARD_VALUE=("milkv-duo" "milkv-duo-spinor" "milkv-duo-spinand" "milkv-duo256m" "milkv-duo256m-spinor" "milkv-duo256m-spinand") + STORAGE_VAUE=("sd" "spinor" "spinand" "sd" "spinor" "spinand") + + for ((i=0;i<${#BOARD_CONFIG[@]};i++)) + do + config_value=$(grep -w "${BOARD_CONFIG[i]}" ${PROJECT_PATH}/.config | cut -d= -f2) + if [ "$config_value" == "y" ]; then + BOARD_TYPE=${BOARD_VALUE[i]} + STORAGE_TYPE=${STORAGE_VAUE[i]} + break + fi + done + export BOARD_TYPE=${BOARD_TYPE} + export STORAGE_TYPE=${STORAGE_TYPE} +} + +function check_bootloader() +{ + restult=$(curl -m 10 -s http://www.ip-api.com/json) + COUNTRY=$(echo $restult | sed 's/.*"country":"\([^"]*\)".*/\1/') + echo "Country: $COUNTRY" + + if [ "$COUNTRY" == "China" ]; then + BOOTLOADER_URL=https://gitee.com/flyingcys/cvitek_bootloader + else + BOOTLOADER_URL=https://github.com/flyingcys/cvitek_bootloader + fi + + if [ ! -d cvitek_bootloader ]; then + echo "cvitek_bootloader not exist, clone it from ${BOOTLOADER_URL}" + git clone ${BOOTLOADER_URL} + + if [ $? -ne 0 ]; then + echo "Failed to clone ${BOOTLOADER_URL} !" + exit 1 + fi +fi +} + + diff --git a/bsp/cvitek/c906_little/Kconfig b/bsp/cvitek/c906_little/Kconfig index a759cc313d..d981d97abe 100755 --- a/bsp/cvitek/c906_little/Kconfig +++ b/bsp/cvitek/c906_little/Kconfig @@ -45,6 +45,14 @@ choice config BOARD_TYPE_MILKV_DUO bool "milkv-duo" + + config BOARD_TYPE_MILKV_DUO_SPINOR + bool "milkv-duo-spinor" + config BOARD_TYPE_MILKV_DUO256M bool "milkv-duo256m" + + config BOARD_TYPE_MILKV_DUO256M_SPINOR + bool "milkv-duo256m-spinor" + endchoice diff --git a/bsp/cvitek/c906_little/README.md b/bsp/cvitek/c906_little/README.md index 5b6b3026bb..14bd1a7e49 100755 --- a/bsp/cvitek/c906_little/README.md +++ b/bsp/cvitek/c906_little/README.md @@ -33,7 +33,9 @@ $ scons --menuconfig ```shell Board Type (milkv-duo) ---> ( ) milkv-duo + ( ) milkv-duo-spinor (X) milkv-duo256m + ( ) milkv-duo256m-spinor ``` 它会自动下载 env 相关脚本到 ~/.env 目录,然后执行 diff --git a/bsp/cvitek/c906_little/README_en.md b/bsp/cvitek/c906_little/README_en.md index d2b872c71f..df6d28fa9c 100755 --- a/bsp/cvitek/c906_little/README_en.md +++ b/bsp/cvitek/c906_little/README_en.md @@ -32,7 +32,9 @@ Choose the target development board type that needs to be compiled: ```shell Board Type (milkv-duo) ---> ( ) milkv-duo + ( ) milkv-duo-spinor (X) milkv-duo256m + ( ) milkv-duo256m-spinor ``` It will automatically download env related scripts to the ~/.env directory, then execute diff --git a/bsp/cvitek/combine-fip.sh b/bsp/cvitek/combine-fip.sh index 82e2edf5b1..414da79eb3 100755 --- a/bsp/cvitek/combine-fip.sh +++ b/bsp/cvitek/combine-fip.sh @@ -11,47 +11,12 @@ fi ROOT_PATH=$(pwd) echo $ROOT_PATH -function get_board_type() -{ - BOARD_CONFIG=("CONFIG_BOARD_TYPE_MILKV_DUO" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINOR" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINAND" "CONFIG_BOARD_TYPE_MILKV_DUO256M") - BOARD_VALUE=("milkv-duo" "milkv-duo-spinor" "milkv-duo-spinand" "milkv-duo256m") - - for ((i=0;i<${#BOARD_CONFIG[@]};i++)) - do - config_value=$(grep -w "${BOARD_CONFIG[i]}" ${PROJECT_PATH}/.config | cut -d= -f2) - if [ "$config_value" == "y" ]; then - BOARD_TYPE=${BOARD_VALUE[i]} - break - fi - done -} +. board_env.sh get_board_type echo "board_type: ${BOARD_TYPE}" -COUNTRY=China -function get_country() -{ - restult=$(curl -m 10 -s http://www.ip-api.com/json) - COUNTRY=$(echo $restult | sed 's/.*"country":"\([^"]*\)".*/\1/') - echo "Country: $COUNTRY" -} - -if [ "$COUNTRY" == "China" ]; then - cvitek_bootloader_url=https://gitee.com/flyingcys/cvitek_bootloader -else - cvitek_bootloader_url=https://github.com/flyingcys/cvitek_bootloader -fi - -if [ ! -d cvitek_bootloader ]; then - echo "cvitek_bootloader not exist, clone it from ${cvitek_bootloader_url}" - git clone ${cvitek_bootloader_url} - - if [ $? -ne 0 ]; then - echo "Failed to clone ${cvitek_bootloader_url} !" - exit 1 - fi -fi +check_bootloader || exit 0 export BLCP_2ND_PATH=${PROJECT_PATH}/${IMAGE_NAME} diff --git a/bsp/cvitek/cv18xx_risc-v/Kconfig b/bsp/cvitek/cv18xx_risc-v/Kconfig index a9e8ed78c1..1977442273 100755 --- a/bsp/cvitek/cv18xx_risc-v/Kconfig +++ b/bsp/cvitek/cv18xx_risc-v/Kconfig @@ -53,6 +53,13 @@ choice config BOARD_TYPE_MILKV_DUO bool "milkv-duo" + config BOARD_TYPE_MILKV_DUO_SPINOR + bool "milkv-duo-spinor" + config BOARD_TYPE_MILKV_DUO256M bool "milkv-duo256m" + + config BOARD_TYPE_MILKV_DUO256M_SPINOR + bool "milkv-duo256m-spinor" + endchoice diff --git a/bsp/cvitek/cv18xx_risc-v/README.md b/bsp/cvitek/cv18xx_risc-v/README.md index 0d92292f15..336b6439ac 100755 --- a/bsp/cvitek/cv18xx_risc-v/README.md +++ b/bsp/cvitek/cv18xx_risc-v/README.md @@ -79,7 +79,9 @@ RT-Thread Kernel ---> ```shell Board Type (milkv-duo) ---> ( ) milkv-duo + ( ) milkv-duo-spinor (X) milkv-duo256m + ( ) milkv-duo256m-spinor ``` 它会自动下载env相关脚本到~/.env目录,然后执行 diff --git a/bsp/cvitek/cv18xx_risc-v/README_en.md b/bsp/cvitek/cv18xx_risc-v/README_en.md index e3141e177d..3b19462de0 100755 --- a/bsp/cvitek/cv18xx_risc-v/README_en.md +++ b/bsp/cvitek/cv18xx_risc-v/README_en.md @@ -78,7 +78,9 @@ RT-Thread Kernel ---> ```shell Board Type (milkv-duo) ---> ( ) milkv-duo + ( ) milkv-duo-spinor (X) milkv-duo256m + ( ) milkv-duo256m-spinor ``` It will automatically download relevant scripts to the ~/.env directory, then execute: diff --git a/bsp/cvitek/cv18xx_risc-v/dtb/milkv-duo-spinor/cv1800b_milkv_duo_spinor.dtb b/bsp/cvitek/cv18xx_risc-v/dtb/milkv-duo-spinor/cv1800b_milkv_duo_spinor.dtb new file mode 100755 index 0000000000000000000000000000000000000000..5275da07d2f7b4e9a7f6b241626ce2beb877a680 GIT binary patch literal 19789 zcmcg!Ym6kkMeX!A=B1Bt$5iD8dG<5GaubP=0`f7$Nf0(()tX2S^A7p-4$2eh@$=0lx3t zbE;HZy2tNAJAPAlag0nj)A3(kX`F3QanJ)pp z#@aT2nBL}!k>8rOCsE$UdfZRTybV%Z+kdGlxAY1!gUi*hozyERR`(XX? zXVLk&`kALc^f(%iG)_GTY!KASUe@fSMcj&=^6M zNZQv12?^6GM9|wz8O@Rx6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S<} zhnShZ@=#H|EbF1gzr=sV!&fiUqObM;s)w&$R`u|I?cqnC?~(u4Jbd-CrS`{KJN^1Y z_T+E)0ipOdUhC-;7JV4A|KQA#8RTfPb)61E!@0;aj?HPde*0gGv-MCv z!NY$StQTdH>(s=586cdrL0_;R)@$Kwv1juAcOpsm2Ka)s(nt0SZBK*6=rv=e#t-E>+46@XST%c4!kykpNB*{_eqL!A55#eg zmA#em%_Fk?cY@+^W|{fK{Ga^y_Pwts!MmUN-V&eHvh?nWjM?*j70gdFzX_g|u6XR+ z%P%d-=T{m5)CWG9e#7C=s>aZb@3w#d{12&!%_~t+HZh@A-9|wk^sSviF}v9>>N0M_|1@_!G| z1OKyP>PTP2dhH|V5Y)bWm4)%+T*aDG`I543j(eRfDpP#E6r3p17n3kf+U+7Z!Bc!v z;0+RKc5q?e#$Q>i1}A6$77|A#|D~c0S6|5!yhhTEFCi-UPbv61I$JNpZq&iXn62Tj z8z4zg1^Fq$(K;d#KqTcjP_=*+K~)_^g&AI1?3RJ^tNA2eLyhY?`ZYW2n@zd-sf_^N zAcrw@>LxT8`i*2_;-q4-ojtm2sF#n9?m3}f@Rv;r2m9x2f>x( zMbL`MDBMU}cr%69|7G5E4IvM~`vktPRrg`_3%l!`pn%g_X`f}Yv-V=Z&lEe+W;k#x zA$Y}y9UMCX@SctbD5DaKDcFUvb91qlu9V_%yuzBHRc+N zLAQqvIJBY!w*Ys5yjbX@U9WX&QLer*Z@G@k3~H8}&3v;7EdxA=Xr|p(vMDuAW*myc zxTRwY{&V5!uphYSbu$Iuh=yqkO9LM-hOG$nHbW5Jm?mz5!qjLvZF4H{g_b5}z3d9; zmd8oZSuYcj5@O=?(^kTC#c_*bWuUfyw#thbTmSnn8%!A5i; zSIG(xl;UBdd~uAqjX!EnbS;PqpYV|wBWW$hA|3A}F&@TDvX; + + images { + kernel-1 { + description = "cvitek kernel"; + data = /incbin/("./Image.lzma"); + type = "kernel"; + arch = "riscv"; + os = "linux"; + compression = "lzma"; + load = <0x0 0x80200000>; + entry = <0x0 0x80200000>; + hash-2 { + algo = "crc32"; + }; + }; + + + /*FDT*/ + + fdt-cv1800b_milkv_duo_spinor { + description = "cvitek device tree - cv1800b_milkv_duo_spinor"; + data = /incbin/("./cv1800b_milkv_duo_spinor.dtb"); + type = "flat_dt"; + arch = "riscv"; + compression = "none"; + hash-1 { + algo = "sha256"; + }; + }; + + + + }; + + /*CFG*/ + configurations { + + config-cv1800b_milkv_duo_spinor { + description = "boot cvitek system with board cv1800b_milkv_duo_spinor"; + kernel = "kernel-1"; + fdt = "fdt-cv1800b_milkv_duo_spinor"; + }; + + }; + + +}; diff --git a/bsp/cvitek/cv18xx_risc-v/dtb/milkv-duo256m-spinor/cv1812cp_milkv_duo256m_spinor.dtb b/bsp/cvitek/cv18xx_risc-v/dtb/milkv-duo256m-spinor/cv1812cp_milkv_duo256m_spinor.dtb new file mode 100755 index 0000000000000000000000000000000000000000..e48fe8e3115caf1849fe8e16bb3145247b289bf2 GIT binary patch literal 20475 zcmd5^Ym6kCk zPWA1c9`DTT8s$pW_nyZ+=iGD8J@;01b$|7`|M^xBeE2&-5IhhB58jTN*A2Li<3gGG z8c46OwZ#vXH@Rx)v!?Jk>Nm3;ucc*jVLD!$IWx22h@?&6I*Mxym%(rI;O|5G-Djom z9rd%1qVr?*dq48vSpau8PTv7)5Y)Fb-y)f61A|#P{4V%TqBJOnsNj)6T zG$8`6Y_XypwYYsD%#$K1Lv$(gUb~&-B%+v&4YWB%!t_ryKI=*x%8;(QAn`%3iLPD| zr|ouB_M8Tje~&T}KF0P^x{hb1~(;Tnp^S_+w4`Sib|; zB{;Y#wn_to(;90BWZ|RU7jS(L7w7duT2lts!8V53O!FrL%8>?;D5R5rM{Dt4$1OX+S)GCFhbKnb7TS|LVaDE8h z8iJqmVcJUH(FY&HMd^myh9Nd&;&zR9Jx!LQZmR(r3wiw5Q*uS4o=p!)ehxy$HBLy1 zjLT>iCqD-gef;ydNaNf{oUAW*B}P!s0LMZ)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(y0A!q~aFSV@;kaX5aCqDDmB z3*y9J=r=0CNrwWFXXt8f;h_X z22;3_F0T|>g5L!b(don<2ISS10$lmbEWB#K>?sd8)$o9s#(dE2p#y%lgc{NUJdg3B zrjvF(==8kY3uA>d%gS2Aw`k3LqsfQJ_?oVnc3a7Yw7BeXWDVn%P9x;cglEFFz{R;+ zQ}_jQn6{8a_yu^_iokDc2@3%W$}MFKHCjyDTr_-@sEPa_IUC*bI0-tdWg=QaEU~q8 z+9e*g@E;$oCS?R!Z#~KJxRx;$tVb7;)y%bvZjoc%B5!E+5DqRe*I>U8lPyp`U4?jn z9^(1rOpr(2Wz4=T_D}&lijzrOW(0;9NU+RlmKc)-j~te9`T3Xu@TA>$;m}z0V1f80 z!(Xw%_lVkdbP>tR-SP}zgTanPz#F_I$J)j%#mYtI82r!x=!;nr$V>kCm|<&{A9MVe z5A0;>>KTO*Rq{*FIj!ddJMbc^$`+;tHeorHX(!?LAztioo5gIWancmcZfnPH+=EVM zH5Amzewucpbvy{EH9f&GrB&&(;x58uqfEfYuZ@76UWt$ud*SK%#k53FW5O9{%!Npv Ox; + + images { + kernel-1 { + description = "cvitek kernel"; + data = /incbin/("./Image.lzma"); + type = "kernel"; + arch = "riscv"; + os = "linux"; + compression = "lzma"; + load = <0x0 0x80200000>; + entry = <0x0 0x80200000>; + hash-2 { + algo = "crc32"; + }; + }; + + + /*FDT*/ + + fdt-cv1812cp_milkv_duo256m_spinor { + description = "cvitek device tree - cv1812cp_milkv_duo256m_spinor"; + data = /incbin/("./cv1812cp_milkv_duo256m_spinor.dtb"); + type = "flat_dt"; + arch = "riscv"; + compression = "none"; + hash-1 { + algo = "sha256"; + }; + }; + + + + }; + + /*CFG*/ + configurations { + + config-cv1812cp_milkv_duo256m_spinor { + description = "boot cvitek system with board cv1812cp_milkv_duo256m_spinor"; + kernel = "kernel-1"; + fdt = "fdt-cv1812cp_milkv_duo256m_spinor"; + }; + + }; + + +}; diff --git a/bsp/cvitek/drivers/SConscript b/bsp/cvitek/drivers/SConscript index 90aa68f80e..b1ea031d90 100755 --- a/bsp/cvitek/drivers/SConscript +++ b/bsp/cvitek/drivers/SConscript @@ -10,7 +10,7 @@ CPPDEFINES = [] CPPPATH = [cwd] CHIP_TYPE = 'cv180x' -if GetDepend('BOARD_TYPE_MILKV_DUO256M'): +if GetDepend('BOARD_TYPE_MILKV_DUO256M') or GetDepend('BOARD_TYPE_MILKV_DUO256M_SPINOR') or GetDepend('BOARD_TYPE_MILKV_DUO256M_SPINAND'): CHIP_TYPE = 'cv181x' elif GetDepend('BOARD_TYPE_MILKV_DUO') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINOR') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINAND'): CHIP_TYPE = 'cv180x' diff --git a/bsp/cvitek/mksdimg.sh b/bsp/cvitek/mksdimg.sh index fabc640d1b..26e70bba62 100755 --- a/bsp/cvitek/mksdimg.sh +++ b/bsp/cvitek/mksdimg.sh @@ -12,20 +12,7 @@ fi ROOT_PATH=$(pwd) echo ${ROOT_PATH} -function get_board_type() -{ - BOARD_CONFIG=("CONFIG_BOARD_TYPE_MILKV_DUO" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINOR" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINAND" "CONFIG_BOARD_TYPE_MILKV_DUO256M") - BOARD_VALUE=("milkv-duo" "milkv-duo-spinor" "milkv-duo-spinand" "milkv-duo256m") - - for ((i=0;i<${#BOARD_CONFIG[@]};i++)) - do - config_value=$(grep -w "${BOARD_CONFIG[i]}" ${PROJECT_PATH}/.config | cut -d= -f2) - if [ "$config_value" == "y" ]; then - BOARD_TYPE=${BOARD_VALUE[i]} - break - fi - done -} +. board_env.sh get_board_type @@ -34,4 +21,24 @@ echo "start compress kernel..." lzma -c -9 -f -k ${PROJECT_PATH}/${IMAGE_NAME} > ${PROJECT_PATH}/dtb/${BOARD_TYPE}/Image.lzma mkdir -p ${ROOT_PATH}/output/${BOARD_TYPE} -./mkimage -f ${PROJECT_PATH}/dtb/${BOARD_TYPE}/multi.its -r ${ROOT_PATH}/output/${BOARD_TYPE}/boot.sd \ No newline at end of file +./mkimage -f ${PROJECT_PATH}/dtb/${BOARD_TYPE}/multi.its -r ${ROOT_PATH}/output/${BOARD_TYPE}/boot.${STORAGE_TYPE} + +if [ "${STORAGE_TYPE}" == "spinor" ] || [ "${STORAGE_TYPE}" == "spinand" ]; then + + check_bootloader || exit 0 + + pushd cvitek_bootloader + + . env.sh + get_build_board ${BOARD_TYPE} + + CHIP_ARCH_L=$(echo $CHIP_ARCH | tr '[:upper:]' '[:lower:]') + + echo "board: ${MV_BOARD_LINK}" + + IMGTOOL_PATH=build/tools/common/image_tool + FLASH_PARTITION_XML=build/boards/"${CHIP_ARCH_L}"/"${MV_BOARD_LINK}"/partition/partition_"${STORAGE_TYPE}".xml + python3 "$IMGTOOL_PATH"/raw2cimg.py "${ROOT_PATH}"/output/"${BOARD_TYPE}"/boot."$STORAGE_TYPE" "${ROOT_PATH}/output/${BOARD_TYPE}" "$FLASH_PARTITION_XML" + + popd +fi \ No newline at end of file