Questions tagged [newlib]

Newlib is a C library intended for use on embedded systems. It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products.

Newlib is a C library intended for use on embedded systems. It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products.

Newlib is only available in source form. It can be compiled for a wide array of processors, and will usually work on any architecture with the addition of a few low-level routines.

See also official cite

160 questions
21
votes
4 answers

understanding the __libc_init_array

I viewed the source code of __libc_init_array from http://newlib.sourcearchive.com/documentation/1.18.0/init_8c-source.html . But I don't quite understand what this function does. I know that these symbols /* These magic symbols are provided by…
Pony279
  • 403
  • 1
  • 6
  • 12
20
votes
6 answers

How to get a call stack backtrace? (deeply embedded, no library support)

I want my exception handlers and debug functions to be able to print call stack backtraces, basically just like the backtrace() library function in glibc. Unfortunately, my C library (Newlib) doesn't provide such a call. I've got something like…
hugov
  • 231
  • 1
  • 2
  • 6
18
votes
1 answer

Using newlib's malloc in an ARM Cortex-M3

I'm creating code for an ARM Cortex-M3 (NXP's LCP17xx). I've been using static memory up to now and everything worked well. I tried to add dynamic memory support, but once I call malloc, the system gets stuck. I'm compiling with gcc for arm bare…
Marga Manterola
  • 642
  • 1
  • 4
  • 12
13
votes
2 answers

Understanding the linkerscript for an ARM Cortex-M microcontroller

I am using the STM32F746NG microcontroller from STMicroelectronics. This device is based on the ARM Cortex-M7 architecture. I invested quite some time in understanding the linkerscript from example projects. I figured out the basics, but I still…
K.Mulier
  • 8,069
  • 15
  • 79
  • 141
12
votes
4 answers

undefined reference to "only some math.h" functions

I am having a strange problem. The math libraries has been added to my makefile. # include standard C library LDFLAGS += -lc # include standard math library LDFLAGS += -lm and in the output file (.map) I can see that everything has been linked…
theAlse
  • 5,577
  • 11
  • 68
  • 110
10
votes
1 answer

Implementing write(), _write() or _write_r() with Newlib?

I am trying to retarget printf() function for STM32F411RET microcontroller in ARM GCC toolchain environment which uses Newlib for standard C library. When I search for how to retarget printf(), many people says I need to implement _write() or…
Bumsik Kim
  • 5,853
  • 3
  • 23
  • 39
10
votes
2 answers

snprintf() prints garbage floats with newlib nano

I am running a bare metal embedded system with an ARM Cortex-M3 (STM32F205). When I try to use snprintf() with float numbers, e.g.: float f; f = 1.23; snprintf(s, 20, "%5.2f", f); I get garbage into s. The format seems to be honored, i.e. the…
DrV
  • 22,637
  • 7
  • 60
  • 72
9
votes
3 answers

How to rebuild newlib and newlib-nano of GNU Arm Embedded Toolchain

I downloaded the toolchain “gcc-arm-none-eabi-6-2017-q2-update-win32-sha1.exe” (Windows) from https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads and installed it on my Windows 10 PC. The installation folder contains a release.txt…
ge45mue
  • 677
  • 8
  • 23
8
votes
2 answers

Cross compiling - Error: selected processor does not support `fmrx r3,fpexc' in ARM mode - Beaglebone

I'm trying to cross-compile a file to flash into the Beaglebone Black. All works fine, but if I try to enable the FPU with #define set_en_bit_in_fpexc() do { \ int dummy; \ __asm__ __volatile__ ("fmrx %0,fpexc\n\t" \ …
igng
  • 372
  • 1
  • 6
  • 17
7
votes
3 answers

gcc to use newlib instead of glibc?

I want to use newlib instead of glibc in order to compile small static binaries. (I do not intend to cross-compile as the binaries are to be used by the same computer.) I believe that I need to compile a separate gcc for this ? I compiled…
Ian McCormick
  • 71
  • 1
  • 1
  • 3
7
votes
1 answer

Does fwrite flush the buffer on '\n'?

I have my own implementation of _open(), _close(), _write(), _read(). My code: FILE *f = fopen("0:test", "wb"); // calls _open() fwrite("hello ", 6, 1, f); fwrite("world\r\n\0", 8, 1, f); // calls _write(3, "hello world\r\n", 13) fflush(f); …
Cosinus
  • 534
  • 4
  • 10
7
votes
2 answers

Error "sigemptyset was not declared in this scope" when using C+11 and Newlib

We are catching compiler errors when using sigemptyset on Cygwin under Newlib. The error occurs with a C++ compiler, but only when -std=XXX is used. Without a standard option, the test program compiles and executes as expected. The test program is…
jww
  • 97,681
  • 90
  • 411
  • 885
7
votes
1 answer

Porting NewLib for my OS: some questions

I am trying to port NewLib for my OS (I am following this tutorial: http://wiki.osdev.org/Porting_Newlib), and I have some questions. Once LibGloss is done and compiled, when exactly will I have to use the libnosys.a that have been created? Is it…
pimpampoum
  • 5,816
  • 6
  • 24
  • 27
6
votes
1 answer

Preprocessing with g++ and specs-file

The question refers to arm-none-eabi-g++ 6.2 and linking against newlib-nano. When I preprocess a C-source with -specs=nano.specs, the file newlib.h from the directory newlib-nano is included: echo '#include '…
hermannk
  • 745
  • 8
  • 12
5
votes
3 answers

Looking for C source code for snprintf()

I need to port snprintf() to another platform that does not fully support GLibC. I am looking for the underlying declaration in the Glibc 2.14 source code. I follow many function calls, but get stuck on vfprintf(). It then seems to call…
kevinarpe
  • 20,319
  • 26
  • 127
  • 154
1
2 3
10 11