Quality RTOS & Embedded Software

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


Loading

using setjmp and longjmp

Posted by joe_her on October 16, 2016

Is it OK to use longjmp inside a task? What if I have an error detected deeply nested, and I want to jump to a "clean" location in the task ( for example some error in communication hardware, needs to restart it, etc.) Thanks


using setjmp and longjmp

Posted by rtel on October 16, 2016

I have to be honest and say I have no idea, although I would suspect not unless you can find some way of making it thread aware. I have used these functions to jump from a running FreeRTOS application back to a host environment, but not within a task.


using setjmp and longjmp

Posted by richard_damon on October 16, 2016

My guess is that a setjmp/longjmp within a single task will likely work (and between tasks will cause all sorts of problems). setjmp/longjmp shouldn't have thread issue themselves, as all the information should be in the jmpbuf, but they would have no knowledge of how to change threads.


using setjmp and longjmp

Posted by happygimp0 on February 17, 2017

Possible Problem with Microcontrollers which need more then a single instruction to manipulate the stack pointer: In longjmp() you change the stack pointer, while you change it, a scheduler interrupt can happen, scheduler want to store the current registers on stack, the stack pointer points on a more or less random location and the push commands rewrite some random locations. Such a bug will be very hard to find, it is very unlikely that the timer interrupt is exactly at this moment and it is possible that you overwrite always other places.


[ 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.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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