Newlib是常用的嵌入式C运行库,在bsp/hbird-e200/stubs目录下移植Newlib所需要的桩函数(即调用的底层功能函数),如read,write,malloc等
以write函数为例:
/* See LICENSE of license details. */
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include "platform.h"
#include "stub.h"
ssize_t _write(int fd, const void* ptr, size_t len)
//ssize_t是有符号整型,在32位机器上等同与int,在64位机器上等同与long int;
//size_t 就是无符号型的ssize_t,也就是unsigned long/ unsigned int
{
const uint8_t * current = (const char *)ptr

本文深入解析了Newlib库在嵌入式系统中的移植过程,特别是write函数的具体实现细节,展示了如何通过write函数与底层硬件交互,完成数据传输。同时,文章提到了在特定处理器上移植read函数的挑战。
最低0.47元/天 解锁文章
3002

被折叠的 条评论
为什么被折叠?



