Quality RTOS & Embedded Software

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


MSP430X Printf Bug Fix

Posted by incoherent on June 8, 2011
There is a bug in printf-stdarg.c when compiling for the large data model.

Line 150:

register char *s = (char *)va_arg( args, int );

Should change to:

register char *s = (char *)va_arg( args, char * );

RE: MSP430X Printf Bug Fix

Posted by MEdwards on June 8, 2011
I think there are three supported compilers, which one needs the change?

RE: MSP430X Printf Bug Fix

Posted by incoherent on June 8, 2011
I've tested this on CCS4.2.3, however it is probably relevant to all three (if they support the large data model).

With the large data model, data pointers (e.g. char *) are 32 bits, whereas the same pointers are 16 bits in the small memory model. In both cases ints are 16 bits, so when the va_arg is incremented it ends up pointing at the high word of the char pointer, rather than pointing to the next argument.

This should fail on any platform in which pointers are not the same size as ints (assuming TI's va_arg implementation is correct).

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

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.


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


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