Migrating STM32F7 SOM to Release 2.1.x Print


This note explains how to upgrade the STM32F7 SOM running earlier release to Release 2.1.x. The procedure below assumes that you have configured networking in U-Boot and placed the release 2.1.x images to the TFTP directory on your host.

Note that the layout of the Flash partitions has changed in Release 2.1.x. If you are using the JFFS2 partition (/dev/mtd2), preserve it contents (for example, using NFS mount) before running the upgrade.

Perform the following step-wise procedure to migrate:

  • Reboot and stop at the U-Boot prompt:
  • U-Boot 2010.03-cortexm-1.14.4 (Jun 22 2016 - 16:45:51)

    CPU : STM32F7 (Cortex-M7)
    Freqs: SYSCLK=200MHz,HCLK=200MHz,PCLK1=50MHz,PCLK2=100MHz
    Board: STM32F7 SOM Rev 1.A, www.emcraft.com
    DRAM: 32 MB
    Flash: 16 MB
    In: serial
    Out: serial
    Err: serial
    Net: STM32_MAC
    Hit any key to stop autoboot: 0
    STM32F7-SOM>

  • Print the current U-Boot environment. This information will be needed at the later steps.
  • STM32F7-SOM> printenv
    bootargs=stm32_platform=stm32f7-som console=ttyS0,115200 panic=10
    bootcmd=run flashboot
    bootdelay=3
    baudrate=115200
    hostname=stm32f7-som
    loadaddr=0xC0007FB4
    args=setenv bootargs stm32_platform=stm32f7-som console=ttyS0,115200 panic=10
    addip=setenv bootargs ${bootargs}
    ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
    flashaddr=60020000
    envmaddr=08040000
    stdin=serial
    netboot=tftp ${image};run args addip;bootm
    envmboot=run args addip;bootm ${envmaddr}
    envmupdate=tftp ${image};cptf ${envmaddr} ${loadaddr} ${filesize}
    flashboot=run args addip;bootm ${flashaddr}
    update=tftp ${image};prot off ${flashaddr} +${filesize};era ${flashaddr} +${filesize};cp.b ${loadaddr} ${flashaddr} ${filesize};setenv kernelsize ${filesize};setenv filesize;  setenv fileaddr;saveenv
    ethact=STM32_MAC
    ipaddr=172.17.44.31
    serverip=172.17.0.1
    kernelsize=20A158
    image=my.uImage
    ethaddr=3C:FB:96:02:04:5B

    Environment size: 900/4092 bytes
    STM32F7-SOM>

  • Update the U-Boot image. The system will reset. Stop at the U-Boot prompt.
  • STM32F7-SOM> tftp psl/stmf7/cm-2.1.0/u-boot.bin
    Auto-negotiation...completed.
    STM32_MAC: link UP (100/Half)
    Using STM32_MAC device
    TFTP from server 172.17.0.1; our IP address is 172.17.44.31
    Filename 'psl/stmf7/cm-2.1.0/u-boot.bin'.
    Load address: 0xc0007fb4
    Loading: #########
    done
    Bytes transferred = 119416 (1d278 hex)
    STM32F7-SOM> cptf 0x08000000 ${loadaddr} $(filesize} 1
    cptf: Updating eNVM. Please wait ...

    U-Boot 2010.03-cortexm-2.1.0 (Sep 19 2016 - 11:18:48)

    CPU : STM32F7 (Cortex-M7)
    Freqs: SYSCLK=200MHz,HCLK=200MHz,PCLK1=50MHz,PCLK2=100MHz
    Board: STM32F7 SOM Rev 1.A, www.emcraft.com
    DRAM: 32 MB
    Flash: 16 MB
    *** Warning - bad CRC, using default environment

    In: serial
    Out: serial
    Err: serial
    Net: STM32_MAC
    Hit any key to stop autoboot: 0
    STM32F7-SOM>

    Note that the message about the bad CRC is expected. Starting this release, U-Boot keeps its environment in the NOR Flash, rather than in the on-chip Flash of the STM32, as before. Consequently, when booted for the first time the updated U-Boot doesn't find the environment in the NOR Flash and prints the message indicating that the default environment, integrated in the U-Boot image, is used.

  • Configure networking in U-Boot (use the values saved with printenv above). Don't forget to restore the MAC address:
  • STM32F7-SOM> setenv ipaddr 172.17.44.31
    STM32F7-SOM> setenv serverip 172.17.0.1
    STM32F7-SOM> setenv ethaddr 3C:FB:96:02:04:5B
    STM32F7-SOM> savee
    Saving Environment to Flash...
    . done
    Un-Protected 1 sectors
    Erasing Flash...
    . done
    Erased 1 sectors
    Writing to Flash... done
    . done
    Protected 1 sectors
    STM32F7-SOM>

  • Check and update the load address in RAM, if it differs from 0xC0007FB4:
  • STM32F7-SOM> print loadaddr
    loadaddr=0xC0007FC0
    STM32F7-SOM> setenv loadaddr 0xC0007FB4
    STM32F7-SOM> savee
    Saving Environment to Flash...
    . done
    Un-Protected 1 sectors
    Erasing Flash...
    . done
    Erased 1 sectors
    Writing to Flash... done
    . done
    Protected 1 sectors
    STM32F7-SOM>

  • Update the Linux image in the NOR Flash:
  • STM32F7-SOM> setenv image psl/stmf7/cm-2.1.0/rootfs.uImage
    STM32F7-SOM> run update
    Auto-negotiation...completed.
    STM32_MAC: link UP (100/Half)
    Using STM32_MAC device
    TFTP from server 172.17.0.1; our IP address is 172.17.44.31
    Filename 'psl/stmf7/cm-2.1.0/rootfs.uImage'.
    Load address: 0xc0007fb4
    Loading: #################################################################
    #################################################################
    #################################################################
    done
    Bytes transferred = 5773923 (581a63 hex)
    ............................................. done
    Un-Protected 45 sectors

    ............................................. done
    Erased 45 sectors
    Copy to Flash... done
    Saving Environment to Flash...
    . done
    Un-Protected 1 sectors
    Erasing Flash...
    . done
    Erased 1 sectors
    Writing to Flash... done
    . done
    Protected 1 sectors
    STM32F7-SOM>

  • Reset and boot the new Linux image:
  • U-Boot 2010.03-cortexm-2.1.0 (Sep 19 2016 - 11:18:48)

    CPU : STM32F7 (Cortex-M7)
    Freqs: SYSCLK=200MHz,HCLK=200MHz,PCLK1=50MHz,PCLK2=100MHz
    Board: STM32F7 SOM Rev 1.A, www.emcraft.com
    DRAM: 32 MB
    Flash: 16 MB
    In: serial

    Out: serial
    Err: serial
    Net: STM32_MAC
    Hit any key to stop autoboot: 0
    ## Booting kernel from Legacy Image at 60020000 ...
    Image Name: Linux-4.2.0-cortexm-2.1.0
    Image Type: ARM Linux Multi-File Image (uncompressed)
    Data Size: 5773859 Bytes = 5.5 MB
    Load Address: c0008000
    Entry Point: c0008001
    Contents:
    Image 0: 5756576 Bytes = 5.5 MB
    Image 1: 17271 Bytes = 16.9 kB
    Verifying Checksum ... OK
    ## Flattened Device Tree from multi component Image at 60020000
    Booting using the fdt at 0x6059d6ec
    Loading Multi-File Image ... OK
    OK
    Loading Device Tree to c1ff8000, end c1fff376 ... OK

    Starting kernel ...

    Booting Linux on physical CPU 0x0
    Linux version 4.2.0-cortexm-2.1.0 ( This e-mail address is being protected from spambots. You need JavaScript enabled to view it ) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) ) #2 Mon Sep 19 11:19:44 +0400 2016
    ...
    Freeing unused kernel memory: 2652K (c02c5000 - c055c000)
    init started: BusyBox v1.17.0 (2016-09-19 11:07:14 +0400)
    / #