P1-9修复:NET层测试缓冲声明前移文件首部,消除Phase 6使用先于声明的#20编译断裂;s_rx_buf条件补Phase 9门控,7配置构建复验

This commit is contained in:
2026-09-16 12:34:09 +08:00
parent 2bed82471d
commit e7348c48ba
2 changed files with 44 additions and 30 deletions
+39 -26
View File
@@ -22,7 +22,7 @@
/*
* 收发缓冲区 —— 全局静态,不在任务栈上。
* s_rx_buf 仅在 Phase 6(Echo)/8(大文件)/10(边界)/11(KeepAlive) 中使用。
* s_rx_buf 用于 Phase 6(Echo)/8(大文件)/9(Select)/10(边界)/11(KeepAlive)。
* s_tx_buf 仅在 Phase 8(大文件) 和 Phase 10(边界) 中使用。
* Phase 7(TCP Client) 使用函数内局部小缓冲(64B 递增 + 回显)。
*
@@ -37,6 +37,44 @@
*/
#define TEST_BUF_SIZE 32768
/*
* 缓冲区声明前置于全部 Phase 代码:声明必须早于任何使用点(Phase 6
* 即首次使用 s_rx_buf)。P1-9 修复:原声明位于文件后段(Phase 8 注释块
* 之后),phase6_run 使用先于声明 → ARMCC #20 identifier undefined,
* 全部 NET 层测试配置不可编译。声明条件按各 Phase 实际用缓冲精确门控:
* s_rx_buf —— Phase 6(Echo)/9(Select)/11(KeepAlive) 恒用,
* Phase 8(大文件) 非 SEND 方向用;
* s_tx_buf —— Phase 8(大文件) 非 RECV 方向(填充发送窗口)及
* Phase 10(边界) 用。
* PHASE8_DIRECTION 由下方方向配置块定义(仅 ENABLE_PHASE8_TESTS 时);
* #if 中未定义标识符按 0(ECHO) 处理,方向门控结果与配置一致。
*/
/* Phase 8 方向配置:须早于下方缓冲声明,以按方向精确控制 s_tx_buf 等是否参与编译 */
#ifdef ENABLE_PHASE8_TESTS
#define PHASE8_DIR_ECHO 0
#define PHASE8_DIR_SEND 1
#define PHASE8_DIR_RECV 2
#ifndef PHASE8_FILE_SIZE
#define PHASE8_FILE_SIZE 102400 /* 100KB */
#endif
#ifndef PHASE8_DIRECTION
#define PHASE8_DIRECTION PHASE8_DIR_ECHO
#endif
#endif
#if defined(ENABLE_PHASE6_TESTS) || \
(defined(ENABLE_PHASE8_TESTS) && (PHASE8_DIRECTION != PHASE8_DIR_SEND)) || \
defined(ENABLE_PHASE9_TESTS) || defined(ENABLE_PHASE10_TESTS) || \
defined(ENABLE_PHASE11_TESTS)
static uint8_t s_rx_buf[TEST_BUF_SIZE];
#endif
/* s_tx_buf 仅 SEND/ECHO(及 Phase 10)需要;RECV 不发送,避免未使用变量警告 */
#if (defined(ENABLE_PHASE8_TESTS) && (PHASE8_DIRECTION != PHASE8_DIR_RECV)) || \
defined(ENABLE_PHASE10_TESTS)
static uint8_t s_tx_buf[TEST_BUF_SIZE];
#endif
/* ===================================================================
* Phase 6 — NET 层 TCP Echo(基础收发)
@@ -412,31 +450,6 @@ void net_layer_client_test_main(void)
* 2 = RECV PC 发 100KB(+4B CRC32 尾),MCU 收齐字节+CRC 校验
* =================================================================== */
/* Phase 8 方向配置:须早于下方缓冲声明,以按方向精确控制 s_tx_buf 等是否参与编译 */
#ifdef ENABLE_PHASE8_TESTS
#define PHASE8_DIR_ECHO 0
#define PHASE8_DIR_SEND 1
#define PHASE8_DIR_RECV 2
#ifndef PHASE8_FILE_SIZE
#define PHASE8_FILE_SIZE 102400 /* 100KB */
#endif
#ifndef PHASE8_DIRECTION
#define PHASE8_DIRECTION PHASE8_DIR_ECHO
#endif
#endif
#if defined(ENABLE_PHASE6_TESTS) || \
(defined(ENABLE_PHASE8_TESTS) && (PHASE8_DIRECTION != PHASE8_DIR_SEND)) || \
defined(ENABLE_PHASE10_TESTS) || defined(ENABLE_PHASE11_TESTS)
static uint8_t s_rx_buf[TEST_BUF_SIZE];
#endif
/* s_tx_buf 仅 SEND/ECHO(及 Phase 10)需要;RECV 不发送,避免未使用变量警告 */
#if (defined(ENABLE_PHASE8_TESTS) && (PHASE8_DIRECTION != PHASE8_DIR_RECV)) || \
defined(ENABLE_PHASE10_TESTS)
static uint8_t s_tx_buf[TEST_BUF_SIZE];
#endif
#ifdef ENABLE_PHASE8_TESTS
/* CRC32(标准,与 Python zlib.crc32 一致;初始 0xFFFFFFFF,末异或 0xFFFFFFFF)