Android I2c-Tools 編譯和使用
阿新 • • 發佈:2020-08-26
參考:Android 平臺下使用 i2c-tools
目錄
前文
首先介紹幾個網站
I2C Tools wiki 官方wiki (https://i2c.wiki.kernel.org/index.php/I2C_Tools)
wiki 直接下載壓縮包列表網址 (https://mirrors.edge.kernel.org/pub/software/utils/i2c-tools/)
kernel 的i2c-tools 主線線上閱讀log(https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git/
Android編譯
下載原始碼後放在任意目錄(我放在android/vendor/i2c-tools)
在目錄下新建Android.mk
LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := eng LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include LOCAL_SRC_FILES := tools/i2cbusses.c tools/util.c LOCAL_MODULE := i2c-tools include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := eng LOCAL_SRC_FILES:=tools/i2cdetect.c LOCAL_MODULE:=i2cdetect LOCAL_CPPFLAGS += -DANDROID LOCAL_SHARED_LIBRARIES:=libc LOCAL_STATIC_LIBRARIES := i2c-tools LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := eng LOCAL_SRC_FILES:=tools/i2cget.c LOCAL_MODULE:=i2cget LOCAL_CPPFLAGS += -DANDROID LOCAL_SHARED_LIBRARIES:=libc LOCAL_STATIC_LIBRARIES := i2c-tools LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := eng LOCAL_SRC_FILES:=tools/i2cset.c LOCAL_MODULE:=i2cset LOCAL_CPPFLAGS += -DANDROID LOCAL_SHARED_LIBRARIES:=libc LOCAL_STATIC_LIBRARIES := i2c-tools LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := eng LOCAL_SRC_FILES:=tools/i2cdump.c LOCAL_MODULE:=i2cdump LOCAL_CPPFLAGS += -DANDROID LOCAL_SHARED_LIBRARIES:=libc LOCAL_STATIC_LIBRARIES := i2c-tools LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include include $(BUILD_EXECUTABLE)
mm 在android/out/目錄生成bin檔案
問題 如何引用到kernel的iic標頭檔案的定義的$(LOCAL_PATH)/$(KERNEL_DIR)/include