要在Androidq下编译efr32mg21,花了2天时间,分享下
拿到源码后,先在linux的环境下编译成功
sudo apt-get install libreadline-dev
sudo apt-get install libncurses5-dev
cd app/builder/Z3GatewayHost
make clean
make
编译成功后,把源码放在external/efr32mg21/下,结构如下

参考app/builder/Z3GatewayHost/Makefile,创建Android.bp文件,内容如下
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
cc_binary {
name: "efr32mg21",
include_dirs: [
"external/efr32mg21/protocol/zigbee/app/framework",
"external/efr32mg21/protocol/zigbee/app/framework/../..",
"external/efr32mg21/protocol/zigbee/app/framework/../../stack",
"external/efr32mg21/protocol/zigbee/app/framework/../util",
"external/efr32mg21/protocol/zigbee/app/framework/../util/common",
"external/efr32mg21/protocol/zigbee/app/framework/../util/ezsp",
"external/efr32mg21/protocol/zigbee/app/framework/../util/serial",
"external/efr32mg21/protocol/zigbee/app/framework/../util/zigbee-framework",
"external/efr32mg21/protocol/zigbee/app/framework/cli",
"external/efr32mg21/protocol/zigbee/app/framework/include",
"external/efr32mg21/protocol/zigbee/app/framework/security",
"external/efr32mg21/protocol/zigbee/app/framework/util",
"external/efr32mg21/platform/base/hal",
"external/efr32mg21/platform/base/hal/plugin",
"external/efr32mg21/platform/base/hal/..",
"external/efr32mg21/platform/base/hal/micro/generic",
"external/efr32mg21/platform/base/hal/micro/unix/host",
"external/efr32mg21/platform/base/hal/micro/unix/host/board",
"external/efr32mg21/util/plugin/plugin-common/mbedtls",
"external/efr32mg21/util/third_party/mbedtls",
"external/efr32mg21/util/third_party/mbedtls/include",
"external/efr32mg21/util/third_party/mbedtls/include/mbedtls",
"external/efr32mg21/util/third_party/mbedtls/sl_crypto/include",
"external/efr32mg21/app/builder/Z3GatewayHost",
],
cflags: [
"-Wno-unused-parameter",
"-Wno-missing-braces",
"-Wno-unused-function",
"-Wno-unused-variable",
"-Wno-date-time",
"-Wno-uninitialized",
"-DUNIX",
"-DUNIX_HOST",
"-DPHY_NULL",
"-DCONFIGURATION_HEADER=\"util/config.h\"",
"-DEZSP_HOST",
"-DGATEWAY_APP",
"-DZA_GENERATED_HEADER=\"Z3GatewayHost.h\"",
"-DATTRIBUTE_STORAGE_CONFIGURATION=\"Z3GatewayHost_endpoint_config.h\"",
"-DPLATFORM_HEADER=\"micro/unix/compiler/gcc.h\"",
"-DBOARD_HOST",
"-DBOARD_HEADER=\"Z3GatewayHost_board.h\"",
"-DEM_AF_TEST_HARNESS_CODE",
"-DEM_AF_LINK_M",
"-DEM_AF_LINK_PTHREAD",
"-DEMBER_AF_API_EMBER_TYPES=\"stack/include/ember-types.h\"",
"-DEMBER_AF_API_DEBUG_PRINT=\"app/framework/util/prin

本文详细介绍了在Androidq环境下编译efr32mg21的过程,包括必要的依赖安装、目录结构搭建、Android.bp文件配置及编译命令。同时,分享了编译过程中遇到的问题及解决方法。
最低0.47元/天 解锁文章
540

被折叠的 条评论
为什么被折叠?



