If external RAM is available, it is strongly recommended to move the heap into the external RAM, regardless of whether or not the variables from the .data and .bss sections are also going to be located there. The stack should always be kept in internal RAM. Some devices even require this, and in general, internal RAM can be accessed faster since no extra wait states are required. When using dynamic memory allocation and stack and heap are separated in distinct memory areas, this is the safest way to avoid a stack-heap collision.
有外部RAM时,一般把.heap, .data和.bss放在外部RAM,而stack一般放在内部RAM。
https://www.microchip.com/webdoc/AVRLibcReferenceManual/malloc_1malloc_where.htmlfrom:

在默认配置下,仅使用内部RAM时,需谨慎管理堆和栈,避免碰撞。建议将堆、.data和.bss段置于外部RAM,保持栈在内部RAM,以提升效率并确保安全。
3140

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



