2

是否可以在嵌入式 ARM 系统(STM32 F4)上开发使用 protobuf-c 0.15 并与使用 protobuf 的 java 服务器通信的系统?

protobuf-c 0.15 使用动态内存分配。并编译抛出错误:

/opt/arm/sourcery-arm-none-eabi-2011.09/bin/../lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-abort.o): In function `abort':
abort.c:(.text+0xa): undefined reference to `_exit'
/opt/arm/sourcery-arm-none-eabi-2011.09/bin/../lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x12): undefined reference to `_sbrk'
...

我知道 nanopb 和 protobuf-embedded-c。但是他们对protobuf的支持有限。

4

1 回答 1

5

未定义的引用_sbrk来自 newlib,即 CodeSourcery 附带的 libc。您将需要提供系统调用函数以将其正确连接到您的系统。参见例如: https ://sites.google.com/site/stm32discovery/open-source-development-with-the-stm32-discovery/getting-newlib-to-work-with-stm32-and-code-sourcery-精简版

(关于 nanopb 对 protobuf 的有限支持,我想更多地了解您需要哪些功能。我是 nanopb 的作者。)

于 2013-01-07T06:26:49.820 回答