feat(ota): OTA功能测试通过,CANFD解包效率优化

- 添加OTA固件升级功能,包括应用程序验证和跳转机制
- 实现CANFD数据传输协议,支持加密和CRC校验
- 优化CAN通信处理,添加调试输出和错误处理
- 更新RTE组件配置,升级csolution版本到2.12.0
- 增加Flash擦除和写入的安全验证机制
- 添加应用程序区域扫描和验证功能

refactor(can): 重构CAN通信模块和OTA数据处理

- 移除未使用的常量定义和辅助函数
- 改进数据解包和加密解密流程
- 添加条件编译调试输出
- 优化Flash操作的安全性和可靠性

chore(build): 更新项目配置和忽略文件

- 添加tmp/和out/目录到.gitignore
- 扩展ROM0_SIZE从0x0020000到0x08005000
- 添加bin输出格式支持
This commit is contained in:
cbb
2026-01-03 18:00:28 +08:00
parent 9c7145ef99
commit 2f482554f0
39 changed files with 1954 additions and 1764 deletions
+5 -7
View File
@@ -52,7 +52,7 @@ const u8 inv_sbox[256] = {
// 轮常量
static const u8 rcon[10] = {0x01, 0x02, 0x04, 0x08, 0x10,
0x20, 0x40, 0x80, 0x1b, 0x36};
0x20, 0x40, 0x80, 0x1b, 0x36};
// 伽罗瓦域乘法 (xtime) - 确保正确
static u8 xtime(u8 x) { return (x << 1) ^ (((x >> 7) & 1) * 0x1b); }
@@ -281,8 +281,7 @@ void aes128_set_key(aes128_context *ctx, const u8 *key) {
}
// 加密单个块
void aes128_encrypt_block(aes128_context *ctx, const u8 *input,
u8 *output) {
void aes128_encrypt_block(aes128_context *ctx, const u8 *input, u8 *output) {
// 复制输入到状态
memcpy(ctx->state, input, AES_BLOCK_SIZE);
@@ -316,8 +315,7 @@ void aes128_ecb_encrypt_48bytes(aes128_context *ctx, const u8 *input,
}
// 解密单个块
void aes128_decrypt_block(aes128_context *ctx, const u8 *input,
u8 *output) {
void aes128_decrypt_block(aes128_context *ctx, const u8 *input, u8 *output) {
// 复制输入到状态
memcpy(ctx->state, input, AES_BLOCK_SIZE);
@@ -351,8 +349,8 @@ void aes128_ecb_decrypt_48bytes(aes128_context *ctx, const u8 *input,
}
// 验证函数:加密后解密,对比原始数据
u8 aes128_verify_encryption(aes128_context *ctx,
const u8 *original_data, size_t length) {
u8 aes128_verify_encryption(aes128_context *ctx, const u8 *original_data,
size_t length) {
u8 temp_ciphertext[48];
u8 temp_plaintext[48];
u8 result = 1; // 1表示验证成功,0表示失败