Mercurial > nand-ecoscentric
changeset 3079:990c52b02d9c
* cdl/lwip_net.cdl: New CDL option CYGSEM_LWIP_MEM_SECTION.
* include/lwipopts.h: Enter MEM_SECTION entity.
* src/mem.c, src/memp.c: Add an ability to use GCC section
attribute for statically allocated buffers, pbufs, and heap.
| author | sergeig |
|---|---|
| date | Mon, 31 Jan 2011 21:52:31 +0000 |
| parents | a1ee8818f5b4 |
| children | 5698d1884c8c |
| files | packages/net/lwip_tcpip/current/ChangeLog packages/net/lwip_tcpip/current/cdl/lwip_net.cdl packages/net/lwip_tcpip/current/include/lwipopts.h packages/net/lwip_tcpip/current/src/core/mem.c packages/net/lwip_tcpip/current/src/core/memp.c |
| diffstat | 5 files changed, 44 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/net/lwip_tcpip/current/ChangeLog +++ b/packages/net/lwip_tcpip/current/ChangeLog @@ -1,3 +1,10 @@ +2011-01-30 Ilija Kocho <ilijak@siva.com.mk> + + * cdl/lwip_net.cdl: New CDL option CYGSEM_LWIP_MEM_SECTION. + * include/lwipopts.h: Enter MEM_SECTION entity. + * src/mem.c, src/memp.c: Add an ability to use GCC section + attribute for statically allocated buffers, pbufs, and heap. + 2011-01-02 Ilija Kocho <ilijak@siva.com.mk> * src/ecos/sequential.c, src/ecos/simple.c: Fixed miltiple-line
--- a/packages/net/lwip_tcpip/current/cdl/lwip_net.cdl +++ b/packages/net/lwip_tcpip/current/cdl/lwip_net.cdl @@ -1422,6 +1422,33 @@ cdl_package CYGPKG_NET_LWIP { to accomodate single full size TCP frame in one pbuf, including TCP_MSS, IP header, and link header." } + + cdl_component CYGOPT_LWIP_MEM_PLF_SPEC { + display "Platform/application specific memory settings" + flavor none + no_define + description " + Platform or application specific settings such as special + memory section and memory constrains." + + cdl_option CYGSEM_LWIP_MEM_SECTION { + display "Place lwIP buffers and heap in special\ + memory section." + flavor bool + default_value is_active(CYGDAT_LWIP_MEM_SECTION_NAME) + active_if CYGDAT_LWIP_MEM_SECTION_NAME + + description " + If you need lwIP buffers to appear in some special + memory section (it is useful for devices with low + memory footprint that is in addition fragmented + in several non-contiguous blocks) the platform + config file should provide the name of this section + through CYGDAT_LWIP_MEM_SECTION_NAME option, if so, + you can let to use the GCC section attribute for + needed variables by this option." + } + } } cdl_component CYGPKG_LWIP_THREADS {
--- a/packages/net/lwip_tcpip/current/include/lwipopts.h +++ b/packages/net/lwip_tcpip/current/include/lwipopts.h @@ -51,6 +51,14 @@ #define MEMP_MEM_MALLOC defined(CYGIMP_LWIP_MEMP_MEM_MALLOC) #define MEM_ALIGNMENT CYGNUM_LWIP_MEM_ALIGNMENT #define MEM_SIZE CYGNUM_LWIP_MEM_SIZE + +#if defined(CYGSEM_LWIP_MEM_SECTION) && CYGSEM_LWIP_MEM_SECTION +# include <cyg/infra/cyg_type.h> +# define MEM_SECTION CYGBLD_ATTRIB_SECTION(CYGDAT_LWIP_MEM_SECTION_NAME) +#else +# define MEM_SECTION +#endif + #define MEMP_OVERFLOW_CHECK defined(CYGDBG_LWIP_MEMP_OVERFLOW_CHECK) #define MEMP_SANITY_CHECK defined(CYGDBG_LWIP_MEMP_SANITY_CHECK)
--- a/packages/net/lwip_tcpip/current/src/core/mem.c +++ b/packages/net/lwip_tcpip/current/src/core/mem.c @@ -172,7 +172,7 @@ struct mem { #define MEM_SIZE_ALIGNED LWIP_MEM_ALIGN_SIZE(MEM_SIZE) /** the heap. we need one struct mem at the end and some room for alignment */ -static u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT]; +static u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT] MEM_SECTION; /** pointer to the heap (ram_heap): for alignment, ram is now a pointer instead of an array */ static u8_t *ram; /** the last entry, always unused! */
--- a/packages/net/lwip_tcpip/current/src/core/memp.c +++ b/packages/net/lwip_tcpip/current/src/core/memp.c @@ -146,7 +146,7 @@ static const char *memp_desc[MEMP_MAX] = static u8_t memp_memory[MEM_ALIGNMENT - 1 #define LWIP_MEMPOOL(name,num,size,desc) + ( (num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size) ) ) #include "lwip/memp_std.h" -]; +] MEM_SECTION; #if MEMP_SANITY_CHECK /**
