This message will disappear after all relevant tasks have been resolved.
Semantic MediaWiki
There are 1 incomplete or pending task to finish installation of Semantic MediaWiki. An administrator or user with sufficient rights can complete it. This should be done before adding new data to avoid inconsistencies.Template:ArticleMainWriter Template:ArticleProposedVersion
1. Overview[edit source]
This stage will explain you how to create, build and execute a simple C code application using the freshly installed SDK.
2. Code[edit source]
- Create your directory that will host your source codes
mkdir $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/sources
- Create a directory for your user space example
mkdir $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/sources/gtk_hello_world_example cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/sources/gtk_hello_world_example
- Create the source code file for this user space example: hello_world_example.c
// SPDX-identifier: GPL-2.0 /* * Copyright (C) STMicroelectronics SA 2018 * * Authors: Jean-Christophe Trotin <jean-christophe.trotin@st.com> * */ #include <stdio.h> #include <unistd.h> int main(int argc, char **argv) { int i =11; printf("\nUser space example: hello world from STMicroelectronics\n"); setbuf(stdout,NULL); while (i--) { printf("%i ", i); sleep(1); } printf("\nUser space example: goodbye from STMicroelectronics\n"); return(0); }
3. Build[edit source]
3.1. Makefile-based project[edit source]
For this method, the cross-toolchain environment variables established by running the cross-toolchain environment setup script are subject to general make rules.
For example, see the following environment variables:
echo $CC arm-openstlinux_weston-linux-gnueabi-gcc -march=armv7ve -marm -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/local/SDK/2.4+openstlinux-4.14-rocko-mp1-18-07-03/sysroots/cortexa7hf-neon-vfpv4-openstlinux_weston-linux-gnueabi echo $CFLAGS -O2 -pipe -g -feliminate-unused-debug-types echo $LDFLAGS -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed echo $LD arm-openstlinux_weston-linux-gnueabi-ld --sysroot=/local/SDK/2.4+openstlinux-4.14-rocko-mp1-18-07-03/sysroots/cortexa7hf-neon-vfpv4-openstlinux_weston-linux-gnueabi
- Create the makefile for this user space example: Makefile
PROG = hello_world_example SRCS = hello_world_example.c OBJS = $(SRCS:.c=.o) CLEANFILES = $(PROG) INSTALL_DIR = ./install_artifact/usr/local/bin # Add / change option in CFLAGS if needed # CFLAGS += <new option> $(PROG): $(OBJS) $(CC) $(CFLAGS) -o $(PROG) $(OBJS) .c.o: $(CC) $(CFLAGS) -c $< -o $@ all: $(PROG) clean: rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) *~ install: $(PROG) mkdir -p $(INSTALL_DIR) install $(PROG) $(INSTALL_DIR)
- Cross-compile the project
make make install
4. Deploy and execute[edit source]
- Check that the generated binary for this user space example is in: ./install_artifact/usr/local/bin/hello_world_example
- Push this binary onto the board
scp -r install_artifact/* root@<board ip address>:/
- Execute this user space example
cd /usr/local/bin ./hello_world_example User space example: hello world from STMicroelectronics 10 9 8 7 6 5 4 3 2 1 0 User space example: goodbye from STMicroelectronics