[原创].HAL的不同方式访问字符器件的空间开销简单比较
2009-12-06 09:21
260 查看
注:本文所述皆为查询方式的比对,中断方式下请读者自习研究比对。
范例:/dev/jtag_uart
图1 系统库属性设置
源代码:
编译结果:
Info: (hello_nios.elf) 2608 Bytes program size (code + initialized data).
Info: 8189 KBytes free for stack + heap.
图2 系统库属性设置
源代码:
编译结果:
Info: (hello_nios.elf) 43 KBytes program size (code + initialized data).
Info: 8148 KBytes free for stack + heap.
2. 李兰英等, NiosII嵌入式软核SOPC设计原理及应用, 200611, 北京航空航天大学出版社
范例:/dev/jtag_uart
Unix类型
图1 系统库属性设置
源代码:
#include "system.h" #include "fcntl.h" #include "unistd.h" int main(void) { int fd; // file descriptor char msg[] = "Hello Nios!"; fd = open("/dev/jtag_uart", O_WRONLY); write(fd, msg, sizeof(msg)-1); close(fd); return 0; }
编译结果:
Info: (hello_nios.elf) 2608 Bytes program size (code + initialized data).
Info: 8189 KBytes free for stack + heap.
ANSI C
图2 系统库属性设置
源代码:
#include "system.h" #include <stdio.h> int main (void) { FILE *fp; // file pointer char msg[] = "Hello Nios!"; fp = fopen("/dev/jtag_uart", "w"); fprintf(fp, msg); fclose(fp); return 0; }
编译结果:
Info: (hello_nios.elf) 43 KBytes program size (code + initialized data).
Info: 8148 KBytes free for stack + heap.
C++流
(略)参考
1. Altera, HAL API Reference, 2009052. 李兰英等, NiosII嵌入式软核SOPC设计原理及应用, 200611, 北京航空航天大学出版社
相关文章推荐
- 在std::vector下,不同内存分配方式效率简单比较
- Java和JSP中对于比较字符的方式不同,需要注意
- 肤色检测算法 - 基于不同颜色空间简单区域划分的皮肤检测算法
- Java不同编码方式,中英文字符所占字节数
- jsp网站访问次数统计的几种方法(比较简单的几种)
- 两个字符串比较,取出重复字符个数。 (原创)
- 打印不同的数(编写一个程序,使用指针访问数组方式,读入十个数,输出其中不同的数,即一个数如果出现多次,只打印一次)
- java中Map的两种不同遍历、迭代方式及比较
- linux访问window共享的最简单方式
- Android HAL实现的三种方式(1) - 基于JNI的简单HAL设计
- powerpc 、mips访问I/O方式的比较
- ASP实现一个空间不同域名访问显示不同版权实例
- oracle coherence POD的3种不同定义方式比较
- Java中XML格式的字符串4读取方式的简单比较
- java 访问不同资源方式
- Android HAL实现的三种方式(1) - 基于JNI的简单HAL设计
- PCIe学习笔记(10)--- 配置空间的两种访问方式--ENHANCED
- java中数据库访问方式的不同处理数据总结:
- Oracle教程之Oracle管理表空间(十四)--表空间管理方式的比较
- Android HAL实现的三种方式(1) - 基于JNI的简单HAL设计