cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157DK2 Hello world application error: Exec format error

ATuin
Associate II

Hello,

I'm new to the linux stuff, so i folowed the tutorial : create hello world application to the key.

At the end of:

https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm%C2%AE_Cortex%C2%AE-A7/Create_a_simple_hello-world_application

I try to run the program on the board but i get the 'error: Cannot execute binary file: exec format error' . I don't know if i forget something or something is missing. When i tried to make the file it was missing gtk3 so i install that myself but i couldn't find that anywhere in the tutorial.

Any help would be appreciated.

Thanks in advance :)

4 REPLIES 4
ADeck
Associate III

Are you sure you sourced the SDK environment script before running compiling the example code? If you don't do that, it is possible that make built targeting x86 and when you try to run on the ARM processor core in the STM32MP1 it doesn't understand the compiled code.

Thank for the reply.

If you mean by sourcing the sdk enviroment:

source SDK/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi

I tried re sourcing it, but that didn't help :(

For checking if the enviroment is setup correctly, i checked the following:

echo $ARCH

echo $CROSS_COMPILE

$CC --version

echo $OECORE_SDK_VERSION

and they all give the correct reponses, according to the tutorial.

Thanks for the suggestion.

Before i found the command uname and that gave me amd64, so i tried a bunch of stuff.

I restarted my computer and then i suddenly didn't have any premission to edit files.

After fixing that and working through visual studio code it suddenly worked.

Now the command uname says linux.

:) thanks

ADeck
Associate III

One trap you have to watch out for is you can't have the Bitbake environment script (that ships with the developer or distribution packages) sourced with the SDK environment script. You have to use them in separate terminals. I personally use TMUX to keep everything separated yet easily accessible.

Glad you got it working though! Good luck!