From 3d9be83e387cbed02d2799a653c134b3f7440e72 Mon Sep 17 00:00:00 2001 From: 0xc0170 Date: Wed, 14 Aug 2013 18:03:32 +0200 Subject: [PATCH 01/15] Chaining in Ticker - switched arguments [fix] --- libraries/mbed/api/Ticker.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/mbed/api/Ticker.h b/libraries/mbed/api/Ticker.h index 6491103938..68cc9ecdc1 100644 --- a/libraries/mbed/api/Ticker.h +++ b/libraries/mbed/api/Ticker.h @@ -104,7 +104,7 @@ public: */ template 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 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; } From c0fdbede021e1b405fa3f7046ae1a1c706dbb35e Mon Sep 17 00:00:00 2001 From: pbrier Date: Wed, 14 Aug 2013 22:34:33 +0200 Subject: [PATCH 02/15] Compile network and RTOS with GCC_ARM --- .../TOOLCHAIN_GCC_ARM/LPC1768.ld | 36 +++++++++++++++++++ libraries/net/eth/lwip-eth/arch/lpc17_emac.c | 2 ++ libraries/tests/mbed/env/test_env.cpp | 6 ++-- workspace_tools/libraries.py | 2 +- workspace_tools/settings.py | 3 +- workspace_tools/tests.py | 26 +++++++------- workspace_tools/toolchains/gcc.py | 2 +- 7 files changed, 58 insertions(+), 19 deletions(-) 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..57b24ac38c 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 @@ -114,6 +114,41 @@ SECTIONS } > RAM + + /* 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 + + /* .data_RAM2 : ALIGN(4) + { + FILL(0xff) + *(.data.$RAM2*) + *(.data.$ETH_RAM*) + . = ALIGN(4) ; + } > ETH_RAM AT>FLASH + + .bss_RAM2 : ALIGN(4) + { + *(.bss.$RAM2*) + *(.bss.$ETH_RAM*) + . = ALIGN(4) ; + } > ETH_RAM + */ + .bss : { __bss_start__ = .; @@ -121,6 +156,7 @@ SECTIONS *(COMMON) __bss_end__ = .; } > RAM + .heap : { diff --git a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c index 7518d72ab5..9b7ce41375 100644 --- a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c +++ b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c @@ -142,6 +142,8 @@ struct lpc_enetdata { # define ETHMEM_SECTION ALIGNED(8) #endif +#define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned)) + /** \brief LPC EMAC driver work data */ ETHMEM_SECTION struct lpc_enetdata lpc_enetdata; diff --git a/libraries/tests/mbed/env/test_env.cpp b/libraries/tests/mbed/env/test_env.cpp index ed88de24b0..1fc3aa1c2d 100644 --- a/libraries/tests/mbed/env/test_env.cpp +++ b/libraries/tests/mbed/env/test_env.cpp @@ -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); } diff --git a/workspace_tools/libraries.py b/workspace_tools/libraries.py index aa5bb2c234..453922a17e 100644 --- a/workspace_tools/libraries.py +++ b/workspace_tools/libraries.py @@ -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 }, { diff --git a/workspace_tools/settings.py b/workspace_tools/settings.py index 0e48d27b86..9317aae200 100644 --- a/workspace_tools/settings.py +++ b/workspace_tools/settings.py @@ -76,7 +76,8 @@ ARM_CPPLIB = join(ARM_LIB, "cpplib") MY_ARM_CLIB = join(ARM_PATH, "lib", "microlib") # GCC ARM -GCC_ARM_PATH = "C:/arm-none-eabi-gcc-4_7/bin" +# GCC_ARM_PATH = "C:/arm-none-eabi-gcc-4_7/bin" +GCC_ARM_PATH = "" # GCC CodeSourcery GCC_CS_PATH = "C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin" diff --git a/workspace_tools/tests.py b/workspace_tools/tests.py index 366049327c..7f9aa9af8e 100644 --- a/workspace_tools/tests.py +++ b/workspace_tools/tests.py @@ -503,79 +503,79 @@ 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, + # "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, + # "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, + # "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, + # "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, + # "supported": CORTEX_ARM_SUPPORT, }, # Vodafone tests diff --git a/workspace_tools/toolchains/gcc.py b/workspace_tools/toolchains/gcc.py index 22ca32dae6..8ec65ee2d7 100644 --- a/workspace_tools/toolchains/gcc.py +++ b/workspace_tools/toolchains/gcc.py @@ -62,7 +62,7 @@ class GCC(mbedToolchain): self.asm = [join(tool_path, "arm-none-eabi-as")] + self.cpu self.cc = [join(tool_path, "arm-none-eabi-gcc"), "-std=gnu99"] + common_flags - self.cppc =[join(tool_path, "arm-none-eabi-g++"), "-std=gnu++98"] + common_flags + self.cppc =[join(tool_path, "arm-none-eabi-g++"), "-std=gnu++11"] + common_flags self.ld = [join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections", "-Wl,--wrap,main"] + self.cpu self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"] From 9011a5453ada72ac2e2390f1366974561fe4d0e4 Mon Sep 17 00:00:00 2001 From: pbrier Date: Wed, 14 Aug 2013 22:45:55 +0200 Subject: [PATCH 03/15] Compile network and RTOS with GCC_ARM --- .../TARGET_LPC176X/TOOLCHAIN_GCC_ARM/LPC1768.ld | 15 --------------- 1 file changed, 15 deletions(-) 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 57b24ac38c..ddec0cf7f2 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 @@ -133,21 +133,6 @@ SECTIONS Image$$RW_IRAM3$$ZI$$Limit = .; } > ETH_RAM - /* .data_RAM2 : ALIGN(4) - { - FILL(0xff) - *(.data.$RAM2*) - *(.data.$ETH_RAM*) - . = ALIGN(4) ; - } > ETH_RAM AT>FLASH - - .bss_RAM2 : ALIGN(4) - { - *(.bss.$RAM2*) - *(.bss.$ETH_RAM*) - . = ALIGN(4) ; - } > ETH_RAM - */ .bss : { From ac078485ace5e34f97a8a4ccb473fa2a8d122fac Mon Sep 17 00:00:00 2001 From: pbrier Date: Wed, 14 Aug 2013 22:52:16 +0200 Subject: [PATCH 04/15] Compile network and RTOS with GCC_ARM --- libraries/net/eth/lwip-eth/arch/lpc17_emac.c | 2 ++ workspace_tools/tests.py | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c index 9b7ce41375..98215a9883 100644 --- a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c +++ b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c @@ -142,7 +142,9 @@ struct lpc_enetdata { # define ETHMEM_SECTION ALIGNED(8) #endif +#if defined(TARGET_LPC1768) && defined(TOOLCHAIN_GCC_ARM) #define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned)) +#endif /** \brief LPC EMAC driver work data */ diff --git a/workspace_tools/tests.py b/workspace_tools/tests.py index 7f9aa9af8e..319faf3c95 100644 --- a/workspace_tools/tests.py +++ b/workspace_tools/tests.py @@ -551,31 +551,26 @@ TESTS = [ "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 From aa7a55b6ddab33d4c876b14124a16dc72afce539 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Tue, 13 Aug 2013 20:33:49 -0700 Subject: [PATCH 05/15] Update LPC1768.ld linker script to work with net stack. The original script assigned memory ranges to USB_RAM and ETH_RAM but it never placed any section data in those regions. I added clauses towards the bottom of the script to place data that the programmer has marked for the AHBSRAM0 and AHBSRAM1 sections into these regions of RAM. Previously the data destined for these sections was being placed in the lower 32K RAM bank and overflowing it at link time. I also added a few Image$$ linker symbols to mimic those used by the online compiler. I have had samples in the past which took advantage of these to display static memory statistics for each SRAM region. I also changed LENGTH=0x7F38 to LENGTH=(32K - 0xC8) to make it more consistent with the sizing of the other regions in this script which use human readable K sizing information. The 0xC8 subtraction reflects the starting offset of 0xC8 for this region. --- .../TOOLCHAIN_GCC_ARM/LPC1768.ld | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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 } From e014b41377e628af7d6460c77a65e27ad56ad754 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Tue, 13 Aug 2013 20:50:02 -0700 Subject: [PATCH 06/15] Silence signed/unsigned comparison warnings in GCC The dn variable in lpc_low_level_output() was originally defined as a u32_t but it is later compared to the s32_t return value from lpc_tx_ready(). Since it is intialized to pbuf_clean() which returns a u8_t, a s32_t type can safely hold the initial value and remains consistent with the signed lpc_tx_ready() comparison. I also modifed writtenLen in TCPSocketConnection::send_all() and readLen in TCPSocketConnection::recieve_all() to be of type int instead of size_t. This is more consistent with their usage within these methods (they accumulate int ret values and are compared to the int length value) and their use as a signed integer return values. --- libraries/net/eth/lwip-eth/arch/lpc17_emac.c | 6 +++--- libraries/net/lwip/Socket/TCPSocketConnection.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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/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) { From 6e95a5ecdeefb538aa0a1e92ff550fd832bf6711 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Tue, 13 Aug 2013 21:03:23 -0700 Subject: [PATCH 07/15] Removed extra ALIGNED macro define --- libraries/net/lwip/lwip-sys/arch/cc.h | 1 - 1 file changed, 1 deletion(-) 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 */ From 1cf5243206862342ee4a2afbe8810f83718d1b66 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Tue, 13 Aug 2013 21:06:04 -0700 Subject: [PATCH 08/15] Don't call ip_addr_isany() on objects which can't be NULL. GCC will issue a warning when the ip_addr_isany() macro is used on a pointer which can never be NULL since the macros NULL check will always be false: #define ip_addr_isany(addr1) ((addr1) == NULL || \ (addr1)->addr == IPADDR_ANY) In these cases, it is probably clearer to just perform the x.addr == IPADDR_ANY check inline. --- libraries/net/lwip/lwip/core/ipv4/ip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))) { From 962dd8bd8fc37958d2648a6e5067937679cd1c17 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Tue, 13 Aug 2013 21:17:25 -0700 Subject: [PATCH 09/15] Silence GCC warnings in dhcp.c The first was a potential out of range index read in dhcp_handle_ack(). The (n < DNS_MAX_SERVERS) check should occur first. There is also a documented lwIP bug for this issue here: http://savannah.nongnu.org/bugs/?36170 In dhcp_bind() there is no need to perform the NULL check in ip_addr_isany() for &gw_addr. Just check (gw_addr.addr == IPADDR_ANY) instead. I refactored the chaddr[] copy in dhcp_create_msg() to first copy all of the valid bytes in hwaddr and then pad the rest of the bytes with 0. Before it used to check on every destination byte if it should copy or pad. GCC originally complained about an index out of range read from the hwaddr[] array even though it was protected by a conditional operator. The refactor makes the intent a bit clearer and saves the extra comparison per loop iteration. It also stops GCC from complaining :) --- libraries/net/lwip/lwip/core/dhcp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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; From 282c354ba733d80307fe9ecfde50320dec31bd7e Mon Sep 17 00:00:00 2001 From: Adam Green Date: Tue, 13 Aug 2013 22:38:48 -0700 Subject: [PATCH 10/15] The value of 2 can't fit in a 1 bit wide field. The phy_speed_100mbs, phy_full_duplex, and phy_link_active fields of PHY_STATUS_TYPE are 1 bit wide but lpc_phy_init() attempted to initialize them to a value of 2. I switched the initializations to be 0 instead and it still generated the same .bin image. --- libraries/net/eth/lwip-eth/arch/lpc_phy_dp83848.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 */ From 657e6df20385240b7751ea4ae83dfc99bf67a5e8 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Wed, 14 Aug 2013 22:24:57 -0700 Subject: [PATCH 11/15] Updates to network code to improve performance/robustness I started out looking at some UDP receive code that was only able to handle 3 inbound 550 byte datagrams out of 16 when sent in quick succession. I stepped through the ethernet driver code and it seemed to work as expected but it just couldn't queue up more than 3 PBUFs for each burst. It was almost like it was being starved of CPU cycles. Based on that observation, I looked up the thread priorities for the receive ethernet thread and found the following close to the top of the lpc17_emac.c source file: #define RX_PRIORITY (osPriorityNormal) This got me to thinking, what is the priority of the tcp thead? It turns out that it gets its priority from the following line in lwipopts.h: #define TCPIP_THREAD_PRIO 1 Interesting! What priority is 1? It turns out that it corresponds to osPriorityAboveNormal. This means that while the tcp thread is handling one packet that has been posted to its mailbox from the ethernet receive thread, the receive thread is starved from processing any more inbound ethernet packets. What happens if we set TCP_IP_THREAD_PRIO to osPriorityNormal? Crash! The ethernet driver ends up crashing in lpc_low_level_input() when it tries to set p->len on a NULL p pointer. The p pointer ended up being NULL because an earlier call to pbuf_alloc() in lpc_rx_queue() failed its allocation (I will have more to say about this failed allocation later since that is caused by yet another bug). I pulled a fix from http://lpcware.com/content/bugtrackerissue/lpc17xx-mac-bugs to remedy this issue. When the pbuf allocation fails, it discards the inbound packet in the pbuf and just puts it back into the rx queue. This means we never end up with a NULL pointer in that queue to dereference and crash on. With that bug fixed, the application would just appear to hang after receiving and processing a few datagrams. I could place breakpoints in the packet_rx() thread function and found that it was being signalled by the ethernet ISR but it was always failing to allocate new PBUFs, which is what led to our previous crash. This means that the new crash prevention code was just discarding every packet that arrived. Why are these allocations failing? In my opinion, this was the most interesting bug to track down. Is there a memory leak somewhere in the code which maybe only triggers in low memory situations? I figured the easiest way to determine that would be to learn a bit about the format of the lwIP heap from which the PBUF was failing to be allocated. I started by just stepping into the failing lwIP memory allocator, mem_malloc(). The loop which search the free list starts with this code: for (ptr = (mem_size_t)((u8_t *)lfree - ram); This loop didn't even go through one iteration and when I looked at the initial ptr value it contained a really large value. It turns out that lfree was actually lower than ram. At this point I figured that lfree had probably been corrupted during a free operation after one of the heap allocations had been underflowed/overflowed to cause the metadata for an allocation to be corrupted. As I started thinking about how to track that kind of bug down, I noticed that the ram variable might be too large (0x20080a68). I restarted the debugger and looked at the initial value. It was at a nice even address (0x2007c000) and certainly nothing like what I saw when the allocations were failing. This global variable shouldn't change at all during the execution of the program. I placed a memory access watchpoint on this ram variable and it fired very quickly inside of the rt_mbx_send() function. The ram variable was being changed by this line in rt_mbx_send(): p_MCB->msg[p_MCB->first] = p_msg; What the what? Why does writing to the mailbox queue overwrite the ram global variable? Let's start by looking at the data structure used in the lwIP port to target RTX (defined in sys_arch.h): // === MAIL BOX === typedef struct { osMessageQId id; osMessageQDef_t def; uint32_t queue[MB_SIZE]; } sys_mbox_t; Compare that to the utility macro that RTX defines to help setup one of these mailboxes with queue: #define osMessageQDef(name, queue_sz, type) \ uint32_t os_messageQ_q_##name[4+(queue_sz)]; \ osMessageQDef_t os_messageQ_def_##name = \ { (queue_sz), (os_messageQ_q_##name) } Note the 4+(queue_sz) used in the definition of the message queue array. What a hack! The RTX OS requires an extra 16 bytes to contain its OS_MCB header and this is how it adds it in. Obviously the sys_mbox_t structure used in the lwIP OS targetting code doesn't have this. Without it, the RTX mailbox routines end up scribbling on memory following the structure in memory. Adding 4 in that structure fixes the memory allocation failure that I was seeing and now the network stack can handle between 7 and 10 datagrams within a burst. --- libraries/net/eth/lwip-eth/arch/lpc17_emac.c | 26 +++++++++++++++++--- libraries/net/lwip/lwip-sys/arch/sys_arch.h | 2 +- libraries/net/lwip/lwip/lwipopts.h | 12 ++++----- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c index 06772f48f1..102efb0a26 100644 --- a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c +++ b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c @@ -424,10 +424,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 +456,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); } } diff --git a/libraries/net/lwip/lwip-sys/arch/sys_arch.h b/libraries/net/lwip/lwip-sys/arch/sys_arch.h index e6da8e9fbf..909532eb2f 100644 --- a/libraries/net/lwip/lwip-sys/arch/sys_arch.h +++ b/libraries/net/lwip/lwip-sys/arch/sys_arch.h @@ -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; diff --git a/libraries/net/lwip/lwip/lwipopts.h b/libraries/net/lwip/lwip/lwipopts.h index 42e36f1112..10846e2416 100644 --- a/libraries/net/lwip/lwip/lwipopts.h +++ b/libraries/net/lwip/lwip/lwipopts.h @@ -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 From 44c43e6e3819968c1ff3c41248cb7f7dd4bcd075 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Thu, 15 Aug 2013 14:09:20 +0300 Subject: [PATCH 12/15] Restore C++98 compilation mode Also, remove the line that required C++11 from UDPSocket.h --- libraries/net/lwip/Socket/UDPSocket.h | 2 -- workspace_tools/toolchains/gcc.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/net/lwip/Socket/UDPSocket.h b/libraries/net/lwip/Socket/UDPSocket.h index 44139efdd4..734b256be8 100644 --- a/libraries/net/lwip/Socket/UDPSocket.h +++ b/libraries/net/lwip/Socket/UDPSocket.h @@ -22,8 +22,6 @@ #include "Socket/Socket.h" #include "Socket/Endpoint.h" -#include - /** UDP Socket */ diff --git a/workspace_tools/toolchains/gcc.py b/workspace_tools/toolchains/gcc.py index 8ec65ee2d7..22ca32dae6 100644 --- a/workspace_tools/toolchains/gcc.py +++ b/workspace_tools/toolchains/gcc.py @@ -62,7 +62,7 @@ class GCC(mbedToolchain): self.asm = [join(tool_path, "arm-none-eabi-as")] + self.cpu self.cc = [join(tool_path, "arm-none-eabi-gcc"), "-std=gnu99"] + common_flags - self.cppc =[join(tool_path, "arm-none-eabi-g++"), "-std=gnu++11"] + common_flags + self.cppc =[join(tool_path, "arm-none-eabi-g++"), "-std=gnu++98"] + common_flags self.ld = [join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections", "-Wl,--wrap,main"] + self.cpu self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"] From 28a3466d110315d30697362584aa1f91b1d52549 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Thu, 15 Aug 2013 04:40:53 -0700 Subject: [PATCH 13/15] Fixups to network code after recent merges. Peter's and my changes to LPC1768.ld ended up adding the same AHBSRAM0 and AHBSRAM1 section clauses to the script twice. I removed one copy. I also pulled Peter's define of the ETHMEM_SECTION macro up into the previous nested #if so that the preprocessor wouldn't spit out a redefined macro warning. I verified that building the code clean before and after these changes still results in the same .bin file but now without warnings and/or duplicate code. --- .../TOOLCHAIN_GCC_ARM/LPC1768.ld | 19 ------------------- libraries/net/eth/lwip-eth/arch/lpc17_emac.c | 8 ++++---- 2 files changed, 4 insertions(+), 23 deletions(-) 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 971f749622..ae8c58fda8 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 @@ -116,25 +116,6 @@ SECTIONS } > RAM - /* 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 - - .bss : { __bss_start__ = .; diff --git a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c index b2d7a0c24c..0aecdca018 100644 --- a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c +++ b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c @@ -139,11 +139,11 @@ struct lpc_enetdata { # define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned)) # endif #else -# define ETHMEM_SECTION ALIGNED(8) -#endif - #if defined(TARGET_LPC1768) && defined(TOOLCHAIN_GCC_ARM) -#define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned)) +# define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned)) +#else +# define ETHMEM_SECTION ALIGNED(8) +#endif #endif /** \brief LPC EMAC driver work data From 6744f473594d886d9dcdf0243cc5dd463ea98b94 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Thu, 15 Aug 2013 15:55:47 +0300 Subject: [PATCH 14/15] Changed definition structure of ETHMEM_SECTION This structure makes it easier to add more targets/toolchains in the future and it's (arguably) a bit easier to read. --- libraries/net/eth/lwip-eth/arch/lpc17_emac.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c index 0aecdca018..243f9930a0 100644 --- a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c +++ b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c @@ -138,12 +138,14 @@ struct lpc_enetdata { # else # define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned)) # endif -#else -#if defined(TARGET_LPC1768) && defined(TOOLCHAIN_GCC_ARM) +#elif defined(TARGET_LPC1768) +# if defined(TOOLCHAIN_GCC_ARM) # define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned)) -#else -# define ETHMEM_SECTION ALIGNED(8) +# endif #endif + +#ifndef ETHMEM_SECTION +#define ETHMEM_SECTION ALIGNED(8) #endif /** \brief LPC EMAC driver work data From 4d26e2ef4abf130fda3fb78a4de17736661dc8e8 Mon Sep 17 00:00:00 2001 From: Emilio Monti Date: Thu, 15 Aug 2013 16:09:12 +0100 Subject: [PATCH 15/15] Tidy up default settings --- .gitignore | 10 ++++-- workspace_tools/settings.py | 62 ++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index d7c764479d..241c7708fd 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/workspace_tools/settings.py b/workspace_tools/settings.py index 9317aae200..9b6d3e9ce8 100644 --- a/workspace_tools/settings.py +++ b/workspace_tools/settings.py @@ -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" @@ -76,8 +53,7 @@ ARM_CPPLIB = join(ARM_LIB, "cpplib") MY_ARM_CLIB = join(ARM_PATH, "lib", "microlib") # GCC ARM -# GCC_ARM_PATH = "C:/arm-none-eabi-gcc-4_7/bin" -GCC_ARM_PATH = "" +GCC_ARM_PATH = "C:/arm-none-eabi-gcc-4_7/bin" # GCC CodeSourcery GCC_CS_PATH = "C:/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin" @@ -94,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"'