2025-04-23 17:54:31 +08:00
<!DOCTYPE html> < html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "zh-cn" lang = "zh-cn" data-whc_version = "26.1" >
2025-07-22 11:15:46 +08:00
< head > < meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" / > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" / > < meta http-equiv = "X-UA-Compatible" content = "IE=edge" / > < meta name = "DC.rights.owner" content = "(C) 版权 2025" / > < meta name = "copyright" content = "(C) 版权 2025" / > < meta name = "generator" content = "DITA-OT" / > < meta name = "DC.type" content = "concept" / > < meta name = "description" content = "按照本节流程编译加密的量产固件。 配置 BootLoader 进入 SDK 根目录: cd <SDK_ROOT> 在 SDK 根目录中执行下列命令: scons --apply-def=d21x_demo88-nand_rt-thread_bootloader_defconfig 打开 BootLoader 的 menuconfig 菜单: scons --menuconfig ..." / > < meta name = "DC.relation" content = "../../../topics/sdk/secure/spienc_function_v1-V1.html" / > < meta name = "DC.relation" content = "../../../topics/sdk/secure/spienc-generate-efuse-V1.html" / > < meta name = "DC.relation" content = "../../../topics/sdk/secure/spinenc-efuse-and-firmware-combined-V1.html" / > < meta name = "DC.contributor" content = "yan.wang" / > < meta name = "DC.creator" content = "yan.wang" / > < meta name = "DC.date.modified" content = "2025-05-16" / > < meta name = "DC.format" content = "HTML5" / > < meta name = "DC.identifier" content = "spienc-generate-production-firmware" / >
< title > 生成量产固件< / title > <!-- Generated with build number 2025051600. --> < meta name = "wh-path2root" content = "../../../" / > < meta name = "wh-toc-id" content = "spienc-generate-production-firmware-d3752e1528" / > < meta name = "wh-source-relpath" content = "topics/sdk/secure/spienc-generate-production-firmware.dita" / > < meta name = "wh-out-relpath" content = "topics/sdk/secure/spienc-generate-production-firmware-V1.html" / >
2025-04-23 17:54:31 +08:00
< link rel = "stylesheet" type = "text/css" href = "../../../webhelp/app/commons.css?buildId=2024041900" / >
< link rel = "stylesheet" type = "text/css" href = "../../../webhelp/app/topic.css?buildId=2024041900" / >
2025-07-22 11:15:46 +08:00
< script src = "../../../webhelp/app/options/properties.js?buildId=20250519091401" > < / script >
2025-04-23 17:54:31 +08:00
< script src = "../../../webhelp/app/localization/strings.js?buildId=2024041900" > < / script >
2025-07-22 11:15:46 +08:00
< script src = "../../../webhelp/app/search/index/keywords.js?buildId=20250519091401" > < / script >
2025-04-23 17:54:31 +08:00
< script defer = "defer" src = "../../../webhelp/app/commons.js?buildId=2024041900" > < / script >
< script defer = "defer" src = "../../../webhelp/app/topic.js?buildId=2024041900" > < / script >
< link rel = "stylesheet" type = "text/css" href = "../../../webhelp/template/css/aic-styles-web-internal.css?buildId=2024041900" / > < link rel = "stylesheet" type = "text/css" href = "../../../webhelp/template/css/notes.css?buildId=2024041900" / > < link rel = "stylesheet" type = "text/css" href = "../../../webhelp/template/css/aic-common.css?buildId=2024041900" / > < link rel = "stylesheet" type = "text/css" href = "../../../webhelp/template/css/aic-images.css?buildId=2024041900" / > < link rel = "stylesheet" type = "text/css" href = "../../../webhelp/template/css/footnote.css?buildId=2024041900" / > < link rel = "stylesheet" type = "text/css" href = "../../../webhelp/template/css/aic-highlight-changes.css?buildId=2024041900" / > < link rel = "stylesheet" type = "text/css" href = "../../../webhelp/template/css/search-in-header.css?buildId=2024041900" / > < link rel = "stylesheet" type = "text/css" href = "../../../webhelp/template/css/topic-body-list.css?buildId=2024041900" / > < / head >
< body id = "spienc-generate-production-firmware" class = "wh_topic_page frmBody" >
< a href = "#wh_topic_body" class = "sr-only sr-only-focusable" >
跳转到主要内容
< / a >
< header class = "navbar navbar-default wh_header" >
< div class = "container-fluid" >
< div xmlns:whc = "http://www.oxygenxml.com/webhelp/components" class = "wh_header_flex_container navbar-nav navbar-expand-md navbar-dark" >
< div class = "wh_logo_and_publication_title_container" >
< div class = "wh_logo_and_publication_title" >
< a href = "https://www.artinchip.com" class = " wh_logo d-none d-sm-block " > < img src = "../../../company-logo.png" alt = " RTOS SDK 使用指南 SDK 指南文件 " / > < / a >
< div class = " wh_publication_title " > < a href = "../../../index.html" > < span class = "booktitle" > < span class = "ph mainbooktitle" > RTOS SDK 使用指南< / span > < span class = "ph booktitlealt" > SDK 指南文件< / span > < / span > < / a > < / div >
< / div >
< / div >
< div class = "wh_top_menu_and_indexterms_link collapse navbar-collapse" id = "wh_top_menu_and_indexterms_link" >
< / div >
< div class = " wh_search_input navbar-form wh_topic_page_search search " role = "form" >
< form id = "searchForm" method = "get" role = "search" action = "../../../search.html" > < div > < input type = "search" placeholder = "搜索 " class = "wh_search_textfield" id = "textToSearch" name = "searchQuery" aria-label = "搜索查询" required = "required" / > < button type = "submit" class = "wh_search_button" aria-label = "搜索" > < span class = "search_input_text" > 搜索< / span > < / button > < / div > < / form >
< / div > < / div >
< / div >
< / header >
< div class = "container-fluid" id = "wh_topic_container" >
< div class = "row" >
< nav class = "wh_tools d-print-none navbar-expand-md" aria-label = "Tools" >
2025-07-22 11:15:46 +08:00
< div data-tooltip-position = "bottom" class = " wh_breadcrumb " > < ol class = "d-print-none" > < li > < span class = "home" > < a href = "../../../index.html" > < span > 主页< / span > < / a > < / span > < / li > < li > < div class = "topicref" data-id = "concept_rcx_czh_pzb" > < div class = "title" > < a href = "../../../topics/sdk/chapter-app.html" > 应用场景< / a > < div class = "wh-tooltip" > < p class = "shortdesc" > 描述了 SDK 在不同应用场景中的配置和使用, 包括系统更新、OTA、安全方案等。< / p > < / div > < / div > < / div > < / li > < li > < div class = "topicref" data-id = "id" > < div class = "title" > < a href = "../../../topics/sdk/secure/chapter-secure.html" > 安全方案< / a > < / div > < / div > < / li > < li > < div class = "topicref" data-id = "spi-flash-enc-function" > < div class = "title" > < a href = "../../../topics/sdk/secure/spi_flash_enc_function.html" > SPI Flash 防抄板方案< / a > < / div > < / div > < / li > < li > < div class = "topicref" data-id = "spienc_function" > < div class = "title" > < a href = "../../../topics/sdk/secure/spienc_function_v1-V1.html" > 方案 V1< / a > < / div > < / div > < / li > < li class = "active" > < div class = "topicref" data-id = "spienc-generate-production-firmware" > < div class = "title" > < a href = "../../../topics/sdk/secure/spienc-generate-production-firmware-V1.html" > 生成量产固件< / a > < div class = "wh-tooltip" > < p class = "shortdesc" > < / p > < / div > < / div > < / div > < / li > < / ol > < / div >
2025-04-23 17:54:31 +08:00
< div class = "wh_right_tools" >
< button class = "wh_hide_highlight" aria-label = "切换搜索突出显示" title = "切换搜索突出显示" > < / button >
< button class = "webhelp_expand_collapse_sections" data-next-state = "collapsed" aria-label = "折叠截面" title = "折叠截面" > < / button >
< div class = " wh_navigation_links " > < span id = "topic_navigation_links" class = "navheader" >
2025-07-22 11:15:46 +08:00
< span class = "navprev" > < a class = "- topic/link link" href = "../../../topics/sdk/secure/spienc-generate-efuse-V1.html" title = "烧录 eFuse" aria-label = "上一主题: 烧录 eFuse" rel = "prev" > < / a > < / span >
< span class = "navnext" > < a class = "- topic/link link" href = "../../../topics/sdk/secure/spinenc-efuse-and-firmware-combined-V1.html" title = "eFuse 与固件合并烧录" aria-label = "下一主题: eFuse 与固件合并烧录" rel = "next" > < / a > < / span > < / span > < / div >
2025-04-23 17:54:31 +08:00
< div class = " wh_print_link print d-none d-md-inline-block " > < button onClick = "window.print()" title = "打印此页" aria-label = "打印此页" > < / button > < / div >
< button type = "button" id = "wh_toc_button" class = "custom-toggler navbar-toggler collapsed wh_toggle_button navbar-light" aria-expanded = "false" aria-label = "Toggle publishing table of content" aria-controls = "wh_publication_toc" >
< span class = "navbar-toggler-icon" > < / span >
< / button >
< / div >
< / nav >
< / div >
< div class = "wh_content_area" >
< div class = "row" >
< nav id = "wh_publication_toc" class = "col-lg-3 col-md-3 col-sm-12 d-md-block d-none d-print-none" aria-label = "Table of Contents Container" >
< div id = "wh_publication_toc_content" >
2025-07-22 11:15:46 +08:00
< div class = " wh_publication_toc " data-tooltip-position = "right" > < span class = "expand-button-action-labels" > < span id = "button-expand-action" role = "button" aria-label = "Expand" > < / span > < span id = "button-collapse-action" role = "button" aria-label = "Collapse" > < / span > < span id = "button-pending-action" role = "button" aria-label = "Pending" > < / span > < / span > < ul role = "tree" aria-label = "Table of Contents" > < li role = "treeitem" > < div data-tocid = "revinfo_linux-d3752e463" class = "topicref" data-id = "revinfo_linux" data-state = "leaf" > < span role = "button" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/revinfo/revinfo_rtos.html" id = "revinfo_linux-d3752e463-link" > 修订记录< / a > < / div > < / div > < / li > < li role = "treeitem" aria-expanded = "false" > < div data-tocid = "id-d3752e480" class = "topicref" data-id = "id" data-state = "not-ready" > < span role = "button" tabindex = "0" aria-labelledby = "button-expand-action id-d3752e480-link" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/sdk/env/sdk-compile.html" id = "id-d3752e480-link" > SDK 编译< / a > < div class = "wh-tooltip" > < p class = "shortdesc" > 介绍不同编译环境下 SDK 的详细编译流程。< / p > < / div > < / div > < / div > < / li > < li role = "treeitem" aria-expanded = "false" > < div data-tocid = "id-d3752e604" class = "topicref" data-id = "id" data-state = "not-ready" > < span role = "button" tabindex = "0" aria-labelledby = "button-expand-action id-d3752e604-link" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/sdk/advanced/sdk-usage.html" id = "id-d3752e604-link" > 使用指南< / a > < div class = "wh-tooltip" > < p class = "shortdesc" > 命令详解,编译选项,镜像和分区配置,添加应用和驱动等的详细使用说明。< / p > < / div > < / div > < / div > < / li > < li role = "treeitem" aria-expanded = "true" > < div data-tocid = "concept_rcx_czh_pzb-d3752e1004" class = "topicref" data-id = "concept_rcx_czh_pzb" data-state = "expanded" > < span role = "button" tabindex = "0" aria-labelledby = "button-collapse-action concept_rcx_czh_pzb-d3752e1004-link" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/sdk/chapter-app.html" id = "concept_rcx_czh_pzb-d3752e1004-link" > 应用场景< / a > < div class = "wh-tooltip" > < p class = "shortdesc" > 描述了 SDK 在不同应用场景中的配置和使用, 包括系统更新、OTA、安全方案等。< / p > < / div > < / div > < / div > < ul role = "group" class = "navbar-nav nav-list" > < li role = "treeitem" > < div data-tocid = "id-d3752e1021" class = "topicref" data-id = "id" data-state = "leaf" > < span role = "button" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/sdk/usb/udisk.html" id = "id-d3752e1021-link" > 挂载 U 盘 < / a > < / div > < / div > < / li > < li role = "treeitem" > < div data-tocid = "id-d3752e1035" class = "topicref" data-id = "id" data-state = "leaf" > < span role = "button" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/sdk/sdmc/sdcard.html" id = "id-d3752e1035-link" > 挂载 SD 卡< / a > < / div > < / div > < / li > < li role = "treeitem" aria-expanded = "false" > < div data-tocid = "id-d3752e1049" class = "topicref" data-id = "id" data-state = "not-ready" > < span role = "button" tabindex = "0" aria-labelledby = "button-expand-action id-d3752e1049-link" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/sdk/burnsys/burnsys_user_guide.html" id = "id-d3752e1049-link" > 系统更新< / a > < / div > < / div > < / li > < li role = "treeitem" aria-expanded = "false" > < div data-tocid = "id-d3752e1163" class = "topicref" data-id = "id" data-state = "not-ready" > < span role = "button" tabindex = "0" aria-labelledby = "button-expand-action id-d3752e1163-link" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/sdk/ota/ota_guide.html" id = "id-d3752e1163-link" > OTA 方案< / a > < / div > < / div > < / li > < li role = "treeitem" aria-expanded = "false" > < div data-tocid = "id-d3752e1283" class = "topicref" data-id = "id" data-state = "not-ready" > < span role = "button" tabindex = "0" aria-labelledby = "button-expand-action id-d3752e1283-link" class = "wh-expand-btn" > < / span > < div class = "title" > < a href = "../../../topics/sdk/xip/xip_user_guide.html" id = "id-d3752e1283-link" > XIP 方案 < / a > < / div > < / div > < / li > < li role = "treeitem" aria-expanded = "false" > < div dat
2025-04-23 17:54:31 +08:00
< / div >
< / nav >
< div class = "col-lg-7 col-md-9 col-sm-12" id = "wh_topic_body" >
< button id = "wh_close_publication_toc_button" class = "close-toc-button d-none" aria-label = "Toggle publishing table of content" aria-controls = "wh_publication_toc" aria-expanded = "true" >
< span class = "close-toc-icon-container" >
< span class = "close-toc-icon" > < / span >
< / span >
< / button >
< button id = "wh_close_topic_toc_button" class = "close-toc-button d-none" aria-label = "Toggle topic table of content" aria-controls = "wh_topic_toc" aria-expanded = "true" >
< span class = "close-toc-icon-container" >
< span class = "close-toc-icon" > < / span >
< / span >
< / button >
< div class = " wh_topic_content body " > < main role = "main" > < article class = "- topic/topic concept/concept topic concept" role = "article" aria-labelledby = "ariaid-title1" >
< span class = "edit-link" style = "font-size:12px; opacity:0.6; text-align:right; vertical-align:middle" > < a target = "_blank" href = "http://aicdocco/taskstopics/sdk/secure/spienc-generate-production-firmware.dita" > Edit online< / a > < / span > < h1 class = "- topic/title title topictitle1" id = "ariaid-title1" > 生成量产固件< / h1 >
2025-07-22 11:15:46 +08:00
< div class = "date inPage" > 16 May 2025< / div > < div style = "color: gray;" >
2025-04-23 17:54:31 +08:00
Read time: 8 minute(s)
< / div >
< div class = "- topic/body concept/conbody body conbody" > < p class = "- topic/shortdesc shortdesc" > < / p >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e30__20250519091517" > 按照本节流程编译加密的量产固件。< / p >
2025-04-23 17:54:31 +08:00
< section class = "- topic/section section" id = "spienc-generate-production-firmware__section_fnv_sfy_52c" data-ofbid = "spienc-generate-production-firmware__section_fnv_sfy_52c" > < h2 class = "- topic/title title sectiontitle" > 配置 BootLoader< / h2 >
2025-07-22 11:15:46 +08:00
< div class = "- topic/p p" data-ofbid = "d120129e38__20250519091517" >
2025-04-23 17:54:31 +08:00
< ol class = "- topic/ol ol" id = "spienc-generate-production-firmware__ul_ufb_pfp_pdc" data-ofbid = "spienc-generate-production-firmware__ul_ufb_pfp_pdc" >
< li class = "- topic/li li" id = "spienc-generate-production-firmware__li_hvb_d3z_52c" data-ofbid = "spienc-generate-production-firmware__li_hvb_d3z_52c" > 进入 SDK
根目录:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_zn4_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_zn4_dp4_fdc" > cd < SDK_ROOT> < / pre > < / li >
< li class = "- topic/li li" id = "spienc-generate-production-firmware__li_jvb_d3z_52c" data-ofbid = "spienc-generate-production-firmware__li_jvb_d3z_52c" > 在 SDK
根目录中执行下列命令:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_sn4_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_sn4_dp4_fdc" > scons --apply-def=d21x_demo88-nand_rt-thread_bootloader_defconfig< / pre > < / li >
< li class = "- topic/li li" id = "spienc-generate-production-firmware__li_kvb_d3z_52c" data-ofbid = "spienc-generate-production-firmware__li_kvb_d3z_52c" >
2025-07-22 11:15:46 +08:00
< div class = "- topic/p p" data-ofbid = "d120129e54__20250519091517" > 打开 BootLoader 的 menuconfig
2025-04-23 17:54:31 +08:00
菜单:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_a44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_a44_dp4_fdc" > scons --menuconfig< / pre > < / div >
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e60__20250519091517" >
< div class = "- topic/p p" data-ofbid = "d120129e62__20250519091517" > 在配置界面,勾选或确认已勾选下列参数:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_b44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_b44_dp4_fdc" > AIC_USING_SPIENC
2025-04-23 17:54:31 +08:00
AIC_SPIENC_BYPASS_IN_UPGMODE< / pre > < / div >
2025-07-22 11:15:46 +08:00
< div class = "- topic/p p" data-ofbid = "d120129e67__20250519091517" > 参数对应的配置界面如下:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_c44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_c44_dp4_fdc" > Board options --->
2025-04-23 17:54:31 +08:00
[*] Using Spienc
[*] Enc qspi0
(< span class = "hl-number" > 0< / span > ) set qspi0 tweak
[*] Using Efuse/SID
SID Parameter --->
(< span class = "hl-number" > 64< / span > ) set efuse max word
Bootloader options --->
[*] Upgrading --->
[*] Secure transfer firmware and burn< / pre > < / div >
< div class = "- topic/note note note note_note" id = "spienc-generate-production-firmware__note_ts1_ghf_jdc" data-ofbid = "spienc-generate-production-firmware__note_ts1_ghf_jdc" > < span class = "note__title" > 注:< / span >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e74__20250519091517" > 编译量产固件时,需将编译烧录 eFuse 程序时的代码修改还原。< / p >
2025-04-23 17:54:31 +08:00
< / div >
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e79__20250519091517" >
< div class = "- topic/p p" data-ofbid = "d120129e81__20250519091517" > 在正式发布的固件中,建议将下列参数选项去掉,防止攻击者通过控制台读出 Flash
2025-04-23 17:54:31 +08:00
中的数据,否则可跳过:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_d44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_d44_dp4_fdc" > AIC_BOOTLOADER_CMD_MTD
AIC_MTD_BARE_TEST
< / pre > < / div >
2025-07-22 11:15:46 +08:00
< div class = "- topic/p p" data-ofbid = "d120129e86__20250519091517" > 参数对应的功能配置界面如下:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_e44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_e44_dp4_fdc" > BootLoader options --->
2025-04-23 17:54:31 +08:00
Commands --->
[ ] mtd read/write
Drivers options --->
Drivers examples --->
[ ] Enable MTD driver test command< / pre > < / div >
< / li >
< / ol >
< / div >
< / section >
< section class = "- topic/section section" id = "spienc-generate-production-firmware__section_of4_5fy_52c" data-ofbid = "spienc-generate-production-firmware__section_of4_5fy_52c" > < h2 class = "- topic/title title sectiontitle" > 配置应用程序< / h2 >
2025-07-22 11:15:46 +08:00
< div class = "- topic/p p" data-ofbid = "d120129e100__20250519091517" >
2025-04-23 17:54:31 +08:00
< ol class = "- topic/ol ol" id = "spienc-generate-production-firmware__ol_k13_1gp_pdc" data-ofbid = "spienc-generate-production-firmware__ol_k13_1gp_pdc" >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e104__20250519091517" > 进入 SDK
2025-04-23 17:54:31 +08:00
根目录:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_f44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_f44_dp4_fdc" > cd < SDK_ROOT> < / pre > < / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e109__20250519091517" > 在 SDK
2025-04-23 17:54:31 +08:00
根目录,执行下列命令:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__codeblock_owg_y2z_52c" data-ofbid = "spienc-generate-production-firmware__codeblock_owg_y2z_52c" > scons --apply-def=d21x_demo88-nand_rt-thread_bootloader_defconfig< / pre > < / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e114__20250519091517" >
< div class = "- topic/p p" data-ofbid = "d120129e116__20250519091517" > 打开 Application 的 menuconfig
2025-04-23 17:54:31 +08:00
菜单:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_g44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_g44_dp4_fdc" > scons --menuconfig< / pre > < / div >
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e122__20250519091517" >
< div class = "- topic/p p" data-ofbid = "d120129e124__20250519091517" > 勾选或确认已勾选下列选项:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_h44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_h44_dp4_fdc" > AIC_USING_SPIENC< / pre > < / div >
< div class = "- topic/p p" data-ofbid = "d120129e129__20250519091517" > 对应的配置界面如下:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_i44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_i44_dp4_fdc" > Board options --->
2025-04-23 17:54:31 +08:00
[*] Using Spienc
[*] Enc qspi0
(< span class = "hl-number" > 0< / span > ) set qspi0 tweak< / pre > < / div >
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e135__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e137__20250519091517" > 在正式版本的固件中,建议删除 < span class = "+ topic/ph sw-d/filepath ph filepath" > bsp/examples/test-spinor/test_sfud.c
2025-04-23 17:54:31 +08:00
bsp/examples/test-spinor/test_fal.c
bsp/examples/test-spinand/test_mtd.c< / span > 文件中的
< span class = "+ topic/keyword sw-d/cmdname keyword cmdname" > sf< / span > 、 < span class = "+ topic/keyword sw-d/cmdname keyword cmdname" > fal< / span > 和
< span class = "+ topic/keyword sw-d/cmdname keyword cmdname" > mtd_nand< / span > 命令命令,防攻击者通过控制台读出 Flash 中的数据,否则可跳过此步。< / p >
< / li >
< / ol >
< / div >
< / section >
< section class = "- topic/section section" id = "spienc-generate-production-firmware__section_g13_wfy_52c" data-ofbid = "spienc-generate-production-firmware__section_g13_wfy_52c" > < h2 class = "- topic/title title sectiontitle" > 固件签名加密< / h2 >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e161__20250519091517" > 在 < span class = "+ topic/ph sw-d/filepath ph filepath" > SDK/target/< SoC> /< board> /pack/image_cfg.json< / span >
2025-04-23 17:54:31 +08:00
文件中配置并生成签名加密固件,例如 < span class = "+ topic/ph sw-d/filepath ph filepath" > SDK/target/d21x/demo88-nand/pack/image_cfg.json< / span > 。< / p >
2025-07-22 11:15:46 +08:00
< div class = "- topic/p p" data-ofbid = "d120129e170__20250519091517" >
< ol class = "- topic/ol ol" data-ofbid = "d120129e172__20250519091517" >
< li class = "- topic/li li" data-ofbid = "d120129e174__20250519091517" >
2025-04-23 17:54:31 +08:00
< div class = "- topic/div div section" id = "spienc-generate-production-firmware__id9" >
2025-07-22 11:15:46 +08:00
< strong class = "+ topic/ph hi-d/b ph b" > 配置生成签名的组件< / strong > < div class = "- topic/p p" data-ofbid = "d120129e180__20250519091517" > 开启了安全启动后,需要对 BootLoader
2025-04-23 17:54:31 +08:00
进行签名。参考签名相关部分的内容进行修改:< pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_m44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_m44_dp4_fdc" > {
< span class = "hl-string" > "spi-nand"< / span > : {
...
},
< span class = "hl-string" > "image"< / span > : {
...
},
< span class = "hl-string" > "info"< / span > : { < em class = "hl-comment" > // Header information about image< / em >
...
},
< span class = "hl-string" > "updater"< / span > : { < em class = "hl-comment" > // Image writer which is downloaded to RAM by USB/UART< / em >
...
},
< span class = "hl-string" > "target"< / span > : { < em class = "hl-comment" > // Image components which will be burn to device's partitions< / em >
...
},
< span class = "hl-string" > "pre-process"< / span > : { < em class = "hl-comment" > // before v1.0.6 is the name "temporary"< / em >
< span class = "hl-string" > "aicimage"< / span > : { < em class = "hl-comment" > // Create aic boot image< / em >
< span class = "hl-string" > "usbupg-ddr-init.aic"< / span > : { < em class = "hl-comment" > // No loader, only PreBootProgram to initialize DDR< / em >
< span class = "hl-string" > "head_ver"< / span > : < span class = "hl-string" > "0x00010001"< / span > ,
< span class = "hl-string" > "resource"< / span > : {
< span class = "hl-string" > "private"< / span > : < span class = "hl-string" > "ddr_init.bin"< / span > ,
< span class = "hl-string" > "pubkey"< / span > : < span class = "hl-string" > "keys/rsa_public_key.der"< / span > , < em class = "hl-comment" > // 签名相关< / em >
< span class = "hl-string" > "pbp"< / span > : < span class = "hl-string" > "d21x.pbp"< / span > ,
},
< span class = "hl-string" > "signature"< / span > : {
< span class = "hl-string" > "algo"< / span > : < span class = "hl-string" > "rsa,2048"< / span > ,
< span class = "hl-string" > "privkey"< / span > : < span class = "hl-string" > "keys/rsa_private_key.der"< / span > , < em class = "hl-comment" > // 签名相关< / em >
},
},
< span class = "hl-string" > "pbp_ext.aic"< / span > : {
< span class = "hl-string" > "head_ver"< / span > : < span class = "hl-string" > "0x00010001"< / span > ,
< span class = "hl-string" > "resource"< / span > : {
< span class = "hl-string" > "pbp"< / span > : < span class = "hl-string" > "d21x.pbp"< / span > ,
< span class = "hl-string" > "pubkey"< / span > : < span class = "hl-string" > "keys/rsa_public_key.der"< / span > , < em class = "hl-comment" > // 签名相关< / em >
< span class = "hl-string" > "private"< / span > : < span class = "hl-string" > "pbp_cfg.bin"< / span > ,
},
< span class = "hl-string" > "signature"< / span > : { < em class = "hl-comment" > // 签名相关< / em >
< span class = "hl-string" > "algo"< / span > : < span class = "hl-string" > "rsa,2048"< / span > ,
< span class = "hl-string" > "privkey"< / span > : < span class = "hl-string" > "keys/rsa_private_key.der"< / span > ,
},
< em class = "hl-comment" > // combine to use with loader.aic< / em >
< span class = "hl-string" > "with_ext"< / span > : < span class = "hl-string" > "true"< / span > ,
},
< span class = "hl-string" > "loader.aic"< / span > : {
< span class = "hl-string" > "head_ver"< / span > : < span class = "hl-string" > "0x00010001"< / span > ,
< span class = "hl-string" > "loader"< / span > : {
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "bootloader.bin"< / span > ,
< span class = "hl-string" > "load address"< / span > : < span class = "hl-string" > "CONFIG_AIC_BOOTLOADER_LOAD_BASE"< / span > ,
< span class = "hl-string" > "entry point"< / span > : < span class = "hl-string" > "CONFIG_AIC_BOOTLOADER_TEXT_BASE"< / span > , < em class = "hl-comment" > // 256 byte aic header< / em >
},
< span class = "hl-string" > "resource"< / span > : {
< span class = "hl-string" > "private"< / span > : < span class = "hl-string" > "ddr_init.bin"< / span > ,
< span class = "hl-string" > "pubkey"< / span > : < span class = "hl-string" > "keys/rsa_public_key.der"< / span > , < em class = "hl-comment" > // 签名相关< / em >
},
< span class = "hl-string" > "signature"< / span > : { < em class = "hl-comment" > // 签名相关< / em >
< span class = "hl-string" > "algo"< / span > : < span class = "hl-string" > "rsa,2048"< / span > ,
< span class = "hl-string" > "privkey"< / span > : < span class = "hl-string" > "keys/rsa_private_key.der"< / span > ,
},
},
},
},
}< / pre > < / div >
< / div >
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e187__20250519091517" >
2025-04-23 17:54:31 +08:00
< div class = "- topic/div div section" id = "spienc-generate-production-firmware__id10" >
< strong class = "+ topic/ph hi-d/b ph b" > 对组件进行加密< / strong >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e194__20250519091517" > 在 < span class = "+ topic/ph sw-d/filepath ph filepath" > image_cfg.json< / span > 的 “temporary” 或 “pre-process”
对象的最后,添加 “data_crypt” 对象配置。< / p > < p class = "- topic/p p" data-ofbid = "d120129e199__20250519091517" > 此处使用的 AES
2025-04-23 17:54:31 +08:00
加密密钥,即为< span class = "+ topic/ph sw-d/filepath ph filepath" > SDK/target/< soc> /< board> /pack/keys/< / span >
2025-07-22 11:15:46 +08:00
文件目录中生成的密钥。< / p > < div class = "- topic/p p" data-ofbid = "d120129e204__20250519091517" > 在下列示例中,配置了一组需要使用 “data_crypt” 工具进行加密的组件,其中生成
2025-04-23 17:54:31 +08:00
< span class = "+ topic/keyword pr-d/parmname keyword parmname" > bootloader.aic.enc< / span > 组件的配置参数为:< ul class = "- topic/ul ul" id = "spienc-generate-production-firmware__ul_i3k_xmx_52c" data-ofbid = "spienc-generate-production-firmware__ul_i3k_xmx_52c" >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e211__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e213__20250519091517" > algo: 加密的算法< / p >
2025-04-23 17:54:31 +08:00
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e217__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e219__20250519091517" > file: 加密的源文件,此处为前面生成的 bootloader.aic 文件< / p >
2025-04-23 17:54:31 +08:00
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e223__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e225__20250519091517" > key: 使用的加密密钥< / p >
2025-04-23 17:54:31 +08:00
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e229__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e231__20250519091517" > nonce: 使用的加密 Nonce 值< / p >
2025-04-23 17:54:31 +08:00
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e235__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e237__20250519091517" > tweak: 该值不需要配置,保持为 0 即可< / p >
2025-04-23 17:54:31 +08:00
< / li >
< / ul > < / div > < pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_o44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_o44_dp4_fdc" > {
< span class = "hl-string" > "spi-nand"< / span > : {
...
},
< span class = "hl-string" > "image"< / span > : {
...
},
< span class = "hl-string" > "info"< / span > : { < em class = "hl-comment" > // Header information about image< / em >
...
},
< span class = "hl-string" > "updater"< / span > : { < em class = "hl-comment" > // Image writer which is downloaded to RAM by USB/UART< / em >
...
},
< span class = "hl-string" > "target"< / span > : { < em class = "hl-comment" > // Image components which will be burn to device's partitions< / em >
...
},
< span class = "hl-string" > "pre-process"< / span > : { < em class = "hl-comment" > // before v1.0.6 is the name "temporary"< / em >
< span class = "hl-string" > "data_crypt"< / span > : {
< span class = "hl-string" > "bootloader.aic.enc"< / span > : { < em class = "hl-comment" > //加密 bootloader 分区< / em >
< span class = "hl-string" > "algo"< / span > : < span class = "hl-string" > "spienc-aes-128-ecb"< / span > ,
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "bootloader.aic"< / span > , < em class = "hl-comment" > // File to be encrypted< / em >
< span class = "hl-string" > "key"< / span > : < span class = "hl-string" > "keys/spi_aes.key"< / span > , < em class = "hl-comment" > // Keys the same in eFuse< / em >
< span class = "hl-string" > "nonce"< / span > : < span class = "hl-string" > "keys/spi_nonce.key"< / span > , < em class = "hl-comment" > // Nonce the same in eFuse< / em >
< span class = "hl-string" > "tweak"< / span > : < span class = "hl-string" > "0"< / span > ,
},
< span class = "hl-string" > "env.bin.enc"< / span > : { < em class = "hl-comment" > //加密 env 分区,备份分区使用同一个组件< / em >
< span class = "hl-string" > "algo"< / span > : < span class = "hl-string" > "spienc-aes-128-ecb"< / span > ,
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "env.bin"< / span > , < em class = "hl-comment" > // File to be encrypted< / em >
< span class = "hl-string" > "key"< / span > : < span class = "hl-string" > "keys/spi_aes.key"< / span > , < em class = "hl-comment" > // Keys the same in eFuse< / em >
< span class = "hl-string" > "nonce"< / span > : < span class = "hl-string" > "keys/spi_nonce.key"< / span > , < em class = "hl-comment" > // Nonce the same in eFuse< / em >
< span class = "hl-string" > "tweak"< / span > : < span class = "hl-string" > "0"< / span > ,
},
< span class = "hl-string" > "d21x_os.itb.enc"< / span > : { < em class = "hl-comment" > //加密 os 分区< / em >
< span class = "hl-string" > "algo"< / span > : < span class = "hl-string" > "spienc-aes-128-ecb"< / span > ,
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "d21x_os.itb"< / span > , < em class = "hl-comment" > // File to be encrypted< / em >
< span class = "hl-string" > "key"< / span > : < span class = "hl-string" > "keys/spi_aes.key"< / span > , < em class = "hl-comment" > // Keys the same in eFuse< / em >
< span class = "hl-string" > "nonce"< / span > : < span class = "hl-string" > "keys/spi_nonce.key"< / span > , < em class = "hl-comment" > // Nonce the same in eFuse< / em >
< span class = "hl-string" > "tweak"< / span > : < span class = "hl-string" > "0"< / span > ,
},
< span class = "hl-string" > "rodata.fatfs.enc"< / span > : { < em class = "hl-comment" > //加密 rodata 分区< / em >
< span class = "hl-string" > "algo"< / span > : < span class = "hl-string" > "spienc-aes-128-ecb"< / span > ,
< span class = "hl-string" > "file"< / span > : rodata.fatfs< span class = "hl-string" > ", // File to be encrypted
< / span > < span class = "hl-string" > "key"< / span > : < span class = "hl-string" > "keys/spi_aes.key"< / span > , < em class = "hl-comment" > // Keys the same in eFuse< / em >
< span class = "hl-string" > "nonce"< / span > : < span class = "hl-string" > "keys/spi_nonce.key"< / span > , < em class = "hl-comment" > // Nonce the same in eFuse< / em >
< span class = "hl-string" > "tweak"< / span > : < span class = "hl-string" > "0"< / span > ,
},
< span class = "hl-string" > "data.fatfs.enc"< / span > : { < em class = "hl-comment" > //加密 data 分区< / em >
< span class = "hl-string" > "algo"< / span > : < span class = "hl-string" > "spienc-aes-128-ecb"< / span > ,
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "data.fatfs.itb"< / span > , < em class = "hl-comment" > // File to be encrypted< / em >
< span class = "hl-string" > "key"< / span > : < span class = "hl-string" > "keys/spi_aes.key"< / span > , < em class = "hl-comment" > // Keys the same in eFuse< / em >
< span class = "hl-string" > "nonce"< / span > : < span class = "hl-string" > "keys/spi_nonce.key"< / span > , < em class = "hl-comment" > // Nonce the same in eFuse< / em >
< span class = "hl-string" > "tweak"< / span > : < span class = "hl-string" > "0"< / span > ,
},
...
},
},
2025-07-22 11:15:46 +08:00
}< / pre > < p class = "- topic/p p" data-ofbid = "d120129e243__20250519091517" >
2025-04-23 17:54:31 +08:00
< strong class = "+ topic/ph hi-d/b ph b" > 对于一个或者多个需要进行加密的组件,都应按照上述方式进行配置。< / strong >
2025-07-22 11:15:46 +08:00
< / p > < p class = "- topic/p p" data-ofbid = "d120129e248__20250519091517" > < span class = "+ topic/ph sw-d/filepath ph filepath" > mk_image.py< / span > 工具在读取
2025-04-23 17:54:31 +08:00
< span class = "+ topic/ph sw-d/filepath ph filepath" > image_cfg.json< / span > 文件时,逐个处理放在 “data_crypt”
中的配置,生成对应的加密组件,然后再进行打包。< / p > < div class = "- topic/note note important note_important" id = "spienc-generate-production-firmware__note_byt_l3q_3dc" data-ofbid = "spienc-generate-production-firmware__note_byt_l3q_3dc" > < span class = "note__title" > 重要:< / span >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e257__20250519091517" > “data_crypt” 字段应放在 “temporary”/”pre-process” 的最后,因为处理
2025-04-23 17:54:31 +08:00
“data_crypt” 时,可能需要依赖前面配置生成的文件,比如 ”aicimage”。< / p >
< / div > < / div >
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e262__20250519091517" >
2025-04-23 17:54:31 +08:00
< div class = "- topic/div div section" id = "spienc-generate-production-firmware__id11" >
2025-07-22 11:15:46 +08:00
< strong class = "+ topic/ph hi-d/b ph b" > 配置烧录加密组件< / strong > < p class = "- topic/p p" data-ofbid = "d120129e268__20250519091517" > 在 < span class = "+ topic/ph sw-d/filepath ph filepath" > image_cfg.json< / span >
2025-04-23 17:54:31 +08:00
中配置下列参数,打包加密组件,以适配烧录加密固件的要求:< / p > < ol class = "- topic/ol ol arabic simple" type = "a" id = "spienc-generate-production-firmware__ol_s44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__ol_s44_dp4_fdc" >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e275__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e277__20250519091517" > updater 中打包的程序,应为非加密程序< / p >
< p class = "- topic/p p" data-ofbid = "d120129e280__20250519091517" > updater 中配置的参数,都不是 < span class = "+ topic/ph sw-d/filepath ph filepath" > .enc< / span > 结尾的组件< / p >
2025-04-23 17:54:31 +08:00
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e287__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e289__20250519091517" > target 中打包的程序和数据,应为加密后的程序< / p >
< p class = "- topic/p p" data-ofbid = "d120129e292__20250519091517" > target 中配置的参数,都是 < span class = "+ topic/ph sw-d/filepath ph filepath" > .enc< / span > 结尾的组件< / p >
2025-04-23 17:54:31 +08:00
< / li >
2025-07-22 11:15:46 +08:00
< / ol > < div class = "- topic/p p" data-ofbid = "d120129e299__20250519091517" > 这是因为:< ul class = "- topic/ul ul arabic simple" id = "spienc-generate-production-firmware__ol_u44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__ol_u44_dp4_fdc" >
< li class = "- topic/li li" data-ofbid = "d120129e303__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e305__20250519091517" > SD 卡启动时,首先运行 updater 中的程序,进入烧录模式。此时由于数据是从 SD
2025-04-23 17:54:31 +08:00
卡加载的,不能为加密程序,否则无法正常执行< / p >
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e309__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e311__20250519091517" > target 中打包的程序是要烧录到 Flash
2025-04-23 17:54:31 +08:00
的数据,如果不加密,则无法起到保护的作用,因此需要打包加密后的组件< / p >
< / li >
< / ul > < / div > < pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_x44_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_x44_dp4_fdc" > { < span class = "hl-string" > "image"< / span > : {
...
},
< span class = "hl-string" > "info"< / span > : { < em class = "hl-comment" > // Header information about image< / em >
...
},
< span class = "hl-string" > "updater"< / span > : { < em class = "hl-comment" > // Image writer which is downloaded to RAM by USB/UART< / em >
< span class = "hl-string" > "ddr"< / span > : {
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "usbupg-ddr-init.aic"< / span > ,
< span class = "hl-string" > "attr"< / span > : [< span class = "hl-string" > "required"< / span > , < span class = "hl-string" > "run"< / span > ],
< span class = "hl-string" > "ram"< / span > : < span class = "hl-string" > "0x00103000"< / span >
},
< span class = "hl-string" > "spl"< / span > : {
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "bootloader.aic"< / span > ,
< span class = "hl-string" > "attr"< / span > : [< span class = "hl-string" > "required"< / span > , < span class = "hl-string" > "run"< / span > ],
< span class = "hl-string" > "ram"< / span > : < span class = "hl-string" > "0x41000000"< / span >
},
},
< span class = "hl-string" > "target"< / span > : { < em class = "hl-comment" > // Image components which will be burn to device's partitions< / em >
< span class = "hl-string" > "spl"< / span > : {
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "bootloader.aic.enc"< / span > , < em class = "hl-comment" > //使用 enc 结尾的加密组件< / em >
< span class = "hl-string" > "attr"< / span > : [< span class = "hl-string" > "mtd"< / span > , < span class = "hl-string" > "required"< / span > ],
< span class = "hl-string" > "part"< / span > : [< span class = "hl-string" > "spl"< / span > ]
},
< span class = "hl-string" > "os"< / span > : {
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "d21x_os.itb.enc"< / span > , < em class = "hl-comment" > //使用 enc 结尾的加密组件< / em >
< span class = "hl-string" > "attr"< / span > : [< span class = "hl-string" > "mtd"< / span > , < span class = "hl-string" > "required"< / span > ],
< span class = "hl-string" > "part"< / span > : [< span class = "hl-string" > "os"< / span > ]
},
< span class = "hl-string" > "rodata"< / span > : {
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "rodata.fatfs.enc"< / span > , < em class = "hl-comment" > //使用 enc 结尾的加密组件< / em >
< span class = "hl-string" > "attr"< / span > : [< span class = "hl-string" > "mtd"< / span > , < span class = "hl-string" > "optional"< / span > ],
< span class = "hl-string" > "part"< / span > : [< span class = "hl-string" > "rodata"< / span > ]
},
< span class = "hl-string" > "data"< / span > : {
< span class = "hl-string" > "file"< / span > : < span class = "hl-string" > "data.fatfs.enc"< / span > , < em class = "hl-comment" > //使用 enc 结尾的加密组件< / em >
< span class = "hl-string" > "attr"< / span > : [< span class = "hl-string" > "mtd"< / span > , < span class = "hl-string" > "optional"< / span > ],
< span class = "hl-string" > "part"< / span > : [< span class = "hl-string" > "data"< / span > ]
},
},
< span class = "hl-string" > "pre-process"< / span > : { < em class = "hl-comment" > // before v1.0.6 is the name "temporary"< / em >
...
},
}< / pre >
< / div >
< / li >
< / ol >
< / div >
< / section >
< section class = "- topic/section section" id = "spienc-generate-production-firmware__section_vwz_fgy_52c" data-ofbid = "spienc-generate-production-firmware__section_vwz_fgy_52c" > < h2 class = "- topic/title title sectiontitle" > < span class = "- topic/ph ph" > USB 烧录< / span > < / h2 >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e329__20250519091517" > 直接使用编译生成的 img 文件进行量产烧录即可。< / p >
2025-04-23 17:54:31 +08:00
< / section >
< section class = "- topic/section section" id = "spienc-generate-production-firmware__section_w5y_ggy_52c" data-ofbid = "spienc-generate-production-firmware__section_w5y_ggy_52c" > < h2 class = "- topic/title title sectiontitle" > SD 卡量产< / h2 >
2025-07-22 11:15:46 +08:00
< div class = "- topic/p p" data-ofbid = "d120129e339__20250519091517" >
2025-04-23 17:54:31 +08:00
< ul class = "- topic/ul ul" id = "spienc-generate-production-firmware__ul_kyj_hbb_y2c" data-ofbid = "spienc-generate-production-firmware__ul_kyj_hbb_y2c" >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e343__20250519091517" >
2025-04-23 17:54:31 +08:00
< div class = "- topic/div div section" id = "spienc-generate-production-firmware__id14" >
< strong class = "+ topic/ph hi-d/b ph b" > 标准方式< / strong >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e350__20250519091517" > 编译生成下列文件后,将其复制到 SD 卡 FAT32 文件系统的根目录中,等待平台重新上电即可进入烧录:< / p > < ul class = "- topic/ul ul simple" id = "spienc-generate-production-firmware__ul_ap4_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__ul_ap4_dp4_fdc" >
< li class = "- topic/li li" data-ofbid = "d120129e354__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e356__20250519091517" > < span class = "+ topic/ph sw-d/filepath ph filepath" > bootcfg.txt< / span > < / p >
2025-04-23 17:54:31 +08:00
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e361__20250519091517" >
< p class = "- topic/p p" data-ofbid = "d120129e363__20250519091517" > 打包后的 img 文件,例如 < span class = "+ topic/ph sw-d/filepath ph filepath" > d21x_demo88-nand_v1.0.0.img< / span > < / p >
2025-04-23 17:54:31 +08:00
< / li >
< / ul > < / div >
< / li >
2025-07-22 11:15:46 +08:00
< li class = "- topic/li li" data-ofbid = "d120129e371__20250519091517" >
2025-04-23 17:54:31 +08:00
< div class = "- topic/div div section" id = "spienc-generate-production-firmware__direct-mode" >
< strong class = "+ topic/ph hi-d/b ph b" > Direct Mode< / strong >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e378__20250519091517" > 修改 < span class = "+ topic/ph sw-d/filepath ph filepath" > bootcfg.txt< / span > ,并且将
2025-04-23 17:54:31 +08:00
< span class = "+ topic/ph sw-d/filepath ph filepath" > bootcfg.txt< / span > 和使用到的组件复制到 SD 卡 FAT32
2025-07-22 11:15:46 +08:00
文件系统的根目录,等待平台重新上电即可进入烧录模式。< / p > < p class = "- topic/p p" data-ofbid = "d120129e386__20250519091517" > < span class = "+ topic/ph sw-d/filepath ph filepath" > bootcfg.txt< / span >
2025-04-23 17:54:31 +08:00
示例:< / p > < pre class = "+ topic/pre pr-d/codeblock pre codeblock language-c" id = "spienc-generate-production-firmware__pre_cp4_dp4_fdc" data-ofbid = "spienc-generate-production-firmware__pre_cp4_dp4_fdc" > boot0=bootloader.aic
writetype=spi-nand
writeintf=< span class = "hl-number" > 0< / span >
write0=bootloader.aic.enc
write1=d21x_os.itb.enc,< span class = "hl-number" > 0x40000< / span >
write2=rodata.fatfs.enc,< span class = "hl-number" > 0x240000< / span >
write3=data.fatfs.enc,< span class = "hl-number" > 0x840000< / span > < / pre > < div class = "- topic/note note important note_important" id = "spienc-generate-production-firmware__note_bzd_pq4_fdc" data-ofbid = "spienc-generate-production-firmware__note_bzd_pq4_fdc" > < span class = "note__title" > 重要:< / span >
2025-07-22 11:15:46 +08:00
< p class = "- topic/p p" data-ofbid = "d120129e394__20250519091517" > 在修改 < span class = "+ topic/ph sw-d/filepath ph filepath" > bootcfg.txt< / span > 文件后,确保使用 UNIX 格式的换行符,而非 DOS
2025-04-23 17:54:31 +08:00
格式的换行符,即 ‘ n’ 换行,而非 ‘ rn’ 换行。< / p >
< / div > < / div >
< / li >
< / ul >
< / div >
< / section >
< / div >
< / article > < / main > < / div >
< / div >
< nav role = "navigation" id = "wh_topic_toc" aria-label = "On this page" class = "col-lg-2 d-none d-lg-block navbar d-print-none" >
< div id = "wh_topic_toc_content" >
< div class = " wh_topic_toc " > < div class = "wh_topic_label" > 在本页上< / div > < ul > < li class = "section-item" > < div class = "section-title" > < a href = "#spienc-generate-production-firmware__section_fnv_sfy_52c" data-tocid = "spienc-generate-production-firmware__section_fnv_sfy_52c" > 配置 BootLoader< / a > < / div > < / li > < li class = "section-item" > < div class = "section-title" > < a href = "#spienc-generate-production-firmware__section_of4_5fy_52c" data-tocid = "spienc-generate-production-firmware__section_of4_5fy_52c" > 配置应用程序< / a > < / div > < / li > < li class = "section-item" > < div class = "section-title" > < a href = "#spienc-generate-production-firmware__section_g13_wfy_52c" data-tocid = "spienc-generate-production-firmware__section_g13_wfy_52c" > 固件签名加密< / a > < / div > < / li > < li class = "section-item" > < div class = "section-title" > < a href = "#spienc-generate-production-firmware__section_vwz_fgy_52c" data-tocid = "spienc-generate-production-firmware__section_vwz_fgy_52c" > < span class = "- topic/ph ph" > USB 烧录< / span > < / a > < / div > < / li > < li class = "section-item" > < div class = "section-title" > < a href = "#spienc-generate-production-firmware__section_w5y_ggy_52c" data-tocid = "spienc-generate-production-firmware__section_w5y_ggy_52c" > SD 卡量产< / a > < / div > < / li > < / ul > < / div >
< / div >
< / nav >
< / div >
< / div >
< / div >
< footer class = "navbar navbar-default wh_footer" >
< div class = " footer-container mx-auto " >
< title > footer def< / title >
< style >
.p1 {
font-family: FangZhengShuSong, Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
.p3 {
font-family: "Lucida Console", "Courier New", monospace;
}
< / style >
< div class = "webhelp.fragment.footer" >
< p class = "p1" > Copyright © 2019-2025 广东匠芯创科技有限公司. All rights reserved.< / p >
< / div >
< div >
< div class = "generation_time" >
2025-07-22 11:15:46 +08:00
Update Time: 2025-05-19
2025-04-23 17:54:31 +08:00
< / div >
< / div >
< / div >
< / footer >
< div id = "go2top" class = "d-print-none" >
< span class = "oxy-icon oxy-icon-up" > < / span >
< / div >
< div id = "modal_img_large" class = "modal" >
< span class = "close oxy-icon oxy-icon-remove" > < / span >
< div id = "modal_img_container" > < / div >
< div id = "caption" > < / div >
< / div >
< script src = "${pd}/publishing/publishing-styles-AIC-template/js/custom.js" defer = "defer" > < / script >
< / body >
< / html >