diff --git a/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld b/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld index 9ad0af0be0..c4d3447dab 100644 --- a/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld +++ b/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld @@ -4,7 +4,7 @@ MEMORY { 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 ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K @@ -84,6 +84,7 @@ SECTIONS .data : AT (__etext) { __data_start__ = .; + Image$$RW_IRAM1$$Base = .; *(vtable) *(.data*) @@ -120,6 +121,7 @@ SECTIONS *(.bss*) *(COMMON) __bss_end__ = .; + Image$$RW_IRAM1$$ZI$$Limit = . ; } > RAM .heap : @@ -146,4 +148,23 @@ SECTIONS /* Check if data + heap + stack exceeds RAM limit */ 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 } diff --git a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c index 0d06464ab7..06772f48f1 100644 --- a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c +++ b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c @@ -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 pbuf *q; u8_t *dst; - u32_t idx; + u32_t idx, notdmasafe = 0; struct pbuf *np; - u32_t dn, notdmasafe = 0; + s32_t dn; /* Zero-copy TX buffers may be fragmented across mutliple payload chains. Determine the number of descriptors needed for the 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 address is once that uses external memory or periphheral RAM. diff --git a/libraries/net/eth/lwip-eth/arch/lpc_phy_dp83848.c b/libraries/net/eth/lwip-eth/arch/lpc_phy_dp83848.c index 76ffc0cf9a..eca6d97338 100644 --- a/libraries/net/eth/lwip-eth/arch/lpc_phy_dp83848.c +++ b/libraries/net/eth/lwip-eth/arch/lpc_phy_dp83848.c @@ -228,9 +228,9 @@ err_t lpc_phy_init(struct netif *netif, int rmii) u32_t tmp; s32_t i; - physts.phy_speed_100mbs = olddphysts.phy_speed_100mbs = 2; - physts.phy_full_duplex = olddphysts.phy_full_duplex = 2; - physts.phy_link_active = olddphysts.phy_link_active = 2; + physts.phy_speed_100mbs = olddphysts.phy_speed_100mbs = 0; + physts.phy_full_duplex = olddphysts.phy_full_duplex = 0; + physts.phy_link_active = olddphysts.phy_link_active = 0; phyustate = 0; /* Only first read and write are checked for failure */ diff --git a/libraries/net/lwip/Socket/TCPSocketConnection.cpp b/libraries/net/lwip/Socket/TCPSocketConnection.cpp index d84dc9c6b3..b853304099 100644 --- a/libraries/net/lwip/Socket/TCPSocketConnection.cpp +++ b/libraries/net/lwip/Socket/TCPSocketConnection.cpp @@ -66,7 +66,7 @@ int TCPSocketConnection::send_all(char* data, int length) { if ((_sock_fd < 0) || !_is_connected) return -1; - size_t writtenLen = 0; + int writtenLen = 0; TimeInterval timeout(_timeout); while (writtenLen < length) { if (!_blocking) { @@ -110,7 +110,7 @@ int TCPSocketConnection::receive_all(char* data, int length) { if ((_sock_fd < 0) || !_is_connected) return -1; - size_t readLen = 0; + int readLen = 0; TimeInterval timeout(_timeout); while (readLen < length) { if (!_blocking) { diff --git a/libraries/net/lwip/lwip-sys/arch/cc.h b/libraries/net/lwip/lwip-sys/arch/cc.h index f9b8e22385..394635a612 100644 --- a/libraries/net/lwip/lwip-sys/arch/cc.h +++ b/libraries/net/lwip/lwip-sys/arch/cc.h @@ -80,7 +80,6 @@ typedef uintptr_t mem_ptr_t; #define PACK_STRUCT_END #define PACK_STRUCT_FIELD(fld) fld #define ALIGNED(n) __attribute__((aligned (n))) - #define ALIGNED(n) __align(n) #endif /* Used with IP headers only */ diff --git a/libraries/net/lwip/lwip/core/dhcp.c b/libraries/net/lwip/lwip/core/dhcp.c index 81b4be271e..03c0c62384 100644 --- a/libraries/net/lwip/lwip/core/dhcp.c +++ b/libraries/net/lwip/lwip/core/dhcp.c @@ -564,7 +564,7 @@ dhcp_handle_ack(struct netif *netif) #if LWIP_DNS /* DNS servers */ 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; ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n))); dns_setserver(n, &dns_addr); @@ -975,7 +975,7 @@ dhcp_bind(struct netif *netif) ip_addr_copy(gw_addr, dhcp->offered_gw_addr); /* gateway address not given? */ - if (ip_addr_isany(&gw_addr)) { + if (gw_addr.addr == IPADDR_ANY) { /* copy network address */ ip_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask); /* 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->siaddr); ip_addr_set_zero(&dhcp->msg_out->giaddr); - for (i = 0; i < DHCP_CHADDR_LEN; i++) { - /* copy netif hardware address, pad with zeroes */ - dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/; + for (i = 0; i < netif->hwaddr_len; i++) { + /* copy netif hardware address */ + 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++) { dhcp->msg_out->sname[i] = 0; diff --git a/libraries/net/lwip/lwip/core/ipv4/ip.c b/libraries/net/lwip/lwip/core/ipv4/ip.c index 6f248716b6..56843273d1 100644 --- a/libraries/net/lwip/lwip/core/ipv4/ip.c +++ b/libraries/net/lwip/lwip/core/ipv4/ip.c @@ -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 */ #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) */ - if (check_ip_src && !ip_addr_isany(¤t_iphdr_src)) + if (check_ip_src && current_iphdr_src.addr != IPADDR_ANY) #endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */ { if ((ip_addr_isbroadcast(¤t_iphdr_src, inp)) || (ip_addr_ismulticast(¤t_iphdr_src))) {