FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2009 Threads] reent struct for freertosPosted 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 freertosPosted 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 freertosPosted 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 freertosPosted by Daniel Nilsson on November 3, 2009 I ended up taking this approach, seems to work: http://sourceware.org/ml/newlib/2008/msg00384.html
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|