Merge pull request #31 from adamgreen/gccWarnFixNetwork

Update LPC1768 linker script and silence GNU warnings in network stack
pull/30/merge
Bogdan Marinescu 2013-08-15 02:55:51 -07:00
commit 9d846d9902
7 changed files with 40 additions and 16 deletions

View File

@ -4,7 +4,7 @@
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = 0x7F38 RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = (32K - 0xC8)
USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K
ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K
@ -84,6 +84,7 @@ SECTIONS
.data : AT (__etext) .data : AT (__etext)
{ {
__data_start__ = .; __data_start__ = .;
Image$$RW_IRAM1$$Base = .;
*(vtable) *(vtable)
*(.data*) *(.data*)
@ -120,6 +121,7 @@ SECTIONS
*(.bss*) *(.bss*)
*(COMMON) *(COMMON)
__bss_end__ = .; __bss_end__ = .;
Image$$RW_IRAM1$$ZI$$Limit = . ;
} > RAM } > RAM
.heap : .heap :
@ -146,4 +148,23 @@ SECTIONS
/* Check if data + heap + stack exceeds RAM limit */ /* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
/* Code can explicitly ask for data to be
placed in these higher RAM banks where
they will be left uninitialized.
*/
.AHBSRAM0 (NOLOAD):
{
Image$$RW_IRAM2$$Base = . ;
*(AHBSRAM0)
Image$$RW_IRAM2$$ZI$$Limit = .;
} > USB_RAM
.AHBSRAM1 (NOLOAD):
{
Image$$RW_IRAM3$$Base = . ;
*(AHBSRAM1)
Image$$RW_IRAM3$$ZI$$Limit = .;
} > ETH_RAM
} }

View File

@ -618,14 +618,14 @@ static err_t lpc_low_level_output(struct netif *netif, struct pbuf *p)
struct lpc_enetdata *lpc_enetif = netif->state; struct lpc_enetdata *lpc_enetif = netif->state;
struct pbuf *q; struct pbuf *q;
u8_t *dst; u8_t *dst;
u32_t idx; u32_t idx, notdmasafe = 0;
struct pbuf *np; struct pbuf *np;
u32_t dn, notdmasafe = 0; s32_t dn;
/* Zero-copy TX buffers may be fragmented across mutliple payload /* Zero-copy TX buffers may be fragmented across mutliple payload
chains. Determine the number of descriptors needed for the chains. Determine the number of descriptors needed for the
transfer. The pbuf chaining can be a mess! */ transfer. The pbuf chaining can be a mess! */
dn = (u32_t) pbuf_clen(p); dn = (s32_t) pbuf_clen(p);
/* Test to make sure packet addresses are DMA safe. A DMA safe /* Test to make sure packet addresses are DMA safe. A DMA safe
address is once that uses external memory or periphheral RAM. address is once that uses external memory or periphheral RAM.

View File

@ -228,9 +228,9 @@ err_t lpc_phy_init(struct netif *netif, int rmii)
u32_t tmp; u32_t tmp;
s32_t i; s32_t i;
physts.phy_speed_100mbs = olddphysts.phy_speed_100mbs = 2; physts.phy_speed_100mbs = olddphysts.phy_speed_100mbs = 0;
physts.phy_full_duplex = olddphysts.phy_full_duplex = 2; physts.phy_full_duplex = olddphysts.phy_full_duplex = 0;
physts.phy_link_active = olddphysts.phy_link_active = 2; physts.phy_link_active = olddphysts.phy_link_active = 0;
phyustate = 0; phyustate = 0;
/* Only first read and write are checked for failure */ /* Only first read and write are checked for failure */

View File

@ -66,7 +66,7 @@ int TCPSocketConnection::send_all(char* data, int length) {
if ((_sock_fd < 0) || !_is_connected) if ((_sock_fd < 0) || !_is_connected)
return -1; return -1;
size_t writtenLen = 0; int writtenLen = 0;
TimeInterval timeout(_timeout); TimeInterval timeout(_timeout);
while (writtenLen < length) { while (writtenLen < length) {
if (!_blocking) { if (!_blocking) {
@ -110,7 +110,7 @@ int TCPSocketConnection::receive_all(char* data, int length) {
if ((_sock_fd < 0) || !_is_connected) if ((_sock_fd < 0) || !_is_connected)
return -1; return -1;
size_t readLen = 0; int readLen = 0;
TimeInterval timeout(_timeout); TimeInterval timeout(_timeout);
while (readLen < length) { while (readLen < length) {
if (!_blocking) { if (!_blocking) {

View File

@ -80,7 +80,6 @@ typedef uintptr_t mem_ptr_t;
#define PACK_STRUCT_END #define PACK_STRUCT_END
#define PACK_STRUCT_FIELD(fld) fld #define PACK_STRUCT_FIELD(fld) fld
#define ALIGNED(n) __attribute__((aligned (n))) #define ALIGNED(n) __attribute__((aligned (n)))
#define ALIGNED(n) __align(n)
#endif #endif
/* Used with IP headers only */ /* Used with IP headers only */

View File

@ -564,7 +564,7 @@ dhcp_handle_ack(struct netif *netif)
#if LWIP_DNS #if LWIP_DNS
/* DNS servers */ /* DNS servers */
n = 0; n = 0;
while(dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n) && (n < DNS_MAX_SERVERS)) { while((n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)) {
ip_addr_t dns_addr; ip_addr_t dns_addr;
ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n))); ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
dns_setserver(n, &dns_addr); dns_setserver(n, &dns_addr);
@ -975,7 +975,7 @@ dhcp_bind(struct netif *netif)
ip_addr_copy(gw_addr, dhcp->offered_gw_addr); ip_addr_copy(gw_addr, dhcp->offered_gw_addr);
/* gateway address not given? */ /* gateway address not given? */
if (ip_addr_isany(&gw_addr)) { if (gw_addr.addr == IPADDR_ANY) {
/* copy network address */ /* copy network address */
ip_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask); ip_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask);
/* use first host address on network as gateway */ /* use first host address on network as gateway */
@ -1678,9 +1678,13 @@ dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type)
ip_addr_set_zero(&dhcp->msg_out->yiaddr); ip_addr_set_zero(&dhcp->msg_out->yiaddr);
ip_addr_set_zero(&dhcp->msg_out->siaddr); ip_addr_set_zero(&dhcp->msg_out->siaddr);
ip_addr_set_zero(&dhcp->msg_out->giaddr); ip_addr_set_zero(&dhcp->msg_out->giaddr);
for (i = 0; i < DHCP_CHADDR_LEN; i++) { for (i = 0; i < netif->hwaddr_len; i++) {
/* copy netif hardware address, pad with zeroes */ /* copy netif hardware address */
dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/; dhcp->msg_out->chaddr[i] = netif->hwaddr[i];
}
for ( ; i < DHCP_CHADDR_LEN; i++) {
/* ... pad rest with zeroes */
dhcp->msg_out->chaddr[i] = 0;
} }
for (i = 0; i < DHCP_SNAME_LEN; i++) { for (i = 0; i < DHCP_SNAME_LEN; i++) {
dhcp->msg_out->sname[i] = 0; dhcp->msg_out->sname[i] = 0;

View File

@ -400,7 +400,7 @@ ip_input(struct pbuf *p, struct netif *inp)
/* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */ /* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */
#if IP_ACCEPT_LINK_LAYER_ADDRESSING #if IP_ACCEPT_LINK_LAYER_ADDRESSING
/* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */ /* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */
if (check_ip_src && !ip_addr_isany(&current_iphdr_src)) if (check_ip_src && current_iphdr_src.addr != IPADDR_ANY)
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */ #endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
{ if ((ip_addr_isbroadcast(&current_iphdr_src, inp)) || { if ((ip_addr_isbroadcast(&current_iphdr_src, inp)) ||
(ip_addr_ismulticast(&current_iphdr_src))) { (ip_addr_ismulticast(&current_iphdr_src))) {