[En-Nut-Discussion] Race condition and stack overflow in tcpsm.c

Ole Reinhardt ole.reinhardt at embedded-it.de
Thu Nov 20 22:07:30 CET 2014

Hi Philipp,

Am 14.11.2014 18:04, schrieb Philipp Burch:
> 1. 388 for tcpsm is still too less, I managed to make it use up to 664
> bytes and hence increased the stack space to 1024 bytes.
> 2. The DHCP thread overflowed as well, I had to set this to 1024 bytes
> as well.

I made the same experience. On CM3 (lpc) I also have set the TCP and
DHCP stack both to 1024 bytes. I never made a measurement of the really
needed size, but I expect it will be more than 650 bytes.

> Always increasing the stacks doesn't seem like an appropriate solution
> however, I'd rather like to find out why the whole thing needs so much
> more space than on other platforms. Does anyone have an idea?

I even doubt that 260 bytes on ARM7 are enough, but the comments in
tcpsm.c show that the needed stack size is heavily related to the used
compiler and optimisation. 384 bytes have been measured using the
arm-elf compiler, while we are looking on the arm-none-eabi compilier,
which uses a differen ABI.

But what we learned is, that we should measure the stack sizes for the
tcpsm with modern compilers again and then add some extra margin.

Best regards,


kernel concepts GmbH            Tel: +49-271-771091-14
Sieghuetter Hauptweg 48         Mob: +49-177-7420433
D-57072 Siegen

More information about the En-Nut-Discussion mailing list