在android模拟器运行arm 移植的 c程序

本文详细介绍了嵌入式开发的基本步骤,从交叉编译器的下载到开发环境配置,再到代码编写、编译及最终在目标设备上的部署与运行验证。此外还提供了遇到常见问题时的解决方法。
  • 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/

转载于:https://www.cnblogs.com/no7dw/archive/2012/09/24/2700612.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值