Helper2416 Development Board compiler compile helloworld run by Xiaomi box (android)
Generally, the program is developed mainly for the helper2416 Development Board. The chip is Samsung's 2416, which belongs to ARM9. the cross compiler is a self-transplanted compiler for the helper2416 Development Board. It supports the armv5te instruction set.
I recently had an android Xiaomi box and thought about the arm platform. The Instruction Set version of the Development Board is not high, can I use the cross compiler of the Development Board to compile a helloworld C language program to run on the Xiaomi box.
Process:
Program:
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- printf( "hello world!\n" );
- return 0;
- }
The arm cross compiler of the Development Board must be compiled with a static link. Otherwise, the system prompts "sh:./helloworld: No such file or directory"
Arm-linux-gcc main. c-o helloworld-static
First, adb first connects to the box (Step omitted) and then transmits the program to the Xiaomi box. The directory/sdcard/may not be uploaded to other directories.
Adb push./helloworld/sdcard/helloworld
465 KB/s (584721 bytes in 1.227 s)
Enter Xiaomi box
Adb shell
Escalate to root permission (make sure the box is already root)
$ Su
Go to the/sdcard directory
$ Cd/sdcard/
Copy to the/mnt/asec/directory. Otherwise, the program cannot be modified as executable.
Root @ android:/sdcard # cp helloworld/mnt/asec/
Root @ android:/sdcard # cd/mnt/asec/
Give the program executable permissions
Root @ android:/mnt/asec # chmod 777 helloworld
Run
Root @ android:/mnt/asec #./helloworld
Input
Hello world!
Succeeded
Author: handsome, dare not go out, programmer group: 31843264