Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Stack check problem on STM32F4

Posted by Dave on March 10, 2013
Hi Folks,

I've got a strange problem on an STM32F4Discovery board which is probably sticky fingers, but has got me fooled. This is FreeRTOS 7.4.0.

I've created an extremely simple build (summon-arm-toolchain) with no active tasks. I have

When I set
to 1, everything is cool, and I can set/trigger a breakpoint in
which implies the code is all cushty.

When I set it to 2, I never seem to reach
. I have taken the expansion for
and pasted it into
, then replaced the
if (memcmp...
with a
if (1==0)...
which results in
getting called again (and no, I'm not running out of stack, I've got breakpoints in there and I've tried setting the stack huge with no change).

Hand stepping through
doesn't reveal anything strange going on either. Its getting late and I will have missed something obvious, but wondered if anyone else had seen any similar behaviour?



RE: Stack check problem on STM32F4

Posted by Dave on March 10, 2013
Spot the newbie who's not used to SF post formatting :-( Hopefully you get the gist from the above despite the rather ridiculous formatting.



RE: Stack check problem on STM32F4

Posted by Richard on March 11, 2013
You are the second person to have this problem - both times it has been with the summon ARM tools. If you can get down to the bottom of the following post you will see that last time it appeared to be some peculiarity with the libraries (or lack of libraries) provided with the tools:



RE: Stack check problem on STM32F4

Posted by Dave on March 11, 2013

Thanks for the quick reply.

Hmm...I was getting to the point of blaming the environment, but that's usually an easy get-out when your own code doesn't work. OK, will investigate further this evening. I have to find out what's going on, otherwise I'll feel like I'm building on sand. Happy to snapshot this build/tools and send it to you if it's useful....there's nothing in it anyway.


RE: Stack check problem on STM32F4

Posted by Dave on March 11, 2013
OK, had a quick dig and changed over from the summon (Linaro) toolchain to gcc-arm....used the pre-compiled version to make sure I've got something the same as others. Linking with newlib from there resulted in the same behavior but linking with the nano lib (--specs nano.specs) results in a correctly working system.

My guess is that something in the way newlib is built results in some strange alignments and without the same incantations for the app there's an incompatibility that shows up as the RTOS not scheduling tasks. I don't really want to be using newlib anyway so for now the solution for me is to move to the nano library. I'll have a quick peek at the build script for the gcc-arm to see if there's anything obvious in there - if I see anything I'll post back for others. In the meantime Richard you might want to note that there may be some issues using newlib (at least without specific incantations on the compile and link lines).



RE: Stack check problem on STM32F4

Posted by Dave on March 11, 2013
...just can't avoid picking at the scab.

The problem was I was missing the -nostartfiles option from the linker step. Add that in and everything works fine with both newlib and nano.

So, sticky fingers wins.



[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner