Modify, rebuild and reload a firmware

Revision as of 16:45, 8 February 2019 by Registered User

Template:ArticleMainWriter Template:ArticleProposedVersion


STM32MP157X-DK2.png
Develop on Arm® Cortex®-M4 What's next
Step category in.png Install the IDE Step.png Install STM32Cube MP1 package Step.png Modify, rebuild and reload a firmware Step category out.png

1. Overview[edit source]

This stage will explain you how to modify, rebuild and reload a STM32MP1 Arm® Cortex®-M4 coprocessor firmware.

2. Open SW4STM32 IDE[edit source]

  • Open System Workbench for STM32 IDE
File:SW4STM32 workspace.png
SW4STM32 workspace

3. Disconnect the built in SW4STM32 serial device[edit source]

  • For convenience and as you already have a Linux console connected to the board using minicom, please disconnect the console serial device embedded inside System Workbench for STM32.
File:SW4STM32 workspace serial disconnect 1.png
SW4STM32 disconnect the serial device by clicking this item
File:SW4STM32 workspace serial disconnect 2.png
SW4STM32 disconnect the serial device by clicking this item

4. Import an existing example in SW4STM32 IDE[edit source]

  • Open the import screen File > Import... and select Existing Project into Workspace
File:SW4STM32 import.png
SW4STM32 import screen
  • Browse and select OpenAMP_TTY_echo application example
    $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/STM32Cube_FW_MP1_V1.0.0/Projects/STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo
  • Click finish
  • The OpenAMP_TTY_echo project is open and you can browse inside using the left pan
File:SW4STM32 workspace project open.png
SW4STM32 workspace with project open

5. Build the firmware[edit source]

  • Click the build button (the little hammer in the toolbar)
  • If the following screen appear, click OK
File:SW4STM32 workspace project warning.png
SW4STM32 Warning: This board already exists
  • Build is finished with no error
File:SW4STM32 workspace project build finished.png
SW4STM32 build finished with no error

6. Upload the firmware[edit source]

  • Upload your firmware example into the board
 cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/STM32Cube_FW_MP1_V1.0.0/Projects/STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo/SW4STM32/OpenAMP_TTY_echo/
 scp Debug/OpenAMP_TTY_echo.elf root@<board ip address>:/lib/firmware

7. Start the firmware[edit source]

  • Verify that no firmware is currently runnig
 cat /sys/class/remoteproc/remoteproc0/state
offline

If offline is displayed, that means that no firmware is currently running. If running is displayed, a firmware is currently running. You shoul then stop it using the following command

 echo stop > /sys/class/remoteproc/remoteproc0/state
  • Set the firmware name to be executed
 echo -n OpenAMP_TTY_echo.elf > /sys/class/remoteproc/remoteproc0/firmware
  • Start the firmware
 echo start > /sys/class/remoteproc/remoteproc0/state
  • Verify that the firmware is runnig
 cat /sys/class/remoteproc/remoteproc0/state
running

8. Test the firmware[edit source]

The OpenAMP_TTY_echo firmware do the following:

  • CPU2(CM4) initialize OPenAMP MW which initializes/configures IPCC peripheral through HAL and setup openamp-rpmsg framwork infrastructure
  • CPU2(CM4) creates 2 rpmsg channels for 2 virtual UART instance UART0 and UART1
  • CPU2(CM4) is waiting for messages from CPU1(CA7) on these both channels
  • When CPU2(CM4) receives a message on 1 Virtual UART instance/rpmsg channel, it sends the message back to CPU1(CA7) on the same Virtual UART instance


  • Initialize the ttyRPMSG0 configuration
 stty -onlcr -echo -F /dev/ttyRPMSG0
  • Read constantly the ttyRPMSG0 channels in background
 cat /dev/ttyRPMSG0 &
  • Send a message on one ttyRPMSG0 channel and recieve the echo on the same ttyRPMSG0 channel
 echo "Hello Virtual UART0" > /dev/ttyRPMSG0
Hello Virtual UART0
  • You can perform the same steps with the ttyRPMSG1 channel


  • After playing a while you can stop the firmware
 echo stop > /sys/class/remoteproc/remoteproc0/state

9. Modify the example[edit source]

10. Rebuild and reload the example[edit source]


Back button.png Overview button.png Next button.png