0

I'm using a Cyclone V HPS and my application file is now booted from a SD card. For some reasons, my SD card is now fixed on the board and unable to be removed from the socket. Therefore, I'm trying to update my files over serial port using u-boot. As far as I've known, there is a command name loady to get files from PC via serial port (How to send binary flashing file to embedded system with only serial console?). My only concern now is that I don't know what would happen to my old file after transferring new file ? Does the new file overwrite the old one or they are two different files ? If they really are two different files, then is there a way to delete my old file ?

  • Files are transfered to RAM first, **then** they will be flashed. I doubt U-Boot supports direct writing from UART, besides the fact that this is very fragile. – 0andriy Nov 13 '21 at 13:30

1 Answers1

0

The loady command loads a file into memory, cf. https://u-boot.readthedocs.io/en/latest/usage/loady.html. It does not touch any file system.

To verify the integrity you could use the sha1sum command.

If you want to write the uploaded file to the SD card, you have to use the save command. You can overwrite the old file or create a new one. Use the variable $filesize set by loady to specify the file length.

If you use a FAT file system you, can issue the fatrm command to remove a file.

If any of the commands is available, depends on the configuration that you used for building U-Boot.

Xypron
  • 2,215
  • 1
  • 12
  • 24
  • Thanks for your help. I've done writing my new binary file to SD card by doing this way: First, I'm using the loady command and transfer my new binary file over serial port by ymodem transfer (the TeraTerm Software). Then, I'm writing my new file to the SD card by using the fatwrite command supported by u-boot (my command is: fatwrite mmc 0 $loadaddr myfile.bin . At the moment, my application is now updated to the latest file, which means that my writing process is succesful. However, I still wonder if is there any drawback to this process ? – JacobMuller Nov 14 '21 at 03:25
  • @JacobMuller, as answer mentioned you need to prove integrity by running `sha1sum` or so and send it as weel to the remote, so U-Boot can test it before writing. – 0andriy Nov 14 '21 at 12:47