|Subject:||Re: [lwip-users] Assertion "memp sanity" failed at line 463 in../lwip_1_4_0/Src/core/memp.c|
|Date:||Mon, 19 Nov 2012 10:45:30 +0700|
|User-agent:||Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2|
So you are using FreeRTOS and Cortex-M3 ? I'm 99% sure your interrupt routine causes problems and I can help you. (I recently faced with very similar issue).
1. define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT to 1 (see description in src/include/lwip/opt.h). This will let you call safely mem_malloc()/mem_free() functions or other lwip functions which imply calls to them (such as pbuf_alloc()) from interrupt context.
2. Make sure your sys arch protection implementation does taskDISABLE_INTERRUPTS/taskENABLE_INTERRUPTS (or portXXX equivalents).
3. Make sure that numerical(!) value of interrupt priority is equal to or greater than the configMAX_SYSCALL_INTERRUPT_PRIORITY setting in your FreeRTOSConfig.h. Also be warned that configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. Use only priorities 1 and above.
4. Make sure you defined priorities values correctly. It's easy to confuse with them in cortex-m3 because there are no standartized way across different tools/libraries to treat them in one manner. FreeRTOSConfig.h macro values must be defined as ready shifted: (prio << (8 - __NVIC_PRIO_BITS)), where prio is number from 1 to <max priority level>. But the way you initialize your interrupts may vary. For example, if you use STM32 CMSIS library, then you must call NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4) before vTaskStartScheduler() and in NVIC_Init() structures you must assign priority as preemtion priority and set subpriority to 0.
5. Make sure you defined configKERNEL_INTERRUPT_PRIORITY to 255 or (255 << (8 - __NVIC_PRIO_BITS))
If all above requirements are fulfilled then everything must work correctly. I'm not sure is #1 essential or not. :)
See http://www.freertos.org/RTOS-Cortex-M3-M4.html for details.
|[Prev in Thread]||Current Thread||[Next in Thread]|