Quality RTOS & Embedded Software

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


Loading

Segmentation fault with the Windows simulator

Posted by Emmanuel Gaudin on May 4, 2012
Hi,
I am working on integrating C code generated from a modeling tool with FreeRTOS. I am using FreeRTOS V7.1 Windows Simulator and mingw32-gcc V3.4.5.
To get started I only have 2 tasks sending ping and pong back and forth and that works fine. With the same 2 tasks, if the exchange is stopped, both tasks should hang quietly on their respective queues for a new message to come in. But in that case I get a segmentation fault in vTaskSwitchContext at C:/FreeRTOS/FreeRTOSV7.1.0/Source/tasks.c : 1625. This line calls the listGET_OWNER_OF_NEXT_ENTRY macro.
I have spent hours trying to figure out what was going on without any success. I would appreciate any suggestion to fix that problem.
Thanks in advance,
Emmanuel

RE: Segmentation fault with the Windows simulator

Posted by Richard on May 4, 2012
I have to admit not using the Eclipse version of the simulator for some time. It has not changed much since it was originally created, whereas I use the Visual Studio version often for development, and have never experienced anything like that.

Can you cut your task code down to the bare minimum necessary to reproduce the problem, then post the code here? Use the "codify" button above to ensure the formatting is maintained.

Regards.

RE: Segmentation fault with the Windows simulator

Posted by Emmanuel Gaudin on May 11, 2012
I am trying to cut the code down to something very simple but since it is generated code it will take me some time. Please also note I am not using Eclipse but a standard makefile generated by the modeling tool. I'll get back to you when I have something usable.

RE: Segmentation fault with the Windows simulator

Posted by Emmanuel Gaudin on July 2, 2012
Hi,

It took me some time to figure out what was happening. It is actually a debugging problem. Our tool automatically asks the debugger a number of information about what is happening on the target. One of the request tries to figure out which thread is currently active. To do so with MingW, the command "info threads" is executed. But after this command a segmentation fault occurs. I have removed this command from the integration so I do not have the problem any more but I thought that might be useful to someone else. Please find below what I get when I debug manually:

G:\Users\gaudin\dev\Test\FreeRTOS\ccg>gdb tabletennis.out
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) break RTDS_StartTimer
Breakpoint 1 at 0x4024ec: file h:/workspaces/gaudin/rtds_rel/share/ccg/freertos/rtds_os.c, line 192.
(gdb) r
Starting program: G:\Users\gaudin\dev\Test\FreeRTOS\ccg/tabletennis.out
Error: dll starting at 0x76ce1000 not found.

Error: dll starting at 0x74f81000 not found.

Error: dll starting at 0x76ce1000 not found.

Error: dll starting at 0x76a91000 not found.

[Switching to thread 264.0x1ab0]

Breakpoint 1, RTDS_StartTimer (instanceId=0x731c88, timerNumber=5,
timerUniqueId=1, delay=100, pTimerStateList=0x731c5c,
RTDS_currentContext=0x731c40)
at h:/workspaces/gaudin/rtds_rel/share/ccg/freertos/rtds_os.c:192
192 watchDogId = xTimerCreate(
(gdb) c
Continuing.

Breakpoint 1, RTDS_StartTimer (instanceId=0x731c88, timerNumber=5,
timerUniqueId=1, delay=100, pTimerStateList=0x731c5c,
RTDS_currentContext=0x731c40)
at h:/workspaces/gaudin/rtds_rel/share/ccg/freertos/rtds_os.c:192
192 watchDogId = xTimerCreate(
(gdb) info threads
6 thread 264.0x1560 prvIdleTask (pvParameters=0x0)
at C:/FreeRTOS/FreeRTOSV7.1.0/Source/tasks.c:1879
5 thread 264.0x1fe4 0x7736fb81 in ?? ()
4 thread 264.0x1840 0x7736fb81 in ?? ()
* 3 thread 264.0x1ab0 RTDS_StartTimer (instanceId=0x731c88, timerNumber=5,
timerUniqueId=1, delay=100, pTimerStateList=0x731c5c,
RTDS_currentContext=0x731c40)
at h:/workspaces/gaudin/rtds_rel/share/ccg/freertos/rtds_os.c:192
2 thread 264.0x1a10 0x7736fd71 in ?? ()
1 thread 264.0xb5c 0x7737013d in ?? ()
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to thread 264.0xb5c]
0x004047b2 in vTaskSwitchContext ()
at C:/FreeRTOS/FreeRTOSV7.1.0/Source/tasks.c:1625
1625 listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) );
(gdb)


[ 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