iarcompat.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Name: iarcompat.h
  2. * Project: AVR USB driver
  3. * Author: Christian Starkjohann
  4. * Creation Date: 2006-03-01
  5. * Tabsize: 4
  6. * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
  7. * License: Proprietary, free under certain conditions. See Documentation.
  8. * This Revision: $Id$
  9. */
  10. /*
  11. General Description:
  12. This header is included when we compile with the IAR C-compiler and assembler.
  13. It defines macros for cross compatibility between gcc and IAR-cc.
  14. Thanks to Oleg Semyonov for his help with the IAR tools port!
  15. */
  16. #ifndef __iarcompat_h_INCLUDED__
  17. #define __iarcompat_h_INCLUDED__
  18. #if defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__
  19. /* Enable bit definitions */
  20. #ifndef ENABLE_BIT_DEFINITIONS
  21. # define ENABLE_BIT_DEFINITIONS 1
  22. #endif
  23. /* Include IAR headers */
  24. #include <ioavr.h>
  25. #ifndef __IAR_SYSTEMS_ASM__
  26. # include <inavr.h>
  27. #endif
  28. #define __attribute__(arg)
  29. #define IAR_SECTION(section) @ section
  30. #ifndef USB_BUFFER_SECTION
  31. # define USB_BUFFER_SECTION "TINY_Z" /* if user has not selected a named section */
  32. #endif
  33. #ifdef __IAR_SYSTEMS_ASM__
  34. # define __ASSEMBLER__
  35. #endif
  36. #ifdef __HAS_ELPM__
  37. # define PROGMEM __farflash
  38. #else
  39. # define PROGMEM __flash
  40. #endif
  41. #define PRG_RDB(addr) (*(PROGMEM char *)(addr))
  42. /* The following definitions are not needed by the driver, but may be of some
  43. * help if you port a gcc based project to IAR.
  44. */
  45. #define cli() __disable_interrupt()
  46. #define sei() __enable_interrupt()
  47. #define wdt_reset() __watchdog_reset()
  48. #endif /* defined __IAR_SYSTEMS_ICC__ || defined __IAR_SYSTEMS_ASM__ */
  49. #endif /* __iarcompat_h_INCLUDED__ */