Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-01

AVR GetMem/AllocMem

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dimitrios Chr. Ioannidis

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

Reply by email

Michael Ring
to Dimitrios Chr. Ioannidis

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

Michael

Dimitrios Chr. Ioannidis wrote 12 lines
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,

Reply by email

Dimitrios Chr. Ioannidis
to Michael Ring

Hi,

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

Show quoted text 10 lines
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

Reply by email

Michael Ring
to Dimitrios Chr. Ioannidis

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

Michael

Dimitrios Chr. Ioannidis wrote 27 lines
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,

Reply by email

Ralf Quint
to Dimitrios Chr. Ioannidis:   AFAIU dynamic allocation memory does not exist for AVR platform ( tried to use…
Dimitrios Chr. Ioannidis wrote 6 lines
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

Reply by email