[PATCH][MSP430] MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being used

Corinna Vinschen vinschen@redhat.com
Thu Jul 20 14:19:00 GMT 2017


On Jul 19 19:01, Jozef Lawrynowicz wrote:
> Many MSP430 devices have a very small amount of RAM (the MSP430FR5969
> has 2kB). A simple "Hello World" printf program built for one of these
> devices will not execute properly as stack and heap collide before
> output is printed.
> About 1.5kB of heap is allocated to do the printf, but reducing
> __BUFSIZ__ to 256 brings this to around 750 bytes, and the hello world
> program comfortably executes on hardware.
> 
> Patch is attached.

> From 7ba27bcfe2fbbc66d07c7f85062d7050b6381fcb Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <jozef.l@somniumtech.com>
> Date: Mon, 10 Jul 2017 17:19:00 +0000
> Subject: [PATCH] MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024
>  being used
> 
> ---
>  newlib/libc/include/sys/config.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
> index c536698..39f8384 100644
> --- a/newlib/libc/include/sys/config.h
> +++ b/newlib/libc/include/sys/config.h
> @@ -155,6 +155,7 @@
>  #define _REENT_SMALL
>  #endif
>  
> +#define __BUFSIZ__ 256
>  #define __SMALL_BITFIELDS
>  
>  #ifdef __MSP430X_LARGE__
> -- 
> 1.8.3.1
> 

Pushed.

Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20170720/3fd9ee74/attachment.sig>


More information about the Newlib mailing list