硬件:STM32F429IGT6核心板
操作系统:RTT V4.1.0
使用Ymodem协议从上位机接收数据至核心板。
查看ry_sy.c发现接收没有保存路径的选项。
只能保存到根目录“/”中。
因为我添加了romfs文件系统,”/“根目录为只读属性。无法保存报错。
只能查看代码修改_rym_recv_begin函数,更改保存路径为
“/flash/”,修改如下
static enum rym_code _rym_recv_begin(
struct rym_ctx *ctx,
rt_uint8_t *buf,
rt_size_t len)
{
struct custom_ctx *cctx = (struct custom_ctx *)ctx;
const char flash[] = "/flash/";
// cctx->fpath[0] = '/';
rt_strncpy(cctx->fpath,flash, sizeof(flash) - 1);
rt_strncpy(&(cctx->fpath[sizeof(flash)-1]), (const char *)buf, len - 1);
cctx->fd = open(cctx->fpath, O_CREAT | O_WRONLY | O_TRUNC, 0);
if (cctx->fd < 0)
{
rt_err_t err = rt_get_errno();
rt_kprintf("error creating file: %d\n", err);
return RYM_CODE_CAN;
}
cctx->flen = atoi(1 + (const char *)buf + rt_strnlen((const char *)buf, len - 1));
if (cctx->flen == 0)
cctx->flen = -1;
return RYM_CODE_ACK;
}
希望ry命令能增加自定义路径的选项。
举报
更多回帖