![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
linux C
文章平均质量分 87
springcrazy
这个作者很懒,什么都没留下…
展开
-
Linux 保留内存memreserve & reserved-memory
1. 概述在linux启动过程中会打印出如下信息,这些信息为我们呈现出系统下的保留内存空间情况。Reserved memory: created DMA memory pool at 0x4c000000, size 8 MiBOF: reserved mem: initialized node vram@4c000000, compatible id shared-dma-pool本文只介绍基本的保留内存,不涉及CMA部分内容保留内存的初始化流程如下图所示:本文所说的保留内存转载 2022-03-15 14:06:29 · 7592 阅读 · 0 评论 -
elf load view & execution view
From :https://www.keil.com/support/man/docs/armlink/armlink_pge1362065902090.htmLoad view and execution view of an imageImage regions are placed in the system memory map at load time. The location of the regions in memory might change during execution.转载 2021-05-10 11:30:26 · 253 阅读 · 0 评论 -
linux fork 注意点
Rule The rule of fork 1 After a successful fork, execution in both the parent and child process continues at the instruction following the fork 2 To determine whether you are running in the parent or child process, use the fork return valu.原创 2020-11-02 20:03:31 · 171 阅读 · 0 评论 -
Linux在应用层读写寄存器的方法
可以通过操作/dev/mem设备文件,以及mmap函数,将寄存器的地址映射到用户空间,直接在应用层对寄存器进行操作,示例如下:#include<stdio.h> #include<stdlib.h> #include<time.h> #include<unistd.h> #include<fcntl.h> #include<unistd.h> #include<sys/mma...转载 2020-09-07 14:20:51 · 424 阅读 · 0 评论 -
文件IO - O_DIRECT和O_SYNC详解
O_DIRECT和O_SYNC是系统调用open的flag参数。通过指定open的flag参数,以特定的文件描述符打开某一文件。这两个flag会对写盘的性能有很大的影响,因此对这两个flag做一些详细的了解。先看一个open函数的使用例子. 1 2 3 4 5 6 /* Open new or existing file for reading and wrting, sync io and no buffe...转载 2020-09-02 17:07:43 · 649 阅读 · 0 评论 -
getopt_long 实例代码
static struct option const long_opts[] ={ {"device", required_argument, NULL, 'd'}, {"address", required_argument, NULL, 'a'}, {"size", required_argument, NULL, 's'}, {"offset", required_argument, NULL, 'o'}, {"count", required_argument, NULL, .原创 2020-06-21 19:37:48 · 412 阅读 · 0 评论 -
getopt_long 示例
static void usage(const char* name){ int i = 0; printf("%s\n\n", name); printf("usage: %s [OPTIONS]\n\n", name); printf("Write using SGDMA, optionally read input from a binary input file.\n\n"); printf(" -%c (--%s) device (defaults to %s)\n",.原创 2020-06-21 18:14:54 · 351 阅读 · 0 评论 -
C 宏中的#和##
RT,#define FUNC(a) #a#define FUNCS(a,b) a##b第一个#a的作用是将字符a变成字符串,如下面例子中,将对应的版本号转换为字符串#define VERSION_MAJOR 1#define VERSION_MINOR 29#define VERSION_PATCH 2#define STRINGIFY(v) STRING...原创 2020-02-06 15:27:28 · 209 阅读 · 0 评论 -
stdarg, va_start, va_arg, va_end, va_copy - variable argument lists
Synopsis#include <stdarg.h>void va_start(va_list ap, last);type va_arg(va_list ap, type);void va_end(va_list ap);void va_copy(va_list dest, va_list src);DescriptionA function may be...转载 2019-05-04 22:12:37 · 117 阅读 · 0 评论 -
JSON与cJSON
该文主要记录是JSON的基本概念以及对应的cJSON API。一、什么是JSON ?详细的介绍见 https://www.json.org/ ,可以看到, JSON 可分为两类,一类是object ,一类是array。1.1 object引用官网的图,object 的定义为以'{'为起始符,'}'为结束符, 中间包含以','为间隔符的数个键-值对的集合,当然也可为空。1.2...原创 2018-11-30 13:05:22 · 726 阅读 · 1 评论 -
bash 相对路径、lib相对路径
该文主要记录运行一程序导致的问题及解决方法。情景是这样的:1. 自己写的一个程序需要开机自启, 当前的root 目录是RO的, 在init.d的启动脚本留有 S99_lunch_init ,其通过source 指向一可r/w的shell 脚本—— /oem/Lunch.sh, 这就可添加自己的可自启程序带来的可能性。...case "$1" in start) ...原创 2018-11-22 19:54:40 · 1122 阅读 · 0 评论