移植IAR到 AVR GCC

本文档介绍了如何将使用IAR编译器构建的AVR应用移植到GCC工具链。主要内容包括:注册、中断服务例程(ISRs)、内联函数、闪存变量和非返回主函数的处理差异。
摘要由CSDN通过智能技术生成
 

Porting From IAR to AVR GCC

Introduction

C language was designed to be a portable language. There two main types of porting activities: porting an application to a different platform (OS and/or processor), and porting to a different compiler. Porting to a different compiler can be exacerbated when the application is an embedded system. For example, the C language Standard, strangely, does not specify a standard for declaring and defining Interrupt Service Routines (ISRs). Different compilers have different ways of defining registers, some of which use non-standard language constructs.

This chapter describes some methods and pointers on porting an AVR application built with the IAR compiler to the GNU toolchain (AVR GCC). Note that this may not be an exhaustive list.

Registers

IO header files contain identifiers for all the register names and bit names for a particular processor. IAR has individual header files for each processor and they must be included when registers are being used in the code. For example:

 #include <iom169.h> 
Note:
IAR does not always use the same register names or bit names that are used in the AVR datasheet.

AVR GCC also has individual IO header files for each processor. However, the actual processor type is specified as a command line flag to the compiler. (Using the -mmcu=processor flag.) This is usually done in the Makefile. This allows you to specify only a single header file for any processor type:

 #include <avr/io.h> 
Note:
The forward slash in the < avr/io.h> file name that is used to separate subdirectories can be used on Windows dist
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值