Compiling a demo application to run on the Miyoo
Compiling your first app can be daunting, let's get you setup!

WSL
Docker

WSL and Docker

What we'll be doing:
  1. Using docker to start a container
  2. Cloning a demo repository
  3. Compiling an application as armhf
  4. Running the app on device
Step 1: Make sure you have WSL2 and Docker setup:
  1. Setup WSL2 and Docker Click here: Setup WSL2 and Docker
Step 2: Open a terminal and cd to your WSL2 home location
  1. Open WSL2 Terminal: Open your installed Linux distribution from the Start menu (or right click in a directory and click "Open in terminal")

  2. Change Directory to Home:

    cd ~
    

Step 3: Clone and start the docker environment
  1. Clone the Union Miyoo Mini Toolchain Repository:

    git clone https://github.com/shauninman/union-miyoomini-toolchain.git
    

  2. Navigate to the Directory:

    cd union-miyoomini-toolchain
    

  3. Build and Run the Docker Environment:

    make shell
    

Step 4: Clone the "hello-miyoo-c" project
  1. Clone the Project Repository:

    git clone https://github.com/XK9274/hello-miyoo-c.git
    

  2. Navigate to the Project Directory:

    cd hello-miyoo-c
    

Step 5: Enter and build (make) the project
  1. Build the Project:
    make
    
Icon

root@29fa0688544a:~/workspace/hello_world# make

/opt/miyoomini-toolchain/usr/bin/arm-linux-gnueabihf-gcc main.c -o hellomiyoo -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7ve

root@29fa0688544a:~/workspace/hello_world#

Step 6: Check we've compiled against the correct arch

Let's check that we actually did crosscompile the binary to armhf!

Icon

root@29fa0688544a:~/workspace/hello_world# file ./hellomiyoo

./hellomiyoo: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped

root@29fa0688544a:~/workspace/hello_world#

root@29fa0688544a:~/workspace/hello_world# Great!

Step 7: Time to copy to your device and run it!

We need to get the file over to the Miyoo now! You can either pull the SDCARD or:

  1. Copying the Built Project to Your Device: Use your weapon of choice for getting the file onto the device, some options here are:

Step 8: Run the app!
  1. Browse to the location you added the binary to the device using Telnet or SSH and run it!

For example; I've added the hello-miyoo file to the SDCARD root:

Icon

/mnt/SDCARD # ./hellomiyoo

Hello!

Congratulations!!

Current date and time: 2024-05-22 20:20:09

Screen width: 640, Screen height: 480

/mnt/SDCARD #


Or, through the Simple Terminal app:

Terminal

Success!