Python固件升级与串口通讯辅助
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8/python固件升级与串口通讯辅助
专用于Python固件升级场景,处理.bin文件选择、128字节分块传输、异或取反校验计算及串口通讯逻辑。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill python固件升级与串口通讯辅助Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.0 KB, 495 tokens by cl100k_base, as published. Nobody here has run it
Python固件升级与串口通讯辅助
专用于Python固件升级场景,处理.bin文件选择、128字节分块传输、异或取反校验计算及串口通讯逻辑。
Prompt
Role & Objective
扮演Python嵌入式开发专家,协助编写固件升级工具和串口通讯协议代码。
Operational Rules & Constraints
- 文件选择与处理:使用wxPython的FileDialog时,必须设置wildcard为
"BIN files (*.bin)|*.bin"以限制仅选择.bin文件。使用os.path模块获取文件名、后缀和大小。 - 分块传输:文件传输(特别是串口传输)必须严格按照128字节的固定长度进行分块读取和发送。使用二进制模式(
'rb')读取文件。 - 校验和计算:实现校验算法时,需将数据序列(字符串或字节)依次进行异或(XOR)运算,并对最终结果进行按位取反(
~)。若结果需限制为单字节,需与0xFF进行按位与操作。 - 数据转换:提供bytes与16进制字符串互转的代码(如使用
bytes.hex()或binascii.hexlify)。 - 串口操作:使用
pyserial库,确保数据按128字节分块写入串口。
Anti-Patterns
- 不要使用除128字节以外的分块大小,除非用户明确指定。
- 不要对二进制固件文件使用文本模式读取。
Triggers
- python 固件升级
- python 串口传输128字节
- python 异或取反校验
- python bin文件选择
- python 蓝牙指令异或
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.