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. SharePoint Framework 企业向导(七)

    博客地址:http://blog.csdn.net/FoxDave 企业中的SPFx SharePoint是最成功的企业协作平台之一,能够成功的其中一点是它能够进行扩展并作为一个应用集成平台.SP ...

  2. ios初识UITableView及简单用法一

    // // ViewController.m // ZQRTableViewTest // // Created by zzqqrr on 17/8/24. // Copyright (c) 2017 ...

  3. CentOS部署PHP环境

    1.安装apache yum -y install httpd httpd-devel 2.启动apache systemctl start httpd.service 检查apache状态 syst ...

  4. git命令学习

    git init:把当前目录变成Git可以管理的仓库git add file:把文件添加到仓库git commit -m "描述语句":把文件提交到仓库git status:该命令 ...

  5. js实现瀑布流以及加载效果

    一.瀑布流是个啥? 瀑布流,是比较流行的一种网站页面布局,视觉表现为参差不齐的多栏布局,随着页面滚动条向下滚动,这种布局还会不断加载数据块并附加至当前尾部. 最早采用瀑布流布局的网站是Pinteres ...

  6. 微信公众号开发遇到simplexml_load_string 未定义

    1.Go to /etc/php/7.0/fpm and edit php.ini 取消注释:     extension=php_xmlrpc.dll 2. sudo apt-get update ...

  7. Too much thinking! Too much annoying.

    I am now in great demand for an opportunity to yearn for, the ability to express myself, in a maximu ...

  8. Python基础3切片,字符串的方法,for 循环

    切片:截取序列(字符串,列表,元组等)中某一段字符,并不改变原数据和数据类型.结构:[起始位置:终止位置:步长]  但不包括终止位置.所谓:顾头不顾尾. 索引:序列中每个元素都是有编号的,都是从0开始 ...

  9. 一个跳转提示页面---JS

    //一个跳转提示页面   <script type="text/javascript">   var s=5;     function go(){        do ...

  10. TLS编程

    最近测试广州电信的电话会议平台,该平台接入采用HTTPS协议,于是有了本文.09年培训时写过一个简单的TLS C/S结构交互,采用openssl的ssl相关接口,但与生产相去胜远.本文采用openss ...