How to start M4 on startup of STM32MP1?
I realize this is probably a pretty basic question but I haven't found a way to have the M4 portion of the firmware startup when the STM32MP1 is powered up. I'm currently using an STM32MP157D-DK1 board, if that helps.
I was able to debug the code of the OpenAMP_TTY_echo_wakeup_CM4 example and all was working except trying to put the A7 to sleep (which made sense in my head. Putting it to sleep could be problematic if I'm still debugging. That said, it's still an issue when not in debug mode but I might save this for a separate thread). When I end debug mode and reset the device, the program stops (which also makes sense as I assume either the M4 is not actually programmed or the program is not setup to start on reset).
I found a video (https://www.youtube.com/watch?v=PsiFDHH87vo&t=600s) that shows how to load the firmware by moving the elf file via a flash drive and placing it in that folder (though apparently, putting it in debug mode essentially does the same thing, unless there's a difference between the built version in STM32CubeIDE and the debug version that is placed from debug mode, which could potentially explain why I'm having issues putting the A7 to sleep), and then running the following commands:
cd /
echo OpenAMP_TTY_echo_wakeup_CM4.elf > /sys/class/remoteproc/remoteproc0/firmware
echo start >/sys/class/remoteproc/remoteproc0/state
This seemed to work for me but, as expected, if I reset the board, the M4 program is no longer running. Is there a way to set the board up so it starts starts up the program and runs a few additional scripts (such as setting up the ttyRMGSG0)?
Any help you can give me would be appreciated. Thanks!
Bonus Issue (can put this in another thread if necessary)
I had a few other issues with putting the A7 to sleep. I was running the following as recommended by the example
echo enabled > /sys/devices/platform/soc/4c001000.mailbox/power/wakeup (legitimately have no idea what this does)
echo "*delay" >/dev/ttyRPMSG0
systemctl suspend
But got the following back:
[ 751.096596] Filesystems sync: 0.025 seconds
[ 751.125951] Freezing user space processes
[ 751.162043] Freezing user space processes completed (elapsed 0.033 seconds)
[ 751.167838] OOM killer disabled.
[ 751.170818] Freezing remaining freezable tasks
[ 751.177208] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[ 751.183265] printk: Suspending console(s) (use no_console_suspend to debug)
[ 751.199627] dwc2 49000000.usb-otg: suspending usb gadget configfs-gadget.g1
[ 751.310081] stm32-dma 48001000.dma-controller: Suspend is prevented by Chan 1
[ 751.310127] stm32-dma 48001000.dma-controller: PM: dpm_run_callback(): platform_pm_suspend+0x0/0x48 returns -16
[ 751.310188] stm32-dma 48001000.dma-controller: PM: failed to suspend: error -16
[ 751.310218] PM: Some devices failed to suspend, or early wake event detected
[ 751.357342] dwmac4: Master AXI performs any burst length
[ 751.357399] stm32-dwmac 5800a000.ethernet end0: No Safety Features support found
[ 751.357446] stm32-dwmac 5800a000.ethernet end0: IEEE 1588-2008 Advanced Timestamp supported
[ 751.357535] stm32-dwmac 5800a000.ethernet end0: configuring for phy/rgmii-id link mode
[ 751.470050] dwc2 49000000.usb-otg: resuming usb gadget configfs-gadget.g1
[ 751.671732] dwc2 49000000.usb-otg: new device is high-speed
[ 751.777167] onboard-usb-hub 1-1: reset high-speed USB device number 2 using ehci-platform
[ 751.799892] dwc2 49000000.usb-otg: new device is high-speed
[ 751.872899] dwc2 49000000.usb-otg: new address 51
[ 756.227589] OOM killer enabled.
[ 756.230635] Restarting tasks ...
[ 756.232538] usb 1-1.1: USB disconnect, device number 3
[ 756.242584] done.
[ 756.243203] random: crng reseeded on system resumption
[ 756.251900] PM: suspend exit
The issues seem to start on line 9. Something seems to be stopping the device from going into suspend mode, no idea what "Chan 1" is or why it's blocking it.
