replacement of talloc

ronnie sahlberg ronniesahlberg at gmail.com
Sun Jul 22 04:51:19 MDT 2012


in crt0.s
once you have decided how big the stack should be, set aside all
memory from there to the end as managed by malloc()/free() and then
juat implement some simple linked lists to track used and free memory.
As it is an embedded system you probably do no need anything very
fancy to keep things very fast.



On Sun, Jul 22, 2012 at 8:39 PM, ronnie sahlberg
<ronniesahlberg at gmail.com> wrote:
> Well,
>
> memset() is not a solution. That is like saying that "I will use
> printf() as a substitute for malloc()." It makes no sense.
>
> If your embedded platform does not yet provide you with a basic libc
> and malloc()/free() you just have to write them yourself
> just like people in embedded systems have had to for ages.
> And hook initialization of it into crt0.s
>
> A simple malloc()/free() implementation should not take more than a
> few hours/a day to write for a new embedded architecture.
>
>
> regards
> ronnie sahlberg
>
> On Sun, Jul 22, 2012 at 8:27 PM, akib sayyed <mailing.akib at gmail.com> wrote:
>>
>> so whats the solution??
>> if i need to implement malloc manually for arm7 how can i do that??
>> any help or hint will be great
>>
>> On Sun, Jul 22, 2012 at 3:51 PM, ronnie sahlberg <ronniesahlberg at gmail.com>
>> wrote:
>>>
>>> You can not substitute malloc() with memset()
>>> they serve completely different purposes.
>>>
>>>
>>> On Sun, Jul 22, 2012 at 8:17 PM, akib sayyed <mailing.akib at gmail.com>
>>> wrote:
>>> > didnt get you
>>> > here is talloc code that has been use.
>>> > i can use memset like this memset(atr,0,sizeof(atr)); in firmware
>>> > so in above code if i replace complete malloc with memset will it work??
>>> >
>>> > On Fri, Jul 20, 2012 at 1:48 AM, Alexander Bokovoy <ab at samba.org> wrote:
>>> >
>>> >> On Thu, Jul 19, 2012 at 7:48 PM, akib sayyed <mailing.akib at gmail.com>
>>> >> wrote:
>>> >> > i am compiling using gnutoolchain  to compile my code. and error is
>>> >> > not
>>> >> > while compiling its while linking
>>> >> So it has missing symbols, most likely in form of malloc and free.
>>> >>
>>> >> Your setup is basically a single statically linked program. You would
>>> >> need to implement memory management on your own. This is actually
>>> >> easier to be done with talloc as you can simply use a single talloc
>>> >> pool internally that hands out memory out of a single raw memory
>>> >> chunk. Since talloc already hides malloc use from the original program
>>> >> you would need to rewrite few places within talloc where memory is
>>> >> allocated.
>>> >>
>>> >> > On Thu, Jul 19, 2012 at 9:55 PM, Alexander Bokovoy <ab at samba.org>
>>> >> > wrote:
>>> >> >>
>>> >> >> On Thu, Jul 19, 2012 at 7:21 PM, akib sayyed
>>> >> >> <mailing.akib at gmail.com>
>>> >> >> wrote:
>>> >> >> > yes it does run calypso but only some part is ran on actual
>>> >> >> > calypso
>>> >> and
>>> >> >> > actual main part in ran on pc
>>> >> >> > in other words layer 1 is ran on calypso and l2 l3 are on host pc.
>>> >> >> > i want to port l2 l3 on calypso
>>> >> >> I don't think you'll get any success in 256KiB of memory there. But
>>> >> >> good
>>> >> >> luck.
>>> >> >> Is there any specific error when compiling talloc?
>>> >>
>>> >>
>>> >> --
>>> >> / Alexander Bokovoy
>>> >>
>>
>>


More information about the samba-technical mailing list