完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好我正在使用STVD + Cosmic和stm8s105k4t6。我有一个问题。我需要分配一个包含612个单元格的数组,但是:
current_packet.data =(uint8_t *)malloc(current_packet.size + 2); if(current_packet.data == 0) bytecount = 0; 但我不能因为current_packet.data保持为零。在较小尺寸的阵列中,此代码运行良好。如何设置堆大小更大,以适应这个Jumbo数组:-)?那些设置在STVD + Cosmic中? #heap #stvd #cosmic 以上来自于谷歌翻译 以下为原文 Hello i am using STVD + Cosmic with stm8s105k4t6. And i have a problem. I need to allocate an array with 612 cells but: current_packet.data = (uint8_t*)malloc(current_packet.size+2); if (current_packet.data == 0) bytecount = 0; But I cant because current_packet.data stays in zero. In smaller sizes of array this code works well. How can I set heap size bigger, to fit this Jumbo array :-)? Where those setting are in STVD + Cosmic? #heap #stvd #cosmic |
|
相关推荐
5个回答
|
|
你好,
请发布您的.lkf和.map文件,以便我们了解如何在您的应用程序中管理内存。 问候。 以上来自于谷歌翻译 以下为原文 Hello, please post your .lkf and .map files so that we can have an idea of how the memory is managed in your application. Regards. |
|
|
|
地图https://dl.dropboxusercontent.com/u/92887381/discover.map
lkf https://dl.dropboxusercontent.com/u/92887381/discover.lkf 以上来自于谷歌翻译 以下为原文 map https://dl.dropboxusercontent.com/u/92887381/discover.map lkf https://dl.dropboxusercontent.com/u/92887381/discover.lkf |
|
|
|
从您发布的文件看起来,您有一个总共“数据”空间为0x500字节 - (100 + 110)= 1070字节可用于堆。
因此,如果您尝试分配612个字符的数组,它应该工作(至少第一次),但是612个int的数组已经太大了。 希望能帮助到你。 以上来自于谷歌翻译 以下为原文 from the files you posted it looks like you have a total ''data'' space of 0x500 bytes - (100+110) = 1070 bytes available for the heap. Therefore if you try to allocate an array of 612 chars it should work (at least the first time), but an array of 612 ints is already too big. Hope it helps. |
|
|
|
那么我可以使堆区更大吗?我的MCU有2K的RAM。
以上来自于谷歌翻译 以下为原文 So can I make heap region bigger? My MCU has 2K of RAM. |
|
|
|
是的,你可以,只要你的所有'数据'都适合2k(变量+堆+堆栈)。
在编译器用户手册中查找“堆”以查看您必须在链接器文件中修改的内容:我不确定您是否可以通过STVD菜单执行此操作,您可能需要使用自定义链接器文件选项并手动修改。 问候。 以上来自于谷歌翻译 以下为原文 yes, you can, as long as all your 'data' fits into the 2k (variables + heap + stack). Look for 'heap' in the compiler user manual to see what you have to modify in the linker file: I'm not sure you can do that via STVD's menu, you will have probably to use the Custom Linker file option and modify by hand. Regards. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2882 浏览 1 评论
3282 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1861 浏览 1 评论
3711 浏览 6 评论
6125 浏览 21 评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
411浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
510浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
334浏览 2评论
使用STM32F407VET6的USB2.0功能,发现ctl后芯片无数据返回,是什么原因可能导致的呢?
246浏览 2评论
用STM32G431开发工程,1.50版本的Package包文件无法输出项目工程
354浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-2-25 05:24 , Processed in 1.013410 second(s), Total 50, Slave 45 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191