Martin,
I just pulled down your two sample .ELF files and looked at the stack for the osTimerThread and they were both unaligned.
mbed_httpserver-badlinking
(gdb) p os_thread_def_osTimerThread 
$2 = {
  pthread = 0xf4d <osTimerThread>, 
  tpriority = osPriorityHigh, 
  stacksize = 2048, 
  stack_pointer = 0x10000279 <os_thread_def_stack_osTimerThread> "", 
  tcb = {
    cb_type = 0 '\000', 
    state = 0 '\000', 
    prio = 0 '\000', 
    task_id = 0 '\000', 
    p_lnk = 0x0 <rt_itv_wait>, 
    p_rlnk = 0x0 <rt_itv_wait>, 
    p_dlnk = 0x0 <rt_itv_wait>, 
    p_blnk = 0x0 <rt_itv_wait>, 
    delta_time = 0, 
    interval_time = 0, 
    events = 0, 
    waits = 0, 
    msg = 0x0 <rt_itv_wait>, 
    stack_frame = 0 '\000', 
    reserved = 0 '\000', 
    priv_stack = 0, 
    tsk_stack = 0, 
    stack = 0x0 <rt_itv_wait>, 
    ptask = 0x0 <rt_itv_wait>
  }
}
rtos_basic-badlinking
(gdb) p os_thread_def_osTimerThread 
$1 = {
  pthread = 0xd99 <osTimerThread>, 
  tpriority = osPriorityHigh, 
  stacksize = 2048, 
  stack_pointer = 0x10000271 <os_thread_def_stack_osTimerThread> "", 
  tcb = {
    cb_type = 0 '\000', 
    state = 0 '\000', 
    prio = 0 '\000', 
    task_id = 0 '\000', 
    p_lnk = 0x0 <rt_itv_wait>, 
    p_rlnk = 0x0 <rt_itv_wait>, 
    p_dlnk = 0x0 <rt_itv_wait>, 
    p_blnk = 0x0 <rt_itv_wait>, 
    delta_time = 0, 
    interval_time = 0, 
    events = 0, 
    waits = 0, 
    msg = 0x0 <rt_itv_wait>, 
    stack_frame = 0 '\000', 
    reserved = 0 '\000', 
    priv_stack = 0, 
    tsk_stack = 0, 
    stack = 0x0 <rt_itv_wait>, 
    ptask = 0x0 <rt_itv_wait>
  }
}
Note that the value of stack_pointer in both is odd and not 4-byte aligned:
 0x10000279 and  0x10000271
Thanks for sharing that information.  The PR for this stack alignment issue was accepted today so it should make it up to the mbed site soon.
-Adam
                    
                 
                
            
The good news: I tried out the TCPEchoServer example program with the online compiler and it works perfectly. The bad news: I exported it to GCC Arm Embedded and I get the following warnings/errors:
In file included from ./EthernetInterface/lwip/include/lwip/arch.h:43:0, from ./EthernetInterface/lwip/include/lwip/debug.h:35, from ./EthernetInterface/lwip/include/lwip/opt.h:46, from EthernetInterface/lwip-eth/arch/lpc17_emac.c:26: ./EthernetInterface/lwip-sys/arch/cc.h:83:0: warning: "ALIGNED" redefined [enabled by default] ./EthernetInterface/lwip-sys/arch/cc.h:82:0: note: this is the location of the previous definition
Fixed the above by commenting out line cc.h, line 83 Then got the following error:
In file included from /usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/include/c++/4.7.4/cstdint:35:0, from ./EthernetInterface/Socket/UDPSocket.h:25, from ./EthernetInterface/EthernetInterface.h:78, from main.cpp:2: /usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/include/c++/4.7.4/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. make: * [main.o] Error 1
Fixed it by commenting out UDPSocket.h, line 25 Then got this linker error:
/usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: TCPEchoServer.elf section `.bss' will not fit in region `RAM' /usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: region RAM overflowed with stack /usr/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: region `RAM' overflowed by 2040 bytes collect2: error: ld returned 1 exit status make: * [TCPEchoServer.elf] Error 1
I looked at the linker script and saw things like ETH_RAM and in the code saw sections like AHBSRAM0 AHBSRAM1, etc. So what is the status of the EthernetInterface library with regard to exporting to GCC and others?? I am not currently familar with linker scripts and memory sections, but I may have to learn??
Thanks!