Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LPC1768 linker script and silence GNU warnings in network stack #31

Merged
merged 6 commits into from
Aug 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -84,6 +84,7 @@ SECTIONS
.data : AT (__etext)
{
__data_start__ = .;
Image$$RW_IRAM1$$Base = .;
*(vtable)
*(.data*)

Expand Down Expand Up @@ -120,6 +121,7 @@ SECTIONS
*(.bss*)
*(COMMON)
__bss_end__ = .;
Image$$RW_IRAM1$$ZI$$Limit = . ;
} > RAM

.heap :
Expand All @@ -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
}
6 changes: 3 additions & 3 deletions libraries/net/eth/lwip-eth/arch/lpc17_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions libraries/net/eth/lwip-eth/arch/lpc_phy_dp83848.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions libraries/net/lwip/Socket/TCPSocketConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion libraries/net/lwip/lwip-sys/arch/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
14 changes: 9 additions & 5 deletions libraries/net/lwip/lwip/core/dhcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libraries/net/lwip/lwip/core/ipv4/ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current_iphdr_src))
if (check_ip_src && current_iphdr_src.addr != IPADDR_ANY)
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
{ if ((ip_addr_isbroadcast(&current_iphdr_src, inp)) ||
(ip_addr_ismulticast(&current_iphdr_src))) {
Expand Down