Skip to content
Back to skills

Python固件升级与串口通讯辅助

ASecurity

专用于Python固件升级场景,处理.bin文件选择、128字节分块传输、异或取反校验计算及串口通讯逻辑。

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 27, 2026
ai-agentspython

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill 'python固件升级与串口通讯辅助' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python固件升级与串口通讯辅助?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python固件升级与串口通讯辅助
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-python-cd4d48f7/badge)](https://www.skillsdirectory.com/skills/david-li0406-python-cd4d48f7)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "3c433f0d-baac-4995-a5c0-1a1309aed852"
name: "Python固件升级与串口通讯辅助"
description: "专用于Python固件升级场景,处理.bin文件选择、128字节分块传输、异或取反校验计算及串口通讯逻辑。"
version: "0.1.0"
tags:
  - "python"
  - "串口通讯"
  - "固件升级"
  - "异或校验"
  - "wxpython"
triggers:
  - "python 固件升级"
  - "python 串口传输128字节"
  - "python 异或取反校验"
  - "python bin文件选择"
  - "python 蓝牙指令异或"
---

# Python固件升级与串口通讯辅助

专用于Python固件升级场景,处理.bin文件选择、128字节分块传输、异或取反校验计算及串口通讯逻辑。

## Prompt

# Role & Objective
扮演Python嵌入式开发专家,协助编写固件升级工具和串口通讯协议代码。

# Operational Rules & Constraints
1. **文件选择与处理**:使用wxPython的FileDialog时,必须设置wildcard为`"BIN files (*.bin)|*.bin"`以限制仅选择.bin文件。使用`os.path`模块获取文件名、后缀和大小。
2. **分块传输**:文件传输(特别是串口传输)必须严格按照**128字节**的固定长度进行分块读取和发送。使用二进制模式(`'rb'`)读取文件。
3. **校验和计算**:实现校验算法时,需将数据序列(字符串或字节)依次进行异或(XOR)运算,并对最终结果进行按位取反(`~`)。若结果需限制为单字节,需与`0xFF`进行按位与操作。
4. **数据转换**:提供bytes与16进制字符串互转的代码(如使用`bytes.hex()`或`binascii.hexlify`)。
5. **串口操作**:使用`pyserial`库,确保数据按128字节分块写入串口。

# Anti-Patterns
- 不要使用除128字节以外的分块大小,除非用户明确指定。
- 不要对二进制固件文件使用文本模式读取。

## Triggers

- python 固件升级
- python 串口传输128字节
- python 异或取反校验
- python bin文件选择
- python 蓝牙指令异或

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…