TFTP PUT失败

发布于 2021-01-06 16:49:29

使用fal把外置w25q128 进行分区 原来的设想是分四个区

#define FAL_PART_TABLE                                                               \
{                                                                                    \
    {FAL_PART_MAGIC_WORD,        "download",          NOR_FLASH_DEV_NAME,          FLASH_DOWNLOAD_ADDR,  FLASH_DOWNLOAD_SIZE, 0}, \
    {FAL_PART_MAGIC_WORD,        "factory",           NOR_FLASH_DEV_NAME,          FLASH_FACTORY_ADDR,  FLASH_FACTORY_SIZE, 0}, \
    {FAL_PART_MAGIC_WORD,        "romfs",             NOR_FLASH_DEV_NAME,          FLASH_ROMFS_ADDR,  FLASH_ROMFS_SIZE, 0}, \
    {FAL_PART_MAGIC_WORD,        "filesystem",        NOR_FLASH_DEV_NAME,          FLASH_FATS_ADDR,  FLASH_FATS_SIZE, 0}, \
}

其中romfs分区用来挂载 romfs文件系统 创建

const struct romfs_dirent _root_dirent[] =
{
    {ROMFS_DIRENT_DIR, "easyflash", RT_NULL, 0},
    {ROMFS_DIRENT_DIR, "download", RT_NULL, 0},
    {ROMFS_DIRENT_DIR, "user", RT_NULL, 0},
    {ROMFS_DIRENT_DIR, "factory", RT_NULL, 0},
};

const struct romfs_dirent romfs_root =
{
    ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_root_dirent, sizeof(_root_dirent) / sizeof(_root_dirent[0])
};
    flash_dev = fal_blk_device_create(FS_ROMFS_NAME);
    if (flash_dev == NULL){
        LOG_D("Can't create a block device on '%s' partition.\n", FS_ROMFS_NAME);
        return -1;
    }
    //romfs分区           rom文件系统挂载到 /
    if (dfs_mount(FS_ROMFS_NAME, "/", "rom", 0, &(romfs_root)) != 0)
    {
        if(dfs_mkfs("rom", FS_ROMFS_NAME) != 0)
        {
            LOG_E("Failed to initialize romfs! ");
        }
        else {
            dfs_mount(FS_ROMFS_NAME, "/", "rom", 0, &(romfs_root));
        }
    }

四个文件夹 再将elm 挂载到/user 目录下

    flash_dev = fal_blk_device_create(FS_FATS_NAME);
    if (flash_dev == NULL){
        LOG_D("Can't create a block device on '%s' partition.\n", FS_FATS_NAME);
        return -1;
    }
    //filesystem分区   elm文件系统挂载到/user
    if (dfs_mount(FS_FATS_NAME, "/user", "elm", 0, 0) != 0)
    {
        if(dfs_mkfs("elm", FS_FATS_NAME) != 0)
        {
            LOG_E("Failed to initialize filesystem! ");
        }
        else {

            dfs_mount(FS_FATS_NAME, "/user", "elm", 0, 0);
        }
    }

发现 我使用tftp 的时候

msh /user/webnet>tftp -s
tftp server is runmsh /user/webnet>server write file err! disconnect client
server write file err! disconnect client
server write file err! disconnect client
server write file err! disconnect client

msh /user/webnet>
msh /user/webnet>
msh /user/webnet>
msh /user/webnet>
msh /user/webnet>server write file err! disconnect client
server write file err! disconnect client
server write file err! disconnect client
server write file err! disconnect client
server write file err! disconnect client

我就好奇了 这为啥不行
然后 我就直接把elm文件系统直接挂载在根目录下

        flash_dev = fal_blk_device_create(FS_FATS_NAME);
        if (flash_dev == NULL){
            LOG_D("Can't create a block device on '%s' partition.\n", FS_FATS_NAME);
            return -1;
        }
        if (dfs_mount(FS_FATS_NAME, "/", "elm", 0, 0) != 0)
        {
            if(dfs_mkfs("elm", FS_FATS_NAME) != 0)
            {
                LOG_E("Failed to initialize filesystem! ");
            }
            else {

                dfs_mount(FS_FATS_NAME, "/", "elm", 0, 0);
            }
        }

tftp 就可以了 。。。。。

搞不懂 那要这个romfs干啥?

查看更多

关注者
0
被浏览
114
1 个回答
还没想好
还没想好 2021-01-06

romfs 能够保证 / 路径是 OK 的。

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览