|
Post by mutantcaterpillar on Nov 29, 2016 10:45:57 GMT
Hi,
On the Arduino, if you want to allocate a large block of memory (say, 200KB), you do it just using a malloc(). However, this doesn't work on the ShieldBuddy as it hangs (on core0) or traps (core1).
On a simple ShieldBuddy project, what is the best way to allocate the memory? Usually I could also use a large block defined in the source but that gives the error: "AurduinoMulticoreUser.elf section `.bss' will not fit in region `int_dsprcpu0'"
How should I allocate such a block of memory? There should be enough RAM available for 200KB, and even if not, it should just return a NULL pointer.
Thanks!
-- Ian Gledhill
|
|
|
Post by mjb on Nov 29, 2016 11:05:33 GMT
Hi,
As the ShieldBuddy development environment is derived from the Arduino, malloc() is not officially supported. However is included and does work. The main thing to bear in mind is that the heap size is set to 0x4000 and is in the LMU RAM. If you try to get a block bigger than this then a trap will occur at some point.
We could make it possible to increase the heap size and move it to a larger RAM area but really it is best to use statically allocated memory on processors like the TC275 rather than using malloc()!
|
|
|
Post by mutantcaterpillar on Nov 29, 2016 11:34:50 GMT
Hi,
The LMU is 32KB only, is that correct? Which is way too small for the 200KB I need. If I statically allocate it, it'll also fail as it's too large for the 32KB - using Eclipse, how should I tell it to use the 500KB RAM space?
Many thanks for the help!
|
|
|
Post by mjb on Nov 29, 2016 14:11:34 GMT
You have 112k of RAM for core0 and 120k each for cores 1 & 2. The LMU RAM is 32k. It may be possible to move the heap to say core2 in a future release.
|
|