newlib

How do you Implement printf in GCC from Newlib?

送分小仙女□ 提交于 2021-02-10 05:20:46
问题 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 explain the back end implementation to me. Based on my current research I have determined that printf outputs a formatted string to the STDOUT. On a PC this was simpler for me to understand because there's a console window that would display the formatted output from printf, however on an

How do you Implement printf in GCC from Newlib?

家住魔仙堡 提交于 2021-02-10 05:18:58
问题 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 explain the back end implementation to me. Based on my current research I have determined that printf outputs a formatted string to the STDOUT. On a PC this was simpler for me to understand because there's a console window that would display the formatted output from printf, however on an

Lua笔记-关于lua table的C API (转)

家住魔仙堡 提交于 2020-12-05 12:51:23
转自: https://blog.csdn.net/GJQI12/article/details/81105975 //Lua笔记-关于lua table的C API //Lua版本5.2 /*相关API: lua_createtable 原型: void lua_createtable (lua_State *L, int narr, int nrec); 描述: 创建一个新的table并将之放在栈顶.narr是该table数组部分的长度,nrec是该table hash部分的长度. 当我们确切的知道要放多少元素到table的时候,使用这个函数,lua可以预分配一些内存,提升性能. 如果不确定要存放多少元素可以使用 lua_newtable 函数来创建table. lua_newtable 原型: void lua_newtable (lua_State *L); 描述: 创建一个新的table并将之放在栈顶. 等同于lua_createtable(L, 0, 0). lua_getfield 原型: void lua_getfield (lua_State *L, int index, const char *k); 描述: 将t[k]元素push到栈顶. 其中t是index处的table. 这个函数可能触发index元方法. lua_setfield 原型: void lua

FreeRTOS学习(一)

生来就可爱ヽ(ⅴ<●) 提交于 2020-08-07 04:08:26
1 FreeRTOS任务基础 1.1 多任务系统 在51单片机、AVR、STM32裸机编程时,我们通常都是用一个main函数里面加一个while(1)做一个大循环来完成所有的事务处理,同时在加上中断处理一些较为紧急的事务。相对于多任务系统而言,这个就是单任务系统,也称作前后台系统,中断服务函数 作为前台程序,大循环while(1)作为后台程序,如图 1.1.1 所示: 图1.1.1 前后台系统 前后台系统的实时性较大(尤其是调度任务较多),每个任务都是轮流执行,没有轮到该任务运行的时候,不管该任务有多么的紧急,就只能等着,大家拥有一样的优先级。但是该类系统简单,所消耗的资源较少。 多任务系统可以将一个大问题分成很多个具有共性的小问题,逐一的将这些小问题解决,进而大问题将得到全面的解决,我们可将每一个小问题都视为一个任务。这些小任务是并发处理的,由于他们的执行时间很短,我们所能感觉到的是所有的任务都是同时进行的。那么多任务运行的问题就来了,这就涉及到任务执行的先后顺序及什么任务该执行不该执行了。该模块的功能将由任务调度器来完成,具体如何实现,各类系统是有很大差别的,通常来说我们可分为抢占式(UCos、FreeRTOS)和非抢占式(Linux)。FreeRTOS是一个支持抢占式的实时操作系统,其任务运行如图1.1.2所示: 图1.1.2 抢占式多任务系统 1.2 FreeRTOS任务

understanding the __libc_init_array

你。 提交于 2019-12-29 19:28:38
问题 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 the linker. */ extern void (*__preinit_array_start []) (void) __attribute__((weak)); extern void (*__preinit_array_end []) (void) __attribute__((weak)); extern void (*__init_array_start []) (void) __attribute__((weak)); extern void (*__init_array_end [

understanding the __libc_init_array

守給你的承諾、 提交于 2019-12-29 19:26:12
问题 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 the linker. */ extern void (*__preinit_array_start []) (void) __attribute__((weak)); extern void (*__preinit_array_end []) (void) __attribute__((weak)); extern void (*__init_array_start []) (void) __attribute__((weak)); extern void (*__init_array_end [

understanding the __libc_init_array

隐身守侯 提交于 2019-12-29 19:24:12
问题 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 the linker. */ extern void (*__preinit_array_start []) (void) __attribute__((weak)); extern void (*__preinit_array_end []) (void) __attribute__((weak)); extern void (*__init_array_start []) (void) __attribute__((weak)); extern void (*__init_array_end [

undefined reference to “only some math.h” functions

孤者浪人 提交于 2019-12-28 06:22:06
问题 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 properly: LOAD c:/gnu/powerpc-eabi/3pp.ronetix.powerpc-eabi/bin/../lib/gcc/powerpc-eabi/4.3.3/nof\libgcc.a LOAD c:/gnu/powerpc-eabi/3pp.ronetix.powerpc-eabi/bin/../lib/gcc/powerpc-eabi/4.3.3/../../../../powerpc-eabi/lib/nof\libc.a LOAD c:/gnu/powerpc

Using newlib's malloc in an ARM Cortex-M3

醉酒当歌 提交于 2019-12-20 08:39:06
问题 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 metal, and using newlib. Version: gcc-arm-none-eabi-4_6-2012q1 To add malloc support, I implemented a simple _sbrk function and modified my linker script to make some space for the heap (I've read many different tutorials about this part, but none

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

血红的双手。 提交于 2019-12-12 17:18:29
问题 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 in “ ../share/doc/gcc-arm-none-eabi/ ” which tells: This release includes the following items: newlib and newlib-nano : git://sourceware.org/git/newlib-cygwin.git commit 0d79b021a4ec4e6b9aa1a9f6db0e29a137005ce7 And also the readme.txt in “ ..