You can insert asm code example asm("NOP") into the c or c++ source code to get a good performance. But it don’t have problem for the compatibility, and because there are no operands and clobbered resources, inline assembler statements have no interface with the surrounding C source code. IAR compiler provides a good solution is intrinsic functions. For example, the provided interrupt controlling intrinsic functions are __disable_interrupt() and __enable_interrupt().

Another example is that it is the first thing is to disable the watchdog in MSP430. The general method is to put the WDTCTL = WDTPW + WDTHOLD; at the first line of main(). But it may failure to disable the watchdog because it is too later to call it as there are lots of code to initialize global variables. The IAR compiler provides a __low_level_init() intrinsic function which makes sure it will be called firstly.

/* There is a possibility that there is a large memory need to be initialized.
* in that, it will cause the system reset if the watchdog is not initialized.
* using __low_level_init in IAR to make sure that this code will executed firstly
*/
#if defined(__IAR_SYSTEMS_ICC__)
__intrinsic int __low_level_init(void)
{
//Stop watchdog timer to prevent time out reset, shall be first line of main.
WDTCTL = WDTPW + WDTHOLD;
return ;
}
#endif

IAR intrinsic functions的更多相关文章

  1. Google C++ Style Guide

    Background C++ is one of the main development languages used by many of Google's open-source project ...

  2. Lock-Free 编程

    文章索引 Lock-Free 编程是什么? Lock-Free 编程技术 读改写原子操作(Atomic Read-Modify-Write Operations) Compare-And-Swap 循 ...

  3. Build Instructions (Windows) – The Chromium Projects

    转自:http://121.199.54.6/wordpress/?p=1156 原始地址:http://www.chromium.org/developers/how-tos/build-instr ...

  4. gcc 编译器参数

    一.GCC编译过程 参考:http://hi.baidu.com/zengzhaonong/item/c00e079f500adccab625314f------------------------- ...

  5. shader函数

    Intrinsic Functions (DirectX HLSL) The following table lists the intrinsic functions available in HL ...

  6. VC 宏与预处理使用方法总结

    目录(?) C/C++ 预定义宏^ C/C++ 预定义宏用途:诊断与调试输出^ CRT 和 C 标准库中的宏^ NULL 空指针^ limits.h 整数类型常量^ float.h 浮点类型常量^ m ...

  7. VC编译连接选项详解(转)

    大家可能一直在用VC开发软件,但是对于这个编译器却未必很了解.原因是多方面的.大多数情况下,我们只停留在“使用”它,而不会想去“了解”它.因为它只是一个工具,我们宁可把更多的精力放在C++语言和软件设 ...

  8. VC6.0的工程设置解读Project--Settings

    [原文:http://wenku.baidu.com/view/f10a241dff00bed5b9f31ddd.html] 做开发差不多一年多了,突然感觉对VC的工程设置都不是很清楚,天天要和VC见 ...

  9. VC6.0设置选项解读(转)

    其实软件调试还是一个技术熟练过程,得慢慢自己总结,可以去搜索引擎查找一些相关的文章看看,下边是一篇关于VC6使用的小文章,贴出来大家看看: 大家可能一直在用VC开发软件,但是对于这个编译器却未必很了解 ...

随机推荐

  1. 戴尔poweredge r730服务器配置以及系统安装

    第一次给服务器安装的是ubantu系统: 首先我们开机进入小型BIOS设置一下RAID,或者进入服务器管理系统,在系统的BIOS中进行RAID设置: 开机后当看到出现< Ctrl > &l ...

  2. Ubuntu16.04 python2.7升级python3.5

    正常情况下,你安装好ubuntu16.04版本之后,系统会自带 python2.7版本,如果需要下载新版本的python3.5,就需要进行更新.下面给出具体教程: 1.首先在ubuntu的终端tern ...

  3. Spring实现Ioc的多种方式--控制反转、依赖注入、xml配置的方式实现IoC、对象作用域

    Spring实现Ioc的多种方式 一.IoC基础 1.1.概念: 1.IoC 控制反转(Inversion of Control) IoC是一种设计思想. 2.DI 依赖注入 依赖注入是实现IoC的一 ...

  4. Sass 混合宏、继承、占位符 详解

    混合宏-声明混合宏如果你的整个网站中有几处小样式类似,比如颜色,字体等,在 Sass 可以使用变量来统一处理,那么这种选择还是不错的.但当你的样式变得越来越复杂,需要重复使用大段的样式时,使用变量就无 ...

  5. L259

    Few things can feel as crushing as being rejected by someone who you're either dating or romanticall ...

  6. dos命令:网络相关命令

    网络相关命令 一.Arp命令 1.介绍 ​ 显示和修改地址解析协议(ARP)使用的“IP 到物理”地址转换表. 2.语法 ARP -s inet_addr eth_addr [if_addr] ARP ...

  7. Day8作业及默写

    1,有如下文件,a1.txt,里面的内容为: 老男孩是最好的培训机构, 全心全意为学生服务, 只为学生未来,不为牟利. 我说的都是真的.哈哈 分别完成以下的功能: 将原文件全部读出来并打印. with ...

  8. 判断input checkbox选中

    $("#chexk").get(0).checked $("#chexk").is(':checked')

  9. js 回车键事件

    document.onkeydown = function (event) { var e = event || window.event || arguments.callee.caller.arg ...

  10. pycharm 利用virtualenv为每个项目配置venv

    1.在某个位置安装一个虚拟环境 2.项目运行是配置virtualenv生成的环境 3.重启terminal 安装依赖: exp => pip install django