소스 검색

[Mod]修改错误代码,删除冗余代码

master
杰杰的笔记本\杰杰 8 시간 전
부모
커밋
3130376aca
34개의 변경된 파일21546개의 추가작업 그리고 22919개의 파일을 삭제
  1. +0
    -10
      Core/Inc/main.h
  2. +3
    -4
      Core/Modbus/modbus.c
  3. +8
    -39
      Core/Src/main.c
  4. +10
    -3
      Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c
  5. +268
    -269
      EWARM/Modbus.dep
  6. +839
    -851
      EWARM/Modbus/Exe/Modbus.hex
  7. BIN
      EWARM/Modbus/Exe/Modbus.sim
  8. +76
    -93
      EWARM/Modbus/Obj/.ninja_log
  9. BIN
      EWARM/Modbus/Obj/Modbus.pbd
  10. BIN
      EWARM/Modbus/Obj/Modbus.pbd.browse
  11. +20126
    -20364
      EWARM/Modbus/Obj/Modbus.pbw
  12. BIN
      EWARM/Modbus/Obj/Modbus_part1.pbi
  13. BIN
      EWARM/Modbus/Obj/Modbus_part3.pbi
  14. BIN
      EWARM/Modbus/Obj/Modbus_part4.pbi
  15. BIN
      EWARM/Modbus/Obj/main.pbi
  16. BIN
      EWARM/Modbus/Obj/modbus.pbi
  17. +8
    -6
      EWARM/Modbus/Obj/modbus.pbi.dep
  18. BIN
      EWARM/Modbus/Obj/stm32f4xx_hal_msp.pbi
  19. BIN
      EWARM/Modbus/Obj/stm32f4xx_hal_uart.pbi
  20. BIN
      EWARM/Modbus/Obj/stm32f4xx_it.pbi
  21. +20
    -19
      EWARM/settings/Modbus.dbgdt
  22. +7
    -7
      EWARM/settings/Modbus.dnx
  23. +24
    -24
      EWARM/settings/Project.wsdt
  24. +148
    -0
      docs/superpowers/plans/2026-08-04-modbus-odd-address-even-count.md
  25. +4
    -8
      docs/项目设计.md
  26. +5
    -6
      document/TouchWin自组Modbus功能码函数.md
  27. +0
    -387
      test/app_runtime_test.c
  28. +0
    -34
      test/check_no_communication_counters.ps1
  29. +0
    -49
      test/check_rtu_runtime_invariants.ps1
  30. +0
    -70
      test/modbus_backup_test.c
  31. +0
    -306
      test/modbus_test.c
  32. +0
    -308
      test/support/app_runtime/main.h
  33. +0
    -16
      test/support/app_runtime/stm32f4xx_it.h
  34. +0
    -46
      test/support/main.h

+ 0
- 10
Core/Inc/main.h 파일 보기

@@ -50,16 +50,6 @@ extern volatile uint8_t coilStorage[MODBUS_COIL_STORAGE_SIZE];
*/
extern volatile uint16_t extendedHoldingRegister;

/** @brief USART1 恢复诊断量,供 IAR Live Watch 定位断线重连问题。 */
extern volatile uint32_t ModbusUartLastErrorCode;
extern volatile uint32_t ModbusUartLastRxState;
extern volatile uint32_t ModbusUartRecoveryCount;
extern volatile uint32_t ModbusUartRecoveryFailureCount;
extern volatile uint32_t ModbusUartRxArmCount;
extern volatile uint32_t ModbusUartRxArmFailureCount;
extern volatile uint8_t ModbusUartLastRxByte;
extern volatile uint16_t ModbusLastCompleteFrameLength;

/* Q0 保留给低电平有效的通信/连接指示灯。Modbus 用户线圈从线圈 1 开始,
* 因此 Q1..Q7 作为 7 个可控输出。 */
#define PLC_Q0_PORT (GPIOF)


+ 3
- 4
Core/Modbus/modbus.c 파일 보기

@@ -729,8 +729,8 @@ static MODBUS_REQUEST_RESULT ModbusBuildWriteExtendedRegisterResponse(

/**
* @brief 构建私有功能码 0x43 的连续奇数地址读取响应。
* @note 数量必须为 1 至 123 的奇数。偶数起始基准地址自动上调到下一奇数,
* 例如起始地址 0 依次返回地址 1、3、5 等的寄存器值。
* @note 数量范围为 1 至 123,奇数和偶数均可。偶数起始基准地址自动上调到
* 下一奇数,例如起始地址 0 依次返回地址 1、3、5 等的寄存器值。
*/
static MODBUS_REQUEST_RESULT ModbusBuildReadOddAddressRegistersResponse(
const MODBUS_SLAVE *slave, uint16_t startAddress,
@@ -744,8 +744,7 @@ static MODBUS_REQUEST_RESULT ModbusBuildReadOddAddressRegistersResponse(
uint16_t registerOffset;

if ((registerCount == 0U)
|| (registerCount > MODBUS_MAX_ODD_COUNT_REGISTER_COUNT)
|| ((registerCount & 0x0001U) == 0U)) {
|| (registerCount > MODBUS_MAX_ODD_COUNT_REGISTER_COUNT)) {
return MODBUS_REQUEST_ILLEGAL_VALUE;
}



+ 8
- 39
Core/Src/main.c 파일 보기

@@ -28,16 +28,6 @@ volatile uint16_t holdingRegisters[MODBUS_DATA_POINT_COUNT];
volatile uint8_t coilStorage[MODBUS_COIL_STORAGE_SIZE];
volatile uint16_t extendedHoldingRegister;

/* UART 诊断变量保留为全局可见,便于在 IAR Live Watch 中观察断线和重连测试。 */
volatile uint32_t ModbusUartLastErrorCode;
volatile uint32_t ModbusUartLastRxState;
volatile uint32_t ModbusUartRecoveryCount;
volatile uint32_t ModbusUartRecoveryFailureCount;
volatile uint32_t ModbusUartRxArmCount;
volatile uint32_t ModbusUartRxArmFailureCount;
volatile uint8_t ModbusUartLastRxByte;
volatile uint16_t ModbusLastCompleteFrameLength;

static MODBUS_SLAVE ModbusSlave;
static OS_EVENT *ModbusFrameSem;
static OS_EVENT *ModbusTxSem;
@@ -56,7 +46,6 @@ static volatile uint8_t ModbusRxDiscard;
static volatile uint8_t ModbusReceptionNeedsRecovery;
static uint32_t ModbusLastActivityTick;
static uint8_t ModbusHasActivity;
static MODBUS_STATUS ModbusLastStatus;

static GPIO_TypeDef *const
AppUserOutputPorts[APP_MODBUS_USER_OUTPUT_COIL_COUNT] =
@@ -337,11 +326,6 @@ static HAL_StatusTypeDef AppStartUartReception(void)
/* 每次只挂接一个字节的接收。接收完成回调负责推进缓冲区并重新挂接下一个
* 字节,使组帧完全由中断驱动且不会阻塞 Modbus 任务。 */
halStatus = HAL_UART_Receive_IT(&Uart1Handle, &ModbusRxBuffer[0], 1U);
ModbusUartRxArmCount++;
if (halStatus != HAL_OK) {
ModbusUartRxArmFailureCount++;
}
ModbusUartLastRxState = (uint32_t)Uart1Handle.RxState;

return halStatus;
}
@@ -355,8 +339,6 @@ static HAL_StatusTypeDef AppRecoverUartReception(void)
HAL_StatusTypeDef halStatus;
HAL_StatusTypeDef abortStatus;

ModbusUartRecoveryCount++;

/* 出错的接收仍由 HAL 持有时,HAL_UART_Receive_IT() 会返回 BUSY。
* 先终止旧接收并清除外设状态,下一次挂接才能从 READY 状态开始。 */
abortStatus = HAL_UART_AbortReceive_IT(&Uart1Handle);
@@ -370,11 +352,6 @@ static HAL_StatusTypeDef AppRecoverUartReception(void)
halStatus = AppStartUartReception();
}

if (halStatus != HAL_OK) {
ModbusUartRecoveryFailureCount++;
}
ModbusUartLastRxState = (uint32_t)Uart1Handle.RxState;

return halStatus;
}

@@ -518,7 +495,6 @@ static void AppHandleModbusRtuTimer(void)
/* T3.5 表示帧结束。通知任务前先保存帧长度,任务随后解析稳定的缓冲区,
* 完成后再重置接收状态。 */
ModbusFrameLength = ModbusRxLength;
ModbusLastCompleteFrameLength = ModbusFrameLength;
ModbusFrameReady = 1U;
(void)HAL_UART_AbortReceive_IT(&Uart1Handle);
(void)AppPostModbusFrameSem();
@@ -689,13 +665,11 @@ static void AppProcessFrame(uint16_t rxLength)

if ((rxLength == 0U) || (rxLength > MODBUS_RX_BUF_SIZE))
{
ModbusLastStatus = MODBUS_STATUS_FRAME_ERROR;
return;
}

if (ModbusRxOverflow != 0U)
{
ModbusLastStatus = MODBUS_STATUS_FRAME_ERROR;
return;
}

@@ -704,7 +678,6 @@ static void AppProcessFrame(uint16_t rxLength)
status = ModbusProcessFrame(&ModbusSlave, ModbusRxBuffer, rxLength,
ModbusTxBuffer, MODBUS_TX_BUF_SIZE,
&txLength);
ModbusLastStatus = status;
/* 只有 CRC 正确且寻址到本站的帧(包括合法广播写入或已生成的异常响应)才算
* 有效链路活动,线路上的随机干扰不能错误点亮连接指示灯。 */
if (AppIsModbusStatusAccepted(status) != 0U)
@@ -712,8 +685,8 @@ static void AppProcessFrame(uint16_t rxLength)
ModbusLastActivityTick = OSTimeGet();
ModbusHasActivity = 1U;
isWriteOperation = AppIsModbusRetentionWriteFunction(functionCode);
if (((ModbusLastStatus == MODBUS_STATUS_OK)
|| (ModbusLastStatus == MODBUS_STATUS_BROADCAST))
if (((status == MODBUS_STATUS_OK)
|| (status == MODBUS_STATUS_BROADCAST))
&& (isWriteOperation != 0U))
{
(void)ModbusBackupSave(&ModbusSlave);
@@ -821,12 +794,12 @@ static void AppTaskT35(void *argument)
updateElapsedTicks = 0U;

while (1) {
/* 这个低频任务不解析帧,只按周期唤醒 Modbus 任务,使空闲线路在达到配置
* 的超时时间后将连接指示灯恢复为断开状态。 */
OSTimeDly(APP_MODBUS_STATUS_CHECK_TICKS);
/* 周期唤醒 Modbus 任务,使空闲线路在达到配置
的超时时间后将连接指示灯恢复为断开状态。 */
OSTimeDly(1U);

updateElapsedTicks += APP_MODBUS_STATUS_CHECK_TICKS;
if (updateElapsedTicks >= APP_MODBUS_STATUS_UPDATE_TICKS) {
updateElapsedTicks += 1U;
if (updateElapsedTicks >= 100U) {
updateElapsedTicks = 0U;
(void)AppPostModbusFrameSem();
}
@@ -845,8 +818,7 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *uartHandle)
return;
}

/* 此回调每次只处理一个字节,不解析功能码,也不写入数据模型;这些操作由
* AppTaskModbus 任务完成。 */
/* 此回调每次只处理一个字节 */
if (ModbusFrameReady != 0U) {
return;
}
@@ -874,7 +846,6 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *uartHandle)

/* HAL 已经将当前字节放入 ModbusRxBuffer[ModbusRxLength]。 */
ModbusRxLength++;
ModbusUartLastRxByte = ModbusRxBuffer[ModbusRxLength - 1U];
AppStartModbusRtuTimer();
if (ModbusRxLength >= MODBUS_RX_BUF_SIZE) {
ModbusRxOverflow = 1U;
@@ -905,8 +876,6 @@ void HAL_UART_ErrorCallback(UART_HandleTypeDef *uartHandle)
/* UART 错误会使当前整帧失效。中断只记录错误并唤醒任务,不在这里终止或重新
* 进入 HAL 接收流程,从而避免 HAL 重入,并让恢复操作集中在一个上下文中。 */
AppStopModbusRtuTimer();
ModbusUartLastErrorCode = uartHandle->ErrorCode;
ModbusUartLastRxState = (uint32_t)uartHandle->RxState;
__HAL_UART_CLEAR_PEFLAG(uartHandle);
ModbusRxOverflow = 1U;
ModbusReceptionNeedsRecovery = 1U;


+ 10
- 3
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c 파일 보기

@@ -1356,22 +1356,29 @@ HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData
* @param Size Amount of data elements (u8 or u16) to be received.
* @retval HAL status
*/
/*开启串口中断接收,CPU 收到 1 帧 / 多字节数据后触发HAL_UART_RxCpltCallback接收完成回调;
本工程 Modbus 采用 Size=1 单字节中断接收,每收到 1 个字节进一次回调,用来精准捕捉 RTU 时序。*/
HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
{
/* Check that a Rx process is not already ongoing */
// 防止重复调用挂载接收,避免缓存覆盖、中断错乱
if (huart->RxState == HAL_UART_STATE_READY)
{
if ((pData == NULL) || (Size == 0U))
if ((pData == NULL) || (Size == 0U)) //接收缓存是空指针,写内存会 HardFault,接收长度为 0,无意义
{
return HAL_ERROR;
}

/* Process Locked */
__HAL_LOCK(huart);
__HAL_LOCK(huart);//操作串口底层寄存器、状态变量时上锁,多任务并发调用不会竞争冲突;

/* Set Reception type to Standard reception */
huart->ReceptionType = HAL_UART_RECEPTION_STANDARD;
huart->ReceptionType = HAL_UART_RECEPTION_STANDARD;//接收类型为标准接收

/*把pData、Size保存到 huart 句柄内部缓存指针
使能串口接收非空中断 (RXNEIE)
修改huart->RxState = HAL_UART_STATE_BUSY_RX(标记正在接收)
返回最终状态 HAL_OK*/
return (UART_Start_Receive_IT(huart, pData, Size));
}
else


+ 268
- 269
EWARM/Modbus.dep 파일 보기

@@ -5,199 +5,221 @@
<configuration>
<name>Modbus</name>
<outputs>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c</file>
<file>$PROJ_DIR$\..\Core\OS\Ports\os_cpu_a.asm</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c</file>
<file>$PROJ_DIR$\..\Core\Modbus\modbus.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\ucos_ii.c</file>
<file>$PROJ_DIR$\Modbus\Obj\os_dbg.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_gpio.o</file>
<file>$PROJ_DIR$\Modbus\Obj\os_cpu_c.o</file>
<file>$PROJ_DIR$\Modbus\Obj\ucos_ii.__cstat.et</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c</file>
<file>$PROJ_DIR$\..\Core\Modbus\modbus_backup.c</file>
<file>$PROJ_DIR$\..\Core\OS\Ports\os_dbg.c</file>
<file>$PROJ_DIR$\..\Core\OS\Cfg\app_hooks.c</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_it.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc_ex.o</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_msp.o</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\os_dbg.xcl</file>
<file>$PROJ_DIR$\Modbus\Exe\Modbus.hex</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus_backup.o</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c</file>
<file>$PROJ_DIR$\..\Core\Src\system_stm32f4xx.c</file>
<file>$PROJ_DIR$\startup_stm32f407xx.s</file>
<file>$PROJ_DIR$\..\Core\Src\main.c</file>
<file>$PROJ_DIR$\..\Core\Src\stm32f4xx_it.c</file>
<file>$PROJ_DIR$\..\Core\Modbus\modbus.c</file>
<file>$PROJ_DIR$\Modbus\Exe\Modbus.out</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\main.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus_backup.xcl</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c</file>
<file>$PROJ_DIR$\Modbus\Obj\ucos_ii.o</file>
<file>$PROJ_DIR$\Modbus\Obj\os_cpu_c.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_pwr.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_dma.o</file>
<file>$PROJ_DIR$\Modbus\Obj\os_cpu_a.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_it.__cstat.et</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c</file>
<file>$PROJ_DIR$\..\Core\Modbus\modbus_backup.c</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_pwr.xcl</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c</file>
<file>$PROJ_DIR$\startup_stm32f407xx.s</file>
<file>$PROJ_DIR$\..\Core\Src\system_stm32f4xx.c</file>
<file>$PROJ_DIR$\..\Core\OS\Cfg\app_hooks.c</file>
<file>$PROJ_DIR$\..\Core\OS\Ports\os_cpu_a.asm</file>
<file>$PROJ_DIR$\..\Core\OS\Source\ucos_ii.c</file>
<file>$PROJ_DIR$\..\Core\OS\Ports\os_cpu_c.c</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c</file>
<file>$PROJ_DIR$\..\Core\OS\Ports\os_dbg.c</file>
<file>$PROJ_DIR$\..\Core\Src\main.c</file>
<file>$PROJ_DIR$\..\Core\Src\stm32f4xx_hal_msp.c</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_flag.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_mutex.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_core.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_q.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_task.c</file>
<file>$PROJ_DIR$\..\Core\Modbus\modbus_backup.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_mem.c</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_mbox.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_time.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_tmr.c</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h</file>
<file>$PROJ_DIR$\..\Core\Modbus\modbus.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_sem.c</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h</file>
<file>$PROJ_DIR$\..\Core\Inc\stm32f4xx_it.h</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal.o</file>
<file>$PROJ_DIR$\Modbus\Obj\os_cpu_c.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc_ex.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_dma.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_gpio.o</file>
<file>$PROJ_DIR$\Modbus\Obj\ucos_ii.o</file>
<file>$PROJ_DIR$\Modbus\Obj\os_dbg.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_msp.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_it.o</file>
<file>$PROJ_DIR$\Modbus\Obj\app_hooks.o</file>
<file>$PROJ_DIR$\..\Core\Src\stm32f4xx_it.c</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_msp.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\main.o</file>
<file>$PROJ_DIR$\Modbus\Obj\system_stm32f4xx.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_cortex.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_pwr.o</file>
<file>$TOOLKIT_DIR$\lib\m7M_tls.a</file>
<file>$TOOLKIT_DIR$\lib\rt7M_tl.a</file>
<file>$TOOLKIT_DIR$\lib\shb_l.a</file>
<file>$TOOLKIT_DIR$\lib\dl7M_tln.a</file>
<file>$PROJ_DIR$\Modbus\List\Modbus.map</file>
<file>$PROJ_DIR$\stm32f407xx_flash.icf</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_uart.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\app_hooks.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\ucos_ii.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus_backup.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_msp.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\os_dbg.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\system_stm32f4xx.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_uart.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\os_cpu_c.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_cortex.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_it.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_pwr.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\main.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc.o</file>
<file>$PROJ_DIR$\Modbus\Obj\system_stm32f4xx.o</file>
<file>$PROJ_DIR$\Modbus\Obj\startup_stm32f407xx.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_gpio.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_dma.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc_ex.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_msp.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\os_cpu_c.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc.xcl</file>
<file>$PROJ_DIR$\Modbus\Exe\Modbus.out</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_gpio.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\os_dbg.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_cortex.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_dma.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\Modbus.pbd</file>
<file>$PROJ_DIR$\Modbus\Exe\Modbus.hex</file>
<file>$PROJ_DIR$\Modbus\Obj\system_stm32f4xx.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_uart.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_it.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal.o</file>
<file>$PROJ_DIR$\Modbus\Obj\app_hooks.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_msp.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\ucos_ii.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\main.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_it.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc_ex.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_gpio.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_rcc_ex.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_dma.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\system_stm32f4xx.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_cortex.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_uart.o</file>
<file>$PROJ_DIR$\Modbus\Obj\system_stm32f4xx.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_uart.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\app_hooks.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus_backup.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\os_cpu_a.o</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_pwr.xcl</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus.o</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus_backup.o</file>
<file>$PROJ_DIR$\Modbus\Obj\startup_stm32f407xx.o</file>
<file>$PROJ_DIR$\Modbus\Obj\app_hooks.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\main.__cstat.et</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_dma.xcl</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_core.c</file>
<file>$TOOLKIT_DIR$\inc\c\ycheck.h</file>
<file>$PROJ_DIR$\..\Core\OS\Cfg\app_cfg.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_flag.c</file>
<file>$TOOLKIT_DIR$\inc\c\stdint.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_q.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_mbox.c</file>
<file>$PROJ_DIR$\..\Core\Modbus\modbus.h</file>
<file>$PROJ_DIR$\Modbus\Obj\os_dbg.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Config_Full.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_mem.c</file>
<file>$TOOLKIT_DIR$\inc\c\ysizet.h</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_pwr.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\stddef.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os.h</file>
<file>$PROJ_DIR$\..\Core\OS\Cfg\os_cfg.h</file>
<file>$PROJ_DIR$\..\Core\Inc\main.h</file>
<file>$PROJ_DIR$\Modbus\Obj\modbus_backup.__cstat.et</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Defaults.h</file>
<file>$PROJ_DIR$\Modbus\Obj\stm32f4xx_hal_cortex.__cstat.et</file>
<file>$PROJ_DIR$\..\Core\OS\Source\ucos_ii.h</file>
<file>$PROJ_DIR$\..\Core\OS\Ports\os_cpu.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_trace.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_mutex.c</file>
<file>$PROJ_DIR$\..\Core\OS\Ports\os_cpu.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_sem.c</file>
<file>$TOOLKIT_DIR$\inc\c\yvals.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_task.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_time.c</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os_tmr.c</file>
<file>$TOOLKIT_DIR$\lib\shb_l.a</file>
<file>$TOOLKIT_DIR$\lib\dl7M_tln.a</file>
<file>$PROJ_DIR$\stm32f407xx_flash.icf</file>
<file>$TOOLKIT_DIR$\lib\rt7M_tl.a</file>
<file>$TOOLKIT_DIR$\lib\m7M_tls.a</file>
<file>$PROJ_DIR$\Modbus\List\Modbus.map</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f407xx.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Include\cmsis_iccarm.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Include\cmsis_version.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Include\cmsis_compiler.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h</file>
<file>$TOOLKIT_DIR$\inc\c\iccarm_builtin.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h</file>
<file>$TOOLKIT_DIR$\inc\c\stdint.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Include\cmsis_version.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Product.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Include\cmsis_compiler.h</file>
<file>$TOOLKIT_DIR$\inc\c\ycheck.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Include\core_cm4.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Defaults.h</file>
<file>$TOOLKIT_DIR$\inc\c\stddef.h</file>
<file>$TOOLKIT_DIR$\inc\c\ysizet.h</file>
<file>$TOOLKIT_DIR$\inc\c\yvals.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h</file>
<file>$PROJ_DIR$\..\Core\Inc\main.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Include\mpu_armv7.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f407xx.h</file>
<file>$PROJ_DIR$\..\Drivers\CMSIS\Include\core_cm4.h</file>
<file>$PROJ_DIR$\..\Core\Inc\stm32f4xx_hal_conf.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h</file>
<file>$TOOLKIT_DIR$\inc\c\DLib_Config_Full.h</file>
<file>$PROJ_DIR$\..\Core\OS\Source\os.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h</file>
<file>$PROJ_DIR$\..\Core\Modbus\modbus_backup.h</file>
<file>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h</file>
<file>$PROJ_DIR$\..\Core\Inc\stm32f4xx_it.h</file>
</outputs>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c</name>
<name>[ROOT_NODE]</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 57</file>
<name>ILINK</name>
<file> 15 110</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c</name>
<outputs>
<tool>
<name>__cstat</name>
<file> 76</file>
<file> 69</file>
</tool>
<tool>
<name>ICCARM</name>
<file> 67</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 89</file>
<file> 46</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
<file> 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\OS\Ports\os_cpu_a.asm</name>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c</name>
<outputs>
<tool>
<name>AARM</name>
<file> 104</file>
<name>__cstat</name>
<file> 43</file>
</tool>
<tool>
<name>ICCARM</name>
<file> 49</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 62</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c</name>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 58</file>
<name>__cstat</name>
<file> 52</file>
</tool>
<tool>
<name>__cstat</name>
<file> 78</file>
<name>ICCARM</name>
<file> 1</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 105</file>
<file> 61</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
<file> 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
@@ -205,183 +227,179 @@
<name>$PROJ_DIR$\..\Core\Modbus\modbus.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 106</file>
<name>__cstat</name>
<file> 16</file>
</tool>
<tool>
<name>__cstat</name>
<file> 74</file>
<name>ICCARM</name>
<file> 53</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 92</file>
<file> 9</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 35 128 124 130 127 138 122 129 117</file>
<file> 82 89 75 101 94 85 84 87 78</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\OS\Source\ucos_ii.c</name>
<name>$PROJ_DIR$\Modbus\Exe\Modbus.out</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 50</file>
</tool>
<tool>
<name>__cstat</name>
<file> 68</file>
<name>ILINK</name>
<file> 110</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 97</file>
<name>OBJCOPY</name>
<file> 11</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 111 109 110 112 113 23 21 30 28 22 24 37 25 31 32</file>
<name>ILINK</name>
<file> 107 56 44 53 12 24 2 0 51 55 45 23 1 8 22 49 6 67 54 50 20 105 108 109 106</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c</name>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 101</file>
<name>__cstat</name>
<file> 88</file>
</tool>
<tool>
<name>__cstat</name>
<file> 65</file>
<name>ICCARM</name>
<file> 22</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 96</file>
<file> 30</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
<file> 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\Modbus\modbus_backup.c</name>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 107</file>
<name>__cstat</name>
<file> 95</file>
</tool>
<tool>
<name>__cstat</name>
<file> 70</file>
<name>ICCARM</name>
<file> 45</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 103</file>
<file> 66</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 132 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42 109 35 110 111 112 113 26</file>
<file> 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\OS\Ports\os_dbg.c</name>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 51</file>
<name>__cstat</name>
<file> 59</file>
</tool>
<tool>
<name>__cstat</name>
<file> 72</file>
<name>ICCARM</name>
<file> 55</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 88</file>
<file> 47</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 111 109 110 112 113</file>
<file> 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\OS\Cfg\app_hooks.c</name>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 54</file>
<name>__cstat</name>
<file> 64</file>
</tool>
<tool>
<name>__cstat</name>
<file> 67</file>
<name>ICCARM</name>
<file> 23</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 102</file>
<file> 73</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 139 111 109 110 112 113</file>
<file> 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c</name>
<name>$PROJ_DIR$\..\Core\Modbus\modbus_backup.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 49</file>
<name>__cstat</name>
<file> 93</file>
</tool>
<tool>
<name>__cstat</name>
<file> 80</file>
<name>ICCARM</name>
<file> 12</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 87</file>
<file> 18</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
<file> 92 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135 76 82 91 96 99 97 136</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\Src\system_stm32f4xx.c</name>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 56</file>
<name>__cstat</name>
<file> 63</file>
</tool>
<tool>
<name>__cstat</name>
<file> 73</file>
<name>ICCARM</name>
<file> 6</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 95</file>
<file> 60</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 133 136 121 137 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
<file> 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
@@ -390,168 +408,154 @@
<outputs>
<tool>
<name>AARM</name>
<file> 108</file>
<file> 51</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\Src\main.c</name>
<name>$PROJ_DIR$\..\Core\Src\system_stm32f4xx.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 55</file>
<name>__cstat</name>
<file> 68</file>
</tool>
<tool>
<name>__cstat</name>
<file> 79</file>
<name>ICCARM</name>
<file> 50</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 98</file>
<file> 65</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 132 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42 109 35 110 111 112 113 26</file>
<file> 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 79 125 113 116 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\Src\stm32f4xx_it.c</name>
<name>$PROJ_DIR$\..\Core\OS\Cfg\app_hooks.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 53</file>
<name>__cstat</name>
<file> 71</file>
</tool>
<tool>
<name>__cstat</name>
<file> 77</file>
<name>ICCARM</name>
<file> 56</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 99</file>
<file> 70</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 132 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42 109 35 110 111 112 113 43</file>
<file> 90 96 76 91 99 97</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c</name>
<name>$PROJ_DIR$\..\Core\OS\Ports\os_cpu_a.asm</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 48</file>
</tool>
<tool>
<name>__cstat</name>
<file> 81</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 90</file>
<name>AARM</name>
<file> 24</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c</name>
<name>$PROJ_DIR$\..\Core\OS\Source\ucos_ii.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 47</file>
<name>__cstat</name>
<file> 3</file>
</tool>
<tool>
<name>__cstat</name>
<file> 82</file>
<name>ICCARM</name>
<file> 20</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 100</file>
<file> 58</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
<file> 96 76 91 99 97 74 77 81 86 98 80 100 102 103 104</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c</name>
<name>$PROJ_DIR$\..\Core\OS\Ports\os_cpu_c.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 46</file>
<name>__cstat</name>
<file> 48</file>
</tool>
<tool>
<name>__cstat</name>
<file> 66</file>
<name>ICCARM</name>
<file> 2</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 85</file>
<file> 21</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
<file> 96 76 91 99 97</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Core\OS\Ports\os_cpu_c.c</name>
<name>$PROJ_DIR$\..\Core\OS\Ports\os_dbg.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 45</file>
<name>__cstat</name>
<file> 83</file>
</tool>
<tool>
<name>__cstat</name>
<file> 75</file>
<name>ICCARM</name>
<file> 0</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 84</file>
<file> 10</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 111 109 110 112 113</file>
<file> 96 76 91 99 97</file>
</tool>
</inputs>
</file>
<file>
<name>$PROJ_DIR$\..\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c</name>
<name>$PROJ_DIR$\..\Core\Src\main.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 44</file>
<name>__cstat</name>
<file> 72</file>
</tool>
<tool>
<name>__cstat</name>
<file> 69</file>
<name>ICCARM</name>
<file> 44</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 91</file>
<file> 17</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42</file>
<file> 92 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135 76 82 91 96 99 97 136</file>
</tool>
</inputs>
</file>
@@ -559,50 +563,45 @@
<name>$PROJ_DIR$\..\Core\Src\stm32f4xx_hal_msp.c</name>
<outputs>
<tool>
<name>ICCARM</name>
<file> 52</file>
<name>__cstat</name>
<file> 57</file>
</tool>
<tool>
<name>__cstat</name>
<file> 71</file>
<name>ICCARM</name>
<file> 8</file>
</tool>
<tool>
<name>BICOMP</name>
<file> 83</file>
<file> 42</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ICCARM</name>
<file> 132 133 136 121 137 125 135 126 117 124 130 127 138 122 119 123 114 115 134 116 118 128 129 120 131 27 36 33 38 39 40 41 20 29 34 42 109 35 110 111 112 113</file>
<file> 92 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135 76 82 91 96 99 97</file>
</tool>
</inputs>
</file>
<file>
<name>[ROOT_NODE]</name>
<name>$PROJ_DIR$\..\Core\Src\stm32f4xx_it.c</name>
<outputs>
<tool>
<name>ILINK</name>
<file> 86 63</file>
<name>__cstat</name>
<file> 25</file>
</tool>
</outputs>
</file>
<file>
<name>$PROJ_DIR$\Modbus\Exe\Modbus.out</name>
<outputs>
<tool>
<name>ILINK</name>
<file> 63</file>
<name>ICCARM</name>
<file> 54</file>
</tool>
<tool>
<name>OBJCOPY</name>
<file> 94</file>
<name>BICOMP</name>
<file> 5</file>
</tool>
</outputs>
<inputs>
<tool>
<name>ILINK</name>
<file> 64 54 55 106 107 104 45 51 108 44 57 48 49 52 58 46 47 101 53 56 50 61 60 59 62</file>
<name>ICCARM</name>
<file> 92 79 125 113 116 117 111 124 78 75 101 94 85 84 114 115 112 118 123 119 120 89 87 121 122 131 133 132 137 127 130 128 129 126 134 135 76 82 91 96 99 97 138</file>
</tool>
</inputs>
</file>


+ 839
- 851
EWARM/Modbus/Exe/Modbus.hex
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


BIN
EWARM/Modbus/Exe/Modbus.sim 파일 보기


+ 76
- 93
EWARM/Modbus/Obj/.ninja_log 파일 보기

@@ -1,103 +1,86 @@
# ninja log v5
32 212 8074502355678817 modbus.pbi 619525046922d8c
37 414 8074502357703612 modbus_backup.pbi 123e4703660258f1
42 436 8074502357928329 main.pbi 35262febfa1deec1
19 88 8075339111610322 modbus.pbi 619525046922d8c
45 1152 8075310580926845 modbus_backup.pbi 123e4703660258f1
16 407 8075340741832096 main.pbi 35262febfa1deec1
48 1091 8073755826259841 stm32f4xx_hal_exti.pbi 3e347d0bb1d3798c
59 1101 8073755826249831 stm32f4xx_hal_flash.pbi 2cdfaeb0d9e8300a
33 612 8074489180587909 stm32f4xx_hal_uart.pbi 959c493f73ca383c
26 542 8074489179881410 stm32f4xx_hal_rcc.pbi f933dfa22ce90c5e
229 1568 8074482060783229 stm32f4xx_hal.pbi 2c3a496029d4643a
415 534 8074502358932342 Modbus_part4.pbi 3eb554587643adc3
77 260 8074482047832492 os_dbg.pbi ad48542575ebad16
1213 1873 8075055292246369 stm32f4xx_hal_uart.pbi 959c493f73ca383c
1690 2173 8075055295264871 stm32f4xx_hal_rcc.pbi f933dfa22ce90c5e
1475 2012 8075055293633681 stm32f4xx_hal.pbi 2c3a496029d4643a
88 223 8075339112970605 Modbus_part4.pbi 3eb554587643adc3
546 621 8075055279742847 os_dbg.pbi ad48542575ebad16
1080 1446 8073755829909061 Modbus_part5.pbi a654eec37f5b129c
542 633 8074489180806267 app_hooks.pbi f504fdb9b23706b6
432 546 8075055278977492 app_hooks.pbi f504fdb9b23706b6
1127 2030 8073755835700893 stm32f4xx_hal_pwr_ex.pbi eb5356e76493648c
54 228 8074482047480349 os_cpu_c.pbi ad0f935dbd645057
47 272 8074489177181738 ucos_ii.pbi 8d2ac5b9d103140d
633 688 8074489181391279 Modbus_part0.pbi aeb228c86547226c
261 1563 8074482060853453 stm32f4xx_hal_rcc_ex.pbi 11298246e7dc88f6
63 1459 8074482059780887 stm32f4xx_hal_cortex.pbi 4a5dfd605852426e
439 554 8075055279042142 os_cpu_c.pbi ad0f935dbd645057
257 748 8075055281021612 ucos_ii.pbi 8d2ac5b9d103140d
1483 1561 8075055289150795 Modbus_part0.pbi aeb228c86547226c
1822 2234 8075055295868027 stm32f4xx_hal_rcc_ex.pbi 11298246e7dc88f6
1561 2086 8075055294395542 stm32f4xx_hal_cortex.pbi 4a5dfd605852426e
1232 2188 8073755837289972 stm32f4xx_hal_tim.pbi c827d2cd726b5c6
1885 2834 8073755843634689 stm32f4xx_hal_dma_ex.pbi 9eeeced39efb067c
2050 2950 8073755844919672 stm32f4xx_hal_flash_ramfunc.pbi 12cb5cfb79057af7
436 748 8074502361068038 Modbus_part1.pbi ddb2d0c7a212e1f7
272 699 8074489181451303 stm32f4xx_hal_pwr.pbi c2df820d73bcc158
408 731 8075340745083576 Modbus_part1.pbi ddb2d0c7a212e1f7
621 1213 8075055285605784 stm32f4xx_hal_pwr.pbi c2df820d73bcc158
2031 3022 8073755845615244 stm32f4xx_hal_flash_ex.pbi 664405238146573
25 382 8074502357363743 stm32f4xx_hal_msp.pbi 329860e7b1b76f81
16 403 8074502357588863 stm32f4xx_it.pbi 5f6e49a9db86e0a1
88 1319 8074482058418971 stm32f4xx_hal_dma.pbi 17eef16aa98bd8d4
59 558 8074489180020666 stm32f4xx_hal_gpio.pbi 5aaf28c36969a435
17 527 8074489179731170 system_stm32f4xx.pbi b28508562e5c4dda
84 1183 8075310581204706 stm32f4xx_hal_msp.pbi 329860e7b1b76f81
63 1119 8075310580579178 stm32f4xx_it.pbi 5f6e49a9db86e0a1
1874 2267 8075055296182415 stm32f4xx_hal_dma.pbi 17eef16aa98bd8d4
1273 1822 8075055291739757 stm32f4xx_hal_gpio.pbi 5aaf28c36969a435
748 1475 8075055286452524 system_stm32f4xx.pbi b28508562e5c4dda
3078 3994 8073755855353542 stm32f4xx_hal_tim_ex.pbi 17c406494728d79b
559 937 8074489183865675 Modbus_part2.pbi fbca1e612a9f24ac
699 1047 8074489184966527 Modbus_part3.pbi c380dcd3336f25d2
748 1016 8074502363749022 Modbus.pbd 6b0161af8161b195
1016 2469 8074502378065434 Modbus.pbw f93412b0d27fc6cf
34 502 8074502468996889 main.pbi 35262febfa1deec1
503 1178 8074502475774119 Modbus_part1.pbi ddb2d0c7a212e1f7
1178 1849 8074502482481135 Modbus.pbd 6b0161af8161b195
1849 4679 8074502510379520 Modbus.pbw f93412b0d27fc6cf
14 780 8074503194135192 main.pbi 35262febfa1deec1
781 1500 8074503201409890 Modbus_part1.pbi ddb2d0c7a212e1f7
1501 2185 8074503208246680 Modbus.pbd 6b0161af8161b195
2185 5560 8074503241357568 Modbus.pbw f93412b0d27fc6cf
17 459 8074507473220841 main.pbi 35262febfa1deec1
460 782 8074507476470558 Modbus_part1.pbi ddb2d0c7a212e1f7
782 1071 8074507479354879 Modbus.pbd 6b0161af8161b195
1071 3584 8074507504106085 Modbus.pbw f93412b0d27fc6cf
28 212 8074507978663912 modbus.pbi 619525046922d8c
213 385 8074507980416262 Modbus_part4.pbi 3eb554587643adc3
385 735 8074507983905221 Modbus.pbd 6b0161af8161b195
735 3343 8074508009558632 Modbus.pbw f93412b0d27fc6cf
17 197 8074508260830677 modbus.pbi 619525046922d8c
39 426 8074508263090619 stm32f4xx_hal_msp.pbi 329860e7b1b76f81
34 443 8074508263236502 main.pbi 35262febfa1deec1
44 444 8074508263236502 stm32f4xx_it.pbi 5f6e49a9db86e0a1
27 515 8074508264005574 modbus_backup.pbi 123e4703660258f1
515 654 8074508265413927 Modbus_part4.pbi 3eb554587643adc3
444 773 8074508266607698 Modbus_part1.pbi ddb2d0c7a212e1f7
773 1100 8074508269873381 Modbus.pbd 6b0161af8161b195
1101 2462 8074508283197878 Modbus.pbw f93412b0d27fc6cf
81 376 8074516456313523 modbus.pbi 619525046922d8c
377 790 8074516460568228 Modbus_part4.pbi 3eb554587643adc3
791 1838 8074516471051303 Modbus.pbd 6b0161af8161b195
1839 6486 8074516516755621 Modbus.pbw f93412b0d27fc6cf
91 1592 8074516729543765 main.pbi 35262febfa1deec1
1593 2907 8074516742819311 Modbus_part1.pbi ddb2d0c7a212e1f7
2908 4130 8074516755009356 Modbus.pbd 6b0161af8161b195
4131 10953 8074516822428244 Modbus.pbw f93412b0d27fc6cf
36 190 8074517401469028 os_dbg.pbi ad48542575ebad16
47 199 8074517401479066 os_cpu_c.pbi ad0f935dbd645057
190 449 8074517404085301 app_hooks.pbi f504fdb9b23706b6
66 612 8074517405706245 ucos_ii.pbi 8d2ac5b9d103140d
612 821 8074517407737225 Modbus_part0.pbi aeb228c86547226c
59 1270 8074517412230290 stm32f4xx_it.pbi 5f6e49a9db86e0a1
82 1368 8074517413203243 modbus_backup.pbi 123e4703660258f1
27 1461 8074517414153987 main.pbi 35262febfa1deec1
199 1519 8074517414731834 stm32f4xx_hal_msp.pbi 329860e7b1b76f81
1369 1806 8074517417613113 Modbus_part4.pbi 3eb554587643adc3
1520 2626 8074517425878496 Modbus_part1.pbi ddb2d0c7a212e1f7
2627 3697 8074517436566989 Modbus.pbd 6b0161af8161b195
3698 8529 8074517483962162 Modbus.pbw f93412b0d27fc6cf
41 221 8074529120713179 modbus.pbi 619525046922d8c
18 536 8074529123854861 stm32f4xx_it.pbi 5f6e49a9db86e0a1
28 563 8074529124122196 main.pbi 35262febfa1deec1
35 570 8074529124197355 stm32f4xx_hal_msp.pbi 329860e7b1b76f81
50 579 8074529124231645 modbus_backup.pbi 123e4703660258f1
579 731 8074529125848910 Modbus_part4.pbi 3eb554587643adc3
571 919 8074529127730504 Modbus_part1.pbi ddb2d0c7a212e1f7
919 1258 8074529131114879 Modbus.pbd 6b0161af8161b195
1258 2925 8074529147442958 Modbus.pbw f93412b0d27fc6cf
31 106 8074529272163016 app_hooks.pbi f504fdb9b23706b6
24 112 8074529272163016 os_cpu_c.pbi ad0f935dbd645057
15 210 8074529273221302 os_dbg.pbi ad48542575ebad16
107 301 8074529274102657 ucos_ii.pbi 8d2ac5b9d103140d
301 367 8074529274814198 Modbus_part0.pbi aeb228c86547226c
44 509 8074529276203566 modbus_backup.pbi 123e4703660258f1
38 529 8074529276394234 stm32f4xx_it.pbi 5f6e49a9db86e0a1
50 540 8074529276499069 main.pbi 35262febfa1deec1
112 582 8074529276937420 stm32f4xx_hal_msp.pbi 329860e7b1b76f81
510 679 8074529277942639 Modbus_part4.pbi 3eb554587643adc3
582 980 8074529280941178 Modbus_part1.pbi ddb2d0c7a212e1f7
980 1396 8074529285110341 Modbus.pbd 6b0161af8161b195
1396 3164 8074529302191447 Modbus.pbw f93412b0d27fc6cf
2267 2627 8075055299820075 Modbus_part2.pbi fbca1e612a9f24ac
2235 2608 8075055299630181 Modbus_part3.pbi c380dcd3336f25d2
731 1057 8075340748346083 Modbus.pbd 6b0161af8161b195
1058 2837 8075340765768357 Modbus.pbw f93412b0d27fc6cf
16 436 8075340793267421 main.pbi 35262febfa1deec1
436 770 8075340796629328 Modbus_part1.pbi ddb2d0c7a212e1f7
770 1084 8075340799766679 Modbus.pbd 6b0161af8161b195
250 1153 8075453062458998 main.pbi 35262febfa1deec1
1153 1745 8075453068428248 Modbus_part1.pbi ddb2d0c7a212e1f7
1746 2146 8075453072430172 Modbus.pbd 6b0161af8161b195
2146 5121 8075453101621635 Modbus.pbw f93412b0d27fc6cf
22 497 8075453129674474 main.pbi 35262febfa1deec1
498 976 8075453134514258 Modbus_part1.pbi ddb2d0c7a212e1f7
976 1362 8075453138361803 Modbus.pbd 6b0161af8161b195
1362 3461 8075453158935680 Modbus.pbw f93412b0d27fc6cf
16 427 8075476355066650 main.pbi 35262febfa1deec1
428 767 8075476358494358 Modbus_part1.pbi ddb2d0c7a212e1f7
768 1075 8075476361569583 Modbus.pbd 6b0161af8161b195
1075 2714 8075476377672014 Modbus.pbw f93412b0d27fc6cf
15 307 8075476402562340 main.pbi 35262febfa1deec1
307 632 8075476405825019 Modbus_part1.pbi ddb2d0c7a212e1f7
632 915 8075476408664485 Modbus.pbd 6b0161af8161b195
916 2369 8075476422943192 Modbus.pbw f93412b0d27fc6cf
16 314 8075476449362888 main.pbi 35262febfa1deec1
314 628 8075476452512808 Modbus_part1.pbi ddb2d0c7a212e1f7
629 917 8075476455401245 Modbus.pbd 6b0161af8161b195
917 2386 8075476469829122 Modbus.pbw f93412b0d27fc6cf
17 198 8075523159199479 modbus.pbi 619525046922d8c
198 445 8075523161675729 Modbus_part4.pbi 3eb554587643adc3
445 706 8075523164291218 Modbus.pbd 6b0161af8161b195
706 2405 8075523181036770 Modbus.pbw f93412b0d27fc6cf
28 1234 8075523236676336 main.pbi 35262febfa1deec1
1238 2777 8075523252722509 Modbus_part1.pbi ddb2d0c7a212e1f7
2777 5340 8075523278202111 Modbus.pbd 6b0161af8161b195
5342 17486 8075523399330406 Modbus.pbw f93412b0d27fc6cf
38 1053 8075524772807383 main.pbi 35262febfa1deec1
1054 2159 8075524783879631 Modbus_part1.pbi ddb2d0c7a212e1f7
2160 3115 8075524793463806 Modbus.pbd 6b0161af8161b195
3116 7524 8075524836672066 Modbus.pbw f93412b0d27fc6cf
32 859 8075525304922906 main.pbi 35262febfa1deec1
860 1715 8075525313453157 Modbus_part1.pbi ddb2d0c7a212e1f7
1716 2558 8075525321928955 Modbus.pbd 6b0161af8161b195
2559 5937 8075525355143631 Modbus.pbw f93412b0d27fc6cf
15 340 8075525949563650 main.pbi 35262febfa1deec1
340 677 8075525952961880 Modbus_part1.pbi ddb2d0c7a212e1f7
678 940 8075525955581323 Modbus.pbd 6b0161af8161b195
940 2446 8075525970333801 Modbus.pbw f93412b0d27fc6cf
23 728 8075532693301980 main.pbi 35262febfa1deec1
728 1516 8075532701204110 Modbus_part1.pbi ddb2d0c7a212e1f7
1517 2507 8075532711124222 Modbus.pbd 6b0161af8161b195
2509 5903 8075532744261763 Modbus.pbw f93412b0d27fc6cf
282 910 8075555241029318 modbus.pbi 619525046922d8c
911 1328 8075555245236163 Modbus_part4.pbi 3eb554587643adc3
1329 2215 8075555254064138 Modbus.pbd 6b0161af8161b195
2216 6879 8075555300045825 Modbus.pbw f93412b0d27fc6cf

BIN
EWARM/Modbus/Obj/Modbus.pbd 파일 보기


BIN
EWARM/Modbus/Obj/Modbus.pbd.browse 파일 보기


+ 20126
- 20364
EWARM/Modbus/Obj/Modbus.pbw
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


BIN
EWARM/Modbus/Obj/Modbus_part1.pbi 파일 보기


BIN
EWARM/Modbus/Obj/Modbus_part3.pbi 파일 보기


BIN
EWARM/Modbus/Obj/Modbus_part4.pbi 파일 보기


BIN
EWARM/Modbus/Obj/main.pbi 파일 보기


BIN
EWARM/Modbus/Obj/modbus.pbi 파일 보기


+ 8
- 6
EWARM/Modbus/Obj/modbus.pbi.dep 파일 보기

@@ -1,6 +1,8 @@
modbus.pbi: E:\IAR\arm\inc\c\ycheck.h E:\IAR\arm\inc\c\stdint.h \
E:\IAR\arm\inc\c\ysizet.h E:\IAR\arm\inc\c\DLib_Product.h \
E:\IAR\arm\inc\c\DLib_Defaults.h E:\IAR\arm\inc\c\yvals.h \
E:\IAR\arm\inc\c\stddef.h \
D:\xinjiedianqi\Study\TrainCamp_zengbingjie_Modbus\Modbus\Core\Modbus\modbus.h \
D:\xinjiedianqi\Study\TrainCamp_zengbingjie_Modbus\Modbus\Core\Modbus\modbus.c
modbus.pbi: \
D:\xinjiedianqi\Study\TrainCamp_zengbingjie_Modbus\Modbus\Core\Modbus\modbus.c \
D:\xinjiedianqi\Study\TrainCamp_zengbingjie_Modbus\Modbus\Core\Modbus/modbus.h \
E:\IAR\arm\inc\c\stddef.h E:\IAR\arm\inc\c\ycheck.h \
E:\IAR\arm\inc\c\yvals.h E:\IAR\arm\inc\c\DLib_Defaults.h \
E:\\IAR\\arm\\inc\\c\\DLib_Config_Full.h \
E:\IAR\arm\inc\c\DLib_Product.h E:\IAR\arm\inc\c\ysizet.h \
E:\IAR\arm\inc\c\stdint.h

BIN
EWARM/Modbus/Obj/stm32f4xx_hal_msp.pbi 파일 보기


BIN
EWARM/Modbus/Obj/stm32f4xx_hal_uart.pbi 파일 보기


BIN
EWARM/Modbus/Obj/stm32f4xx_it.pbi 파일 보기


+ 20
- 19
EWARM/settings/Modbus.dbgdt
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 7
- 7
EWARM/settings/Modbus.dnx 파일 보기

@@ -12,15 +12,15 @@
<ByteLimit>50</ByteLimit>
</Stack>
<StLinkDriver>
<stlinkserialNo>54492557</stlinkserialNo>
<stlinkfoundProbes />
<CStepIntDis>_ 0</CStepIntDis>
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
<stlinkResetStyle>0</stlinkResetStyle>
<stlinkResetStrategy>2</stlinkResetStrategy>
<stlinkserialNo>54492557</stlinkserialNo>
<stlinkfoundProbes />
</StLinkDriver>
<DebugChecksum>
<Checksum>3495406535</Checksum>
<Checksum>3638146800</Checksum>
</DebugChecksum>
<Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught>
@@ -107,10 +107,6 @@
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<LogFile>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
@@ -133,4 +129,8 @@
<CallStackStripe>
<ShowTiming>1</ShowTiming>
</CallStackStripe>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
</settings>

+ 24
- 24
EWARM/settings/Project.wsdt
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 148
- 0
docs/superpowers/plans/2026-08-04-modbus-odd-address-even-count.md 파일 보기

@@ -0,0 +1,148 @@
# 0x43 奇数地址任意数量读取实现计划

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** 让私有功能码 `0x43` 从第一个不小于起始基准地址的奇数地址开始,按地址 `+2` 读取 `1..123` 个寄存器,并允许请求数量为奇数或偶数。

**Architecture:** 保持现有 `0x43` 帧格式和从站地址步进算法不变,只移除主从两端“数量必须为奇数”的限制。PLC 从站负责最终的数量、地址范围和响应容量校验;TouchWin 在发送前执行同样的边界校验,并按实际数量解析响应。

**Tech Stack:** C、STM32F407、uC/OS-II、IAR EWARM 8.3、TouchWin C 函数、Modbus RTU 私有功能码 `0x43`。

## Global Constraints

- `0x43` 是本项目私有功能码,不属于标准 Modbus 功能码。
- 起始基准地址为偶数时先加 `1`,为奇数时保持不变。
- 后续读取地址每次增加 `2`。
- 数量范围为 `1..123`,奇数和偶数均合法。
- 数量为 `0` 或大于 `123` 返回异常码 `0x03`;最后一个读取地址越过 `0x270F` 返回异常码 `0x02`。
- 不恢复或新增仓库内的测试工程和测试文件。

---

### Task 1: 主从数量校验修正

**Files:**
- Modify: `Core/Modbus/modbus.c:730`
- Modify: `document/TouchWin自组Modbus功能码函数.md:13`
- Modify: `document/TouchWin自组Modbus功能码函数.md:151`

**Interfaces:**
- Consumes: `0x43 <start_hi> <start_lo> <count_hi> <count_lo>` 请求 PDU。
- Produces: `0x43 <byte_count> <data...>` 响应 PDU,数据地址依次为 `firstOddAddress + registerOffset * 2`。

- [x] **Step 1: 运行修改前的失败检查**

运行以下 PowerShell 检查,确认当前 TouchWin 代码仍包含偶数数量拒绝条件,同时从站还残留已注释的旧条件:

```powershell
$slave = Get-Content -Raw -Encoding UTF8 Core/Modbus/modbus.c
$hmi = Get-Content -Raw -Encoding UTF8 document/TouchWin自组Modbus功能码函数.md
if (($slave -match 'registerCount & 0x0001U') -or
($hmi -match 'registerCount & 1')) { throw '仍存在奇数数量限制' }
```

Expected: FAIL with `仍存在奇数数量限制`。

- [x] **Step 2: 清理从站旧条件并保持地址算法**

将从站数量校验保留为:

```c
if ((registerCount == 0U)
|| (registerCount > MODBUS_MAX_ODD_COUNT_REGISTER_COUNT)) {
return MODBUS_REQUEST_ILLEGAL_VALUE;
}
```

保留以下奇数地址计算:

```c
firstOddAddress = (uint16_t)(startAddress | 0x0001U);
readAddress = (uint16_t)(firstOddAddress + (registerOffset * 2U));
```

- [x] **Step 3: 移除 TouchWin 偶数数量拒绝条件**

发送条件改为:

```c
if ((registerCount != 0) && (registerCount <= MODBUS_ODD_COUNT_MAX) &&
(firstOddAddress <= MODBUS_ADDRESS_MAX) &&
(registerCount <= (((MODBUS_ADDRESS_MAX - firstOddAddress) / 2) + 1)))
```

同时把数量说明改为 `1..123`,奇数和偶数均可;示例中明确数量 `4` 返回地址 `1、3、5、7`,数量 `122` 为合法请求。

- [x] **Step 4: 运行无持久测试文件的通过检查**

重新运行 Step 1 命令。

Expected: PASS,命令退出码为 `0`。

### Task 2: 项目说明同步

**Files:**
- Modify: `docs/项目设计.md:112`

**Interfaces:**
- Consumes: Task 1 确认的 `0x43` 行为。
- Produces: 与生产代码一致的项目设计说明。

- [x] **Step 1: 更新功能表**

将 `0x43` 说明改为:从不小于起始基准地址的第一个奇数地址开始,每隔 `2` 读取一个值;数量允许 `1..123`,奇偶均可。

- [x] **Step 2: 检查项目文档冲突**

```powershell
Get-ChildItem docs,document -Recurse -File -Include *.md |
Where-Object FullName -NotLike '*superpowers\\plans*' |
Select-String -Pattern '数量必须为奇数|只能输入奇数|数量为偶数.*异常码'
```

Expected: 项目交付文档中没有旧规则命中。

### Task 3: 构建与边界验证

**Files:**
- Verify: `Core/Modbus/modbus.c`
- Verify: `Core/Modbus/modbus.h`
- Verify: `EWARM/Modbus.ewp`

**Interfaces:**
- Consumes: Task 1 和 Task 2 的完整修改。
- Produces: 可由 IAR 构建并可供 TouchWin 联调的固件。

- [x] **Step 1: 检查关键边界**

核对以下结果:

```text
start=0, count=2 -> 1, 3
start=0, count=4 -> 1, 3, 5, 7
start=5, count=2 -> 5, 7
start=0, count=123 -> 1, 3, ..., 245
count=0 -> exception 0x03
count=124 -> exception 0x03
start=0x270E,count=1 -> 0x270F
start=0x270E,count=2 -> exception 0x02
```

- [x] **Step 2: IAR 全量构建**

```powershell
& 'E:\IAR\common\bin\iarbuild.exe' `
'D:\xinjiedianqi\Study\TrainCamp_zengbingjie_Modbus\Modbus\EWARM\Modbus.ewp' `
'-build' 'Modbus' '-log' 'info' '-parallel' '4'
```

Expected: `Total number of errors: 0` and `Total number of warnings: 0`。

- [x] **Step 3: 审查最终差异**

```powershell
git diff -- Core/Modbus/modbus.c document/TouchWin自组Modbus功能码函数.md docs/项目设计.md
git diff --cached -- Core/Modbus/modbus.c
```

Expected: 只包含本次 `0x43` 规则修正以及用户已有的相关暂存修改,不恢复 `test/`。

+ 4
- 8
docs/项目设计.md 파일 보기

@@ -72,13 +72,9 @@ USART1 使用 `115200 bit/s`、1 个停止位和偶校验,代码配置为
| `coilStorage` | `Core/Src/main.c` | 按位压缩的普通线圈区,可在 IAR Live Watch 查看;不保持。 |
| `extendedHoldingRegister` | `Core/Src/main.c` | 私有地址 `0x00010000` 的唯一扩展值;仅它可被 RTC 保存。 |

协议层不再维护请求帧、响应帧或数据镜像副本,调试时应直接查看上表三个真实数据对象,
避免镜像数据与协议数据不同步。为便于断线、插拔和 UART 恢复测试,`main.c` 仍保留
`ModbusUartLastErrorCode`、`ModbusUartLastRxState`、`ModbusUartRecoveryCount`、
`ModbusUartRecoveryFailureCount`、`ModbusUartRxArmCount`、
`ModbusUartRxArmFailureCount`、`ModbusUartLastRxByte` 和
`ModbusLastCompleteFrameLength` 等运行时诊断变量;这些变量只记录收发恢复过程,
不参与 Modbus 地址映射,也不会作为额外寄存器对外提供。
协议层不再维护请求帧、响应帧、数据镜像或 UART 诊断计数器,调试时应直接查看上表
三个真实数据对象。UART 错误恢复依靠 `ModbusReceptionNeedsRecovery` 状态标志和
HAL 当前状态完成,不依赖额外的调试变量,也不会对外提供诊断寄存器。

`AppSyncCoilsToGpio` 将线圈 1 至 7 写入 Q1 至 Q7。
板级输出为低有效,因此逻辑线圈置 1 时写入 `GPIO_PIN_RESET`。线圈 0 是链路
@@ -113,7 +109,7 @@ Q0 指示灯由 `AppUpdateLinkStatus` 根据最近一次有效、已寻址的通
| --- | --- | --- |
| `0x41` | 读取固定 32 位地址 `0x00010000`,数量必须为 1。 | `ModbusBuildReadExtendedRegistersResponse` |
| `0x42` | 写入 `0x00010000` 并回显地址和值。协议核心只改 RAM;应用层确认成功后保存 RTC。 | `ModbusBuildWriteExtendedRegisterResponse` + `AppProcessFrame` |
| `0x43` | 从不小于起始基准地址的第一个奇数地址开始,每隔 2 读取一个值;数量必须为 `1..123` 的奇数。 | `ModbusBuildReadOddAddressRegistersResponse` |
| `0x43` | 从不小于起始基准地址的第一个奇数地址开始,每隔 2 读取一个值;数量允许 `1..123`,奇数和偶数均可。 | `ModbusBuildReadOddAddressRegistersResponse` |

私有功能码只供当前 TouchWin 与本 PLC 工程配套使用,不应声明为标准 Modbus
功能码。触摸屏侧的 `PSW372..PSW494` 最多显示 123 个 `0x43` 返回值;一次请求只读取


+ 5
- 6
document/TouchWin自组Modbus功能码函数.md 파일 보기

@@ -10,9 +10,9 @@
| --- | --- | --- | --- |
| `0x41` | 读取 `0x00010000` | 32 位地址、16 位数量 | 地址固定为 `0x10000`,数量固定为 `1` |
| `0x42` | 写入 `0x00010000` | 32 位地址、16 位写入值 | 地址固定为 `0x10000`,正常响应回显地址和值 |
| `0x43` | 读取奇数地址的寄存器 | 16 位起始基准地址、16 位数量 | 数量为 `1..123` 中的奇数 |
| `0x43` | 读取奇数地址的寄存器 | 16 位起始基准地址、16 位数量 | 数量为 `1..123`,奇数和偶数均可 |

`0x43` 按地址 `+2` 跳读,只返回奇数地址的值。起始基准地址会自动向上取奇数:基准地址为 `0`、数量为 `123` 时,读取地址 `1, 3, 5, ..., 245`;基准地址为 `10` 时,读取 `11, 13, 15, ...`。数量表示返回值个数,仍必须是奇数。
`0x43` 按地址 `+2` 跳读,只返回奇数地址的值。起始基准地址会自动向上取奇数:基准地址为 `0`、数量为 `123` 时,读取地址 `1, 3, 5, ..., 245`;基准地址为 `10` 时,读取 `11, 13, 15, ...`。数量表示返回值个数,允许 `1..123` 范围内的奇数或偶数。

## 2. TouchWin 地址

@@ -25,7 +25,7 @@
| `0x43` 起始基准地址、数量 | `PSW370`、`PSW371` |
| `0x43` 结果 | `PSW372..PSW494`,共 123 个 WORD |

`PSW371` 只能输入奇数,最大 `123`。`PSW370 = 0` 时,`PSW372` 对应 PLC 的 `D1`,`PSW373` 对应 `D3`,依次类推;`PSW370 = 10` 时,结果依次对应 `D11`、`D13`、`D15`。若要在一个画面显示全部批量读取结果,需要 123 个数值显示组件,依次绑定 `PSW372` 至 `PSW494`。用于演示时,可以只放前 8 或前 16 个显示组件,全部 123 个结果仍会写入 PSW。
`PSW371` 可以输入 `1..123`,奇数和偶数均可。`PSW370 = 0` 时,`PSW372` 对应 PLC 的 `D1`,`PSW373` 对应 `D3`,依次类推;`PSW370 = 10` 时,结果依次对应 `D11`、`D13`、`D15`。若要在一个画面显示全部批量读取结果,需要 123 个数值显示组件,依次绑定 `PSW372` 至 `PSW494`。用于演示时,可以只放前 8 或前 16 个显示组件,全部 123 个结果仍会写入 PSW。

状态码:`0` 成功;`1` 输入错误;`2` 发送失败;`3` 接收失败;`4` CRC 错误;`5` 应答错误;`0x8000` 以上表示异常应答,低字节为异常码。

@@ -150,7 +150,7 @@ PSW[PSW_EXTENDED_RESULT] = 0;

## 7. `ReadOddCountRegisters`:`0x43` 读取奇数地址寄存器

起始基准地址可以是任意合法地址,PLC 会从第一个不小于该值的奇数地址开始,每次地址加 `2`。数量必须为奇数且不超过 `123`。响应容量为 251 字节,满足 123 个 WORD 的数据:
起始基准地址可以是任意合法地址,PLC 会从第一个不小于该值的奇数地址开始,每次地址加 `2`。数量允许 `1..123` 范围内的奇数或偶数。响应容量为 251 字节,满足 123 个 WORD 的数据:

```c
WORD startAddress;
@@ -170,7 +170,6 @@ receiveLength = 0;
status = MODBUS_STATUS_INPUT_ERROR;

if ((registerCount != 0) && (registerCount <= MODBUS_ODD_COUNT_MAX) &&
((registerCount & 1) != 0) &&
(firstOddAddress <= MODBUS_ADDRESS_MAX) &&
(registerCount <= (((MODBUS_ADDRESS_MAX - firstOddAddress) / 2) + 1)))
{
@@ -211,7 +210,7 @@ PSW[PSW_STATUS] = status;
PSW[PSW_RECEIVE_LENGTH] = receiveLength;
```

示例请求:起始基准地址 `0`、数量 `123` 的请求数据为 `00 00 00 7B`,响应数据字节数为 `246`,返回地址为 `1, 3, 5, ..., 245`。若数量为 `122` 或 `124`,PLC 返回异常码 `03`;若最后一个奇数地址越过 `0x270F`,返回异常码 `02`。
示例请求:起始基准地址 `0`、数量 `123` 的请求数据为 `00 00 00 7B`,响应数据字节数为 `246`,返回地址为 `1, 3, 5, ..., 245`。数量 `122` 也是合法请求,返回地址 `1, 3, 5, ..., 243`;数量为 `0` 或 `124` 时 PLC 返回异常码 `03`。若最后一个奇数地址越过 `0x270F`,返回异常码 `02`。

## 8. RTC 断电保持



+ 0
- 387
test/app_runtime_test.c 파일 보기

@@ -1,387 +0,0 @@
#include <assert.h>
#include <stdint.h>
#include <string.h>

#define main AppFirmwareMain
#define static
#include "../Core/Src/main.c"
#undef static
#undef main
#include "../Core/Src/stm32f4xx_it.c"

TIM_TypeDef TestTim5;
GPIO_TypeDef TestGpioE;
GPIO_TypeDef TestGpioF;
GPIO_TypeDef TestGpioI;
USART_TypeDef TestUsart1;
OS_EVENT TestFrameSem;

IRQn_Type TestNvicIrq;
uint32_t TestNvicPreemptPriority;
uint32_t TestNvicSubPriority;
uint32_t TestHalTickCallCount;
uint32_t TestOsCpuSysTickCallCount;
HAL_StatusTypeDef TestReceiveResults[4U];
uint32_t TestReceiveResultCount;
uint32_t TestReceiveCallCount;
uint32_t TestReceiveErrorInjectionCall;
uint32_t TestAbortReceiveCallCount;
uint32_t TestUartFlagClearCallCount;
uint8_t TestRecoveryCallOrder[4U];
uint32_t TestRecoveryCallOrderLength;
uint32_t TestSemPostCallCount;
uint8_t OSRunning;

static void TestResetFakes(void)
{
(void)memset(&TestTim5, 0, sizeof(TestTim5));
(void)memset(&TestGpioE, 0, sizeof(TestGpioE));
(void)memset(&TestGpioF, 0, sizeof(TestGpioF));
(void)memset(&TestGpioI, 0, sizeof(TestGpioI));
(void)memset(&TestUsart1, 0, sizeof(TestUsart1));
(void)memset(&TestFrameSem, 0, sizeof(TestFrameSem));
(void)memset(&Uart1Handle, 0, sizeof(Uart1Handle));
(void)memset(TestReceiveResults, 0, sizeof(TestReceiveResults));
TestNvicIrq = 0;
TestNvicPreemptPriority = 0U;
TestNvicSubPriority = 0U;
TestHalTickCallCount = 0U;
TestOsCpuSysTickCallCount = 0U;
TestReceiveResultCount = 0U;
TestReceiveCallCount = 0U;
TestReceiveErrorInjectionCall = 0U;
TestAbortReceiveCallCount = 0U;
TestUartFlagClearCallCount = 0U;
(void)memset(TestRecoveryCallOrder, 0, sizeof(TestRecoveryCallOrder));
TestRecoveryCallOrderLength = 0U;
TestSemPostCallCount = 0U;
OSRunning = 0U;
ModbusUartLastErrorCode = 0U;
ModbusUartLastRxState = 0U;
ModbusUartRecoveryCount = 0U;
ModbusUartRecoveryFailureCount = 0U;
ModbusUartRxArmCount = 0U;
ModbusUartRxArmFailureCount = 0U;
ModbusUartLastRxByte = 0U;
ModbusLastCompleteFrameLength = 0U;
ModbusFrameSem = &TestFrameSem;
ModbusReceptionNeedsRecovery = 0U;
}

static void TestSysTickUsesKernelAwarePriority(void)
{
TestResetFakes();

AppInitSystemTick();

assert(TestNvicIrq == SysTick_IRQn);
assert(TestNvicPreemptPriority == CPU_CFG_KA_IPL_BOUNDARY);
assert(TestNvicSubPriority == 0U);
}

static void TestSysTickDelegatesToOsPort(void)
{
TestResetFakes();
OSRunning = OS_TRUE;

SysTick_Handler();

assert(TestHalTickCallCount == 1U);
assert(TestOsCpuSysTickCallCount == 1U);
}

static void TestReceiveRecoveryRetriesAfterBusy(void)
{
TestResetFakes();
Uart1Handle.Instance = USART1;
TestReceiveResults[0U] = HAL_BUSY;
TestReceiveResults[1U] = HAL_OK;
TestReceiveResultCount = 2U;

assert(AppRecoverUartReception() == HAL_OK);
assert(TestReceiveCallCount == 2U);
assert(TestAbortReceiveCallCount == 2U);
assert(TestRecoveryCallOrderLength == 4U);
assert(TestRecoveryCallOrder[0U] == 2U);
assert(TestRecoveryCallOrder[1U] == 1U);
assert(TestRecoveryCallOrder[2U] == 2U);
assert(TestRecoveryCallOrder[3U] == 1U);
assert(TestUartFlagClearCallCount == 2U);
}

static void TestUartErrorClearsFlagsBeforeRecovery(void)
{
TestResetFakes();
Uart1Handle.Instance = USART1;
Uart1Handle.ErrorCode = HAL_UART_ERROR_ORE;

HAL_UART_ErrorCallback(&Uart1Handle);

assert(ModbusReceptionNeedsRecovery == 1U);
assert(TestUartFlagClearCallCount == 1U);
assert(TestReceiveCallCount == 0U);
}

static void TestUartErrorDefersRecoveryToTask(void)
{
TestResetFakes();
Uart1Handle.Instance = USART1;
Uart1Handle.ErrorCode = HAL_UART_ERROR_ORE;

HAL_UART_ErrorCallback(&Uart1Handle);

assert(ModbusReceptionNeedsRecovery == 1U);
assert(TestSemPostCallCount == 1U);
assert(TestReceiveCallCount == 0U);
}

static void TestPendingRecoveryKeepsConcurrentErrorRequest(void)
{
TestResetFakes();
Uart1Handle.Instance = USART1;
ModbusReceptionNeedsRecovery = 1U;
TestReceiveErrorInjectionCall = 1U;

assert(AppRecoverPendingUartReception() == HAL_OK);
assert(TestReceiveCallCount == 1U);
assert(TestSemPostCallCount == 1U);
assert(ModbusReceptionNeedsRecovery == 1U);
}

static void TestReceptionWatchdogRearmsWhenHalStateIsLost(void)
{
TestResetFakes();
Uart1Handle.Instance = USART1;
Uart1Handle.RxState = HAL_UART_STATE_READY;
TestReceiveResults[0U] = HAL_OK;
TestReceiveResultCount = 1U;

assert(AppEnsureUartReception() == HAL_OK);
assert(TestAbortReceiveCallCount == 1U);
assert(TestReceiveCallCount == 1U);
assert(ModbusUartRecoveryCount == 1U);
}

int main(void)
{
TestSysTickUsesKernelAwarePriority();
TestSysTickDelegatesToOsPort();
TestReceiveRecoveryRetriesAfterBusy();
TestUartErrorClearsFlagsBeforeRecovery();
TestUartErrorDefersRecoveryToTask();
TestPendingRecoveryKeepsConcurrentErrorRequest();
TestReceptionWatchdogRearmsWhenHalStateIsLost();

return 0;
}

void HAL_Init(void)
{
}

HAL_StatusTypeDef HAL_RCC_OscConfig(const RCC_OscInitTypeDef *config)
{
(void)config;
return HAL_OK;
}

HAL_StatusTypeDef HAL_RCC_ClockConfig(const RCC_ClkInitTypeDef *config,
uint32_t latency)
{
(void)config;
(void)latency;
return HAL_OK;
}

void HAL_GPIO_Init(GPIO_TypeDef *port, const GPIO_InitTypeDef *config)
{
(void)port;
(void)config;
}

void HAL_GPIO_WritePin(GPIO_TypeDef *port, uint16_t pin,
GPIO_PinState state)
{
(void)port;
(void)pin;
(void)state;
}

HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *uartHandle)
{
(void)uartHandle;
return HAL_OK;
}

HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *uartHandle,
uint8_t *data, uint16_t size)
{
HAL_StatusTypeDef result;

(void)uartHandle;
(void)data;
(void)size;
if (TestRecoveryCallOrderLength < sizeof(TestRecoveryCallOrder)) {
TestRecoveryCallOrder[TestRecoveryCallOrderLength++] = 1U;
}
result = HAL_OK;
if (TestReceiveCallCount < TestReceiveResultCount) {
result = TestReceiveResults[TestReceiveCallCount];
}
TestReceiveCallCount++;
if (result == HAL_OK) {
uartHandle->RxState = HAL_UART_STATE_BUSY_RX;
}
if ((TestReceiveErrorInjectionCall != 0U)
&& (TestReceiveCallCount == TestReceiveErrorInjectionCall)) {
Uart1Handle.ErrorCode = HAL_UART_ERROR_ORE;
HAL_UART_ErrorCallback(&Uart1Handle);
}

return result;
}

HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *uartHandle)
{
(void)uartHandle;
TestAbortReceiveCallCount++;
if (TestRecoveryCallOrderLength < sizeof(TestRecoveryCallOrder)) {
TestRecoveryCallOrder[TestRecoveryCallOrderLength++] = 2U;
}

return HAL_OK;
}

HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *uartHandle,
uint8_t *data, uint16_t size)
{
(void)uartHandle;
(void)data;
(void)size;

return HAL_OK;
}

HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *uartHandle)
{
(void)uartHandle;

return HAL_OK;
}

void HAL_UART_IRQHandler(UART_HandleTypeDef *uartHandle)
{
(void)uartHandle;
}

void HAL_NVIC_SetPriority(IRQn_Type irqn, uint32_t preemptPriority,
uint32_t subPriority)
{
TestNvicIrq = irqn;
TestNvicPreemptPriority = preemptPriority;
TestNvicSubPriority = subPriority;
}

void HAL_NVIC_EnableIRQ(IRQn_Type irqn)
{
(void)irqn;
}

void HAL_IncTick(void)
{
TestHalTickCallCount++;
}

void OSInit(void)
{
}

void OSStart(void)
{
}

INT8U OSTaskCreateExt(void (*task)(void *), void *argument, OS_STK *stackTop,
INT8U priority, INT16U taskId, OS_STK *stackBottom,
INT32U stackSize, void *extension, INT16U options)
{
(void)task;
(void)argument;
(void)stackTop;
(void)priority;
(void)taskId;
(void)stackBottom;
(void)stackSize;
(void)extension;
(void)options;

return OS_ERR_NONE;
}

OS_EVENT *OSSemCreate(INT16U count)
{
(void)count;
return &TestFrameSem;
}

void OSSemPend(OS_EVENT *event, uint32_t timeout, INT8U *error)
{
(void)event;
(void)timeout;
if (error != NULL) {
*error = OS_ERR_NONE;
}
}

INT8U OSSemPost(OS_EVENT *event)
{
(void)event;
TestSemPostCallCount++;

return OS_ERR_NONE;
}

void OSTaskSuspend(INT8U priority)
{
(void)priority;
}

void OSTimeDly(uint32_t ticks)
{
(void)ticks;
}

uint32_t OSTimeGet(void)
{
return 0U;
}

void OSIntEnter(void)
{
}

void OSIntExit(void)
{
}

void OSTimeTick(void)
{
}

void OS_CPU_SysTickHandler(void)
{
TestOsCpuSysTickCallCount++;
}

MODBUS_STATUS ModbusBackupRestore(MODBUS_SLAVE *slave)
{
(void)slave;

return MODBUS_STATUS_OK;
}

MODBUS_STATUS ModbusBackupSave(const MODBUS_SLAVE *slave)
{
(void)slave;

return MODBUS_STATUS_OK;
}

+ 0
- 34
test/check_no_communication_counters.ps1 파일 보기

@@ -1,34 +0,0 @@
$projectRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
$sourcePaths = @(
(Join-Path $projectRoot 'Core/OS/Cfg/app_cfg.h'),
(Join-Path $projectRoot 'Core/Src/main.c')
)
$forbiddenSymbols = @(
'APP_MODBUS_REG_OPERATION_RX_COUNT',
'APP_MODBUS_REG_OPERATION_TX_COUNT',
'APP_MODBUS_REG_ERROR_COUNT',
'ModbusOperationRxCount',
'ModbusOperationTxCount',
'ModbusProtocolErrorCount',
'ModbusReceiveErrorCount',
'ModbusSemaphoreErrorCount',
'AppUpdateStatusRegisters',
'AppRecordIsrError'
)

$violations = @()
foreach ($sourcePath in $sourcePaths) {
$source = Get-Content -Raw $sourcePath
foreach ($symbol in $forbiddenSymbols) {
if ($source.Contains($symbol)) {
$violations += "$sourcePath still contains $symbol"
}
}
}

if ($violations.Count -ne 0) {
$violations | ForEach-Object { Write-Error $_ }
exit 1
}

Write-Output 'Communication counter logic is absent.'

+ 0
- 49
test/check_rtu_runtime_invariants.ps1 파일 보기

@@ -1,49 +0,0 @@
$projectRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
$mainSource = Get-Content -Raw (Join-Path $projectRoot 'Core/Src/main.c')
$interruptSource = Get-Content -Raw (Join-Path $projectRoot 'Core/Src/stm32f4xx_it.c')

function Require-SourcePattern
{
param(
[string]$Source,
[string]$Pattern,
[string]$Message
)

if ($Source -notmatch $Pattern)
{
throw $Message
}
}

Require-SourcePattern $mainSource `
'HAL_NVIC_SetPriority\(SysTick_IRQn, CPU_CFG_KA_IPL_BOUNDARY, 0U\)' `
'SysTick priority must use CPU_CFG_KA_IPL_BOUNDARY.'
Require-SourcePattern $interruptSource 'OS_CPU_SysTickHandler\(\)' `
'SysTick must use the uC/OS-II port wrapper.'
Require-SourcePattern $mainSource `
'static HAL_StatusTypeDef AppRecoverUartReception\(void\)' `
'UART recovery helper is missing.'
Require-SourcePattern $mainSource 'ModbusReceptionNeedsRecovery' `
'UART pending-recovery state is missing.'

$sysTickHandler = [regex]::Match(
$interruptSource,
'void SysTick_Handler\(void\)\s*\{(?s:.*?)\n\}\s*/\*\*').Value
if (($sysTickHandler -match 'OSIntEnter\(\)') `
-or ($sysTickHandler -match 'OSTimeTick\(\)') `
-or ($sysTickHandler -match 'OSIntExit\(\)'))
{
throw 'SysTick must not contain a handwritten uC/OS-II tick sequence.'
}

$uartErrorCallback = [regex]::Match(
$mainSource,
'void HAL_UART_ErrorCallback\(UART_HandleTypeDef \*uartHandle\)\s*\{(?s:.*?)\n\}\s*/\*\*').Value
if (($uartErrorCallback -match 'HAL_UART_Receive_IT') `
-or ($uartErrorCallback -match 'HAL_UART_AbortReceive_IT'))
{
throw 'UART error callback must defer recovery to the Modbus task.'
}

Write-Output 'RTU runtime invariants are present.'

+ 0
- 70
test/modbus_backup_test.c 파일 보기

@@ -1,70 +0,0 @@
#include <assert.h>
#include <stdint.h>
#include <string.h>

#include "main.h"
#include "modbus.h"
#include "modbus_backup.h"

#define TEST_SLAVE_ADDRESS (1U)

TEST_RTC_TYPEDEF TestRtc;

static uint16_t TestHoldingRegisters[MODBUS_DATA_POINT_COUNT];
static uint8_t TestCoilStorage[MODBUS_COIL_STORAGE_SIZE];
static uint16_t TestExtendedRegister;

static void TestInitSlave(MODBUS_SLAVE *slave)
{
assert(slave != NULL);
assert(ModbusSlaveInit(slave, TEST_SLAVE_ADDRESS, TestHoldingRegisters,
TestCoilStorage) == MODBUS_STATUS_OK);
assert(ModbusConfigureExtendedHoldingRegister(slave,
&TestExtendedRegister)
== MODBUS_STATUS_OK);
}

static void TestRestoreOnlyExtendedRegister(void)
{
MODBUS_SLAVE slave;
uint8_t coilValue;

(void)memset(&TestRtc, 0, sizeof(TestRtc));
(void)memset(TestHoldingRegisters, 0, sizeof(TestHoldingRegisters));
(void)memset(TestCoilStorage, 0, sizeof(TestCoilStorage));
TestExtendedRegister = 0U;
TestInitSlave(&slave);

assert(ModbusSetHoldingRegister(&slave, 0U, 0x1111U)
== MODBUS_STATUS_OK);
assert(ModbusSetHoldingRegister(&slave, 31U, 0x2222U)
== MODBUS_STATUS_OK);
assert(ModbusSetCoil(&slave, 0U, 1U) == MODBUS_STATUS_OK);
assert(ModbusSetCoil(&slave, 15U, 1U) == MODBUS_STATUS_OK);
TestExtendedRegister = 0xBEEFU;
assert(ModbusBackupSave(&slave) == MODBUS_STATUS_OK);

assert(ModbusSetHoldingRegister(&slave, 0U, 0xAAAAU)
== MODBUS_STATUS_OK);
assert(ModbusSetHoldingRegister(&slave, 31U, 0x5555U)
== MODBUS_STATUS_OK);
assert(ModbusSetCoil(&slave, 0U, 0U) == MODBUS_STATUS_OK);
assert(ModbusSetCoil(&slave, 15U, 0U) == MODBUS_STATUS_OK);
TestExtendedRegister = 0U;

assert(ModbusBackupRestore(&slave) == MODBUS_STATUS_OK);
assert(TestHoldingRegisters[0U] == 0xAAAAU);
assert(TestHoldingRegisters[31U] == 0x5555U);
assert(ModbusGetCoil(&slave, 0U, &coilValue) == MODBUS_STATUS_OK);
assert(coilValue == 0U);
assert(ModbusGetCoil(&slave, 15U, &coilValue) == MODBUS_STATUS_OK);
assert(coilValue == 0U);
assert(TestExtendedRegister == 0xBEEFU);
}

int main(void)
{
TestRestoreOnlyExtendedRegister();

return 0;
}

+ 0
- 306
test/modbus_test.c 파일 보기

@@ -1,306 +0,0 @@
/**
* @file modbus_test.c
* @brief Modbus RTU 从站私有功能码单元测试。
* @version 2.1
* @author zengbingjie
* @date 2026-08-02
*/

#include <assert.h>
#include <stdint.h>
#include <string.h>

#include "modbus.h"

#define TEST_SLAVE_ADDRESS (1U)
#define TEST_EXTENDED_READ_FRAME_LENGTH (10U)
#define TEST_EXTENDED_READ_RESPONSE_LENGTH (7U)
#define TEST_EXTENDED_WRITE_FRAME_LENGTH (10U)
#define TEST_ODD_READ_FRAME_LENGTH (8U)
#define TEST_ODD_READ_RESPONSE_LENGTH (11U)
#define TEST_ODD_READ_MAX_RESPONSE_LENGTH (251U)

#define TEST_FC_READ_EXTENDED_REGISTER (0x41U)
#define TEST_FC_WRITE_EXTENDED_REGISTER (0x42U)
#define TEST_FC_READ_ODD_COUNT_REGS (0x43U)

static uint16_t TestHoldingRegisters[MODBUS_DATA_POINT_COUNT];
static uint8_t TestCoilStorage[MODBUS_COIL_STORAGE_SIZE];
static uint16_t TestExtendedRegister;

/**
* @brief 向测试请求末尾追加 Modbus RTU CRC。
* @param[in,out] frame 测试请求帧。
* @param[in] payloadLength 未含 CRC 的帧长度。
* @return 无。
*/
static void TestAppendCrc(uint8_t *frame, uint16_t payloadLength)
{
uint16_t crcValue;

assert(frame != NULL);
crcValue = ModbusCrc16(frame, payloadLength);
frame[payloadLength] = (uint8_t)(crcValue & 0x00FFU);
frame[payloadLength + 1U] = (uint8_t)(crcValue >> 8U);
}

/**
* @brief 校验响应帧的 CRC 字节序和数值。
* @param[in] frame 响应帧。
* @param[in] frameLength 含 CRC 的帧长度。
* @return 无。
*/
static void TestAssertFrameCrc(const uint8_t *frame, uint16_t frameLength)
{
uint16_t expectedCrc;
uint16_t actualCrc;

assert(frame != NULL);
assert(frameLength >= MODBUS_RTU_ADU_MIN_LENGTH);
expectedCrc = ModbusCrc16(frame, frameLength - MODBUS_RTU_CRC_LENGTH);
actualCrc = (uint16_t)frame[frameLength - MODBUS_RTU_CRC_LENGTH]
| ((uint16_t)frame[frameLength - 1U] << 8U);
assert(actualCrc == expectedCrc);
}

/**
* @brief 使用真实数据存储初始化一个从站测试实例。
* @param[out] slave 待初始化的从站。
* @return 无。
*/
static void TestInitSlave(MODBUS_SLAVE *slave)
{
assert(slave != NULL);
assert(ModbusSlaveInit(slave, TEST_SLAVE_ADDRESS, TestHoldingRegisters,
TestCoilStorage) == MODBUS_STATUS_OK);
assert(ModbusConfigureExtendedHoldingRegister(slave,
&TestExtendedRegister)
== MODBUS_STATUS_OK);
}

/**
* @brief 回归验证 0x41 仍可读取固定扩展寄存器。
* @return 无。
*/
static void TestReadExtendedRegister(void)
{
uint8_t request[TEST_EXTENDED_READ_FRAME_LENGTH] = {
TEST_SLAVE_ADDRESS, TEST_FC_READ_EXTENDED_REGISTER,
0x00U, 0x01U, 0x00U, 0x00U, 0x00U, 0x01U, 0x00U, 0x00U
};
uint8_t response[MODBUS_RTU_ADU_MAX_LENGTH];
uint16_t responseLength;
MODBUS_SLAVE slave;

TestInitSlave(&slave);
TestExtendedRegister = 0x1000U;
TestAppendCrc(request, 8U);
assert(ModbusProcessFrame(&slave, request, sizeof(request), response,
sizeof(response), &responseLength)
== MODBUS_STATUS_OK);
assert(responseLength == TEST_EXTENDED_READ_RESPONSE_LENGTH);
assert(response[0U] == TEST_SLAVE_ADDRESS);
assert(response[1U] == TEST_FC_READ_EXTENDED_REGISTER);
assert(response[2U] == 2U);
assert(response[3U] == 0x10U);
assert(response[4U] == 0x00U);
TestAssertFrameCrc(response, responseLength);
}

/**
* @brief 验证 0x42 将指定值写入固定扩展寄存器并完整回显。
* @return 无。
*/
static void TestWriteExtendedRegister(void)
{
uint8_t request[TEST_EXTENDED_WRITE_FRAME_LENGTH] = {
TEST_SLAVE_ADDRESS, TEST_FC_WRITE_EXTENDED_REGISTER,
0x00U, 0x01U, 0x00U, 0x00U, 0xBEU, 0xEFU, 0x00U, 0x00U
};
uint8_t response[MODBUS_RTU_ADU_MAX_LENGTH];
uint16_t responseLength;
MODBUS_SLAVE slave;

TestInitSlave(&slave);
TestAppendCrc(request, 8U);
assert(ModbusProcessFrame(&slave, request, sizeof(request), response,
sizeof(response), &responseLength)
== MODBUS_STATUS_OK);
assert(responseLength == TEST_EXTENDED_WRITE_FRAME_LENGTH);
assert(memcmp(response, request, 8U) == 0);
assert(TestExtendedRegister == 0xBEEFU);
TestAssertFrameCrc(response, responseLength);
}

/**
* @brief 验证 0x42 拒绝非 0x00010000 的扩展地址。
* @return 无。
*/
static void TestWriteExtendedRegisterRejectsInvalidAddress(void)
{
uint8_t request[TEST_EXTENDED_WRITE_FRAME_LENGTH] = {
TEST_SLAVE_ADDRESS, TEST_FC_WRITE_EXTENDED_REGISTER,
0x00U, 0x01U, 0x00U, 0x01U, 0x12U, 0x34U, 0x00U, 0x00U
};
uint8_t response[MODBUS_RTU_ADU_MAX_LENGTH];
uint16_t responseLength;
MODBUS_SLAVE slave;

TestInitSlave(&slave);
TestAppendCrc(request, 8U);
assert(ModbusProcessFrame(&slave, request, sizeof(request), response,
sizeof(response), &responseLength)
== MODBUS_STATUS_EXCEPTION);
assert(responseLength == MODBUS_RTU_EXCEPTION_LENGTH);
assert(response[0U] == TEST_SLAVE_ADDRESS);
assert(response[1U]
== (TEST_FC_WRITE_EXTENDED_REGISTER | 0x80U));
assert(response[2U] == MODBUS_EXCEPTION_ILLEGAL_DATA_ADDR);
TestAssertFrameCrc(response, responseLength);
}

/**
* @brief 验证 0x43 从起始基准地址后的奇数地址读取保持寄存器。
* @return 无。
*/
static void TestReadOddAddressRegisters(void)
{
uint8_t request[TEST_ODD_READ_FRAME_LENGTH] = {
TEST_SLAVE_ADDRESS, TEST_FC_READ_ODD_COUNT_REGS,
0x00U, 0x00U, 0x00U, 0x03U, 0x00U, 0x00U
};
uint8_t response[MODBUS_RTU_ADU_MAX_LENGTH];
uint16_t responseLength;
MODBUS_SLAVE slave;

TestInitSlave(&slave);
TestHoldingRegisters[0U] = 0xDEADU;
TestHoldingRegisters[1U] = 0x1234U;
TestHoldingRegisters[2U] = 0xBEEFU;
TestHoldingRegisters[3U] = 0xABCDU;
TestHoldingRegisters[4U] = 0xFEEDU;
TestHoldingRegisters[5U] = 0x0001U;
TestAppendCrc(request, 6U);
assert(ModbusProcessFrame(&slave, request, sizeof(request), response,
sizeof(response), &responseLength)
== MODBUS_STATUS_OK);
assert(responseLength == TEST_ODD_READ_RESPONSE_LENGTH);
assert(response[0U] == TEST_SLAVE_ADDRESS);
assert(response[1U] == TEST_FC_READ_ODD_COUNT_REGS);
assert(response[2U] == 6U);
assert(response[3U] == 0x12U);
assert(response[4U] == 0x34U);
assert(response[5U] == 0xABU);
assert(response[6U] == 0xCDU);
assert(response[7U] == 0x00U);
assert(response[8U] == 0x01U);
TestAssertFrameCrc(response, responseLength);
}

/**
* @brief 验证 0x43 从偶数基准地址 10 开始读取 D11、D13 和 D15。
* @return 无。
*/
static void TestReadOddAddressRegistersFromAddressTen(void)
{
uint8_t request[TEST_ODD_READ_FRAME_LENGTH] = {
TEST_SLAVE_ADDRESS, TEST_FC_READ_ODD_COUNT_REGS,
0x00U, 0x0AU, 0x00U, 0x03U, 0x00U, 0x00U
};
uint8_t response[MODBUS_RTU_ADU_MAX_LENGTH];
uint16_t responseLength;
MODBUS_SLAVE slave;

TestInitSlave(&slave);
TestHoldingRegisters[10U] = 0xDEADU;
TestHoldingRegisters[11U] = 0x1111U;
TestHoldingRegisters[12U] = 0xBEEFU;
TestHoldingRegisters[13U] = 0x1313U;
TestHoldingRegisters[14U] = 0xFEEDU;
TestHoldingRegisters[15U] = 0x1515U;
TestAppendCrc(request, 6U);
assert(ModbusProcessFrame(&slave, request, sizeof(request), response,
sizeof(response), &responseLength)
== MODBUS_STATUS_OK);
assert(responseLength == TEST_ODD_READ_RESPONSE_LENGTH);
assert(response[2U] == 6U);
assert(response[3U] == 0x11U);
assert(response[4U] == 0x11U);
assert(response[5U] == 0x13U);
assert(response[6U] == 0x13U);
assert(response[7U] == 0x15U);
assert(response[8U] == 0x15U);
TestAssertFrameCrc(response, responseLength);
}

/**
* @brief 验证 0x43 支持最大 123 个奇数地址寄存器。
* @return 无。
*/
static void TestReadOddCountRegistersMaximum(void)
{
uint8_t request[TEST_ODD_READ_FRAME_LENGTH] = {
TEST_SLAVE_ADDRESS, TEST_FC_READ_ODD_COUNT_REGS,
0x00U, 0x00U, 0x00U, 0x7BU, 0x00U, 0x00U
};
uint8_t response[MODBUS_RTU_ADU_MAX_LENGTH];
uint16_t responseLength;
MODBUS_SLAVE slave;

TestInitSlave(&slave);
TestHoldingRegisters[245U] = 0x7E57U;
TestAppendCrc(request, 6U);
assert(ModbusProcessFrame(&slave, request, sizeof(request), response,
sizeof(response), &responseLength)
== MODBUS_STATUS_OK);
assert(responseLength == TEST_ODD_READ_MAX_RESPONSE_LENGTH);
assert(response[0U] == TEST_SLAVE_ADDRESS);
assert(response[1U] == TEST_FC_READ_ODD_COUNT_REGS);
assert(response[2U] == 246U);
assert(response[247U] == 0x7EU);
assert(response[248U] == 0x57U);
TestAssertFrameCrc(response, responseLength);
}

/**
* @brief 验证 0x43 拒绝偶数数量。
* @return 无。
*/
static void TestReadOddCountRegistersRejectsEvenCount(void)
{
uint8_t request[TEST_ODD_READ_FRAME_LENGTH] = {
TEST_SLAVE_ADDRESS, TEST_FC_READ_ODD_COUNT_REGS,
0x00U, 0x00U, 0x00U, 0x02U, 0x00U, 0x00U
};
uint8_t response[MODBUS_RTU_ADU_MAX_LENGTH];
uint16_t responseLength;
MODBUS_SLAVE slave;

TestInitSlave(&slave);
TestAppendCrc(request, 6U);
assert(ModbusProcessFrame(&slave, request, sizeof(request), response,
sizeof(response), &responseLength)
== MODBUS_STATUS_EXCEPTION);
assert(responseLength == MODBUS_RTU_EXCEPTION_LENGTH);
assert(response[0U] == TEST_SLAVE_ADDRESS);
assert(response[1U] == (TEST_FC_READ_ODD_COUNT_REGS | 0x80U));
assert(response[2U] == MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE);
TestAssertFrameCrc(response, responseLength);
}

/**
* @brief 执行 Modbus RTU 私有功能码单元测试。
* @return 0 表示全部测试通过。
*/
int main(void)
{
TestReadExtendedRegister();
TestWriteExtendedRegister();
TestWriteExtendedRegisterRejectsInvalidAddress();
TestReadOddAddressRegisters();
TestReadOddAddressRegistersFromAddressTen();
TestReadOddCountRegistersMaximum();
TestReadOddCountRegistersRejectsEvenCount();

return 0;
}

+ 0
- 308
test/support/app_runtime/main.h 파일 보기

@@ -1,308 +0,0 @@
#ifndef APP_RUNTIME_TEST_MAIN_H
#define APP_RUNTIME_TEST_MAIN_H

#include <stdint.h>

#include "modbus.h"

#define CPU_CFG_KA_IPL_BOUNDARY (4U)

#define APP_TASK_MODBUS_PRIO (4U)
#define APP_TASK_START_PRIO (5U)
#define APP_TASK_T35_PRIO (6U)
#define APP_TASK_START_STK_SIZE (128U)
#define APP_TASK_MODBUS_STK_SIZE (384U)
#define APP_TASK_T35_STK_SIZE (128U)

#define APP_MODBUS_BAUD_RATE (115200U)
#define APP_MODBUS_BITS_PER_CHARACTER (10U)
#define APP_MODBUS_RTU_CHARACTER_TIME_US (87U)
#define APP_MODBUS_RTU_T15_US (750U)
#define APP_MODBUS_RTU_T35_US (1750U)
#define APP_MODBUS_RTU_T15_RX_TIMEOUT_US (837U)
#define APP_MODBUS_RTU_T35_AFTER_T15_US (913U)
#define APP_MODBUS_RTU_TIMER_CLOCK_HZ (84000000U)
#define APP_MODBUS_RTU_TIMER_TICK_HZ (1000000U)
#define APP_MODBUS_STATUS_CHECK_TICKS (1U)
#define APP_MODBUS_STATUS_UPDATE_TICKS (100U)
#define APP_MODBUS_LINK_TIMEOUT_TICKS (3000U)
#define APP_MODBUS_TX_TIMEOUT_TICKS (100U)

#define APP_MODBUS_DEBUG_REGISTER_COUNT (16U)
#define APP_MODBUS_DEBUG_COIL_COUNT (16U)
#define APP_MODBUS_DEBUG_FRAME_SIZE (256U)

#define APP_MODBUS_OUTPUT_COIL_COUNT (8U)
#define APP_MODBUS_FIRST_USER_OUTPUT_COIL (1U)
#define APP_MODBUS_USER_OUTPUT_COIL_COUNT (7U)
#define APP_MODBUS_LINK_STATE_COIL (100U)
#define APP_MODBUS_LINK_DISCONNECTED (0U)
#define APP_MODBUS_LINK_CONNECTED (1U)

typedef uint8_t INT8U;
typedef uint16_t INT16U;
typedef uint32_t INT32U;
typedef uint32_t OS_STK;
typedef uint32_t OS_CPU_SR;

typedef struct
{
uint8_t value;
} OS_EVENT;

typedef int32_t IRQn_Type;

typedef struct
{
uint32_t CR1;
uint32_t CNT;
uint32_t ARR;
uint32_t SR;
uint32_t PSC;
uint32_t EGR;
uint32_t DIER;
} TIM_TypeDef;

typedef struct
{
uint32_t value;
} GPIO_TypeDef;

typedef struct
{
uint32_t value;
uint32_t SR;
uint32_t DR;
} USART_TypeDef;

typedef struct
{
uint32_t PLLState;
uint32_t PLLSource;
uint32_t PLLM;
uint32_t PLLN;
uint32_t PLLP;
uint32_t PLLQ;
} RCC_PLLInitTypeDef;

typedef struct
{
uint32_t OscillatorType;
uint32_t HSEState;
RCC_PLLInitTypeDef PLL;
} RCC_OscInitTypeDef;

typedef struct
{
uint32_t ClockType;
uint32_t SYSCLKSource;
uint32_t AHBCLKDivider;
uint32_t APB1CLKDivider;
uint32_t APB2CLKDivider;
} RCC_ClkInitTypeDef;

typedef struct
{
uint32_t Pin;
uint32_t Mode;
uint32_t Pull;
uint32_t Speed;
uint32_t Alternate;
} GPIO_InitTypeDef;

typedef struct
{
uint32_t BaudRate;
uint32_t WordLength;
uint32_t StopBits;
uint32_t Parity;
uint32_t Mode;
uint32_t HwFlowCtl;
uint32_t OverSampling;
} UART_InitTypeDef;

typedef struct
{
void *Instance;
UART_InitTypeDef Init;
uint32_t ErrorCode;
uint32_t RxState;
} UART_HandleTypeDef;

typedef enum
{
HAL_OK = 0,
HAL_ERROR = 1,
HAL_BUSY = 2,
HAL_TIMEOUT = 3
} HAL_StatusTypeDef;

typedef enum
{
GPIO_PIN_RESET = 0,
GPIO_PIN_SET = 1
} GPIO_PinState;

extern TIM_TypeDef TestTim5;
extern GPIO_TypeDef TestGpioE;
extern GPIO_TypeDef TestGpioF;
extern GPIO_TypeDef TestGpioI;
extern USART_TypeDef TestUsart1;
extern OS_EVENT TestFrameSem;

extern IRQn_Type TestNvicIrq;
extern uint32_t TestNvicPreemptPriority;
extern uint32_t TestNvicSubPriority;
extern uint32_t TestHalTickCallCount;
extern uint32_t TestOsCpuSysTickCallCount;
extern HAL_StatusTypeDef TestReceiveResults[4U];
extern uint32_t TestReceiveResultCount;
extern uint32_t TestReceiveCallCount;
extern uint32_t TestReceiveErrorInjectionCall;
extern uint32_t TestAbortReceiveCallCount;
extern uint32_t TestUartFlagClearCallCount;
extern uint8_t TestRecoveryCallOrder[4U];
extern uint32_t TestRecoveryCallOrderLength;
extern uint32_t TestSemPostCallCount;
extern uint8_t OSRunning;

#define TIM5 (&TestTim5)
#define GPIOE (&TestGpioE)
#define GPIOF (&TestGpioF)
#define GPIOI (&TestGpioI)
#define USART1 (&TestUsart1)

#define SysTick_IRQn ((IRQn_Type)-1)
#define TIM5_IRQn ((IRQn_Type)50)
#define USART1_IRQn ((IRQn_Type)37)

#define OS_TRUE (1U)
#define OS_ERR_NONE (0U)
#define OS_PRIO_SELF (0U)
#define OS_TASK_OPT_STK_CHK (0U)
#define OS_TASK_OPT_STK_CLR (0U)

#define TIM_CR1_CEN (0x0001U)
#define TIM_SR_UIF (0x0001U)
#define TIM_EGR_UG (0x0001U)
#define TIM_DIER_UIE (0x0001U)

#define GPIO_MODE_OUTPUT_PP (0U)
#define GPIO_PULLUP (0U)
#define GPIO_SPEED_FREQ_LOW (0U)
#define GPIO_PIN_4 (0x0010U)
#define GPIO_PIN_5 (0x0020U)
#define GPIO_PIN_6 (0x0040U)
#define GPIO_PIN_7 (0x0080U)
#define GPIO_PIN_8 (0x0100U)
#define GPIO_PIN_9 (0x0200U)

#define PLC_Q0_PORT (GPIOF)
#define PLC_Q0_PIN (GPIO_PIN_6)
#define PLC_Q1_PORT (GPIOF)
#define PLC_Q1_PIN (GPIO_PIN_8)
#define PLC_Q2_PORT (GPIOF)
#define PLC_Q2_PIN (GPIO_PIN_7)
#define PLC_Q3_PORT (GPIOF)
#define PLC_Q3_PIN (GPIO_PIN_9)
#define PLC_Q4_PORT (GPIOI)
#define PLC_Q4_PIN (GPIO_PIN_8)
#define PLC_Q5_PORT (GPIOE)
#define PLC_Q5_PIN (GPIO_PIN_6)
#define PLC_Q6_PORT (GPIOE)
#define PLC_Q6_PIN (GPIO_PIN_5)
#define PLC_Q7_PORT (GPIOE)
#define PLC_Q7_PIN (GPIO_PIN_4)
#define PLC_LINK_LED_PORT (PLC_Q0_PORT)
#define PLC_LINK_LED_PIN (PLC_Q0_PIN)

#define RCC_OSCILLATORTYPE_HSE (0U)
#define RCC_HSE_ON (0U)
#define RCC_PLL_ON (0U)
#define RCC_PLLSOURCE_HSE (0U)
#define RCC_PLLP_DIV2 (0U)
#define RCC_CLOCKTYPE_HCLK (0U)
#define RCC_CLOCKTYPE_SYSCLK (0U)
#define RCC_CLOCKTYPE_PCLK1 (0U)
#define RCC_CLOCKTYPE_PCLK2 (0U)
#define RCC_SYSCLKSOURCE_PLLCLK (0U)
#define RCC_SYSCLK_DIV1 (0U)
#define RCC_HCLK_DIV4 (0U)
#define RCC_HCLK_DIV2 (0U)
#define FLASH_LATENCY_5 (0U)
#define PWR_REGULATOR_VOLTAGE_SCALE1 (0U)

#define UART_WORDLENGTH_8B (0U)
#define UART_STOPBITS_1 (0U)
#define UART_PARITY_NONE (0U)
#define UART_MODE_TX_RX (0U)
#define UART_HWCONTROL_NONE (0U)
#define UART_OVERSAMPLING_16 (0U)
#define HAL_UART_ERROR_NONE (0U)
#define HAL_UART_ERROR_ORE (0x00000008U)
#define HAL_UART_STATE_READY (0U)
#define HAL_UART_STATE_BUSY_RX (0x22U)

#define __HAL_UART_CLEAR_PEFLAG(handle) \
do { (void)(handle); TestUartFlagClearCallCount++; } while (0)
#define __HAL_UART_CLEAR_FEFLAG(handle) \
__HAL_UART_CLEAR_PEFLAG(handle)
#define __HAL_UART_CLEAR_NEFLAG(handle) \
__HAL_UART_CLEAR_PEFLAG(handle)
#define __HAL_UART_CLEAR_OREFLAG(handle) \
__HAL_UART_CLEAR_PEFLAG(handle)
#define __HAL_UART_CLEAR_IDLEFLAG(handle) \
__HAL_UART_CLEAR_PEFLAG(handle)

#define __HAL_RCC_PWR_CLK_ENABLE() do { } while (0)
#define __HAL_PWR_VOLTAGESCALING_CONFIG(v) do { (void)(v); } while (0)
#define __HAL_RCC_GPIOE_CLK_ENABLE() do { } while (0)
#define __HAL_RCC_GPIOF_CLK_ENABLE() do { } while (0)
#define __HAL_RCC_GPIOI_CLK_ENABLE() do { } while (0)
#define __HAL_RCC_TIM5_CLK_ENABLE() do { } while (0)

#define OS_ENTER_CRITICAL() do { (void)cpu_sr; } while (0)
#define OS_EXIT_CRITICAL() do { } while (0)
#define __disable_irq() do { } while (0)

void HAL_Init(void);
HAL_StatusTypeDef HAL_RCC_OscConfig(const RCC_OscInitTypeDef *config);
HAL_StatusTypeDef HAL_RCC_ClockConfig(const RCC_ClkInitTypeDef *config,
uint32_t latency);
void HAL_GPIO_Init(GPIO_TypeDef *port, const GPIO_InitTypeDef *config);
void HAL_GPIO_WritePin(GPIO_TypeDef *port, uint16_t pin,
GPIO_PinState state);
HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *uartHandle);
HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *uartHandle,
uint8_t *data, uint16_t size);
HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *uartHandle);
HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *uartHandle,
uint8_t *data, uint16_t size);
HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *uartHandle);
void HAL_UART_IRQHandler(UART_HandleTypeDef *uartHandle);
void HAL_NVIC_SetPriority(IRQn_Type irqn, uint32_t preemptPriority,
uint32_t subPriority);
void HAL_NVIC_EnableIRQ(IRQn_Type irqn);
void HAL_IncTick(void);
void Error_Handler(void);

void OSInit(void);
void OSStart(void);
INT8U OSTaskCreateExt(void (*task)(void *), void *argument, OS_STK *stackTop,
INT8U priority, INT16U taskId, OS_STK *stackBottom,
INT32U stackSize, void *extension, INT16U options);
OS_EVENT *OSSemCreate(INT16U count);
void OSSemPend(OS_EVENT *event, uint32_t timeout, INT8U *error);
INT8U OSSemPost(OS_EVENT *event);
void OSTaskSuspend(INT8U priority);
void OSTimeDly(uint32_t ticks);
uint32_t OSTimeGet(void);
void OSIntEnter(void);
void OSIntExit(void);
void OSTimeTick(void);
void OS_CPU_SysTickHandler(void);

MODBUS_STATUS ModbusBackupRestore(MODBUS_SLAVE *slave);
MODBUS_STATUS ModbusBackupSave(const MODBUS_SLAVE *slave);

#endif

+ 0
- 16
test/support/app_runtime/stm32f4xx_it.h 파일 보기

@@ -1,16 +0,0 @@
#ifndef APP_RUNTIME_TEST_STM32F4XX_IT_H
#define APP_RUNTIME_TEST_STM32F4XX_IT_H

void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void TIM5_IRQHandler(void);
void USART1_IRQHandler(void);

#endif

+ 0
- 46
test/support/main.h 파일 보기

@@ -1,46 +0,0 @@
#ifndef MODBUS_BACKUP_TEST_MAIN_H
#define MODBUS_BACKUP_TEST_MAIN_H

#include <stdint.h>

typedef struct
{
volatile uint32_t BKP0R;
volatile uint32_t BKP1R;
volatile uint32_t BKP2R;
volatile uint32_t BKP3R;
volatile uint32_t BKP4R;
volatile uint32_t BKP5R;
volatile uint32_t BKP6R;
volatile uint32_t BKP7R;
volatile uint32_t BKP8R;
volatile uint32_t BKP9R;
volatile uint32_t BKP10R;
volatile uint32_t BKP11R;
volatile uint32_t BKP12R;
volatile uint32_t BKP13R;
volatile uint32_t BKP14R;
volatile uint32_t BKP15R;
volatile uint32_t BKP16R;
volatile uint32_t BKP17R;
volatile uint32_t BKP18R;
volatile uint32_t BKP19R;
} TEST_RTC_TYPEDEF;

extern TEST_RTC_TYPEDEF TestRtc;

#define RTC (&TestRtc)
#define RCC_RTCCLKSOURCE_NO_CLK (0U)
#define RCC_FLAG_LSIRDY (0U)
#define RESET (0U)

#define __HAL_RCC_PWR_CLK_ENABLE() do { } while (0)
#define HAL_PWR_EnableBkUpAccess() do { } while (0)
#define __HAL_RCC_GET_RTC_SOURCE() (1U)
#define __HAL_RCC_LSI_ENABLE() do { } while (0)
#define __HAL_RCC_GET_FLAG(flag) (1U)
#define __HAL_RCC_RTC_CONFIG(source) do { } while (0)
#define __HAL_RCC_RTC_ENABLE() do { } while (0)
#define HAL_GetTick() (0U)

#endif

불러오는 중...
취소
저장