diff --git a/components/utilities/ymodem/ry_sy.c b/components/utilities/ymodem/ry_sy.c index b77bd7abc2451d053ad8cdde7d544cb7d846a3e8..d61b0cde588f61b94288c0d0ad40a37a47af3836 100644 --- a/components/utilities/ymodem/ry_sy.c +++ b/components/utilities/ymodem/ry_sy.c @@ -15,8 +15,6 @@ #include #include #include - -#include #include #include @@ -115,7 +113,7 @@ static enum rym_code _rym_send_begin( rt_kprintf("error open file.\n"); return RYM_ERR_FILE; } - sprintf((char *)buf, "%s%c%ld", (char *) & (cctx->fpath[1]), insert_0, file_buf.st_size); + rt_sprintf((char *)buf, "%s%c%d", (char *) & (cctx->fpath[1]), insert_0, file_buf.st_size); return RYM_CODE_SOH; } @@ -140,8 +138,7 @@ static enum rym_code _rym_send_data( if (read_size < len) { rt_memset(buf + read_size, 0x1A, len - read_size); - /* stage = RYM_STAGE_FINISHING */ - ctx->stage = 4; + ctx->stage = RYM_STAGE_FINISHING; } return RYM_CODE_SOH; diff --git a/components/utilities/ymodem/ymodem.h b/components/utilities/ymodem/ymodem.h index 7006cf268d6abb4ab995984d15180d914af80ffb..2f05e4f2f21390c754e0cf9d315f8f8eefa1a65a 100644 --- a/components/utilities/ymodem/ymodem.h +++ b/components/utilities/ymodem/ymodem.h @@ -72,7 +72,7 @@ enum rym_code enum rym_stage { - RYM_STAGE_NONE, + RYM_STAGE_NONE = 0, /* set when C is send */ RYM_STAGE_ESTABLISHING, /* set when we've got the packet 0 and sent ACK and second C */