Hi Oleg,

Have you executed the elf by any chance directly like this:
> ./bin/native/ccn-lite-relay.elf
> or did you use `make term`?
>

I have directly executed the elf with following command
./bin/native/ccn-lite-relay.elf tap0

But if you don't want to use tlsf, you can simple remove it from the
> Makefile.
> (But note that it won't work on most real devices then, because `free()` is
> not implemented on most MCUs currently. (To be accurate: free() is
> available,
> but sbrk() with negative values is not handled correctly.))
>

My plan is to run the RIOT on MCU, but for now I am running it in native to
explore RIOT. I currently have a telosb (msp430) and an arduino-uno. I was
not able to run RIOT os in telosb and was able to run RIOT on arduino-uno.
But I think arduino-uno is a little less powerful for networking stuff and
it is still a WIP, so I am planning to buy arduino-due.
So, as far as your suggestion and my understanding, I will use the RIOT
with tlsf when flashing it to MCU.

Thank you again for your valuable suggestions.

On Thu, Sep 1, 2016 at 9:19 AM, Oleg Hahm <[email protected]> wrote:

> Hi Nazmul!
>
> On Wed, Aug 31, 2016 at 04:53:20PM +0000, Nazmul Alam wrote:
> > Sorry for the poor explanation.
>
> No need to excuse here. :)
>
> > I have created four tap devices. But the image was crashing before
> running
> > the ccn-lite-relay example.
>
> I was just checking, because this can sometimes cause weird error messages.
>
> > 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/
> > > pkg/native/tlsf/src/tlsf-malloc.c:9
> > > ...
> > > #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).
>
> Have you executed the elf by any chance directly like this:
> ./bin/native/ccn-lite-relay.elf
> or did you use `make term`?
>
> In the first case, you're right, there's an issue that native will call
> printf() before tlsf got initialized and malloc() will fail. I will open an
> issue.
>
> > Following lines defined in tlsf-malloc.h
> >
> > > #ifndef TLSF_MALLOC_PREFIX
> > > #   define TLSF_MALLOC_PREFIX
> > > #endif
> > > #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
> > null).
> >
> > defining the TLSF_MALLOC_PREFIX forces the linker to use correct malloc.
>
> But if you don't want to use tlsf, you can simple remove it from the
> Makefile.
> (But note that it won't work on most real devices then, because `free()` is
> not implemented on most MCUs currently. (To be accurate: free() is
> available,
> but sbrk() with negative values is not handled correctly.))
>
> Cheers,
> Oleg
> --
> printk("MASQUERADE: No route: Rusty's brain broke!\n");
>         linux-2.4.3/net/ipv4/netfilter/ipt_MASQUERADE.c
>
> _______________________________________________
> users mailing list
> [email protected]
> https://lists.riot-os.org/mailman/listinfo/users
>
>


-- 
with best regards,
       Nazmul Alam Shovon


*শুভেচ্ছান্তে,       নাজমুল আলম শোভন*

blog : https://yourdigitaleffects.wordpress.com/
_______________________________________________
users mailing list
[email protected]
https://lists.riot-os.org/mailman/listinfo/users

Reply via email to