[riot-users] ccnx-lite-relay example crashing in native board
fadedreamz at gmail.com
Wed Aug 31 18:53:20 CEST 2016
Sorry for the poor explanation.
I have created four tap devices. But the image was crashing before running
the ccn-lite-relay example.
Following stacktrace suggests that it crashed inside the printf function
which tries to use the malloc defined in tlsf.
> #3 0x0805a26c in malloc (bytes=1024)
> at /home/fadedreamz/riotos/RIOT/examples/ccn-lite-relay/bin/
> #8 0xf7e41d17 in vfprintf () from /lib32/libc.so.6
> #9 0xf7e48f66 in printf () from /lib32/libc.so.6
> #10 0x08049749 in usage_exit ()
> at /home/fadedreamz/riotos/RIOT/cpu/native/startup.c:198
> #11 0x08048eb4 in startup (argc=1, argv=0xffffd024)
But tlsf malloc will work only if is initialized previously with
tlsf_create_with_pool() (as per my understanding).
Following lines defined in tlsf-malloc.h
> #ifndef TLSF_MALLOC_PREFIX
> # define TLSF_MALLOC_PREFIX
> #define __TLSF_MALLOC_NAME(A, B) A ## B
> #define _TLSF_MALLOC_NAME(A, B) __TLSF_MALLOC_NAME(A, B)
> #define TLSF_MALLOC_NAME(NAME) _TLSF_MALLOC_NAME(TLSF_MALLOC_PREFIX, NAME)
> void *TLSF_MALLOC_NAME(malloc)(size_t bytes);
is expanded into
> void * malloc(size_t bytes);
if TLSF_MALLOC_PREFIX is not defined
So, I think linker uses the malloc version defined into tlsf for printf,
which was causing the crash (due to control structure being pointed to
defining the TLSF_MALLOC_PREFIX forces the linker to use correct malloc.
I used fresh copy of RIOT-OS and build the stock ccn-lite-relay example
without any modification in Ubuntu 16.04.
On Aug 31, 2016 5:23 AM, "Oleg Hahm" <oliver.hahm at inria.fr> wrote:
> Hi Nazmul,
> On Tue, Aug 30, 2016 at 11:50:20PM +0000, Nazmul Alam wrote:
> > The issue previously mentioned was due to same signature of two different
> > types of malloc/free function.
> > The malloc/free used by printf was causing the crash as it was trying to
> > use the malloc/free defined from tlsf library, causing the call to
> > search_suitable_block() before actually allocating memory by the library.
> > It can be solved by adding following define in the Makefile to specify
> > prefix for the tlsf specific malloc/free
> > CFLAGS += -DTLSF_MALLOC_PREFIX=mytlsf_
> > this will make tlsf malloc to become mytlsf_malloc/mytlsf_free and then
> > printf will use the correct malloc/free function.
> I'm not sure I understand the problem.
> First of all, the ccn-lite-relay example works perfectly fine on native
> when I
> try it.
> Second, it is supposed to use tlsf for malloc instead of the host system's
> malloc implementation. TLSF works fine on native and other 32 bit platforms
> that I tested.
> Have you made sure that you have created at least on tap device?
> The worst thing about Perl jokes is that next morning you can't understand
> they seemed so funny.
> users mailing list
> users at riot-os.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users