Installing uClinux on SmartFusion2 over UART Interface Print

 

The most easy and straightforward way of installing a uClinux image from U-Boot is downloading it over the Ethernet interface. If Ethernet is not available for any reason then the UART interface can be used instead. To install uClinux from U-Boot over the UART Interface, please see the steps below:

  1. Linux host preparation steps. Install the following packages on your Linux host:
    • picocom - a terminal emulation application;
    • lrzsz - a communication package providing YMODEM file transfer protocols.
  2. U-Boot environment settings.
    The default U-Boot environment contains a useful variable update that downloads a Linux kernel image via TFTP and puts it to Flash. We will define a similar variable updatey to download an image using the loady YMODEM U-Boot command:
    • Connect to the board with picocom (use your terminal device instead of ttyS2):
    • picocom --send-cmd "sb -vv" -l -b 115200 /dev/ttyS2

    • Define the updatey environment variable:
    • SF2-DEV-KIT> setenv updatey loady \${loadaddr}\;run spiprobe\;sf erase \${spiaddr} 0x3F0000\;sf write \${loadaddr} \${spiaddr} \${filesize}\;setenv spisize 0x\${filesize}\;saveenv

    • Verify the new variable:
    • SF2-DEV-KIT> print updatey
      updatey=loady ${loadaddr};run spiprobe;sf erase ${spiaddr} 0x3F0000;sf write ${loadaddr} ${spiaddr} ${filesize};setenv spisize 0x${filesize};saveenv
      SF2-DEV-KIT>

    • Define the bootcmd environment variable to boot from Flash:
    • SF2-DEV-KIT> setenv bootcmd run flashboot

    • Save the environment to the persistent storage:
    • SF2-DEV-KIT> saveenv
      Saving Environment to SPI Flash...
      Erasing SPI flash...Writing to SPI flash...done
      SF2-DEV-KIT>

  3. Installing the uClinux image to Flash over the UART interface.
    Before proceeding with the uClinux installation, place the uClinux image on the Linux host where picocom is running. After that:
    • Run the updatey command:
    • SF2-DEV-KIT> run updatey
      ## Ready for binary (ymodem) download to 0x0A007FC0 at 115200 bps...

    • At this point, type ^-A and then ^-S. The prompt will appear:
    • *** file:

    • Enter the full path to the uClinux image file to start downloading. It will take a few minutes to complete:
    • *** file: /tmp/networking.uImage
      sb -vv /tmp/networking.uImage
      Sending: /tmp/networking.uImage
      Ymodem sectors/kbytes sent: 0/ 0kRetry 0: NAK on sector
      Bytes Sent:1345792 BPS:9363
      Sending:
      Ymodem sectors/kbytes sent: 0/ 0k
      Transfer complete

      *** exit status: 0
      xyzModem - CRC mode, 10516(SOH)/0(STX)/0(CAN) packets, 4 retries
      ## Total Size = 0x001488c0 = 1345728 Bytes

      8192 KiB AT25DF641 at 0:0 is now current device
      Saving Environment to SPI Flash...
      Erasing SPI flash...Writing to SPI flash...done
      SF2-DEV-KIT>

  4. Next reset will load the newly installed image from Flash:
  5. SF2-DEV-KIT> reset
    resetting ...