[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] NIOS II port: Request for memory alignement macro to be inc
From: |
Jan Ulvesten |
Subject: |
[lwip-users] NIOS II port: Request for memory alignement macro to be included in lwip source |
Date: |
Tue, 6 Dec 2005 23:25:55 +0100 |
Hi
In Alteras uCOS II port of lwIP for NIOS II, 3 source files have been
changed.
__attribute__ ((aligned (MEM_ALIGNMENT))) is added to a few defs (5) to
control the memory alignment (gnu C syntax).
Patching the standard code base is by no mean the preferred method of
targeting alignment. I suppose that an array is always aligned at an
even boundary, but the 4-byte alignment is only achieved using
__attribute__ ((aligned (4))).
It could easily be avoided adding a macro the defs below, e.g.:
#define MEM_ALIGMENT_ATTR __attribute__ ((aligned (MEM_ALIGNMENT)))
- or -
#define MEM_ALIGMENT_ATTR
The definition could then be:
static u8_t ram[MEM_SIZE + sizeof(struct mem) + MEM_ALIGNMENT]
MEM_ALIGMENT_ATTR;
Altera changes:
------------------------------------------------------------------------
----
mem.c
static u8_t ram[MEM_SIZE + sizeof(struct mem) + MEM_ALIGNMENT]
__attribute__ ((aligned (MEM_ALIGNMENT)));
------------------------------------------------------------------------
----ipfrag.c:
static u8_t ip_reassbuf[IP_HLEN + IP_REASS_BUFSIZE] __attribute__
((aligned (MEM_ALIGNMENT)));
static u8_t ip_reassbitmap[IP_REASS_BUFSIZE / (8 * 8)] __attribute__
((aligned (MEM_ALIGNMENT)));
static u8_t ip_reassbuf[IP_HLEN + IP_REASS_BUFSIZE] __attribute__
((aligned (MEM_ALIGNMENT)));
------------------------------------------------------------------------
----pbuf.c
static u8_t pbuf_pool_memory[(PBUF_POOL_SIZE *
MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE + sizeof(struct pbuf)))] __attribute__
((aligned (MEM_ALIGNMENT)));
------------------------------------------------------------------------
----
+ in dhcp.h a
#if LWIP_DHCP==1 could be used to avoid defining protos when DHCP is
disabled.
Jan Ulvesten
SICOM
- [lwip-users] NIOS II port: Request for memory alignement macro to be included in lwip source,
Jan Ulvesten <=