发布 HPW422 V1.3 第一版量产代码

This commit is contained in:
2026-07-11 14:30:24 +08:00
parent d9e2a58a66
commit fb8d47971f
30 changed files with 494 additions and 5 deletions
+148
View File
@@ -0,0 +1,148 @@
param(
[string]$ConfigPath,
[string]$Mac,
[string]$Count,
[string]$OnlineBinPath,
[string]$OtaBinPath,
[switch]$NoOta
)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$repoRoot = Split-Path -Parent $scriptDir
if ([string]::IsNullOrWhiteSpace($ConfigPath)) {
$ConfigPath = Join-Path $repoRoot "project_info.ini"
}
function Read-ProjectInfo {
param([string]$Path)
if (-not (Test-Path -LiteralPath $Path)) {
throw "Config file not found: $Path"
}
$result = @{}
foreach ($line in Get-Content -LiteralPath $Path) {
$trimmed = $line.Trim()
if ($trimmed.Length -eq 0 -or $trimmed.StartsWith("#") -or $trimmed.StartsWith(";")) {
continue
}
$parts = $trimmed.Split("=", 2)
if ($parts.Count -ne 2) {
continue
}
$key = $parts[0].Trim()
$value = $parts[1].Trim()
if ($key.Length -gt 0) {
$result[$key] = $value
}
}
return $result
}
function Require-Value {
param(
[hashtable]$Info,
[string]$Key
)
if (-not $Info.ContainsKey($Key) -or [string]::IsNullOrWhiteSpace([string]$Info[$Key])) {
throw "Missing required config value: $Key"
}
return [string]$Info[$Key]
}
$info = Read-ProjectInfo -Path $ConfigPath
$product = Require-Value -Info $info -Key "PRODUCT"
$version = Require-Value -Info $info -Key "VERSION"
$chip = Require-Value -Info $info -Key "CHIP"
if ([string]::IsNullOrWhiteSpace($Mac)) {
if ($info.ContainsKey("OFFLINE_MAC")) {
$Mac = [string]$info["OFFLINE_MAC"]
} else {
$Mac = "40-ab-00-cd-01-01"
}
}
if ([string]::IsNullOrWhiteSpace($Count)) {
if ($info.ContainsKey("OFFLINE_COUNT")) {
$Count = [string]$info["OFFLINE_COUNT"]
} else {
$Count = "1000000"
}
}
if ([string]::IsNullOrWhiteSpace($OnlineBinPath)) {
$OnlineBinPath = Join-Path $repoRoot "project\example\ble\ble_peripheral\mdk\ble_peripheral.bin"
}
if ([string]::IsNullOrWhiteSpace($OtaBinPath)) {
$OtaBinPath = Join-Path $repoRoot "project\example\ble\ble_peripheral\mdk\output_bin\ota_data_aes.bin"
}
$offlineDir = Join-Path $repoRoot "tools\offline_burn"
$offlineTool = Join-Path $offlineDir "Xinc_mac_tool.exe"
$offlineInput = Join-Path $offlineDir "download.bin"
$releaseDir = Join-Path $repoRoot "release"
$onlineReleaseDir = Join-Path $releaseDir "online"
$otaReleaseDir = Join-Path $releaseDir "ota"
if (-not (Test-Path -LiteralPath $OnlineBinPath)) {
throw "Online BIN not found: $OnlineBinPath"
}
if (-not (Test-Path -LiteralPath $offlineTool)) {
throw "Offline checksum tool not found: $offlineTool"
}
Copy-Item -LiteralPath $OnlineBinPath -Destination $offlineInput -Force
Push-Location $offlineDir
try {
& $offlineTool $Mac $Count
if ($LASTEXITCODE -ne 0) {
throw "Xinc_mac_tool.exe failed with exit code $LASTEXITCODE"
}
} finally {
Pop-Location
}
$namePattern = "^" + [regex]::Escape($Mac) + "_([0-9A-Fa-f]{8})_" + [regex]::Escape($Count) + "\.bin$"
$generated = Get-ChildItem -LiteralPath $offlineDir -File -Filter "$Mac`_*.bin" |
Where-Object { $_.Name -match $namePattern } |
Sort-Object LastWriteTimeUtc -Descending |
Select-Object -First 1
if ($null -eq $generated) {
throw "Checksum output was not found in $offlineDir"
}
$checksum = ([regex]::Match($generated.Name, $namePattern)).Groups[1].Value.ToUpperInvariant()
New-Item -ItemType Directory -Force -Path $onlineReleaseDir | Out-Null
$onlineName = "{0}_{1}_{2}_{3}.bin" -f $product, $version, $chip, $checksum
$onlineReleasePath = Join-Path $onlineReleaseDir $onlineName
Copy-Item -LiteralPath $OnlineBinPath -Destination $onlineReleasePath -Force
Write-Host "Checksum source: $($generated.FullName)"
Write-Host "Online BIN: $onlineReleasePath"
if (-not $NoOta) {
if (Test-Path -LiteralPath $OtaBinPath) {
New-Item -ItemType Directory -Force -Path $otaReleaseDir | Out-Null
$otaName = "{0}_{1}_{2}_{3}_OTA.bin" -f $product, $version, $chip, $checksum
$otaReleasePath = Join-Path $otaReleaseDir $otaName
Copy-Item -LiteralPath $OtaBinPath -Destination $otaReleasePath -Force
Write-Host "OTA BIN: $otaReleasePath"
} else {
Write-Warning "OTA BIN not found, skipped: $OtaBinPath"
}
}
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
# Offline checksum tool
This folder keeps the original XC6517 offline burn helper used only to calculate
the checksum segment for release file names.
Normal release flow:
1. Build the Keil project and generate `mdk\ble_peripheral.bin`.
2. Run `tools\make_release_bin.ps1` from the repository root.
3. The script copies `ble_peripheral.bin` to `download.bin`, runs
`Xinc_mac_tool.exe`, extracts the checksum from the generated offline file
name, then copies the real online burn file to `release\online`.
Do not use the generated offline BIN as the online burn file.
+2
View File
@@ -0,0 +1,2 @@
如果要烧录与烧录器最开始同一MAC的程序,需要先烧录erase.bin
MCU烧录Mcu_download.bin文件
+163
View File
@@ -0,0 +1,163 @@
:020000040800F2
:1000000020040020D50000085D020008E30100087C
:1000100000000000000000000000000000000000E0
:10002000000000000000000000000000CD030008F8
:100030000000000000000000B10200086904000890
:10004000E7000008E7000008E7000008E7000008F4
:10005000E7000008E7000008E7000008E7000008E4
:10006000E7000008E7000008E7000008E7000008D4
:10007000E7000008E7000008E7000008E7000008C4
:10008000E7000008E700000800000000E7000008A3
:10009000E7000008E7000008E7000008E7000008A4
:1000A000E7000008E7000008E7000008CD040008AA
:1000B000E700000800000000E70000080000000062
:1000C0000348854600F02AF800480047C5080008A4
:1000D000200400200448804704480047FEE7FEE76C
:1000E000FEE7FEE7FEE7FEE76D040008C10000083A
:1000F00030B50B46014600202022012409E00D46C0
:10010000D5409D4205D31D469540491B2546954047
:1001100040191546521E002DF1DC30BD064C01255C
:10012000064E05E0E36807CC2B430C3C984710349F
:10013000B442F7D3FFF7C8FFC4090008E409000878
:10014000F0B50022032501230C6893401C409C421B
:100150002AD10C79012C01D0022C12D187685400CD
:100160002E46A640B74387604E79A6408468264352
:10017000866084889C43848084888B7993401C4368
:100180008480066853002C469C40A64306600E7986
:1001900007689E403E430660C668A643C660CC79A9
:1001A0009C40C3681C43C460521C102ACBD3F0BDD2
:1001B0004B07DB0E9A40C90810B589000818016A80
:1001C0000F249C40A1430162016A1143016210BDEA
:1001D0000246128A00200A4200D001207047816145
:1001E0007047FEE7FEB50121880400F063F80121A5
:1001F000480400F05FF8012468460094047100256B
:1002000085710226C671032141710927FF066946DF
:100210003846FFF795FF102000906846047144713E
:10022000C57169463846FFF78BFF0A48009068465B
:1002300005714471C47169463846FFF781FF68460D
:10024000009605714471C47169460348FFF778FF51
:10025000FEBD0000C26600000004004870470000B8
:1002600030B5827801240178002A15D08B080E4A17
:100270009B009A1813688907C90EFF258D40AB4370
:100280004578AD072D0E8D401D4315600078C006E2
:10029000C00E8440054804E0C806C00E84400348F0
:1002A0008030046030BD000000E400E000E100E0C8
:1002B00070470000044A0029516901D0014300E061
:1002C000814351617047000000100240044A002938
:1002D000916901D0014300E08143916170470000C2
:1002E00000100240F8B5334E044670680C21324DC0
:1002F000084003D0042801D0082801D0256012E06E
:10030000716870680122890212040F0F1040BF1C2F
:1003100000281CD0F06A0107090F2846491CFFF786
:10032000E7FE784320607068244B0006000F1A5CDB
:1003300020680146D140616072685205520F9A5C94
:10034000D140A160326BD20505D41D4A09E01D4899
:1003500047432760E7E77268520401D44A0800E087
:100360008A08E260326B184B520603D4164A1232E6
:10037000226100E02361326BD20601D4656100E0A6
:100380006061326B92070FD0316B8907890F0129A9
:100390000CD0306B8007800F022809D0306BC0432F
:1003A000800700D1A561F8BDA161F8BDA061F8BDCD
:1003B000A361F8BD0010024000127A000000002086
:1003C000809FD50000093D000080000070470000BC
:1003D0001CB50023224800930193016801221204F6
:1003E0001143016051000524240302680A40019270
:1003F000009A521C0092019A002A02D1009AA2424D
:10040000F3D10168890328D501210191154A1121F1
:100410001160416841604168416041683F221204B7
:100420009143416041681122120411434160016807
:10043000012212061143016001688901FCD541685F
:100440008908890041604168022211434160416886
:100450000907890F0229FAD11CBD01931CBD0000B8
:1004600000100240002002407047000010B5144800
:1004700001680122114301604168124A1140416044
:100480000168114A11400160016801229204914300
:10049000016041683F22120491434160C16A090929
:1004A0000901C162016BFF22543291430163416B28
:1004B00049084900416300218160FFF789FF10BDB1
:1004C000001002400CB8FFF8FFFFF6FE10B50B4C11
:1004D0000949204600F06FF800280CD0204600F0B3
:1004E000E1F80146204600F0E1F88021204600F0C6
:1004F0005BF80028F9D010BD050105000038014067
:10050000F0B5012189B04804FFF7D4FE012188032A
:10051000FFF7DCFE092001220221C006FFF748FE9A
:10052000092001220321C006FFF742FE0C26022704
:1005300068460096077103214171002484710125EA
:10054000C57109206946C006FFF7FAFDE120049451
:1005500005940694089440020C4C039003A9079656
:10056000204600F059F801220949204600F03FF8E2
:100570000121204600F00EF81B21684601724772E7
:10058000857202A8FFF76CFE09B0F0BD003801408B
:10059000050105000029016802D00122114301E094
:1005A00049084900016070470246D26900200A42AA
:1005B00000D00120704730B50A04130E01252A46E9
:1005C00000248A40012B0ED0022B0ED08368090C28
:1005D0001340C0698D402840002B02D0002800D075
:1005E0000124204630BD0368F1E74368EFE710B50A
:1005F0000B041C0E01238B40022C02D0032C02D0D2
:1006000002E0001D00E008300168002A01D0194313
:1006100000E09943016010BD30B50446006887B022
:100620000D464008400020606068032109038843AC
:10063000A9680143616020681749EA680840696851
:1006400011432A69024311432160A0680321090272
:10065000884369690143A1606846FFF743FE0F487C
:10066000844201D1069800E00298216809042968B3
:1006700000D54000FFF73CFD2A6852088A4200D8A6
:10068000401C2168090404D50107054A490F1040A0
:100690000843A08107B030BDF3E9FFFF00380140F7
:1006A000F0FF0000808CC005C00D7047C905C90D62
:1006B000018570470FB410B503A9044B044A029892
:1006C00000F018F810BC08BC04B01847A1080008D6
:1006D0001800002002E008C8121F08C1002AFAD141
:1006E00070477047002001E001C1121F002AFBD1B2
:1006F00070470000FFB58DB00446002506E02528B0
:100700000AD0109A0F999047641C6D1C207800281D
:10071000F5D1284611B0F0BD00270121484A0097C5
:1007200000E00743641C23780846203B98401042B1
:10073000F7D120782E2817D1042007436078641C55
:100740002A280CD10E98641C02C800910E900BE070
:1007500000990A22514330394018641C00902078D7
:10076000014630390929F3D920780028D1D06428EE
:1007700008D0692806D075281ED0109A0F99904786
:100780006D1C5BE00A200E99019001C90E910028B2
:1007900002DA40422D2102E0390504D52B216A46B8
:1007A0001172012103E0F90704D02021F7E70BAE15
:1007B0000B910DE00021FAE70A200E99019001C982
:1007C0000E91F7E70199FFF793FC3031761E3170F7
:1007D0000028F7D103A8801B20300190780701D5AD
:1007E000009801E0012000900199884201DD401A43
:1007F00000E000200027009006E002A8109AC05DEB
:100800000F9990476D1C7F1C0B988742F5DB04E025
:10081000109A30200F9990476D1C0099481E009047
:100820000029F5DC05E03078109A761C0F99904786
:100830006D1C0199481E01900029F4DC641C65E7D9
:1008400009280100FEB501218804FFF733FD0121CD
:100850004804FFF72FFD09200121C006FFF7BFFC68
:100860000D48009001266846067100278771022412
:10087000C4710325457109206946C006FFF760FC75
:100880006846009406718771C471457169460348D2
:10089000FFF756FCFEBD0000C062000000040048E7
:1008A00070B5074D0446C1B22846FFF7FFFE402150
:1008B0002846FFF779FE0028F9D0204670BD0000D9
:1008C00000380140FFF71CFE19A0FFF7F3FE21A03E
:1008D000FFF7F0FE28A0FFF7EDFEFFF783FC0927E6
:1008E0002F4EFF062F4D00243046401EFDD12EA076
:1008F0002A686968FFF7DEFE02213846FFF768FCC8
:10090000002804D06C602868401C286006E02C6039
:100910006868401C68601E2802DA20461E28E3DB57
:10092000FFF790FF10213846FFF759FCFEE7000063
:10093000BBB6D3ADCAB9D3C3D4B4B5D859442D537B
:10094000544D3332463033304634BACBD0C4B0E5A0
:100950000D0A0000CDF8B5EAB5D8D6B76874747042
:100960003A2F2F7663632D676E642E74616F626118
:100970006F2E636F6D0D0A004D4355B4AEBFDABDE7
:10098000D3CAD5B5BDD0C5CFA2BAF3B7B4C0A1BD47
:10099000D3CAD5B5BDB5C4D0C5CFA20D0A000000DD
:1009A000FFFF0F001000002068656172745F696EC0
:1009B00076657273653A25643A2068656172743AA7
:1009C00025640A00E4090008000000201C00000063
:1009D000D4060008000A00081C00002004040000DF
:1009E000E406000800000000010203040102030401
:1009F00006070809000000000000000000000000D9
:04000005080000C12E
:00000001FF
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

+2
View File
@@ -0,0 +1,2 @@
Xinc_mac_tool.exe 40-ab-00-cd-01-01 1000000
REM pause
Binary file not shown.
Binary file not shown.
Binary file not shown.