AVR GetMem/AllocMem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

AVR GetMem/AllocMem

Free Pascal - General mailing list
Hi,

   AFAIU dynamic allocation memory does not exist for AVR platform (
tried to use AllocMem, GetMem and the mcu restart it's self. ) .

Is there any other way to dynamically allocate memory in AVR ?

( I'm writing a driver for the ENC28J60 and I need to allocate memory on
demand for the ethernet packet buffer ).

regards,

--

Dimitrios Chr. Ioannidis

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AVR GetMem/AllocMem

Michael Ring-2
Did you include the HeapMgr unit? This unit enables heap memory
allocation for arm+pic cpu's, hopefully it also works for avr.....

Michael

Am 26.01.19 um 10:29 schrieb Dimitrios Chr. Ioannidis via fpc-pascal:

> Hi,
>
>   AFAIU dynamic allocation memory does not exist for AVR platform (
> tried to use AllocMem, GetMem and the mcu restart it's self. ) .
>
> Is there any other way to dynamically allocate memory in AVR ?
>
> ( I'm writing a driver for the ENC28J60 and I need to allocate memory
> on demand for the ethernet packet buffer ).
>
> regards,
>
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AVR GetMem/AllocMem

Free Pascal - General mailing list
Hi,

Στις 26/1/2019 12:40 μ.μ., ο Michael Ring έγραψε:

> Did you include the HeapMgr unit? This unit enables heap memory
> allocation for arm+pic cpu's, hopefully it also works for avr.....
>
> Am 26.01.19 um 10:29 schrieb Dimitrios Chr. Ioannidis via fpc-pascal:
>> Hi,
>>
>>   AFAIU dynamic allocation memory does not exist for AVR platform (
>> tried to use AllocMem, GetMem and the mcu restart it's self. ) .
>>
>> Is there any other way to dynamically allocate memory in AVR ?


   didn't know that ! ( Also I didn't read anything regarding this in
the wiki )

   A quick test shows that it's working.

   Thx a lot.

   If you've time could you post any other hint / insight you'll think
it could be handy and is not in the wiki ?

regards,

--

Dimitrios Chr. Ioannidis

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AVR GetMem/AllocMem

Michael Ring-2
Use search on fpc-devel + fpc-pascal lists and look for embedded/arm/avr
topics, they are often a goldmine of knowledge....

Michael

Am 26.01.19 um 11:58 schrieb Dimitrios Chr. Ioannidis via fpc-pascal:

> Hi,
>
> Στις 26/1/2019 12:40 μ.μ., ο Michael Ring έγραψε:
>> Did you include the HeapMgr unit? This unit enables heap memory
>> allocation for arm+pic cpu's, hopefully it also works for avr.....
>>
>> Am 26.01.19 um 10:29 schrieb Dimitrios Chr. Ioannidis via fpc-pascal:
>>> Hi,
>>>
>>>   AFAIU dynamic allocation memory does not exist for AVR platform (
>>> tried to use AllocMem, GetMem and the mcu restart it's self. ) .
>>>
>>> Is there any other way to dynamically allocate memory in AVR ?
>
>
>   didn't know that ! ( Also I didn't read anything regarding this in
> the wiki )
>
>   A quick test shows that it's working.
>
>   Thx a lot.
>
>   If you've time could you post any other hint / insight you'll think
> it could be handy and is not in the wiki ?
>
> regards,
>
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: AVR GetMem/AllocMem

Ralf Quint
In reply to this post by Free Pascal - General mailing list
On 1/26/2019 1:29 AM, Dimitrios Chr. Ioannidis via fpc-pascal wrote:
> Hi,
>
>   AFAIU dynamic allocation memory does not exist for AVR platform (
> tried to use AllocMem, GetMem and the mcu restart it's self. ) .
>
> Is there any other way to dynamically allocate memory in AVR ?

I have not used any AVR with FPC (I hope to do so on the next project
that comes along), but the general problem is that you have extremely
limited amount of RAM on those micro controller chips. The popular ones
used on the Arduino Uno and Leonardo, just as an example, do have only
2KB and 2.5KB of RAM to work with. So it is very unwise to rely on any
form of dynamic memory allocation. There is just no guarantee that there
is enough RAM for such operations available. It simply requires a
different mindset and a lot of planning ahead, more than on pretty much
any other platform these days...

Ralf


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal