linux程序移植到vxworks,VxWorks入门(一):VxWorks Vs Linux
1, VxWorks的特点:
幻灯片 4
.O {font-size:149%;}
■
All functions exist in the same "space".
►
Name clashes may appear between different modules (libraries).
►
Use unique names (with prefix) for global functions!
●
Wrong:
config
,
test
,
read_bi
●
Right:
drvXy
Config
,
foo
Test
,
devAbc_
read_bi
►
Or make functions
static
.
■
vxWorks has no
main
function.
■
Every function (including the shell) can call any other function.
►
You don’t start
programs
from the shell, you call
functions
.
►
When name clash happens, you might call the wrong function.
幻灯片 5
.O {font-size:149%;}
■
Ending a thread does not clean up system resources.
2, VxWorks中不同模块下相同名字的全局变量仍占用同一块内存;
static可让变量仅在一个源文件中生效;
可能的内存问题:
幻灯片 6
.O {font-size:149%;}
■
Pro: Functions and threads can easily
…
►
exchange large amounts of data by reference (pointers).
►
access any hardware register (e.g. VME bus).
■
Con: Functions and threads can easily
…
►
overrun allocated memory or stack size (esp. with arrays)
►
overwrite system tables. (e.g. interrupt handler table at
NULL
)
►
overwrite program code.
►
modify global variables of other modules (e.g. drivers).
3, 入门指导:
幻灯片 9
.O {font-size:149%;}
► Important for beginners: VxWorks Programmer's Guide, Chapter 2
● All about tasks, semaphores, watchdog timers, interrupts
► Always helpful: vxWorks Reference Manual
● All vxWorks system functions
■ Run-time help: Type help on the vxWorks shell.
4,VxWorks shell使用注意:
1)最多只能传10个参数;
2)PPC结构中float和double无效;
3)可以直接使用shell创建全局变量;
5,写程序应注意以下错误处理:
■
Error checking is the key to a stable system.
►
Stability is limited by the weakest point!
■
Check arguments to API functions (esp. shell functions)
►
Never trust a user! Not even yourself.
■
Always check pointer arguments for validity.
►
Writing to
NULL
overwrites the interrupt handler table!
■
Check results of system functions (
malloc
,
fopen
,
…
)
►
System functions may fail and return
NULL
or
ERROR
.
►
Using these values unchecked may crash the system much later.
■
Check for "impossible" values (e.g. in
case
constructs
幻灯片 17
.O {font-size:149%;}
linux程序移植到vxworks,VxWorks入门(一):VxWorks Vs Linux相关推荐
- Linux程序移植到Android上
序言: 由于本人还是比较偏重于先说明原理在说明实际操作步骤,要知其然更要知其所以然,如下图所示: 传统的linux系统中的程序基本都依赖于glibc(至于什么是glibc可以百度去),而右边AOSP( ...
- linux程序独占桌面,桌面应用|14个可以提升Linux桌面体验的应用程序
转战到Ubuntu,或者是别的流行的Linux发行版,不仅仅是操作系统的操作方式的改变,更多的是你还需要一些能支持你完成工作的好的应用. 在这篇文章中,我将分享一些我精选出来不可或缺的应用程序,并谈谈 ...
- linux程序已经在后台运行冻结了_让linux下程序永远后台运行
今天写了一个后台运行的脚本,发现只要我关终端,脚本也就随之停止了,昨天还不是这样啊?发现,细节之处有所不同,昨天我在运行该脚本之后,在终端shell中用exit命令退出,而今天则是直接关了终端,就这么 ...
- 将 MFC 应用程序移植到 Linux(循序渐进使用 wxWindows 的指南)
将 Windows 应用程序移植到 Linux 不必涉及再培训的痛苦经历.Markus Neifer 演示了如何使用 wxWindows 移植 MFC,指导读者使用 wxWindows 这一开放源码工 ...
- linux系统移植篇(四)—— 根文件系统使用介绍
linux系列目录: linux基础篇(一)--GCC和Makefile编译过程 linux基础篇(二)--静态和动态链接 ARM裸机篇(一)--i.MX6ULL介绍 ARM裸机篇(二)--i.MX6 ...
- linux 内核移植和根文件系统的制作【转载】
原文地址:http://www.cnblogs.com/hnrainll/archive/2011/06/09/2076214.html 1.1 Linux内核基础知识 在动手进行Linux内核移植之 ...
- Linux内核移植和根文件系统制作(详细步骤精讲)
第一章移植内核 1.1 Linux内核基础知识 1.1.1 Linux版本 1.1.2 什么是标准内核 1.1.3 Linux操作系统的分类 1.1.4 linux内核的选择 1.2 Linux内核启 ...
- linux系统移植篇(二)—— Uboot使用介绍
linux系列目录: linux基础篇(一)--GCC和Makefile编译过程 linux基础篇(二)--静态和动态链接 ARM裸机篇(一)--i.MX6ULL介绍 ARM裸机篇(二)--i.MX6 ...
- ida调试linux程序,MAC使用IDA PRO远程调试LINUX程序
1 背景 在学习Linux系统上的一些漏洞知识的时候,往往需要进行"实地测试",但是在Linux系统上进行调试并不太方便,因为LINUX自带的GDB调试工具真的不太人性化,即使有G ...
最新文章
- python商务图表_Excel职场商务图表高效制作
- IDEA云行项目提示Error: java: OutOfMemoryError
- [Spring5]IOC容器_Bean管理XML方式_注入其他类型属性
- AFNetworking 3.0源码阅读 - AFURLResponseSerialization
- linux 打开php服务器文件夹,Linux下如何查看文件和文件夹大小
- Java学习--泛型
- MySQL之父Michael Wideneus:有自己的电脑,我可以做任何事情
- 网站项目建设流程概述
- 远程连接Linux密码特殊字符,[转载]linux shell 命令_特殊字符
- 国产常用GIS工具软件
- 有道云笔记快捷键大全+修改
- 手把手带你学python自动化测试(一)——自动化测试环境搭建
- 好未来谢华亮:AI 在教育行业中的应用
- 抑制电源模块电磁干扰的几种方法
- 百度地图api根据详细地址反查坐标
- 【C++】内联函数是什么?内联和宏有什么区别?
- 如何学习人工智能,学习AI的一般路线
- torch.squeeze 函数运用
- 风云三国2.4问鼎天下修改作弊大全
- 【进阶版】机器学习之决策树知识与易错点总结(06)