cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging M4 in Production Mode, buildroot linux

MSven.2
Associate II

Hi,

I'm using a custom buildroot build (2021.11) with linux 5.15.13, on the stm32mp157f-ev1 board.

I can load an .elf M4 firmware into the M4 core and start it, using /sys/class/remoteproc/remoteproc0

However, I can't use the debugging feature of STM32CubeIDE. I get an error in "final launch sequence".

0693W00000JOx4BQAT.png 

It works fine when I'm running the standard ST linux distribution however.

Does anybody know, what is required for CubeIDE debugging to work on the M4 core in production mode?

I notice some ST stuff missing from linux 5.15.13, compared to the 5.10.61 linux used in the ST distribution: rproc_srm_core, rproc_srm_dev, tee_remoteproc, rpmsg_tty. Any of this required for CubeIDE debugging?

1 ACCEPTED SOLUTION

Accepted Solutions
MSven.2
Associate II

Hi @LudovicR​ and @Community member​ ,

I figured out the last detail now.

The MPU SSH was enabled and working ("Open Command Shell" works), but debug still failed.

Under Window -> Preferences -> Remote Development -> Remote Connections -> "Remote Services: SSH" -> "MPU SSH" -> "Advanced", I need to either disable "Use login shell", or change it to /bin/sh.

Now everything works fine!

Probably my issue was that I don't have /bin/bash, but only /bin/sh. Funny that MPU SSH -> Open Command Shell worked fine though.

Thanks for all your help, I'm very happy now! 🙂

View solution in original post

10 REPLIES 10
Olivier GALLIEN
ST Employee

Hi @MSven.2​ ,

CubeIDE rely on some network service such as ssh, ifconfig and sftp server to load the .elf on target.

Since you are using a more recent / non validated version than the one certified by ST you may encounter few issues around this.

eg could you please display what give ifconfig on your target ?

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
MSven.2
Associate II

Hi Olivier,

Thanks for your help!

ssh is on the target, and scp, but not sftp.

ifconfig:

~ # ifconfig -a

can0     Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

         NOARP MTU:16 Metric:1

         RX packets:0 errors:0 dropped:0 overruns:0 frame:0

         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

         collisions:0 txqueuelen:10

         RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

         Interrupt:68

eth0     Link encap:Ethernet HWaddr F2:74:59:89:C6:AE

         inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0

         UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

         RX packets:74 errors:0 dropped:0 overruns:0 frame:0

         TX packets:37 errors:0 dropped:0 overruns:0 carrier:0

         collisions:0 txqueuelen:1000

         RX bytes:7714 (7.5 KiB) TX bytes:5008 (4.8 KiB)

         Interrupt:61 Base address:0xc000

lo       Link encap:Local Loopback

         inet addr:127.0.0.1 Mask:255.0.0.0

         UP LOOPBACK RUNNING MTU:65536 Metric:1

         RX packets:4 errors:0 dropped:0 overruns:0 frame:0

         TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

         collisions:0 txqueuelen:1000

         RX bytes:340 (340.0 B) TX bytes:340 (340.0 B)

Olivier GALLIEN
ST Employee

Hi @MSven.2​ ,

ok ifconfig format looks good and CubeIDE might not have problem to grep the Ip address.

You should get green light and address on bottom right corner ( serial target widget ) right ?

0693W00000JOxgoQAD.pngsftp good track to follow ..

It's a core service on Yocto side .. I don't know for buildroot.

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
MSven.2
Associate II

Hi @Community member​ ,

Thanks, I got a bit further now.

I included sftp server in my target build, and now CubeIDE actually transfers the .elf file to the target, in /usr/local/projects/my_project_name.

However, I then get another error:

0693W00000JOxs6QAD.png 

The m4 program does not start.

But, if I manually run the fw_cortex_m4.sh shellscript that CubeIDE made in /usr/local/projects/my_project_name, it works fine and runs the m4 program (after a "chmod o+x" to make it executable).

And once "chmod o+x" done, did you succeed to relaunch witch CubeIDE ?

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
MSven.2
Associate II

@Community member​ ,

No, CubeIDE overwrites the script, and sets permissions to owner read/write only, no execute.

I made the script write protected, but CubeIDE still manages to overwrite it.

LudovicR
ST Employee

Hello @MSven.2​ 

I understand you have updated your target device with sftp-server so you are able to browse it from an xterm of you Linux PC with "sftp root@192.168.7.1".

Could you please open connections inside STM32CubeIDE using menu:

Window > Show View > Otrhers.. Connections > Connections

and check if "MPU SSH" is present

0693W00000JP78OQAT.png 

If not please add it, with New Connection icon.

You should be able to open this connection, and Open Command Shell.

Then, you can try to debug production mode.

Hope this help,

LudovicR

MSven.2
Associate II

@Community member​ and @LudovicR​ ,

I have figured out a workaround.

I need to first download the m4 firmware to the target, which creates the /usr/local/project/my_project_name files, including the fw_cortex_m4.sh file. This results in a failure in the STM32CubeIDE, as it can't start the downloaded firmware.

Then I need to "chmod +x fw_cortex_m4.sh", and then change the STM32CubeIDE settings, so the debug process does not download the target firmware. Then it works fine, and the STM32CubeIDE debugger works!

So the issue seems to be that STM32CubeIDE can't set the file permissions on the shellscript correctly to allow execution. But I can do this manually without issue when I log in with sftp. And STM32CubeIDE can do it on the STlinux...

Do you know how STM32CubeIDE sets the file permissions? Is there maybe a script on the STlinux build?

Thanks for all your help!

LudovicR
ST Employee

Hi @MSven.2​ ,

I guess your issue is linked to "MPU SSH" connnection not present.

Could you try after setting it up?

LudovicR