STM32F103CB能跑RTT+LWIP吗
本来在STM32F103ET6上是正常的。但转到STM32F103C8就运行不起来。好像在初始化内存时异常。void rt_system_heap_init(void* begin_addr, void* end_addr)
{
struct heap_mem *mem;
rt_uint32_t begin_align = RT_ALIGN((rt_uint32_t)begin_addr, RT_ALIGN_SIZE);
rt_uint32_t end_align = RT_ALIGN_DOWN((rt_uint32_t)end_addr, RT_ALIGN_SIZE);
/* alignment addr */
if((end_align > (2 * SIZEOF_STRUCT_MEM) ) &&
((end_align - 2 * SIZEOF_STRUCT_MEM) >= begin_align ))
{
/* calculate the aligned memory size */
mem_size_aligned = end_align - begin_align - 2 * SIZEOF_STRUCT_MEM;
}
else
{
rt_kprintf("mem init, error begin address 0x%x, and end address 0x%x\n", (rt_uint32_t)begin_addr, (rt_uint32_t)end_addr);
return;
}
/* point to begin address of heap */
heap_ptr = (rt_uint8_t *)begin_align;
#ifdef RT_MEM_DEBUG
rt_kprintf("mem init, heap begin address 0x%x, size %d\n", (rt_uint32_t)heap_ptr, mem_size_aligned);
#endif
/* initialize the start of the heap */
mem = (struct heap_mem *)heap_ptr;
mem->magic= HEAP_MAGIC;
mem->next = mem_size_aligned + SIZEOF_STRUCT_MEM;
mem->prev = 0;
mem->used = 0;
/* initialize the end of the heap */
heap_end = (struct heap_mem *)&heap_ptr;
heap_end->magic= HEAP_MAGIC;
heap_end->used = 1;---------------------------------------------------------到这一句就异常了
heap_end->next = mem_size_aligned + SIZEOF_STRUCT_MEM;
heap_end->prev = mem_size_aligned + SIZEOF_STRUCT_MEM; 能跑,你的工程不是STM32F103C的配置吧。因为103C内存比较小,也可以看看itspy的uip。 回复【1楼】ffxz
能跑,你的工程不是stm32f103c的配置吧。因为103c内存比较小,也可以看看itspy的uip。
-----------------------------------------------------------------------
感谢ffxz的帮助,真的是内存小了。我把内存大小改为20K的就可以了。 跑uip吧,uIP本身的消耗是比较少的,经过一定的优化3,4K以下都可以,这样就可省出很多空间,再加上RTT,那就不错了 回复【2楼】guocai
回复【1楼】ffxz
能跑,你的工程不是stm32f103c的配置吧。因为103c内存比较小,也可以看看itspy的uip。
-----------------------------------------------------------------------
感谢ffxz的帮助,真的是内存小了。我把内存大小改为20k的就可以了。
-----------------------------------------------------------------------
在哪里修改内存大小?我也遇到这样的情况 找到了!
页:
[1]