<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.somlabs.com/index.php?action=history&amp;feed=atom&amp;title=Building_simple_C_program_for_VisionSOM-STM32MP1</id>
	<title>Building simple C program for VisionSOM-STM32MP1 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.somlabs.com/index.php?action=history&amp;feed=atom&amp;title=Building_simple_C_program_for_VisionSOM-STM32MP1"/>
	<link rel="alternate" type="text/html" href="https://wiki.somlabs.com/index.php?title=Building_simple_C_program_for_VisionSOM-STM32MP1&amp;action=history"/>
	<updated>2026-04-28T08:30:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.somlabs.com/index.php?title=Building_simple_C_program_for_VisionSOM-STM32MP1&amp;diff=1729&amp;oldid=prev</id>
		<title>KrzysztofChojnowski: Created page with &quot;{{PageHeader|Building simple C program for VisionSOM-STM32MP1}} __toc__  This article describes how to build a simple Hello World C application fo the VisionSOM-STM32MP1 modul...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.somlabs.com/index.php?title=Building_simple_C_program_for_VisionSOM-STM32MP1&amp;diff=1729&amp;oldid=prev"/>
		<updated>2020-01-31T13:46:27Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{PageHeader|Building simple C program for VisionSOM-STM32MP1}} __toc__  This article describes how to build a simple Hello World C application fo the VisionSOM-STM32MP1 modul...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{PageHeader|Building simple C program for VisionSOM-STM32MP1}} __toc__&lt;br /&gt;
&lt;br /&gt;
This article describes how to build a simple Hello World C application fo the VisionSOM-STM32MP1 module. To do this we need to have the installed toolchain as described in the article [[OpenSTLinux for VisionSOM-STM32MP1]]. In this example the toolchain is installed in the &amp;#039;&amp;#039;/opt/st/stm32mp157a-visionsom-mx/2.6-snapshot&amp;#039;&amp;#039; directory.&lt;br /&gt;
&lt;br /&gt;
= Configuring the environment =&lt;br /&gt;
&lt;br /&gt;
The environment configuration script is installed with the toolchain. We need to call it in order to configure required environmental variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
. /opt/st/stm32mp157a-visionsom-mx/2.6-snapshot/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can verify it by checking the value of the CC variable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo $CC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the example output looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
arm-openstlinux_weston-linux-gnueabi-gcc -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/opt/st/stm32mp157a-visionsom-mx/2.6-snapshot/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnuea&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration step has to be repeated in each terminal separatelly every time after opening it.&lt;br /&gt;
&lt;br /&gt;
= Building the example code =&lt;br /&gt;
&lt;br /&gt;
Now we can create a simple program in the HelloWorld.c file: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
	printf(&amp;quot;Hello world!\n&amp;quot;);&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and compile it using the previously prepared terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$CC -o HelloWorld HelloWorld.c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created executable can be run only on ARM architecture - it can be verified by calling the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
file HelloWorld&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output contains the details about the binary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HelloWorld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.2.0, BuildID[sha1]=0ba619f33a20c2521f445510df799064aa330e2f, with debug_info, not stripped&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now it is time to upload the executable file to the target using ssh or by copying it directly to the SD card and running it from the target terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@stm32mp157a-visionsom-mx:~# ./HelloWorld &lt;br /&gt;
Hello world!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>KrzysztofChojnowski</name></author>
	</entry>
</feed>