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




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