Quality RTOS & Embedded Software

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


Strange lock ups

Posted by saiberion on July 23, 2013
I was updating a software project for an AT91SAM7S256 to add some new features amd emcountered a really strange problem.
The software initialised some necessary hardware and creates an Init Task with highest priority for further initialisation where scheduler commands are needed. In this task other tasks are created that should only start running after the init task is done.
Now I ran into a really strange behaviour.
From the init task I call a function that creates a task located in file a.c and es soon as the init function ends with vTaskDelete(NULL) the software locks ups or somehow gets cought in a reboot loop.
The really strange part is, if I copy the code of the task function to main.c everything works as expected, I can even start multiple instances to the same task code. It is also possible to move the task code to another file b.c and it still works. I'm puzzled why task code leads to undefined behaviour if it is located in a.c.

FreeRTOS Version 7.2.0 and 7.5.0
Yagarto Toolchain: BU 2.20.1; GCC 4.5.0; NL 1.18.0; GDB 7.1

Any ideas why this is happening? So far I only found out that it that it happens at the end of the context switch with FreeRTOS function vTaskSwitchContext() and for some unknown reason the task function in a.c results in different disassembly output than it's exact copies in b.c and main.c

At the moment I'm stripping down the project to see how long I can reproduce this behaviour and also to maybe upload the project code.

RE: Strange lock ups

Posted by Richard on July 23, 2013
If the code is the same, but only works when it is included from a file with one name but not another, then my first thought is that it can only be something to do with the build process. Is it possible that you are supplying different command line options to different files? Maybe a.c is being built in thumb mode and all the others in ARM mode and you don't have the interworking option set? (normally you can mix ARM and thumb mode tasks, but you have to tell the compiler you intend doing that)


RE: Strange lock ups

Posted by saiberion on July 23, 2013
Up until a few minutes I was sure that all files were compiled with the same parameters, but my Makefile had a missing two-liner for the added source file.

So, my bad, everything is working fine now.
It probably was as you said that this file was not built in thumb mode because make had to guess the build parameters.

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

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

Latest News

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

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

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