我正在ESP8266上尝试使用kaa IoT平台并且已经跟踪this guide。我在Lubuntu虚拟框中设置了一个新的构建环境,并且构建似乎运行正常,但它抱怨缺少代码空间(见下文)。
似乎ESP8266无法处理加密,所以我确保使用“-DWITH_ENCRYPTION = OFF”在cmake文件中关闭了,但这没有帮助。奇怪的是,构建似乎仍然提到加密,所以也许我没有正确地禁用它。
当我将目标指定为esp8266时,我不明白为什么会提到“建立目标mbedtls”。
无论如何,这是构建输出以防任何人可以帮助我: - )
martin@martin-VirtualBox:/media/sf_martin/kaaSDKs/esp8266-sample/build$ make clean
martin@martin-VirtualBox:/media/sf_martin/kaaSDKs/esp8266-sample/build$ make
-- Toolchain path: /opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf
-- Default SDK location will be used: /opt/Espressif/esp-rtos-sdk
==================================
BUILD_TYPE = MinSizeRel
KAA_PLATFORM = esp8266
KAA_MAX_LOG_LEVEL = 3
==================================
BOOTSTRAP ENABLED
PROFILE ENABLED
USER EXTENSION ENABLED
KAA WILL BE INSTALLED TO /usr/local
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Could NOT find cppcheck
-- Configuring done
-- Generating done
-- Build files have been written to: /media/sf_martin/kaaSDKs/esp8266-sample/build
[ 1%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/aes.c.obj
[ 2%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/asn1parse.c.obj
[ 3%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/asn1write.c.obj
[ 5%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/bignum.c.obj
[ 6%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/ctr_drbg.c.obj
[ 7%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/entropy.c.obj
[ 8%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/entropy_poll.c.obj
[ 10%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/md.c.obj
[ 11%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/md_wrap.c.obj
[ 12%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/oid.c.obj
[ 13%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pk.c.obj
[ 15%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pkwrite.c.obj
[ 16%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pem.c.obj
[ 17%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pk_wrap.c.obj
[ 18%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/rsa.c.obj
[ 20%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/sha256.c.obj
[ 21%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pkparse.c.obj
[ 22%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/sha1.c.obj
[ 23%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/base64.c.obj
[ 25%] Linking C static library libmbedtls.a
[ 25%] Built target mbedtls
[ 26%] Creating directories for 'kaa_rsa_keygen'
[ 27%] No download step for 'kaa_rsa_keygen'
[ 28%] No patch step for 'kaa_rsa_keygen'
[ 30%] No update step for 'kaa_rsa_keygen'
[ 31%] Performing configure step for 'kaa_rsa_keygen'
-- Configuring done
-- Generating done
-- Build files have been written to: /media/sf_martin/kaaSDKs/esp8266-sample/build/libs/kaa/kaa_keys
[ 32%] Performing build step for 'kaa_rsa_keygen'
[ 83%] Built target mbedtls
[ 91%] Built target rsa_keygen
[100%] Built target generate_rsa_keys
[ 33%] Generating RSA headers
[ 35%] Completed 'kaa_rsa_keygen'
[ 35%] Built target kaa_rsa_keygen
[ 36%] Building C object libs/kaa/CMakeFiles/extension_profile.dir/src/extensions/profile/kaa_profile.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c: In function 'kaa_profile_manager_is_profile_set':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c:195:64: warning: unused parameter 'self' [-Wunused-parameter]
bool kaa_profile_manager_is_profile_set(kaa_profile_manager_t *self)
^
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c: In function 'kaa_profile_manager_update_profile':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c:394:71: warning: unused parameter 'self' [-Wunused-parameter]
kaa_error_t kaa_profile_manager_update_profile(kaa_profile_manager_t *self, kaa_profile_t *profile_body)
^
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c:394:92: warning: unused parameter 'profile_body' [-Wunused-parameter]
kaa_error_t kaa_profile_manager_update_profile(kaa_profile_manager_t *self, kaa_profile_t *profile_body)
^
[ 37%] Linking C static library libextension_profile.a
[ 37%] Built target extension_profile
Scanning dependencies of target kaac
[ 38%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/logger.c.obj
[ 40%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/kaa_client.c.obj
[ 41%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/configuration_persistence.c.obj
[ 42%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/status.c.obj
[ 43%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/tcp_utils.c.obj
[ 45%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/time.c.obj
[ 46%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/exit.c.obj
[ 47%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/snprintf.c.obj
[ 48%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/sha.c.obj
[ 50%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/kaa_failover_strategy.c.obj
[ 51%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/ext_log_storage_memory.c.obj
[ 52%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/ext_log_upload_strategies.c.obj
[ 53%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/key_utils.c.obj
[ 55%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/kaa_tcp_channel.c.obj
[ 56%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_protocols/kaa_tcp/kaatcp_parser.c.obj
[ 57%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_protocols/kaa_tcp/kaatcp_request.c.obj
[ 58%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/avro_src/io.c.obj
[ 60%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/avro_src/encoding_binary.c.obj
[ 61%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/collections/kaa_list.c.obj
[ 62%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/utilities/kaa_aes_rsa.c.obj
[ 63%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/utilities/kaa_log.c.obj
[ 65%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/utilities/kaa_mem.c.obj
[ 66%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/utilities/kaa_buffer.c.obj
[ 67%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_platform_utils.c.obj
[ 68%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_platform_protocol.c.obj
[ 70%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_channel_manager.c.obj
[ 71%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_common_schema.c.obj
[ 72%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_status.c.obj
[ 73%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa.c.obj
[ 75%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_extension.c.obj
[ 76%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/kaa_htonll.c.obj
[ 77%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_profile_gen.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_profile_gen.c: In function 'kaa_profile_empty_data_deserialize':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_profile_gen.c:47:76: warning: unused parameter 'reader' [-Wunused-parameter]
kaa_profile_empty_data_t *kaa_profile_empty_data_deserialize(avro_reader_t reader)
^
[ 78%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_logging_gen.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_logging_gen.c: In function 'kaa_logging_empty_data_deserialize':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_logging_gen.c:47:76: warning: unused parameter 'reader' [-Wunused-parameter]
kaa_logging_empty_data_t *kaa_logging_empty_data_deserialize(avro_reader_t reader)
^
[ 80%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_configuration_gen.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_configuration_gen.c: In function 'kaa_configuration_empty_data_deserialize':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_configuration_gen.c:47:88: warning: unused parameter 'reader' [-Wunused-parameter]
kaa_configuration_empty_data_t *kaa_configuration_empty_data_deserialize(avro_reader_t reader)
^
[ 81%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_notification_gen.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_notification_gen.c: In function 'kaa_notification_empty_data_deserialize':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_notification_gen.c:47:86: warning: unused parameter 'reader' [-Wunused-parameter]
kaa_notification_empty_data_t *kaa_notification_empty_data_deserialize(avro_reader_t reader)
^
[ 82%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_chat.c.obj
[ 83%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_chat_definitions.c.obj
[ 85%] Linking C static library libkaac.a
[ 85%] Built target kaac
[ 86%] Building C object libs/kaa/CMakeFiles/extension_user.dir/src/extensions/user/kaa_user.c.obj
[ 87%] Linking C static library libextension_user.a
[ 87%] Built target extension_user
[ 88%] Building C object libs/kaa/CMakeFiles/extension_bootstrap.dir/src/extensions/bootstrap/kaa_bootstrap_manager.c.obj
[ 90%] Linking C static library libextension_bootstrap.a
[ 90%] Built target extension_bootstrap
[ 91%] Building C object CMakeFiles/kaa_demo_s.dir/user/user_main.c.obj
[ 92%] Building C object CMakeFiles/kaa_demo_s.dir/driver/uart.c.obj
[ 93%] Building C object CMakeFiles/kaa_demo_s.dir/src/kaa_demo.c.obj
[ 95%] Linking C static library libkaa_demo_s.a
[ 95%] Built target kaa_demo_s
Scanning dependencies of target kaa_demo
[ 96%] Building C object CMakeFiles/kaa_demo.dir/blank.c.obj
[ 97%] Linking C executable kaa_demo
/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: kaa_demo section `.text' will not fit in region `iram1_0_seg'
/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: region `iram1_0_seg' overflowed by 24817 bytes
collect2: error: ld returned 1 exit status
CMakeFiles/kaa_demo.dir/build.make:122: recipe for target 'kaa_demo' failed
make[2]: *** [kaa_demo] Error 1
CMakeFiles/Makefile2:107: recipe for target 'CMakeFiles/kaa_demo.dir/all' failed
make[1]: *** [CMakeFiles/kaa_demo.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
martin@martin-VirtualBox:/media/sf_martin/kaaSDKs/esp8266-sample/build$
答案 0 :(得分:4)
根据您引用的教程,首次使用自定义SDK构建示例应用时,我遇到了完全相同的问题。
首先, Built目标mbedtls 是指make文件指定的构建目标,而不是目标平台。正如您在开头看到的那样, KAA_PLATFORM = esp8266 显示正确的值。稍后,make也会编译正确的文件(例如:[ 38%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/logger.c.obj
)。这应该没问题。
您的构建中禁用了加密功能。否则,它将在 USER EXTENSION ENABLENS 下面打印 ENCRYPTION ENABLED 。
以下是一些可能的解决方案:
我遇到的一个问题是链接器文件 eagle.app.v6.ld (应该位于项目根目录的 ld 文件夹中)必须进行调整,以便将代码的某些部分从RAM移动到ROM。
我使用Kaa sample app中的链接器文件,并参考以下说明中的内容。
在.text : ALIGN(4)
部分中,找到包含以下内容的行:
*( .literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
从那里删除.literal.* .text.*
部分,然后在.irom0.text : ALIGN(4)
之后添加以下行,将其移至_irom0_text_start = ABSOLUTE(.);
:
*(.literal.* .text.*)
现在,所有以.literal.
和.text.
开头的部分都位于ROM中。这是一种蛮力,因为无论* .a模块(由.irom0.text : ALIGN(4)
部分下面的行定义),此类型的所有部分都将移至ROM。它可能有一些我尚未经历的并发症。绝对有优化链接器映射的空间。
对我来说,这在RAM中节省了大量内存,程序已经编译,链接并正确运行。
使用cmake
配置构建时,您可以将不同的参数传递给cmake
以打开或关闭扩展程序(例如-DWITH_EXTENSION_PROFILE=OFF
以关闭配置文件)。
在您的情况下,似乎启用了以下扩展程序:
根据我的经验,一些扩展只是为了编译成最终图像。我成功添加了配置和日志记录扩展。添加任何其他扩展名会导致RAM溢出。
确保仅启用端点SDK真正需要的扩展。如果仍然失败,请尝试关闭所有扩展并逐步启用它们以查看哪些扩展失败。
以下命令将列表打印到文件 listing.txt ,详细说明哪些代码映射到哪个部分。它可能有助于找出代码的哪些部分在RAM和ROM中使用最多的内存。 (将 name_of_your_image 替换为make命令生成的图像的实际名称)
xtensa-lx106-elf-objdump -x name_of_your_image > listing.txt