在android模拟器运行arm 移植的 c程序
2013-06-15 08:45
337 查看
first : download arm cross compliers
next : modify env
[dengwei@localhost ~]$ vi ~/.bashrc
export PATH="/home/dengwei/arm-marvell-linux-gnueabi/bin:$PATH"
third: code here
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv) {
printf("hello world\n");
FILE *pfd = fopen("/mnt/sdcard/345","a+");
fwrite("abcedfg", sizeof(char), strlen("abcdefg"),pfd);
fclose(pfd);
return 0;
}
fourth: compile: arm-marvel-linux-gnueabi-gcc -static hi.c -o hi123
fifth: usage of adb
adb push ~/hi123 /data
adb shell # /data/hi123
hello world
# pwd
/mnt/sdcard
# cat 345
abcedfg#
if you intend to use cpp file , just : mv hi123.c hi.cpp ,and use: arm-marvell-linux-gnueabi-g++ -static hi.cpp -o hi1234
if you meet "Read-only file system
" error, pls do the following:
mount -o remount,rw /
when I put the executable file to real mobile phone , excuted it by console by emulator
#/sdcard/hi1234,I encount a error: Permission denied. It works now after I
#chmod u+x /sdcard/hi1234 # mv /sdcard/hi1234 /system/sbin/
from: http://www.cnblogs.com/no7dw/archive/2012/09/24/2700612.html
next : modify env
[dengwei@localhost ~]$ vi ~/.bashrc
export PATH="/home/dengwei/arm-marvell-linux-gnueabi/bin:$PATH"
third: code here
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv) {
printf("hello world\n");
FILE *pfd = fopen("/mnt/sdcard/345","a+");
fwrite("abcedfg", sizeof(char), strlen("abcdefg"),pfd);
fclose(pfd);
return 0;
}
fourth: compile: arm-marvel-linux-gnueabi-gcc -static hi.c -o hi123
fifth: usage of adb
adb push ~/hi123 /data
adb shell # /data/hi123
hello world
# pwd
/mnt/sdcard
# cat 345
abcedfg#
if you intend to use cpp file , just : mv hi123.c hi.cpp ,and use: arm-marvell-linux-gnueabi-g++ -static hi.cpp -o hi1234
if you meet "Read-only file system
" error, pls do the following:
mount -o remount,rw /
when I put the executable file to real mobile phone , excuted it by console by emulator
#/sdcard/hi1234,I encount a error: Permission denied. It works now after I
#chmod u+x /sdcard/hi1234 # mv /sdcard/hi1234 /system/sbin/
from: http://www.cnblogs.com/no7dw/archive/2012/09/24/2700612.html
相关文章推荐
- 在android模拟器运行arm 移植的 c程序
- Android模拟器Genymotion添加ARM程序运行环境的方法
- openssl 客户端程序移植到arm平台 OK6410上运行
- GDB arm-linux交叉编译移植和使用方法(特别是对于正在运行的程序或者段错误的程序进行分析)
- Android模拟器Genymotion添加ARM程序运行环境的方法
- 安装交叉编译工具arm-none-linux-gnueabi-gcc——Linux上编译在android上运行的c程序
- android模拟器运行后出错:5554:androidavd: emulator-arm.exe - 应用程序错误
- ARM裸机程序开发——ARM运行模式及寄存器
- Genymotion 运行ARM架构的程序
- Android 运行 C/C++程序 (使用 arm-linux-gcc 交叉编译环境)
- GDB arm-linux交叉编译移植和使用方法(特别是对于正在运行的程序或者段错误的程序进行分析)
- gm8180:arm linux启动加载模块、运行程序
- ARM下的程序运行问题
- 移植boa后运行CGI程序可能出现的原因及解决方法
- 对ARM加载域和运行域的理解(ARM程序是怎么运行的)
- 基于ARM的KVM移植优化MIDP程序
- eclipse下,每次运行程序时,新启动Android模拟器(在已经有一个模拟器运行的情况)
- 移植boa后运行CGI程序可能出现的原因及解决方法
- Qt程序移植到Firefly开发板(Arm linux)下运行--转载
- cortex-A8 ARM核 opencv程序移植 (2)