Template:ArticleMainWriter Template:ArticleProposedVersion
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
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.
4. Import an existing example in SW4STM32 IDE[edit source]
- Open the import screen File > Import... and select Existing Project into Workspace
- 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
5. Build the firmware[edit source]
- Click the build button (the little hammer in the toolbar)
- If the following screen appear, click OK
- Build is 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]
The original firmware example receive a message for the host one channel end sent it back to to the host on the same channel.
We propose here to made some modification in the firmware in order to receive a message on one channel and to send the response on the second channel.
Further, we propose to make a led blinking when a message is receive from one channel