Build Custom C/C++ Appļ
This guide provides step-by-step instructions for creating a custom C application and building it for the SiMa DevKit using the Palette SDKs. It covers developing a simple āHello Worldā program, configuring it for cross-compilation, and using the SDKās tools for building.
Note
While cross-compilation is the standard approach for both platforms, Modalix (eLxr) also supports On-Device compilation directly on the hardware. For more details on building directly on Modalix, see the On-Device Compilation section.
Before you run the following commands, ensure you have followed the cross compilation setup for your target platform (Yocto or eLxr).
Step 1. Create the Application Source Code
First, write a simple C program as your custom application.
Create a project directory and navigate to it:
user@palette-container-id:/home/docker/$mkdir ~/myproject
user@palette-container-id:/home/docker/$cd ~/myproject
Create a file named
hello.cwith the following content:
#include <stdio.h>
int main() {
printf("Hello, SiMa DevKit!\n");
return 0;
}
This basic program prints a greeting when executed.
Step 2. Compile the Application Using the SDK
To compile the program for the target architecture, you must be inside the correct SDK container and have the environment activated.
Compile the program:
user@palette-container-id:/home/docker/myproject$ $CC hello.c -o hello
Verify the build:
user@palette-container-id:/home/docker/myproject$ file hello
Output should resemble:
hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, ...
Step 3. Deploy the Application to the DevKit
To run the application, transfer it to the SiMa DevKit and execute it.
Copy the executable to the DevKit (e.g., via
scpif networked):user@palette-container-id:/home/docker/myproject$ scp hello sima@devkit-ip:~/
Replace
user@devkit-ipwith your DevKitās SSH credentials and IP address.Connect to the DevKit via SSH and run the application:
user@palette-container-id:/home/docker/myproject$ssh sima@devkit-ip "./hello"
Expected output:
Hello, SiMa DevKit!