yabo国际娱乐Dialog半导体客户支持- malloc https://support.dialog-semiconductor.com/resource-keywords/malloc EN 动态内存分配问题 https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-软件/问题动态内存分配
论坛:
malloc
基本da14580 Sun,2018年9月2日22:34:56+0000 uched41 226018 athttps://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/problem-dynamic-memory-allocation#comments malloc/free使用带1468x的FreeRTOS https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-软件/mallocfree-using-freertos-1468x < div class = "字段field-name-taxonomy-forums field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >论坛:,< / div > < div class = "字段条目" > < div class =”field-item甚至“rel = " sioc: has_container " > < a href = " /论坛/ dialog-smartbond-bluetooth-low-energy - % E2 % 80% 93 -软件”“=“sioc:容器sioc:论坛”属性= " rdfs: label skos: prefLabel”数据类型= " " >对话框Smartbond蓝牙低能量-软件< / > < / div > < / div > < / div > < div class =”字段field-name-body field-type-text-with-summary field-label-hidden”> < div class = "字段条目" > < div class =”field-item甚至“财产=“内容:编码”> < p >我用一些内部使用的C库用于动态内存的Malloc /free。如果我在1468x上运行FreeRTOS,是否可以使用标准的C malloc/free ?编译器是否会自动将这些链接到正确的实现,或者我应该提供一个覆盖,将它们映射到OS_MALLOC/OS_FREE,就像RETARGET对printf所做的那样?Dialog推荐的方法是什么?< / p > < p >谢谢。< / p > < / div > < / div > < / div > < div class =”字段field-name-field-forum-keywords field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >关键词:,< / div > < div class = "字段条目" > < div class =”field-item甚至“> < a href = " / resource-keywords / malloc”“=“skos:概念”属性=“rdfs: label skos: prefLabel”数据类型= " " > malloc < / > < / div > < / div > < / div > < div class =”字段field-name-field-device field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >设备:,< / div > < div class = "字段条目" > < div class =”field-item甚至“> < a href = " / forum-post-device / da1468x”“=“skos:概念”属性=“rdfs: label skos: prefLabel”数据类型= " " > DA1468x < / > < / div > < / div > < / div > 2017年9月11日星期一09:59:23+0000 ewilson90 91411 athttps://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/mallocfree-using-freertos-1468x#comments GTL消息和(动态)内存分配 https://support.dialog-semiconductor.com/gtl-messages-and-dynamic-memory-allocation < div class = "字段field-name-taxonomy-forums field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >论坛:,< / div > < div class = "字段条目" > < div class =”field-item甚至“rel = " sioc: has_container " > < a href = " /论坛/ dialog-smartbond-bluetooth-low-energy - % E2 % 80% 93 -软件”“=“sioc:容器sioc:论坛”属性= " rdfs: label skos: prefLabel”数据类型= " " >对话框Smartbond蓝牙低能量-软件< / > < / div > < / div > < / div > < div class =”字段field-name-body field-type-text-with-summary field-label-hidden”> < div class = "字段条目" > < div class =”field-item甚至“财产=“内容:编码”> < p >亲爱的支持,< / p > < p >目前我对GTL实现自定义嵌入式项目中的接口(通过UART)。我的第一个目标是让prox_reporter_ext项目与我们的外部处理器(DA1458x_SDK\5.0.2.1\projects\target_apps\ble_examples文件夹)一起工作。我使用了host_proxr_sdk项目作为参考(DA1458x_SDK\5.0.2.1\projects\host_apps\windows\proximity\reporter\文件夹)。

我面临的挑战是内存分配。到目前为止,我们一直避免在我们的嵌入式代码中使用malloc/free,这只是为了防止引入灾难性的副作用,比如内存泄漏(它还可能与我们的RTOS结合带来新的挑战)。在上述项目的ble_msg中,我看到malloc和free是通过BleMsgAlloc和BleFreeMsg使用的,uart.c中的SendToMain也是如此。此外,UARTProc (uart.c)中的接收缓冲区大小为1000字节,MAX_PACKET_LENGTH为350字节(uart.h)。在UARTSend (uart.c)中分配另外500个字节。

从综合过程应用.pdf和UM-B-010_DA14580_581_583 Proximity application_v1.3.pdf中的源和读取UM-B-017 GTL接口的理解来看,GTL接口不能被归类为停止-等待协议。 In other words, multiple event packets / messages can be sent by the DA14580 to the external processor at any given moment. On the other hand the external processor can send a command packet / message whenever required by the application.

I fully understand the reason for using dynamic memory allocation, it makes sense with a variable number of packets and a variable PAR_LEN field value. However I would like to know if static memory allocation is a viable option (and achievable looking at memory requirements). In this case I would like to know what the max value for PAR_LEN is (the maximum number of bytes of Parameters that a message can contain) and how many packets / messages could potentially be sent by the DA14580. If feasible, I could create a circular buffer of X number of packets, each with MAX_PAR_LEN bytes of Parameters (we have 32kB of RAM available in total, so for example 3 packets of each 350 bytes with a separate read buffer of 350 bytes and a write buffer of 350 bytes (for asynchronous reading/writing) is not very realistic).

I would love to hear your thoughts on this. If at all possible, I would rather not use malloc / free.

Kind regards,
Arjan

Edit 02-11-2015
I have added information regarding endianness and data structure padding below, perhaps other forum users might find this useful as well.

Device: 
2015年10月21日星期三16:34:59+0000 阿布雷曼 2147在https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/gtl-messages-and-dynamic-memory-allocation#comments