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
3
votes
2 answers

Providing a `malloc` implementation for `newlib-nano`

I'd like to provide an implementation of malloc for newlib-nano when using it with gcc. In my situation, I have some source file, say main.c, that calls strftime. The newlib-nano implementation of strftime uses malloc. In a header file, my_memory.h,…
rambo
  • 369
  • 1
  • 13
3
votes
2 answers

Why does malloc only work immediately after flashing cortex-m3?

I'm trying to dynamically allocate memory using newlib's malloc running on a cortex-m3 (bare-metal) and I've run into a perplexing problem. Immediately after flashing the device, malloc and free both work as expected. However, once I reset the…
Neil
  • 2,137
  • 16
  • 24
3
votes
2 answers

Retargeting newlib for c++ chrono

I am using arm-none-eabi toolchain with newlib to target a custom board with an ARM Cortex-M0+ (specifically the MCU-on-eclipse version of the toolchain). I am compiling/linking with -nostartfiles and --specs=nano.specs and have re-targeted stdout…
CrustyAuklet
  • 357
  • 3
  • 16
3
votes
1 answer

GNU toolchain (newlib): compatibility between toolchain versions (undefined symbol __ctype_ptr__)

Having here a project that is using some external GNU-toolchain built libraries (provided externally, without source-code). I'm compiling an application for embedded systems (FreeRTOS specifically), so I use newlib. I initially tried using this…
Zuzu Corneliu
  • 1,594
  • 2
  • 15
  • 27
3
votes
0 answers

Why does _exit() jump to _etext?

I am running a project using the ARM Embedded Tollchain on a stm32 microcontroller which uses the newLib. I called assert(false) to test the assert output and ended in a Hard Fault Exception. I debugged into the assembly of assert(...) and found out…
eDeviser
  • 1,605
  • 2
  • 17
  • 44
3
votes
1 answer

Build newlib with existing cross Compiler

I'd like to build the newlib library using a preinstalled cross compiler for mips (mips-linux-gnu-gcc). The compiler links the glibc by default. $ mips-linux-gnu-gcc -v Using built-in…
Qfelix
  • 43
  • 3
3
votes
0 answers

printf in newlib is not working in baremetal ARM environment

I am working in a bare-metal ARM project in which I am trying to integrate newlib library. As a beginner, I am trying to make the printf function working first so that I can see the standard output through UART. I have already gone through many…
3
votes
1 answer

Compile ARM binaries, run them in ARMulator

Here is my problem: Introduction I am currently trying to execute some basic code on an ARM processor. As I currently (and probably for a long time) do not have any ARM hardware around me, I’ve been using QEMU (an ARM emulator) for some days now,…
IceTea
  • 58
  • 7
3
votes
0 answers

How Can I Increase Maximum Nesting Level?

I want to make an operating system for the Raspberry Pi, and I need a cross-compiler. I decided to build it on Mac OS X and I'm using the GNU compiler toolchain and the 'arm-none-eabi' target. After building binutils and installing some other…
Jerome Carter
  • 237
  • 1
  • 4
  • 18
3
votes
1 answer

printf only prints characters up to stdout's buffer size

I'm trying to use newlib's printf function to print something on a UART device. Therefor I implemented int _write(int file, char *ptr, int len) { HAL_StatusTypeDef status; switch (file) { case STDOUT_FILENO: /*stdout*/ case STDERR_FILENO:…
Tobias Müller
  • 585
  • 1
  • 4
  • 21
3
votes
3 answers

Porting NewLib: crt0

I am porting NewLib for my own OS by following a tutorial. It says that once I finished my crt0, I have to "link it as the first object". How can I do that?
pimpampoum
  • 5,816
  • 6
  • 24
  • 27
3
votes
1 answer

newlib-nano long long support

I'm developing a program for ARM architecture (bare metal) using a GCC cross compiler (arm-none-eabi-). To keep the code size small, I use a "--specs=nano.specs" linker flag, to link against newlib-nano. The problem I've ran into is having "long…
J_S
  • 2,985
  • 3
  • 15
  • 38
3
votes
1 answer

Newlib's Malloc is "ignoring" a whole bunch of free memory

So I am using bare metal malloc in combination with a self-written _sbrk. I am running everything on the Stellaris Launchpad. This board contains a cortex M4. It also contains 32K RAM, starting at memaddr 0x20000000 and running until 0x20007FFF. At…
Cheiron
  • 3,620
  • 4
  • 32
  • 63
3
votes
1 answer

FreeRTOS queues for IO before scheduler starts (or after it stops)

I'm looking for advice on how to best implement thread-safe IO (e.g. for printf going to a debug serial port) in an environment in which the operating system scheduler may yet to have started, be running, suspended or may have stopped or crashed.…
hugov
  • 231
  • 1
  • 2
  • 6
3
votes
1 answer

What goes to the __init_array?

I have a Cortex-M3 project compiled with GCC. The startup_LPC177x_8x.s code copies the initialized data from flash to RAM, initializes the bss, calls the clock initialization SystemInit. Before calling the _main function the code also calls the…
harper
  • 13,345
  • 8
  • 56
  • 105
1 2
3
10 11