[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Error in lwip_init() function
From: |
joa1101 |
Subject: |
[lwip-users] Error in lwip_init() function |
Date: |
Fri, 14 Jul 2017 05:12:23 -0700 (MST) |
Hello,
I am using lwip 2.0.2 version, and I am trying to port lwIP stack into ERIKA
enterprise RTOS to a Aurix Tricore TC297A-step board. I am very new to lwIP
so I really know not how to interprete this error.
When I try to initialize lwIP stack with lwip_init() function the board
stops working. While debugging, I discovered that function memp_init is the
part which halts the board from working, and the line in memp_init that
causes the errors is this particular one:
memp = *desc->tab;
I had same problem with previous versions of lwip aswell. After crashing,
debugger ends in intrinsic function:
IFX_INLINE void __debug(void)
{
__asm__ volatile ("debug" : : : "memory");
}
Here is the memp_init function body:
void
memp_init(void)
{
u16_t i;
/* for every pool: */
for (i = 0; i < LWIP_ARRAYSIZE(memp_pools); i++) {
memp_init_pool(memp_pools[i]);
#if LWIP_STATS && MEMP_STATS
lwip_stats.memp[i] = memp_pools[i]->stats;
#endif
}
#if MEMP_OVERFLOW_CHECK >= 2
/* check everything a first time to see if it worked */
memp_overflow_check_all();
#endif /* MEMP_OVERFLOW_CHECK >= 2 */
}
static void*
#if !MEMP_OVERFLOW_CHECK
do_memp_malloc_pool(const struct memp_desc *desc)
#else
do_memp_malloc_pool_fn(const struct memp_desc *desc, const char* file, const
int line)
#endif
{
struct memp *memp;
SYS_ARCH_DECL_PROTECT(old_level);
#if MEMP_MEM_MALLOC
memp = (struct memp *)mem_malloc(MEMP_SIZE + MEMP_ALIGN_SIZE(desc->size));
SYS_ARCH_PROTECT(old_level);
#else /* MEMP_MEM_MALLOC */
SYS_ARCH_PROTECT(old_level);
memp = *desc->tab;
#endif /* MEMP_MEM_MALLOC */
if (memp != NULL) {
#if !MEMP_MEM_MALLOC
#if MEMP_OVERFLOW_CHECK == 1
memp_overflow_check_element_overflow(memp, desc);
memp_overflow_check_element_underflow(memp, desc);
#endif /* MEMP_OVERFLOW_CHECK */
*desc->tab = memp->next;
#if MEMP_OVERFLOW_CHECK
memp->next = NULL;
#endif /* MEMP_OVERFLOW_CHECK */
#endif /* !MEMP_MEM_MALLOC */
#if MEMP_OVERFLOW_CHECK
memp->file = file;
memp->line = line;
#if MEMP_MEM_MALLOC
memp_overflow_init_element(memp, desc);
#endif /* MEMP_MEM_MALLOC */
#endif /* MEMP_OVERFLOW_CHECK */
LWIP_ASSERT("memp_malloc: memp properly aligned",
((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
#if MEMP_STATS
desc->stats->used++;
if (desc->stats->used > desc->stats->max) {
desc->stats->max = desc->stats->used;
}
#endif
SYS_ARCH_UNPROTECT(old_level);
/* cast through u8_t* to get rid of alignment warnings */
return ((u8_t*)memp + MEMP_SIZE);
} else {
LWIP_DEBUGF(MEMP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("memp_malloc: out of
memory in pool %s\n", desc->desc));
#if MEMP_STATS
desc->stats->err++;
#endif
}
SYS_ARCH_UNPROTECT(old_level);
return NULL;
}
Thank you in advance.
Josip
--
View this message in context:
http://lwip.100.n7.nabble.com/Error-in-lwip-init-function-tp30137.html
Sent from the lwip-users mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] Error in lwip_init() function,
joa1101 <=