Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


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 ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists