public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][MSP430] MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being used
@ 2017-07-19 18:01 Jozef Lawrynowicz
  2017-07-20 14:19 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Jozef Lawrynowicz @ 2017-07-19 18:01 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

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.

[-- Attachment #2: 0001-MSP430-Define-__BUFSIZ__-as-256-to-prevent-default-o.patch --]
[-- Type: text/plain, Size: 659 bytes --]

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][MSP430] MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being used
  2017-07-19 18:01 [PATCH][MSP430] MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being used Jozef Lawrynowicz
@ 2017-07-20 14:19 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2017-07-20 14:19 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1314 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-20 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-19 18:01 [PATCH][MSP430] MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being used Jozef Lawrynowicz
2017-07-20 14:19 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).