English 中文(简体)
阅读文档将超过保留记忆。 Failed toload hello_world.bin with U-room 2022.04 by technexion
原标题:Reading file would overwrite reserved memory. Failed to load hello_world.bin with U-boot 2022.04 by technexion

首先,我必须对以下专题的行为和结果表示歉意。 我发现,这个问题也出现在乌姆,改变装置树(地块)对于解决这一问题并不重要。

This is so true that currently, not even technexion s U-boot 2021.04 pulling directly from github is working without the error mentioned above.

阅读文档将超过保留记忆。 Failed toload hello_world.bin

我与承运人委员会有imx7d-pico。 这一微薄的计算机被大量用于安星。 PDF(数据表)易于找到。

顺便说一句,这里叙述了事件的顺序:

2022年4月 我定制了2021.04号技术boot,这些技术boot在没有<代码>error的情况下进行工作:阅读文档将超时保留<>/代码>。

2023年4月 我再一次从技术专家那里定制了2021.04的U-room 2022.04和U-post 202.04, 而这种u子(DOES NOT)的工作则更是。 我曾发表过:Reading file will overwrite reservations memory ** Failed toload hello_world.bin , 当我尝试fatloadmmc 0:1 0x7F8000 hello_world.bin

I put #define LOG_DEBUG to the top of lmb.c and I see some debugging about the reserved memory:

lmb.c when RPMsg work: https://gist.github.com/neuberfran/c4df18a27974cd6fdc8a967f192d54d6

lmb.c when RPMsg not Work: https://gist.github.com/neuberfran/aebbac2db52c5f78c680f10496cb8784

printenv result U-boot 2021.04 to imx7d-pico When RPMsg not work https://gist.github.com/neuberfran/f07e3d2d83c0f311bdebbf4c12646df8

我对 im子/dev树和 im子/dev树做了一些改动,但还做了一些工作。

www.un.org/spanish/ecosoc 我如何解决我的问题?

“enterography

最佳回答

I have imx7d-pico with Carrier board.
...
I have issue: Reading file would overwrite reserved memory ** Failed to load hello_world.bin,

Your use of an SoC that has both a microprocessor and an auxiliary microcontroller with shared memory is a salient point. Refer to the NXP Appnote (esp. Table 5) for details. The use of multiple memory address ranges probably makes your problem a boundary case that U-Boot developers may have overlooked.

很显然,U-Boot在能够装上空间的档案(可能是为了帮助发现错误)方面,已经变得更加严格。 液压板结构的垃圾堆放清楚表明,某些U-Boot指挥部只能获取主要记忆,即0x80000至0xbfffff。 由于获得辅助处理器记忆的地址空间(0x7f8000至0x7fff)不属于这一主要记忆范围,因此这一附属记忆区无法由各种负荷文件指挥所解释。

错误信息的根源在于U-Boot的“图书馆”,lib/lmb.c。 程序lmb_init_and_serv()仅根据U-Boot的遗产定义分配现有(因而可装)记忆空间。

遗产法依靠宏观定义,如CFG_SYS_SDRAM_BASE,通常在一份针对理事会的负责人档案中加以界定。 例如,以下定义摘自include/configs/imx7-cm.h><<>>>/strong>:

#define CFG_SYS_SDRAM_BASE      PHYS_SDRAM
#define CFG_SYS_INIT_RAM_ADDR   IRAM_BASE_ADDR
#define CFG_SYS_INIT_RAM_SIZE   IRAM_SIZE

然后在common/pad_f.c上,SDRAM基面地址被分配到用于U-Boot使用的RAM基面地址的全球数据变量上:

static int setup_dest_addr(void)
{
    ...
    gd->ram_base = CFG_SYS_SDRAM_BASE;

委员会信息结构的第一个记忆库后来填充了common/板_f.c的全球数据记忆:

__weak int dram_init_banksize(void)
{
    gd->bd->bi_dram[0].start = gd->ram_base;
    gd->bd->bi_dram[0].size = get_effective_memsize();

    return 0;
}

这是后来用于填充LMB结构(lib/lmb.c)的理事会记忆:

/* Initialize the struct, add memory and call arch/board reserve functions */
void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, void *fdt_blob)
{
    int i;

    lmb_init(lmb);

    for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
        if (bd->bi_dram[i].size) {
            lmb_add(lmb, bd->bi_dram[i].start,
                bd->bi_dram[i].size);
        }
    }

    lmb_reserve_common(lmb, fdt_blob);
}

So the Logical Memory Block "library" relies on U-Boot s legacy method for defining memory.
That means the memory definitions in the Device Tree are ignored by U-Boot.


When you try to load a file from a storage device to memory, the following procedure is called in fs/fs.c

#ifdef CONFIG_LMB
/* Check if a file may be read to the given address */
static int fs_read_lmb_check(const char *filename, ulong addr, loff_t offset,
                 loff_t len, struct fstype_info *info)
{
    ...
    lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
    lmb_dump_all(&lmb);

    if (lmb_alloc_addr(&lmb, addr, read_len) == addr)
        return 0;

    log_err("** Reading file would overwrite reserved memory **
");
    return -ENOSPC;
}
#endif

Note the conditional compilation for this routine that performs the memory check.
I tied to build a version of U-Boot 2022.01 without CONFIG_LMB, but the build failed. So even though CONFIG_LMB appears to be an optional library selection in the menuconfig, there seems to be source code changes needed to de-select CONFIG_LMB.
So you cannot try to bypass this memory check by building an alternate configuration of U-Boot.



A Workaround

Rather than try to define the aux memory as a bank of main memory, there is a simple & easy workaround to use a recent & unmodified U-Boot in your situation. Instead of loading the file directly to the auxiliary processor memory, simply load the file to main memory at 0x80008000, and then perform a copy of 32KB to the aux memory at tcm_addr.
The loadm4image variable should be changed to:

loadm4image=fatload mmc ${mmcdev}:${mmcpart} 80008000 ${m4image}; 
cp.b 80008000 ${tcm_addr} 8000

This can be accomplished with the following command to the previously posted environment:

setenv loadm4image  fatload mmc ${mmcdev}:${mmcpart} 80008000 ${m4image}; cp.b 80008000 ${tcm_addr} 8000 
问题回答

作为可接受的答案的一种替代办法,我遇到了一个类似的问题,试图把RTOS图像装上装置树文档中确定的记忆。

我的解决办法是在fs/Kconfig中设定一个条目,以便能够在文件/fs.c文档的顶端编定一个时间旗帜和使用。





相关问题
Steps to read data from ARM microcontroller port

I am having trouble reading serial data from ARM LPC2378 microcontroller. Will I have to use UART or any GPIO port can be used?? is ayone having c code for it??

high speed tracing

I have an embedded board with a 32 Micro-controller, and an custom built OS, Unfortunately, as of now, connection to the PC is only through serial port, Internal memory is limited to 512KB. There are ...

Affordable, programmable device with gprs and simple sensors?

I ve got quite a fun challenge / work assignment. I m to monitor a couple of 5V light bulbs (warning lights) on a machine standing far out in no man s land. I m looking for an affordable device with ...

Alarm history stack or queue?

I m trying to develop an alarm history structure to be stored in non-volatile flash memory. Flash memory has a limited number of write cycles so I need a way to add records to the structure without ...

LD linker: Target address aligning but not address in ROM

I have a program that s resident in flash and will run from flash. Early in the program data segments are copied from flash to ram. I m using a linker script like (simplified): .text : { *(....

clear code for counting from 0 to 255 using 8-bit datatype

I was wondering if there is a clean way of counting from 0 to 255 using an 8 bit datatype, something like: for(uint8_t i(0);i<=255;++i) { .... } This obviously will not work but it makes it ...