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.
155
questions
1
vote
0
answers
121
views
arm-none-eabi-gcc "is not implemented and will always fail" messages
I have two stm32 projects (one with stm32f103rb and the other with stm32f103re). Both projects are built using cmake and make based on stm32-cmake template and also use cubeMX HAL libraries. For both ...
2
votes
0
answers
60
views
Stdio initialisation - embedded, newlib, freeRTOS
I am not actually sure where the best place to post this is as it is a combination of newlib code, FreeRTOS and a custom implementation. Application is embedded ARM using GCC (arm-eabi...), newlib ...
0
votes
1
answer
31
views
Adding support for gb2312 and sift-jis to newlib iconv
I have a requirement to covert UCS2 to following code pages
Chinese: gb2312
Japanese: shift_jis
Russian : cp1251
Hungrian, Polish and Cesky: cp1252
Default:cp1250
I could see that ...
0
votes
0
answers
37
views
How to build GCC ARM project with hard restrictions to link libgcc?
Im has found, what even with --specs.nano.specs --specs.nosys.lib will link libgcc, if some dependencies request it (like some float operations).
With -nostdlib flag, compiler will throw out newlib-...
1
vote
0
answers
75
views
Macros defined in _newlib_version.h are not filled with actual value
Platform: Ubuntu22.04 for wsl2
I am trying to check some Macros defined in _newlib_version.h, but I found that they are not filled with actual value. The following is the code snippet from the file /...
0
votes
1
answer
143
views
How to use newlib instead of glibc
I want to use newlib instead of glibc because I work on cygwin. The github project I want to use uses glibc as default, because I'm on cygwin I cant use glibc, so I want to use newlib but I don't know ...
0
votes
0
answers
22
views
How to copy additional header directories in Newlib-4.1.0?
I am modifying one Makefile.am to export my headers' folder "sap_additional_headers". The issue is that no subdir of this folder is copied, while the files in this root folder are copied.
...
0
votes
0
answers
68
views
What is the correct way to enable soft floating point computation for 68000 with gcc and newlib?
I am using crosstool-ng to crosscompile for 68000 (version:crosstool-ng-1.24.0-rc2, host OS:Ubuntu 20.04)
My target is a 68000 (plain, not a 68020 or a cpu with floating point support).
I am compiling ...
0
votes
0
answers
29
views
Cygwin doesn't define __STDC_IEC_559__
I was curious if this is intentional. I found that traditionally __STDC_IEC_559__ is defined in glibc and then used by gcc. Cygwin doesn't use glibc however, and I was wondering if __STDC_IEC_559__ ...
3
votes
2
answers
88
views
Why is does char from an array give subscript warning in gcc for isspace in newlib
I´m having troubles understand a compiler warning that we have in our code. The code we have are similar to the one in this example that give the warning (-Wchar-subscripts). We are using ARM gcc 9.2....
0
votes
1
answer
262
views
Integrate picolibc into STM32 FreeRTOS
I'm trying to set up a build environment for STM32F4 with picolibc and ran into a problem:
Subprojects drivers : YES freertos : YES picolibc : YES 5 warnings
User defined options Cross files: cross ...
0
votes
1
answer
113
views
How do I link Newlib memcpy into bare-metal project?
I'm trying to compile a simple project for a TM4C123GXL microcontroller using arm-none-eabi-gcc. Inside main I call memcpy just to test that it works as expected, but it causes a fault. What causes ...
0
votes
0
answers
630
views
Cross compiling newlib for ARM target in mingw-w64 environment
I'm trying to cross compile the newlib for ARM under the mingw-w64 environment.
Toolchain was downloaded from here: GNU Arm Embedded Toochain
Newlib cloned from its GIT repository
I'm running my ...
0
votes
1
answer
258
views
Why system call stubs in NewLib are needed only on Linux and not on Windows?
I have a project in MCUXpresso with a custom linker file. The project builds fine on Windows but it fails on Linux. On Linux, the linker fails with the following error (the compiler paths are ...
3
votes
3
answers
1k
views
Hard fault on sprintf() with float after toolchain update
I have an opensource project (https://github.com/WhiteFossa/yiff-l), where I use STM32F103 MCU.
In firmware I have a lot of sprintf's with float parameters, for example:
char buffer[32];
sprintf(...
0
votes
1
answer
348
views
Calling fgets in RISC-V assembly on Spike/PK
Update: Writing this out allowed me to spot where I was going wrong, but not why. I am obviously calling fgets in the wrong way, because after five calls I get to the address 0x221000 which is where ...
1
vote
0
answers
348
views
TensorFlow Lite on RISC V newlib
I'd like to compile TensorFlow Lite using the riscv64-unknown-elf (newlib) cross-compiler to run it on Spike or some other RISC-V simulator. AFAIK, no such option exists:
https://github.com/...
0
votes
1
answer
369
views
Bare-metal ARM Cortex-A7 newlib crt0 not initializing .bss and .data regions
I'm learning to write bare-metal ARM Cortex-A7 firmware to run on QEMU with semihosting. I know that ARM GCC has a libc implementation called newlib, which supports semihosting for common libc ...
2
votes
2
answers
632
views
Why do strtod() and strtof() of the Newlib C Standard Library implementation uses dynamic memory allocation?
Newlib is a C standard library implementation (largely inspired by BSD libc) intended for use on embedded systems.
Apparently, the string to floating point conversion functions (strtod, strtof) use ...
0
votes
2
answers
93
views
newlib init_array contains only 0xffffffff with RTEMS
I'm trying to port RTEMS on the SAME54P20A. I managed to make a basic BSP that compile and a basic application.
I compile the application using
./waf configure --rtems=$HOME/rtems/5 --rtems-bsp=arm/...
1
vote
1
answer
658
views
Where does the increment value for sbrk come from when using newlib nano malloc?
I have a target (Stm32f030R8) I am using with FreeRTOS and the newlib reentrant heap implementation (http://www.nadler.com/embedded/newlibAndFreeRTOS.html). This shim defines sbrk in addition to ...
0
votes
1
answer
593
views
How do I build a newlib RISC-V toolchain with a modified linker script?
I'm trying to build a GCC/newlib cross compilation toolchain targeting an embedded OS on RISC-V. For this purpose, I need to modify the virtual addresses that binaries are linked at.
One way to ...
0
votes
1
answer
788
views
Failure to clone risc-v tools (failure with newlib-cygwin.git)
I have been attempting to clone the risc-v GNU toolchain on Linux but failing.
On:
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
I get (fragment):
Checking connectivity... done.
...
0
votes
1
answer
111
views
Concurrency in Spike/Newlib
How do I simulate concurrent programs in the Spike RISC-V ISS using newlib?
What I know is that Spike has a -p flag to simulate multiple processors, but I can't use pthreads or other such system calls ...
0
votes
1
answer
195
views
newlib: Compiler gets confused when building 32-bit compatibility
I am compiling newlib so I can continue the building of my cross-compiler, but newlib is getting confused with the 32-bit support I also included in my cross-compiler.
I already have my cross-compiler ...
4
votes
1
answer
672
views
ARM + gcc: global destructors not called after main() returns, but constructors are
I am trying to write a simple "Hello, World!" firmware for Cortex-M0 CPU. The goal is to correctly initialize and shutdown C++ runtime so that global constructors are called before main() ...
1
vote
0
answers
185
views
non-zero float is generated as \0 in sprintf
I'm working with psoc creator, and I'm trying to print a float between -1 and 1 to an I2C OLED.
To get this working I'm using the function sprintf. I added the following flag to my linker -u ...
0
votes
1
answer
122
views
ccosl undeclared when trying to use cos(double) from tgmath.h on arm-none-eabi-gcc
Consider the following test code:
#include <tgmath.h>
void test()
{
double x=cos(4.5);
}
Compiling it as with
arm-none-eabi-gcc test.c -c
on Ubuntu 18.04 (gcc 6.3.1, newlib 2.4.0) works ...
0
votes
1
answer
734
views
Embedded ARM with GCC - Is it okay for me to branch right to main() instead of going through mainCRTStartup?
I have some embedded ARM code compiled with GCC - and I want to get rid of the library startup files.
I looked at what Newlib's mainCRTStartup startup did, and although my ASM skills are terrible, it ...
0
votes
2
answers
939
views
How to override C lib functions like _sbrk with user-defined one?
I want to use STL functions in C and C++ on RISCV that are provided by newlib. In order to use those I must replace the default implementation of _sbrk, _read, _write and some other functions. By ...
0
votes
1
answer
520
views
Cant find non-standard header includes
I am not using standard gcc headers. I am building with -nostdlib and -nostdinc options. These options force the compiler to not use standard headers.
I am using newlib for my custom kernel ...
0
votes
1
answer
206
views
newlib support for 8 bit AVR MCUs
I was trying to build a complete toolchain for avr 8 bit MCU from scratch. I am using latest sources of binutils, gcc and newlib. I was able to compile binutils and bootstrap gcc for target avr-...
0
votes
1
answer
69
views
How can I use newlib with android NDK?
Can I use newlib or newlib-nano with android NDK to build a dynamic library?
I know this is not a to-the-point question. But couldn't find much write-up on this. Any help is appreciated. I'm a newbie ...
1
vote
1
answer
812
views
How to get assert to print to UART? STM32 newlib nano
Context: STM32, newlib nano, GCC-ARM, C/C++, FreeRTOS
I would like my assert statements to print to the UART. printf works perfectly. I can also get assert to print an error message to the UART, ...
0
votes
1
answer
1k
views
Debug semihosting printf function on stm32
I am trying to enable printing on host machine using printf() function and rdimon library.
My hardware is:
-STM32F103C8T6
-ST-Link V2
In order to enable printf() on host, I use:
-specs=nano....
4
votes
1
answer
1k
views
Does glibc work on bare metal or RTOS platforms?
Embedded experts, is this possible without major modifications?
I'm building firmware that has both a Linux kernel and a minimal RTOS that runs when resuming from sleep. The same toolchain, aarch64-...
0
votes
1
answer
665
views
Undefined reference to std::nothrow in libsupc++.a of newlib
Now I am trying to cross compile Nuttx with libc++ using arm-none-eabi toolchain. Most of things is fine, however some C++ applications have an undefined reference to std::nothrow. I found out that ...
0
votes
0
answers
164
views
Using gnu toolchain compiled library in Keil
I'm trying to use a library I compiled under debian by GNU toolchain in Keil and getting this error:
._build\nrf52832_xxaa_s132.axf: Error: L6218E: Undefined symbol
_impure_ptr
this symbol comes ...
0
votes
1
answer
3k
views
What are arm-none-eabi-c++ and arm-none-eabi-cpp for?
I'm using the GNU Arm Embedded Toolchain to cross-compile on Windows, and was wondering what the following highlighted executables were used for. There are already arm-none-eabi-gcc and arm-none-eabi-...
-1
votes
1
answer
925
views
cortex m - newlib-nano - time functions (HEAP USAGE)
i work on a cortex m system (GCC+newlib-nano (-specs=nano.specs)).
there i use
- gmtime
- mktime
- localtime
i face the following issues:
A.)
gmtime uses malloc to allocate some ram, but never ever ...
1
vote
1
answer
1k
views
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 ...
1
vote
1
answer
472
views
How to run Newlib applications using QEMU?
I wrote an application that uses several trigonometric functions (sin, tan, cos, ...). My objective is to study the different implementations of these functions in the GNU C library, MUSL, and Newlib.
...
1
vote
2
answers
831
views
Why specify the target architecture to the linker?
I've been working on using the Meson build system for an embedded project. Since I'm working on an embedded platform, I've written a custom linker script and also an invocation for the linker. I ...
0
votes
1
answer
644
views
Section `text` will not fit after upgrading `arm-none-eabi-gcc`
I have an open source micromouse robot project. For easier compilation, I use containers (both Podman and Docker should be fine):
make image
make libopencm3
make
This works just fine and generates a ...
0
votes
0
answers
238
views
How to identify why a particular symbol gets pulled in by LLVM's ld.lld during static linking
I updated my LLVM-based ARMv7em toolchain from LLVM 8 to the just published release candidate 1 of LLVM 9. I haven't touched the compilation settings of newlib, which is the runtime library I use (...
1
vote
1
answer
325
views
arm-gcc mktime binary size
I need to perform simple arithmetic on struct tm from time.h. I need to add or subtract seconds or minutes, and be able to normalize the structure. Normally, I'd use mktime(3) which performs this ...
1
vote
0
answers
355
views
How do we link a C library like Newlib with a custom linker script?
I'm porting newlib for a manycore architecture being developed in our research group. Up until now, we were writing bare metal code with a minimal crt.S and a linker script. The manycore processor can ...
3
votes
2
answers
1k
views
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 ...
2
votes
1
answer
4k
views
How do you Implement printf in GCC from Newlib?
I'm struggling to properly implement printf from newlib into my esp32, using GCC.
I've gone through the newlib documentation and it gives me general information about how printf is called, but doesn't ...
3
votes
1
answer
1k
views
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), ...