微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > arm汇编学习(三)

arm汇编学习(三)

时间:11-09 来源:互联网 点击:
一、ndk编译android上运行的c程序

新建个hello目录,底下要有jni目录,下面就是Android.mk文件

1.Android.mk文件内容如下:

LOCAL_PATH:= $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES:= hello.cLOCAL_MODULE:= helloLOCAL_FORCE_STATIC_EXECUTABLE := true#LOCAL_STATIC_LIBRARIES := libc#LOCAL_CFLAGS += -Iinclude/dir -DSOMEFLAGSinclude $(BUILD_EXECUTABLE)

2.jni下新建个hello.c,内容取自kanxue论坛上的一份代码:

#include #include int main(int argc,char *argv[]){char name[]="helloworld";int keys[]={0xb,0x1f,0x19,0x19,0x49,0xb,0xb,0xb,0x31,0x53};char Thekeys[11];int i;for(i=0;i<10;i++){keys[i]^=7;keys[i]=keys[i]/6;keys[i]+=22;keys[i]-=24;keys[i]^=name[i];}for(i=0;i<10;i++){Thekeys[i]=keys[i];}Thekeys[i]=0;if(!strcmp(Thekeys,argv[1]))printf("Good Work,you have Successed!");elseprintf("NO,you are failed!");return 0;}

3.编译

moonflow@WIN-KG08V2FIOKP /cygdrive/c/helloc/jni$ $NDK/ndk-buildCygwin : Generating dependency file converter scriptCompile thumb : hello <= hello.cExecutable : helloInstall : hello => libs/armeabi/hello

4.参考:

http://leave001.blog.163.com/blog/static/16269129320128113217384/
http://guoh.org/lifelog/2012/02/run-native-c-code-on-android/
http://www.cnblogs.com/newcj/archive/2011/08/14/2138553.html

二、ARM crackme学习

ARM初步完成,开始以crackme练习作为学习的目的

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top