zoukankan      html  css  js  c++  java
  • 在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/
  • 相关阅读:
    vue中插槽的使用场景
    css实现文字两端对齐
    es6 every的使用
    es6 filter方法应用
    es6 map的用法
    spring-servlet.xml
    Spring MVC过滤器HiddenHttpMethodFilter
    controller大全(推荐)
    目前接触到的UI
    jdk环境配置(windows版)
  • 原文地址:https://www.cnblogs.com/no7dw/p/2700612.html
Copyright © 2011-2022 走看看