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

basic question about using configUSE_NEWLIB_REENTRANT 1

Posted by sagi2097 on March 13, 2014

Hello I have a question regarding the use of configUSENEWLIBREENTRANT. Let me tell you first, that I have not used it before, so I am not familiar with all the details. All I understand is that it embedds a struct compatible with reent.h in the TCB so one does not have to allocate and point to that struct manually. Correct me if I am wrong here... Now the question: Suppose a simple case where I would like to use reentrancy features, so i set configUSENEWLIBREENTRANT to 1. In a task lets say that all I do is use sprintf in the reentrant version :sprintfr. This version demands as second argument a pointer to the reent struct. what is the correct way to use this version of sprintf in this case? dig out the reent pointer from TCB and pass it by hand? Something like sprintfr(buff,pxTCB->xNewLib_reent,"...."); ?? Maybe what I write irrelevant ... but I could use an example to get started. Thank You

Alex


basic question about using configUSE_NEWLIB_REENTRANT 1

Posted by rtel on March 13, 2014

As far as I know, if you are using newlib, then you should be able to just use the normal library functions and the kernel takes care of ensuring the reent structure is set correctly for whichever task is running at that time. I'm not familiar with functions that end in r, but if they are asking you to use the reent structure manually then you should be able to pass _impureptr, which will be pointing to the correct reent structure - don't try obtaining it from the TCB as that would require code changes. Try googling impureptr.

I suspect the functions you are using are not intended to be called directly, but indirectly from the standard library functions, but as noted in the comments where the reent manipulation is implemented in the code, I don't use this functionality myself so can give a very authoritative answer without checking google myself.

Regards.


[ 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