2010-09-02 07:59:07     bfin-elf: How to put heap into external memory

Document created by Aaronwu Employee on Sep 26, 2013
Version 1Show Document
  • View in full screen mode

2010-09-02 07:59:07     bfin-elf: How to put heap into external memory

Frank Lorenz (GERMANY)

Message: 93072   

 

Hi,

 

I started to use dynamic memory (malloc) on my BF-534 based custom board. I already put major parts of my code and data into external memory using a custom linker script.

 

But when I allocate memory it is put into internal data RAM A. I have no idea how to alter this. I need some rather huge data blocks which will not fit into internal RAM, so is there any option for the linker script? Or do I have to recompile newlib?

 

 

 

best regards,

 

Frank

TranslateQuoteReplyEditDelete

 

 

2010-09-02 11:24:47     Re: bfin-elf: How to put heap into external memory

Mike Frysinger (UNITED STATES)

Message: 93081   

 

the default heap on Blackfin starts at the _end symbol.  if you want to do something more, you'll have to define your own _sbrk() function.

 

you can consult the libgloss/bfin/syscalls.c to see how.

QuoteReplyEditDelete

 

 

2010-10-06 03:31:52     Re: bfin-elf: How to put heap into external memory

Frank Lorenz (GERMANY)

Message: 94240   

 

Do I have to recompile newlib for this? Or can I just add a _sbrk function inside my project that handles this?

TranslateQuoteReplyEditDelete

 

 

2010-10-06 03:36:40     Re: bfin-elf: How to put heap into external memory

Mike Frysinger (UNITED STATES)

Message: 94242   

 

bare metal is all statically linked.  so there is no need to touch newlib itself.  simply define your funcs first.

QuoteReplyEditDelete

 

 

2010-10-06 08:50:20     Re: bfin-elf: How to put heap into external memory

Frank Lorenz (GERMANY)

Message: 94270   

 

Thanks for the help. It works now.

 

 

 

I just added a symbol at the end of my external memory data sections in the linker script (like described here: http://sourceware.org/binutils/docs/ld/Assignments.html#Assignments)

 

Then I just added a copy of the _sbrk function to my code and modified it to work with the newly defined symbol instead of the _end symbol.

 

 

 

best regards,

 

Frank

Attachments

    Outcomes