Android驱动例子(LED灯控制)(3)

3、 回到Android源代码顶层目录进行编译:

# cd $(YOUR_ANDROID) && make ledtestapp

例如我这里的实际操作是

#cd android2.1#make ledtestapp

注意make ledtestapp中的目标名ledtestapp就是上面Android.mk文件中由LOCAL_MODULE指定的模块名。编译结果如下

make ledtestapp============================================PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=2.1-update1TARGET_PRODUCT=genericTARGET_BUILD_VARIANT=engTARGET_SIMULATOR=TARGET_BUILD_TYPE=releaseTARGET_ARCH=armHOST_ARCH=x86HOST_OS=linuxHOST_BUILD_TYPE=releaseBUILD_ID=ECLAIR============================================/bin/bash: line 0: cd: sdk/layoutopt/app/src/resources: No such file or directorytarget thumb C: ledtestapp <= external/LEDTEST/ledtest.cInstall: out/host/linux-x86/bin/aprioriInstall: out/host/linux-x86/bin/soslimtarget Executable: ledtestapp (out/target/product/generic/obj/EXECUTABLES/ledtestapp_intermediates/LINKED/ledtestapp)target Non-prelinked: ledtestapp (out/target/product/generic/symbols/system/bin/ledtestapp)target Strip: ledtestapp (out/target/product/generic/obj/EXECUTABLES/ledtestapp_intermediates/ledtestapp)Install: out/target/product/generic/system/lib/libdl.soInstall: out/target/product/generic/system/lib/libc.soInstall: out/target/product/generic/system/lib/libstdc++.soInstall: out/target/product/generic/system/lib/libm.soInstall: out/target/product/generic/system/bin/ledtestapp

4、如上面的编译结果所示,编译后的可执行文件存放在

out/target/product/generic/system/bin/目录 可执行文件是ledtestapp

5、拷贝ledtestapp可执行文件到T卡,插入开发板

6、开电,在启动进入android的过程中,串口终端 按回车,进入命令行模式

7、拷贝可执行文件到根目录

#cp /sdcard/ledtestapp /

8、执行程序

#./ledtestapp

通过上面的步骤,可以看到开发板上相应的LED在闭,每秒钟闪一次!

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwxjwz.html