Merge remote-tracking branch 'upstream/master'

pull/34/head
ytsuboi 2013-08-16 02:38:42 +09:00
commit 478f0498e7
16 changed files with 131 additions and 81 deletions

10
.gitignore vendored
View File

@ -3,6 +3,14 @@
# Private settings
private_settings.py
# Default Build Directory
build/
# Eclipse Project Files
.cproject
.project
.pydevproject
# C extensions
*.so
@ -34,8 +42,6 @@ nosetests.xml
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
output.txt
uVision Project/

View File

@ -104,7 +104,7 @@ public:
*/
template<typename T>
pFunctionPointer_t attach(T* tptr, void (T::*mptr)(void), float t) {
return attach_us(tptr, mptr, t * 1000000.0f);
return attach_us(tptr, mptr, t * 1000000.0f);
}
/** Add a function to be called by the Ticker at the end of the call chain
@ -158,7 +158,7 @@ public:
*/
template<typename T>
pFunctionPointer_t attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
pFunctionPointer_t pf = _chain.add(mptr, tptr);
pFunctionPointer_t pf = _chain.add(tptr, mptr);
setup(t);
return pf;
}

View File

@ -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*)
@ -114,13 +115,16 @@ SECTIONS
} > RAM
.bss :
{
__bss_start__ = .;
*(.bss*)
*(COMMON)
__bss_end__ = .;
Image$$RW_IRAM1$$ZI$$Limit = . ;
} > RAM
.heap :
{
@ -146,4 +150,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
}

View File

@ -138,8 +138,14 @@ struct lpc_enetdata {
# else
# define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned))
# endif
#else
# define ETHMEM_SECTION ALIGNED(8)
#elif defined(TARGET_LPC1768)
# if defined(TOOLCHAIN_GCC_ARM)
# define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned))
# endif
#endif
#ifndef ETHMEM_SECTION
#define ETHMEM_SECTION ALIGNED(8)
#endif
/** \brief LPC EMAC driver work data
@ -424,10 +430,31 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
p = lpc_enetif->rxb[idx];
p->len = (u16_t) length;
/* Free pbuf from desriptor */
/* Free pbuf from descriptor */
lpc_enetif->rxb[idx] = NULL;
lpc_enetif->rx_free_descs++;
/* Attempt to queue new buffer(s) */
if (lpc_rx_queue(lpc_enetif->netif) == 0) {
/* Drop the frame due to OOM. */
LINK_STATS_INC(link.drop);
/* Re-queue the pbuf for receive */
lpc_rxqueue_pbuf(lpc_enetif, p);
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_low_level_input: Packet index %d dropped for OOM\n",
idx));
#ifdef LOCK_RX_THREAD
#if NO_SYS == 0
sys_mutex_unlock(&lpc_enetif->TXLockMutex);
#endif
#endif
return NULL;
}
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_low_level_input: Packet received: %p, size %d (index=%d)\n",
p, length, idx));
@ -435,9 +462,6 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
/* Save size */
p->tot_len = (u16_t) length;
LINK_STATS_INC(link.recv);
/* Queue new buffer(s) */
lpc_rx_queue(lpc_enetif->netif);
}
}
@ -618,14 +642,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.

View File

@ -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 */

View File

@ -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) {

View File

@ -22,8 +22,6 @@
#include "Socket/Socket.h"
#include "Socket/Endpoint.h"
#include <cstdint>
/**
UDP Socket
*/

View File

@ -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 */

View File

@ -51,7 +51,7 @@ typedef struct {
osMessageQId id;
osMessageQDef_t def;
#ifdef CMSIS_OS_RTX
uint32_t queue[MB_SIZE];
uint32_t queue[4+MB_SIZE]; /* The +4 is required for RTX OS_MCB overhead. */
#endif
} sys_mbox_t;

View File

@ -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;

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 */
#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))) {

View File

@ -29,14 +29,14 @@
#define LWIP_RAW 0
#define TCPIP_MBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_RAW_RECVMBOX_SIZE 6
#define DEFAULT_ACCEPTMBOX_SIZE 6
#define TCPIP_MBOX_SIZE 8
#define DEFAULT_TCP_RECVMBOX_SIZE 8
#define DEFAULT_UDP_RECVMBOX_SIZE 8
#define DEFAULT_RAW_RECVMBOX_SIZE 8
#define DEFAULT_ACCEPTMBOX_SIZE 8
#define TCPIP_THREAD_STACKSIZE 1024
#define TCPIP_THREAD_PRIO 1
#define TCPIP_THREAD_PRIO (osPriorityNormal)
#define DEFAULT_THREAD_STACKSIZE 512

View File

@ -13,11 +13,11 @@ void led_blink(PinName led) {
void notify_completion(bool success) {
if (success) {
printf("{{success}}"NL);
printf("{{success}}" NL );
} else {
printf("{{failure}}"NL);
printf("{{failure}}" NL );
}
printf("{{end}}"NL);
printf("{{end}}" NL);
led_blink(success?LED1:LED4);
}

View File

@ -71,7 +71,7 @@ LIBRARIES = [
"source_dir": [ETH_SOURCES, LWIP_SOURCES],
"build_dir": ETH_LIBRARY,
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_SOURCES, LWIP_SOURCES],
"supported": CORTEX_ARM_SUPPORT
# "supported": CORTEX_ARM_SUPPORT
},
{

View File

@ -18,38 +18,15 @@ from os.path import join, abspath, dirname
import logging
ROOT = abspath(join(dirname(__file__), ".."))
BUILD_DIR = abspath(join(ROOT, "..", "build"))
# These default settings have two purposes:
# 1) Give a template for writing local "private_settings.py"
# 2) Give default initialization fields for the "toolchains.py" constructors
SERVER_PORT = 59432
SERVER_ADDRESS = "10.2.200.94"
LOCALHOST = "10.2.200.94"
MUTs = {
"1" : {"mcu": "LPC1768",
"port":"COM41", "disk":'E:\\',
"peripherals": ["TMP102", "digital_loop", "port_loop", "analog_loop", "SD"]
},
"2": {"mcu": "LPC11U24",
"port":"COM42", "disk":'F:\\',
"peripherals": ["TMP102", "digital_loop", "port_loop", "SD"]
},
"3" : {"mcu": "LPC2368",
"port":"COM43", "disk":'G:\\',
"peripherals": ["TMP102", "digital_loop", "port_loop", "analog_loop", "SD"]
},
"4" : {"mcu": "KL25Z",
"port":"COM44", "disk":'H:\\',
"peripherals": ["TMP102", "digital_loop", "port_loop", "analog_loop", "SD"]
},
"5" : {"mcu": "LPC1114",
"port":"COM45", "disk":"I:\\",
"peripherals": ["TMP102", "digital_loop", "port_loop", "analog_loop", "SD"]
}
}
##############################################################################
# Build System Settings
##############################################################################
BUILD_DIR = abspath(join(ROOT, "build"))
# ARM
armcc = "standalone" # "keil", or "standalone", or "ds-5"
@ -93,10 +70,34 @@ CW_EWL_PATH = "C:/Freescale/CW MCU v10.3/MCU/ARM_GCC_Support/ewl/lib"
BUILD_OPTIONS = []
##############################################################################
# Test System Settings
##############################################################################
SERVER_PORT = 59432
SERVER_ADDRESS = "10.2.200.94"
LOCALHOST = "10.2.200.94"
MUTs = {
"1" : {"mcu": "LPC1768",
"port":"COM41", "disk":'E:\\',
"peripherals": ["TMP102", "digital_loop", "port_loop", "analog_loop", "SD"]
},
"2": {"mcu": "LPC11U24",
"port":"COM42", "disk":'F:\\',
"peripherals": ["TMP102", "digital_loop", "port_loop", "SD"]
},
"3" : {"mcu": "KL25Z",
"port":"COM43", "disk":'G:\\',
"peripherals": ["TMP102", "digital_loop", "port_loop", "analog_loop", "SD"]
},
}
##############################################################################
# Private Settings
##############################################################################
try:
# Allow to overwrite the default settings without the need to edit the
# settings file stored in the repository
from workspace_tools.private_settings import *
logging.debug("Loaded user settings")
except ImportError:
logging.debug("[WARNING] Using default settings. Define you settings in the file private_settings.py")
print '[WARNING] Using default settings. Define you settings in the file "workspace_tools/private_settings.py"'

View File

@ -503,79 +503,74 @@ TESTS = [
"id": "NET_1", "description": "TCP client hello world",
"source_dir": join(TEST_DIR, "net", "helloworld", "tcpclient"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
# "supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_2", "description": "UDP client hello world",
"source_dir": join(TEST_DIR, "net", "helloworld", "udpclient"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
# "supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_3", "description": "TCP echo server",
"source_dir": join(TEST_DIR, "net", "echo", "tcp_server"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
# "supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_4", "description": "TCP echo client",
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
# "supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_5", "description": "UDP echo server",
"source_dir": join(TEST_DIR, "net", "echo", "udp_server"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
# "supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_6", "description": "UDP echo client",
"source_dir": join(TEST_DIR, "net", "echo", "udp_client"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
# "supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_7", "description": "HTTP client",
"source_dir": join(TEST_DIR, "net", "protocols", "HTTPClient_HelloWorld"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
# "supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_8", "description": "NTP client",
"source_dir": join(TEST_DIR, "net", "protocols", "NTPClient_HelloWorld"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
# "supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_9", "description": "Multicast Send",
"source_dir": join(TEST_DIR, "net", "helloworld", "multicast_send"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_10", "description": "Multicast Receive",
"source_dir": join(TEST_DIR, "net", "helloworld", "multicast_receive"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_11", "description": "Broadcast Send",
"source_dir": join(TEST_DIR, "net", "helloworld", "broadcast_send"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_12", "description": "Broadcast Receive",
"source_dir": join(TEST_DIR, "net", "helloworld", "broadcast_receive"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
},
{
"id": "NET_13", "description": "TCP client echo loop",
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client_loop"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"supported": CORTEX_ARM_SUPPORT,
},
# Vodafone tests