public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Jozef Lawrynowicz <jozef.l@somniumtech.com>
To: newlib@sourceware.org
Subject: [PATCH][MSP430] MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being used
Date: Wed, 19 Jul 2017 18:01:00 -0000	[thread overview]
Message-ID: <a3139646-1d62-1c2c-25f4-723113c6bcac@somniumtech.com> (raw)

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


             reply	other threads:[~2017-07-19 18:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 18:01 Jozef Lawrynowicz [this message]
2017-07-20 14:19 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3139646-1d62-1c2c-25f4-723113c6bcac@somniumtech.com \
    --to=jozef.l@somniumtech.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).