[patch #6966] Moving the heap into a user defined section

View: New views
1 Messages — Rating Filter:   Alert me  

[patch #6966] Moving the heap into a user defined section

by Sylvain Beucler-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


URL:
  <http://savannah.nongnu.org/patch/?6966>

                 Summary: Moving the heap into a user defined section
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: iordan_neshev
            Submitted on: Fri 30 Oct 2009 04:20:05 PM GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

This is my suggestion how to move the heap with GCC.
It does not affect the current code if a section is not defined.


This should go in mem.c (above the heap declaration)

/** Defining this allows the heap to be placed in a user-defined
linker section (e.g. EXTERNAL RAM) */

#ifndef HEAP_SECT_PRE
#define HEAP_SECT_PRE
#endif /* HEAP_SECT_PRE */

/** Defining this allows the heap to be placed in a user-defined
linker section (e.g. EXTERNAL RAM) */

#ifndef HEAP_SECT_POST
#define HEAP_SECT_POST
#endif /* HEAP_SECT_POST */

mem.c, line 175: change
static u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) +
MEM_ALIGNMENT];
to
static HEAP_SECT_PRE u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) +
MEM_ALIGNMENT] HEAP_SECT_POST;

We may add a note how to define the section
/** Place this in cc.h to tell GCC to place the heap in section .externalram:

#define HEAP_SECT_PRE(/POST) _attribute_ ((section (".externalram")))
*/

Alternatively, the two #ifndef-#define-#endifs can be placed in opt.h. Then
the _atribute_ would go to lwipopts.h

Unfortunately, this is not easily compatible with #pragma-s





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?6966>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
lwip-devel mailing list
lwip-devel@...
http://lists.nongnu.org/mailman/listinfo/lwip-devel