iar

What is the IAR equivalent of '__attribute__ ((weak, alias (#f))) '?

狂风中的少年 提交于 2020-02-23 07:38:05
问题 I was using LPC series (NXP) as control something. And now, we are switching over to another MCU (Spansion) and the compiler is from GNU to IAR. Some attribute doesn't the same between IAR and GNU, I would like to ask for help: In the past (GNU): #define ALIAS(f) __attribute__((weak, alias (#f))); #define CSV_IRQHandler(void) ALIAS(IntDefaultHandler) What is different if the compiler change to IAR? If I use the same syntax I get the error: Error[Pe130]: expected a "{" Any suggestion would be

.net利用委托BeginInvoke和EndInvoke实现异步编程

旧街凉风 提交于 2020-01-27 19:02:56
最近看书,看到了可以利用学过的委托知识实现异步编程,这里做一个简单的说明示例。如果委托对象在调用列表中只有一个方法(引用方法),他就可有异步执行这个方法。委托类有两个方法,BeginInvoke和EndInvoke。 当我们调用委托的BeginInvoke方法时,它开始在一个独立线程上执行引用方法。并且立即返回到原始线程。原始线程可以继续。而引用方法会在线程池中的线程中并行执行。 当程序希望获取已完成的异步方法的结果时,可以检查BeginInvoke返回的IAsyncResult的IsCompleted属性。或调用委托的EndInvoke方法来等待委托完成。 等待-直到完成 模式 delegate string MyDownLoadDel(string weburl); static void Main(string[] args) { Stopwatch watch = new Stopwatch(); watch.Start(); Debug.WriteLine(string.Format("开始计时:{0,4:N0}ms", watch.Elapsed.TotalMilliseconds)); MyDownLoadDel del = new MyDownLoadDel(DownLoadWeb); IAsyncResult iar = del.BeginInvoke(

CC2530在IAR下printf重定向

给你一囗甜甜゛ 提交于 2020-01-26 13:11:59
CC2530在IAR下的printf函数重定向,与8051的方法是一致的: 第一步包含头文件: # include <stdio.h> 第二步定义putchar函数: __near_func int putchar ( int c ) { UTX0IF = 0 ; U0DBUF = ( char ) c ; while ( UTX0IF == 0 ) ; return ( c ) ; } 第三步:在初始化函数时配置好串口 void SampleApp_Init ( uint8 task_id ) 函数里添加 halUARTCfg_t uart_config ; uart_config . configured = TRUE ; uart_config . flowControl = FALSE ; uart_config . baudRate = HAL_UART_BR_9600 ; //这里的波特率是9600 HalUARTOpen ( HAL_UART_PORT_0 , & uart_config ) ; 完成以上步骤就可以使用printf函数了 参考: https://blog.csdn.net/bsaver/article/details/51120040 来源: CSDN 作者: qq_40787630 链接: https://blog.csdn.net/qq

IAR建立STM32F4工程

依然范特西╮ 提交于 2020-01-14 11:58:07
文章目录 1. 官方固件库下载 2. 复制相关文件 2.1 复制启动文件 .s 2.2 复制system相关文件 2.3 复制底层驱动文件 2.4 复制.icf链接文件 2.5 复制中断和配置相关文件 3. IAR新建工程并添加工程文件 4. IAR工程的修改 4.1 工程文件的修改 4.1.1 具体单板的选择 4.1.2 外部晶振的修改 4.2 IAR配置的修改 4.2.1 头文件包含路径修改 4.2.2 链接文件选择修改 4.2.3 printf重定向到串口出错修改 4.2.4 Debug和下载器修改 4.2.5 Tab替换为4个空格修改 4.2.6 ctrl+T 一键格式化代码修改  在建立工程之前,为了使自己的工程看起来更加清晰,方便后期的修改,分别建立不同的文件夹以存放不同类型的文件,本工程建立的文件夹如下图所示。  本文基于ST官方固件库建立STM32F407工程,详细步骤如下: 1. 官方固件库下载  官方固件库下载链接为: STM32F4xx_DSP_StdPeriph_Lib_V1.8.0.rar 2. 复制相关文件 2.1 复制启动文件 .s  在文件夹 STM32F4xx_DSP_StdPeriph_Lib_V1.8.0\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates\iar 下找到相对应的.s启动文件

MISRA C:2004, error with bit shifting

我怕爱的太早我们不能终老 提交于 2020-01-11 03:14:29
问题 I'm using IAR Workbench compiler with MISRA C:2004 checking on. The fragment is: #define UNS_32 unsigned int UNS_32 arg = 3U; UNS_32 converted_arg = (UNS_32) arg; /* Error line --> */ UNS_32 irq_source = (UNS_32)(1U << converted_arg); The MISRA error is: Error[Pm136]: illegal explicit conversion from underlying MISRA type "unsigned char" to "unsigned int" (MISRA C 2004 rule 10.3) I don't see any unsigned char in any of the code above. The discussion at Why did Misra throw an error here?

IAR使用的一些小技巧

萝らか妹 提交于 2020-01-09 13:36:43
IAR使用的一些小技巧 IAR版本:IAR for ARM 8.30.1.17 1.无法go to define的解决方法: 1.首先,Project -->Clean,清理所有编译信息,然后重新编译一下; 2.等待编译完成,会看到右下角有个绿色的进度条在跑,这是IAR在同步所有的文件,建立联系,等待这个进度完成,就可以愉快的跳转啦; 2.IAR查找函数,变量的小技巧 实话说,这些功能最好用的还是SourceInsight,但是如果开发环境也能方便的使用这些功能,又何必去建一个SI的工程呢; 1.右键功能 下面加粗的用的是最多的: Go to Definition of XXX: 查找XXX的定义 快捷键:F12 Go to Declaration of XXX:查找XXX的声明 Find All Reference to XXX:查找XXX所有被调用的地方 Find All Calls to XXX : 查找所有调用XXX的函数(XXX必须是函数) Find All Calls from XXX :查找所有XXX调用的函数(XXX必须是函数) 2.查找特定字符 此版本的IAR的快捷键是:Ctrl+Shift+F,注意要在英文输入下使用,或者: 3.查看当前文件下的所有函数列表 这个是偶然发现的,一个文件函数太多跳到某个函数还是蛮好用的 来源: CSDN 作者: 贝萝岗的小蚂蚁

How to force IAR to use desired Cortex-M0+ instructions (optimization will be disabled for this func.)

独自空忆成欢 提交于 2020-01-07 08:05:09
问题 I need to force IAR tp use certain Cortex-M0+ instruction in some part of my code while codding with C. Please do not offer pure asm functions or inline asm etc. I have managed to do this for 51 instruction but could not for ; ADR, BLX, RSBS, SBCS, SXTH instructions. Optimization is disabled for this function (#pragma optimization=none) I have tried many things by considering instruction behaviour. But IAR preferred to same function with different instructions. Did anyone else struggle with

How to force IAR to use desired Cortex-M0+ instructions (optimization will be disabled for this func.)

耗尽温柔 提交于 2020-01-07 08:05:06
问题 I need to force IAR tp use certain Cortex-M0+ instruction in some part of my code while codding with C. Please do not offer pure asm functions or inline asm etc. I have managed to do this for 51 instruction but could not for ; ADR, BLX, RSBS, SBCS, SXTH instructions. Optimization is disabled for this function (#pragma optimization=none) I have tried many things by considering instruction behaviour. But IAR preferred to same function with different instructions. Did anyone else struggle with

RTC with msp430

折月煮酒 提交于 2020-01-01 20:09:21
问题 I have asked this question before, but I think this time I can ask with some more clarity. The below is my RTC Test code. I am using msp430f5418 with IAR EW 5. My problem is after some time (we tested with 15 minutes and more) the minutes interrupt is coming earlier than expected. ie, On first time, after exactly 60 seconds and after 15 minutes the minute interrupt comes on 45th seconds itself. Why is it so? We are using the library provided by TI for RTC register manipulation. Can anybody

RTC with msp430

折月煮酒 提交于 2020-01-01 20:09:11
问题 I have asked this question before, but I think this time I can ask with some more clarity. The below is my RTC Test code. I am using msp430f5418 with IAR EW 5. My problem is after some time (we tested with 15 minutes and more) the minutes interrupt is coming earlier than expected. ie, On first time, after exactly 60 seconds and after 15 minutes the minute interrupt comes on 45th seconds itself. Why is it so? We are using the library provided by TI for RTC register manipulation. Can anybody