Initial import: PWM32E C/W 100% firmware
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding:UTF-8 -*-
|
||||
import socket
|
||||
from select import select
|
||||
import time
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import json
|
||||
import struct
|
||||
import binascii
|
||||
import time
|
||||
import re
|
||||
import fileinput
|
||||
|
||||
|
||||
|
||||
def dump_addr(addr):
|
||||
file_asm = "./Xinc_ble_sdk_asm1"
|
||||
cur_func = ""
|
||||
with open(file_asm, 'r') as fd:
|
||||
for line in fd:
|
||||
if re.match(r" \w+", line) != None:
|
||||
cur_func = line.strip()
|
||||
#
|
||||
if re.search("^ 0x", line) != None and re.search(addr, line) != None:
|
||||
print(addr, cur_func)
|
||||
break
|
||||
fd.close()
|
||||
|
||||
def dump_addr1(addr):
|
||||
file_asm = "./Xinc_ble_sdk_asm1"
|
||||
cur_func = ""
|
||||
with open(file_asm, 'r') as fd:
|
||||
for line in fd:
|
||||
if re.match(r" \w+", line) != None:
|
||||
cur_func = line.strip()
|
||||
#
|
||||
if re.search("^ 0x", line) != None and re.search(addr, line) != None:
|
||||
print(addr, cur_func)
|
||||
break
|
||||
fd.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
file_in = "./dump.txt"
|
||||
|
||||
for line in fileinput.input(file_in):
|
||||
print(line)
|
||||
# 处理 PC 指针信息
|
||||
if re.search("PC = ", line) != None:
|
||||
pc_addr = line.split("PC = ")[1].split(",")[0]
|
||||
#print(hex(int(pc_addr, 16)))
|
||||
dump_addr(hex(int(pc_addr, 16)))
|
||||
dump_addr1(hex(int(pc_addr, 16)))
|
||||
# 处理 栈信息
|
||||
if re.search("^[0-9]",line) != None:
|
||||
#print(line)
|
||||
stack = line.split('=')[1].replace('\n', '').split(' ')
|
||||
for addr in stack:
|
||||
if addr == ' ' or re.search("^1", addr) == None:
|
||||
continue
|
||||
#print(addr, hex(int(addr,16)-1))
|
||||
dump_addr(hex(int(addr,16)-1))
|
||||
dump_addr1(hex(int(addr,16)-1))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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.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.
@@ -0,0 +1,14 @@
|
||||
# Offline checksum tool
|
||||
|
||||
This folder keeps the XC6517 offline burn helper used 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 `make_release_bin.bat` 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 online and OTA files to `release\`.
|
||||
|
||||
Do not use the generated offline BIN as the online burn file.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user