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

reent struct for freertos

Posted by Daniel Nilsson on November 2, 2009
I want to make calls through newlib from my tasks thread safe and reentrant - it seems like I need to let each task have its own reent structure, and have the scheduler re-point the impure_ptr to this struct each context switch. Has anyone done this in freertos, or have any idea on how it can be done?


RE: reent struct for freertos

Posted by Richard on November 2, 2009
Yes this is quite a common thing to do. You can do it quite easily by modifying the tasks.c file, but even that is not necessary. Instead you can create a reent structure for each task and use the traceTASK_SWITCHED_IN macro to assign impure_ptr to the correct structure on each context switch.

Also take a look at:

https://open-roadster.com/development/

SVN areas of interest:
https://open-roadster.com/svn/public/crooner/trunk/library/
https://open-roadster.com/svn/public/crooner/trunk/library/newlib
https://open-roadster.com/svn/public/crooner/trunk/library/freertos
https://open-roadster.com/svn/public/crooner/trunk/apps/make/Makefile.common


Which I believe is a project that uses both FreeRTOS and NewLIb, so you can copy what they have done.

Regards.

RE: reent struct for freertos

Posted by Daniel Nilsson on November 2, 2009
Thanks, will look into that when my strength returns after a weekend of struggling with the code ;)

RE: reent struct for freertos

Posted by Daniel Nilsson on November 3, 2009
I ended up taking this approach, seems to work: http://sourceware.org/ml/newlib/2008/msg00384.html


[ 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