Chinaunix首页 | 论坛 | 博客
  • 博客访问: 349193
  • 博文数量: 72
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 632
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-08 16:54
文章分类

全部博文(72)

文章存档

2007年(54)

2006年(18)

我的朋友

分类: C/C++

2007-02-03 19:05:42

I've used the IAR compiler to program an MSP430, and it has a few nice features to access the special features of the MSP430. What does mspgcc have?
In general, mspgcc has similar facilities to the IAR tools. The syntax is a little different in some cases. For example, declaring a routine as an interrupt service routine requires round brackets, instead of square ones, around the vector name. However, just a little editing, and a few "#if defined(__GNUC__)"s will allow a program to compile with either the IAR or the mspgcc tools. In fact, just a little more work should allow programs to compile with the Quadravox or Rowley compilers, too.
The way embedded assembly language is handled is the biggest difference between source code for these compilers. This is likely to be the greatest source of code porting work, assuming you have resorted to using assembly language.

>>i am trying to convert code written for the IAR compiler to the msp430-gcc
>>on windows.
>>right now it is complaining about this line:
>>__interrupt void ISRTimerA0 (void)
>>IntService.c:11: syntax error before "void"
>>i've read the following link.  it's not enough information for me though.
>>where is there more thorough documentation?
>>
>>i am a newb at this, so anything at all will be useful.
>>thank you.
>>    
>>
>
>With GCC, you need to use a line like:
>interrupt (TIMERA0_VECTOR) ISRTimerA0 (void)
>
>Also, you need  "#include " for the definition of the
>"interrupt" macro, and "#include " for the vector definitions.
We started working a little way towards cross-compiler compatibility. If
you include "isr_compat.h" from our GCC distribution you can start the
above interrupt service routine with:
    ISR(TIMERA0, ISRTimerA0)
and it will work with GCC, IAR, Quadravox and CCE.
thank you.  i have compiled and used code with this information.
now i am at another road block.  there does not seem to be a "calloc" function.  what is the best way to remedy this?  i tried to add it to stdlib, but mspgcc has only header files, not the source code.  would the best solution be to just write my own and include it in the same directory as the rest of the project?
in addition, the iar code has a #pragma location=0xE864.  what is the equivalent gcc code?  i couldn't tell if gcc handled it correctly, or ignored it or what.
thanks again.
阅读(2312) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~