Search code examples
ramu-boottftp

Is a software image loaded into non-volatile RAM when using tftpboot from U-boot?


I have a Xilinx development board connected to a RHEL workstation.

I have U-boot loaded over JTAG and connect to it with minicom.

Then I tftpboot the helloworld standalone application.

Where do these images go?

I understand I am specifying a loadaddr, but I don't fully understand the meaning.

When I run the standalone application, I get various outputs on the serial console.

I had it working correctly the first time, but then started trying different things when building.

It almost feelings like I am clobbering memory, but I assumed after a power cycle anything tftp'd would be lost.

The issue stills occurs through a power cycle though.


Solution

  • Where do these images go?

    The U-Boot command syntax is:

    tftpboot [loadAddress] [[hostIPaddr:]bootfilename]
    

    You can explicitly specify the memory destination address as the loadAddress parameter.

    When the loadAddress parameter is omitted from the command, then the memory destination address defaults to the value of the environment variable loadaddr.
    Note that several other U-Boot commands also use this loadaddr variable, such as "bootp", "rarpboot", "loadb" and "diskboot".

    I understand I am specifying a loadaddr, but I don't fully understand the meaning.

    When I run the standalone application, I get various outputs on the serial console.

    The loadAddress is simply the start address in memory to which the file transfered will be written.
    For a standalone application, this loadAddress should match the CONFIG_STANDALONE_LOAD_ADDR that was used to link this program.

    Likewise the "go" command to execute this standalone application program should use the same CONFIG_STANDALONE_LOAD_ADDR.


    For example, assume the physical memory of your board starts at 0x20000000.
    To allow the program to use the maximum amount of available memory, the program is configured to start at:

    #define CONFIG_STANDALONE_LOAD_ADDR        0x20000000
    

    For convenient loading, define the environment variable (at the U-Boot prompt):

    setenv loadaddr 0x20000000   
    

    Assuming that the serverip variable is defined with the IP address of the TFTP server, then the U-Boot command

    tftpboot hello_world.bin  
    

    should retrieve that file from the server, and store it at 0x20000000.
    Use

    go 20000000  
    

    to execute the program.


    I assumed after a power cycle anything tftp'd would be lost.

    It should.
    But what might persist in "volatile" memory after a power cycle is unpredictable. Nor can you be assured of a default value such as all zeros or all ones. The contents of dynamic RAM should always be presumed to be unknown unless you know it has been initialized and has been written.

    Is a software image loaded into non-volatile RAM when using tftpboot from U-boot?

    Only if your board has main memory that is non-volatile (e.g. ferrite core or battery-backed SRAM, which are not likely).
    You can use the "md" (memory display) command to inspect RAM.