Skip to content

Commit 478f049

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 268a297 + 4d26e2e commit 478f049

File tree

16 files changed

+131
-81
lines changed

16 files changed

+131
-81
lines changed

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# Private settings
44
private_settings.py
55

6+
# Default Build Directory
7+
build/
8+
9+
# Eclipse Project Files
10+
.cproject
11+
.project
12+
.pydevproject
13+
614
# C extensions
715
*.so
816

@@ -34,8 +42,6 @@ nosetests.xml
3442

3543
# Mr Developer
3644
.mr.developer.cfg
37-
.project
38-
.pydevproject
3945

4046
output.txt
4147
uVision Project/

libraries/mbed/api/Ticker.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class Ticker : public TimerEvent {
104104
*/
105105
template<typename T>
106106
pFunctionPointer_t attach(T* tptr, void (T::*mptr)(void), float t) {
107-
return attach_us(tptr, mptr, t * 1000000.0f);
107+
return attach_us(tptr, mptr, t * 1000000.0f);
108108
}
109109

110110
/** Add a function to be called by the Ticker at the end of the call chain
@@ -158,7 +158,7 @@ class Ticker : public TimerEvent {
158158
*/
159159
template<typename T>
160160
pFunctionPointer_t attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
161-
pFunctionPointer_t pf = _chain.add(mptr, tptr);
161+
pFunctionPointer_t pf = _chain.add(tptr, mptr);
162162
setup(t);
163163
return pf;
164164
}

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MEMORY
55
{
66
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
7-
RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = 0x7F38
7+
RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = (32K - 0xC8)
88

99
USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K
1010
ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K
@@ -84,6 +84,7 @@ SECTIONS
8484
.data : AT (__etext)
8585
{
8686
__data_start__ = .;
87+
Image$$RW_IRAM1$$Base = .;
8788
*(vtable)
8889
*(.data*)
8990

@@ -114,13 +115,16 @@ SECTIONS
114115

115116
} > RAM
116117

118+
117119
.bss :
118120
{
119121
__bss_start__ = .;
120122
*(.bss*)
121123
*(COMMON)
122124
__bss_end__ = .;
125+
Image$$RW_IRAM1$$ZI$$Limit = . ;
123126
} > RAM
127+
124128

125129
.heap :
126130
{
@@ -146,4 +150,23 @@ SECTIONS
146150

147151
/* Check if data + heap + stack exceeds RAM limit */
148152
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
153+
154+
155+
/* Code can explicitly ask for data to be
156+
placed in these higher RAM banks where
157+
they will be left uninitialized.
158+
*/
159+
.AHBSRAM0 (NOLOAD):
160+
{
161+
Image$$RW_IRAM2$$Base = . ;
162+
*(AHBSRAM0)
163+
Image$$RW_IRAM2$$ZI$$Limit = .;
164+
} > USB_RAM
165+
166+
.AHBSRAM1 (NOLOAD):
167+
{
168+
Image$$RW_IRAM3$$Base = . ;
169+
*(AHBSRAM1)
170+
Image$$RW_IRAM3$$ZI$$Limit = .;
171+
} > ETH_RAM
149172
}

libraries/net/eth/lwip-eth/arch/lpc17_emac.c

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,14 @@ struct lpc_enetdata {
138138
# else
139139
# define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned))
140140
# endif
141-
#else
142-
# define ETHMEM_SECTION ALIGNED(8)
141+
#elif defined(TARGET_LPC1768)
142+
# if defined(TOOLCHAIN_GCC_ARM)
143+
# define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned))
144+
# endif
145+
#endif
146+
147+
#ifndef ETHMEM_SECTION
148+
#define ETHMEM_SECTION ALIGNED(8)
143149
#endif
144150

145151
/** \brief LPC EMAC driver work data
@@ -424,20 +430,38 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
424430
p = lpc_enetif->rxb[idx];
425431
p->len = (u16_t) length;
426432

427-
/* Free pbuf from desriptor */
433+
/* Free pbuf from descriptor */
428434
lpc_enetif->rxb[idx] = NULL;
429435
lpc_enetif->rx_free_descs++;
430436

437+
/* Attempt to queue new buffer(s) */
438+
if (lpc_rx_queue(lpc_enetif->netif) == 0) {
439+
/* Drop the frame due to OOM. */
440+
LINK_STATS_INC(link.drop);
441+
442+
/* Re-queue the pbuf for receive */
443+
lpc_rxqueue_pbuf(lpc_enetif, p);
444+
445+
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
446+
("lpc_low_level_input: Packet index %d dropped for OOM\n",
447+
idx));
448+
449+
#ifdef LOCK_RX_THREAD
450+
#if NO_SYS == 0
451+
sys_mutex_unlock(&lpc_enetif->TXLockMutex);
452+
#endif
453+
#endif
454+
455+
return NULL;
456+
}
457+
431458
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
432459
("lpc_low_level_input: Packet received: %p, size %d (index=%d)\n",
433460
p, length, idx));
434461

435462
/* Save size */
436463
p->tot_len = (u16_t) length;
437464
LINK_STATS_INC(link.recv);
438-
439-
/* Queue new buffer(s) */
440-
lpc_rx_queue(lpc_enetif->netif);
441465
}
442466
}
443467

@@ -618,14 +642,14 @@ static err_t lpc_low_level_output(struct netif *netif, struct pbuf *p)
618642
struct lpc_enetdata *lpc_enetif = netif->state;
619643
struct pbuf *q;
620644
u8_t *dst;
621-
u32_t idx;
645+
u32_t idx, notdmasafe = 0;
622646
struct pbuf *np;
623-
u32_t dn, notdmasafe = 0;
647+
s32_t dn;
624648

625649
/* Zero-copy TX buffers may be fragmented across mutliple payload
626650
chains. Determine the number of descriptors needed for the
627651
transfer. The pbuf chaining can be a mess! */
628-
dn = (u32_t) pbuf_clen(p);
652+
dn = (s32_t) pbuf_clen(p);
629653

630654
/* Test to make sure packet addresses are DMA safe. A DMA safe
631655
address is once that uses external memory or periphheral RAM.

libraries/net/eth/lwip-eth/arch/lpc_phy_dp83848.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ err_t lpc_phy_init(struct netif *netif, int rmii)
228228
u32_t tmp;
229229
s32_t i;
230230

231-
physts.phy_speed_100mbs = olddphysts.phy_speed_100mbs = 2;
232-
physts.phy_full_duplex = olddphysts.phy_full_duplex = 2;
233-
physts.phy_link_active = olddphysts.phy_link_active = 2;
231+
physts.phy_speed_100mbs = olddphysts.phy_speed_100mbs = 0;
232+
physts.phy_full_duplex = olddphysts.phy_full_duplex = 0;
233+
physts.phy_link_active = olddphysts.phy_link_active = 0;
234234
phyustate = 0;
235235

236236
/* Only first read and write are checked for failure */

libraries/net/lwip/Socket/TCPSocketConnection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int TCPSocketConnection::send_all(char* data, int length) {
6666
if ((_sock_fd < 0) || !_is_connected)
6767
return -1;
6868

69-
size_t writtenLen = 0;
69+
int writtenLen = 0;
7070
TimeInterval timeout(_timeout);
7171
while (writtenLen < length) {
7272
if (!_blocking) {
@@ -110,7 +110,7 @@ int TCPSocketConnection::receive_all(char* data, int length) {
110110
if ((_sock_fd < 0) || !_is_connected)
111111
return -1;
112112

113-
size_t readLen = 0;
113+
int readLen = 0;
114114
TimeInterval timeout(_timeout);
115115
while (readLen < length) {
116116
if (!_blocking) {

libraries/net/lwip/Socket/UDPSocket.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include "Socket/Socket.h"
2323
#include "Socket/Endpoint.h"
2424

25-
#include <cstdint>
26-
2725
/**
2826
UDP Socket
2927
*/

libraries/net/lwip/lwip-sys/arch/cc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ typedef uintptr_t mem_ptr_t;
8080
#define PACK_STRUCT_END
8181
#define PACK_STRUCT_FIELD(fld) fld
8282
#define ALIGNED(n) __attribute__((aligned (n)))
83-
#define ALIGNED(n) __align(n)
8483
#endif
8584

8685
/* Used with IP headers only */

libraries/net/lwip/lwip-sys/arch/sys_arch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typedef struct {
5151
osMessageQId id;
5252
osMessageQDef_t def;
5353
#ifdef CMSIS_OS_RTX
54-
uint32_t queue[MB_SIZE];
54+
uint32_t queue[4+MB_SIZE]; /* The +4 is required for RTX OS_MCB overhead. */
5555
#endif
5656
} sys_mbox_t;
5757

libraries/net/lwip/lwip/core/dhcp.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ dhcp_handle_ack(struct netif *netif)
564564
#if LWIP_DNS
565565
/* DNS servers */
566566
n = 0;
567-
while(dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n) && (n < DNS_MAX_SERVERS)) {
567+
while((n < DNS_MAX_SERVERS) && dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)) {
568568
ip_addr_t dns_addr;
569569
ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n)));
570570
dns_setserver(n, &dns_addr);
@@ -975,7 +975,7 @@ dhcp_bind(struct netif *netif)
975975

976976
ip_addr_copy(gw_addr, dhcp->offered_gw_addr);
977977
/* gateway address not given? */
978-
if (ip_addr_isany(&gw_addr)) {
978+
if (gw_addr.addr == IPADDR_ANY) {
979979
/* copy network address */
980980
ip_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask);
981981
/* 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)
16781678
ip_addr_set_zero(&dhcp->msg_out->yiaddr);
16791679
ip_addr_set_zero(&dhcp->msg_out->siaddr);
16801680
ip_addr_set_zero(&dhcp->msg_out->giaddr);
1681-
for (i = 0; i < DHCP_CHADDR_LEN; i++) {
1682-
/* copy netif hardware address, pad with zeroes */
1683-
dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/;
1681+
for (i = 0; i < netif->hwaddr_len; i++) {
1682+
/* copy netif hardware address */
1683+
dhcp->msg_out->chaddr[i] = netif->hwaddr[i];
1684+
}
1685+
for ( ; i < DHCP_CHADDR_LEN; i++) {
1686+
/* ... pad rest with zeroes */
1687+
dhcp->msg_out->chaddr[i] = 0;
16841688
}
16851689
for (i = 0; i < DHCP_SNAME_LEN; i++) {
16861690
dhcp->msg_out->sname[i] = 0;

libraries/net/lwip/lwip/core/ipv4/ip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ ip_input(struct pbuf *p, struct netif *inp)
400400
/* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */
401401
#if IP_ACCEPT_LINK_LAYER_ADDRESSING
402402
/* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */
403-
if (check_ip_src && !ip_addr_isany(&current_iphdr_src))
403+
if (check_ip_src && current_iphdr_src.addr != IPADDR_ANY)
404404
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
405405
{ if ((ip_addr_isbroadcast(&current_iphdr_src, inp)) ||
406406
(ip_addr_ismulticast(&current_iphdr_src))) {

libraries/net/lwip/lwip/lwipopts.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929

3030
#define LWIP_RAW 0
3131

32-
#define TCPIP_MBOX_SIZE 6
33-
#define DEFAULT_TCP_RECVMBOX_SIZE 6
34-
#define DEFAULT_UDP_RECVMBOX_SIZE 6
35-
#define DEFAULT_RAW_RECVMBOX_SIZE 6
36-
#define DEFAULT_ACCEPTMBOX_SIZE 6
32+
#define TCPIP_MBOX_SIZE 8
33+
#define DEFAULT_TCP_RECVMBOX_SIZE 8
34+
#define DEFAULT_UDP_RECVMBOX_SIZE 8
35+
#define DEFAULT_RAW_RECVMBOX_SIZE 8
36+
#define DEFAULT_ACCEPTMBOX_SIZE 8
3737

3838
#define TCPIP_THREAD_STACKSIZE 1024
39-
#define TCPIP_THREAD_PRIO 1
39+
#define TCPIP_THREAD_PRIO (osPriorityNormal)
4040

4141
#define DEFAULT_THREAD_STACKSIZE 512
4242

libraries/tests/mbed/env/test_env.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ void led_blink(PinName led) {
1313

1414
void notify_completion(bool success) {
1515
if (success) {
16-
printf("{{success}}"NL);
16+
printf("{{success}}" NL );
1717
} else {
18-
printf("{{failure}}"NL);
18+
printf("{{failure}}" NL );
1919
}
2020

21-
printf("{{end}}"NL);
21+
printf("{{end}}" NL);
2222
led_blink(success?LED1:LED4);
2323
}

workspace_tools/libraries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"source_dir": [ETH_SOURCES, LWIP_SOURCES],
7272
"build_dir": ETH_LIBRARY,
7373
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_SOURCES, LWIP_SOURCES],
74-
"supported": CORTEX_ARM_SUPPORT
74+
# "supported": CORTEX_ARM_SUPPORT
7575
},
7676

7777
{

0 commit comments

Comments
 (0)