iniciando o projeto

This commit is contained in:
2026-02-01 16:41:07 -03:00
commit 431ccb69db
12 changed files with 1840 additions and 0 deletions

126
CROSS_COMPILE.md Normal file
View File

@@ -0,0 +1,126 @@
# Cross-Compilation Guide for ARM64
This guide explains how to cross-compile the framebuffer demo for ARM64 (aarch64) architecture, which is used by the R36 Ultra device.
## Prerequisites
### Install ARM64 Cross-Compiler
On Ubuntu/Debian:
```bash
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
sudo apt-get install valac
```
### Verify Installation
```bash
aarch64-linux-gnu-gcc --version
```
## Compilation Methods
### Method 1: Using the Compile Script (Recommended)
```bash
./compile.sh arm64
```
This will:
1. Compile Vala code to C
2. Cross-compile C code to ARM64 using `aarch64-linux-gnu-gcc`
3. Create a statically-linked binary for ARM64
### Method 2: Manual Cross-Compilation
#### Step 1: Compile Vala to C
```bash
valac --pkg posix -C framebuffer_demo.vala
```
#### Step 2: Cross-compile C to ARM64
```bash
aarch64-linux-gnu-gcc framebuffer_demo.c -o framebuffer_demo \
$(pkg-config --cflags --libs glib-2.0 gobject-2.0) \
-static
```
### Method 3: Native Compilation (on R36 Ultra)
If you prefer to compile directly on the R36 Ultra device:
```bash
./compile.sh
```
## Verifying the Binary
Check the compiled binary architecture:
```bash
file framebuffer_demo
```
Expected output:
```
framebuffer_demo: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, ...
```
## Transferring to R36 Ultra
### Using SCP
```bash
scp framebuffer_demo user@r36ultra:/home/user/
```
### Using USB/SD Card
1. Copy `framebuffer_demo` to USB drive or SD card
2. Insert into R36 Ultra
3. Copy to device storage
## Running on R36 Ultra
```bash
chmod +x framebuffer_demo
sudo ./framebuffer_demo
```
## Troubleshooting
### Cross-compiler not found
```bash
sudo apt-get install gcc-aarch64-linux-gnu
```
### Missing GLib dependencies
```bash
sudo apt-get install libglib2.0-dev
```
### Binary won't run on device
- Ensure you compiled for the correct architecture (ARM64/aarch64)
- Try static linking: add `-static` flag to gcc command
- Check device architecture: `uname -m` (should show `aarch64`)
### Permission denied on /dev/fb0
```bash
sudo ./framebuffer_demo
```
## Static vs Dynamic Linking
### Static Linking (Recommended for R36 Ultra)
- Binary includes all dependencies
- Larger file size
- No dependency issues on target device
- Use `-static` flag
### Dynamic Linking
- Smaller binary
- Requires compatible libraries on target device
- May have compatibility issues
- Remove `-static` flag
## Architecture Information
- **R36 Ultra**: ARM64 (aarch64)
- **Cross-compiler**: `aarch64-linux-gnu-gcc`
- **Target**: Linux ARM 64-bit