update flash size 3000k

This commit is contained in:
Steven Dan
2026-06-11 08:59:20 +08:00
parent 3a11b4f891
commit 4f92c454d5
4 changed files with 8 additions and 7 deletions

View File

@@ -23,7 +23,7 @@
*/
#ifndef FLASH_MAX_UPGRADE_SIZE
//#define FLASH_MAX_UPGRADE_SIZE (512 * 1024)
#define FLASH_MAX_UPGRADE_SIZE (2800 * 1024)
#define FLASH_MAX_UPGRADE_SIZE (3000 * 1024)
#endif
#define FLASH_ERROR() do {} while(0)

View File

@@ -8,15 +8,12 @@
#include <xclib.h>
#include <stdio.h>
#include "debug_print.h"
#include "dfu_upgrade.h"
#include "xua.h"
#if HID_DFU_EN
#ifndef DFU_FLASH_MAX_UPGRADE_SIZE
#define DFU_FLASH_MAX_UPGRADE_SIZE (2800 * 1024)
#endif
#define DFU_FLASH_ERROR()
static int dfu_flash_device_open = 0;

View File

@@ -95,7 +95,7 @@ unsigned char handle_firmware_upgrade_start(uint8_t data[], uint16_t len)
debug_printf("g_first_page_write_executed: %d\n", g_first_page_write_executed);
if (firmware_size == 0 || firmware_size > FLASH_MAX_UPGRADE_SIZE) {
if (firmware_size == 0 || firmware_size > DFU_FLASH_MAX_UPGRADE_SIZE) {
debug_printf("Firmware upgrade error: invalid size %lu\n", firmware_size);
response[0] = STATUS_SIZE_INVALID;
send_firmware_upgrade_response(FIRMWARE_UPGRADE_START, response, 1);

View File

@@ -44,7 +44,11 @@ typedef enum {
// 数据包格式:同步头(1) + 命令码(1) + 块序号(2) + 数据长度(1) + 数据(N) + Checksum(1)
// 所以最大数据长度 = 63 - 5(头部) - 1(Checksum) = 57字节
#define MAX_DATA_BLOCK_SIZE 57 // 最大数据块大小63字节HID数据包 - 5字节头部 - 1字节Checksum
#define FLASH_MAX_UPGRADE_SIZE (2000 * 1024) // 最大固件大小1400KB
#ifndef DFU_FLASH_MAX_UPGRADE_SIZE
#define DFU_FLASH_MAX_UPGRADE_SIZE (3000 * 1024)
#endif
// 页缓冲区结构
typedef struct {