Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX8M-L/Development/Hello World example

231 bytes removed, 17:58, 15 February 2022
no edit summary
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|X1.Y0.Z0|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month YearFeb 2022|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD|-|-|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|[TBD_link X.Y.Z]|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year|style="border-left:solid 2px #73B2C7; borderFirst DESK-right:solid 2px #73B2C7;borderMX8M-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBDL release
|-
|}
=== Setting the cross-compiler ===
It is assumed that the development environment has been set up properly as described [[DESK-MX6MX8-L#Quick_start_guide|here]].
* start the Linux development VM and login into the system
* open a terminal window and ''cd'' into your source code directory
* configure the build environment
<pre class="workstation-terminal">
dvdk@vagrant:~/myproject$ source /home/dvdk/desk-mx-l/desk-mx6mx8m-l-12.0.0_env0-rc2_env.sh
</pre>
<pre class="workstation-terminal">
dvdk@vagrant:~/myproject$ echo $CC
armaarch64-poky-linux-gnueabi-gcc -marchmcpu=armv7cortex-a a53+crc+crypto -mfpufstack-protector-strong -D_FORTIFY_SOURCE=neon 2 -mfloatWformat -abi=hard Wformat-security -mcpuWerror=cortexformat-a9 security --sysroot=/home/dvdk/desk-mx-l/sdk/desk-mx6mx8m-l-12.0.0-rc2-toolchain/sysroots/cortexa9hf-neonaarch64-poky-linux-gnueabi
dvdk@vagrant:~/myproject$
</pre>
* invoke the cross-compiler for compiling your source code example: the object file obtained, is a proper ELF 3264-bit for the target microprocessor
<pre class="workstation-terminal">
dvdk@vagrant:~/myproject$ $CC hello.c -o hello
dvdk@vagrant:~/myproject$ file hello
hello: ELF 3264-bit LSB executableshared object, ARMaarch64, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhfaarch64.so.31, BuildID[sha1]=497fafcb543f87ac45afb33d43506381c3473e7b, for GNU/Linux 3.214.0, BuildID[sha1]=212bc8245d6274bb4ed675b71128b0e835870fab, not stripped
dvdk@vagrant:~/myproject$
</pre>
=== Running the example on the target ===
Now it is enough to copy the object file in the <code>/home/root</code> rfs directory and [[ORCA SOM/DESK-MX8M-L/General/Booting_from_NFS | boot from nfs...]]
<pre class="workstation-terminal">
dvdk@vagrant:~/myproject$ sudo cp hello /home/dvdk/desk-mx-l/rfs/desk-mx6mx8m-l/home/root/dvdk@vagrant:~/myproject$ sudo ls -la /home/dvdk/desk-mx-l/rfs/desk-mx6mx8m-l/home/root/total 3224drwx------ 2 root root 4096 Jun 8 12Feb 15 18:36 53 .drwxr-xr-x 3 root root 4096 Jan 28 2320 16:54 44 ..-rwxr-xr-x 1 root root 16432 Jun 8 1213256 Feb 15 18:36 53 hello-rw-r--r-- 1 root root 1011 Nov 25 2020 .profile
dvdk@vagrant:~/myproject$
</pre>
...
...
[ OK ] Started Terminate Psplash Boot ScreenNFS status monitor for NFSv2/3 locking.. Starting Permit User Sessions...[ OK ] Started /etc/rcTarget Communication Framework agent.local Compatibility[ OK ] Started Xinetd A Powerful Replacement For Inetd. Starting Hostname [ OK ] Started Kernel Logging Service... Starting WPA supplicant..[ OK ] Started Permit User Sessions.[ OK ] Started Serial Getty on ttymxc2Avahi mDNS/DNS-SD Stack.
[ OK ] Started Getty on tty1.
[ OK ] Started WPA supplicantSerial Getty on ttymxc1.[ OK ] Reached target Login Prompts.[ OK ] Reached target Multi-User System. Starting Update UTMP about System Runlevel Changes...[ OK ] Started Hostname ServiceUpdate UTMP about System Runlevel Changes.
NXP i.MX Release Distro 5.4.14-sumo zeus desk-mx6 ttymxc2mx8mp ttymxc1
desk-mx6 mx8mp login: rootroot@desk-mx6mx8mp:~# ls -la
total 32
drwx------ 2 3 root root 4096 Jun 8 2021 Dec 15 21:35 .drwxr-xr-x 3 root root 4096 Jan 28 20 2021 2022 ..-rw-r--r---- 1 root root 7 Dec 15 1011 Nov 25 2020 2021 .profilebash_history-rwxr-xr-x 1 root root 16432 Jun 8 2021 13256 Dec 15 21:35 helloroot@desk-mx6mx8mp:~# ./hello
Hello, World!
root@desk-mx6mx8mp:~#
</pre>
----
[[Category:ORCA]] [[Category:MITO 8M Mini]]
8,256
edits