Home   Product Info   IrDA Info   Applications   Downloads   Contact Us
Stack Info  |  C Compiler  |  Book Info  |  Purchase
 

C Compiler Requirements

To use the 'Microlite' IrDA stack, your target C compiler must have these features:

  • ANSI C compliant
  • Flexible array members (C99)
  • Packed structures, ie byte structure alignment

Flexible Array Members

Your target compiler must support 'flexible array members' with either a [] or a [0] dimension for the last element. Furthermore, 'sizeof()' must return the size of the explicitly defined members. eg

struct f1
{
  uint16_t x; 
  uint8_t  y[];
};

where sizeof(f1) = sizeof(uint16_t).

This feature was introduced in C99. If your compiler does not support 'flexible array members', this can be fixed but will require code changes. These types of declarations are used as overlays for IrDA frames.

Packed Structures

Your target compiler must support 'packed structures' where no padding is added after byte fields in structures. Furthermore, 'sizeof()' must return the size of the explicitly defined members. eg

struct f2
{
  uint8_t  x; 
  uint16_t y;
  uint8_t  z; 
};

where sizeof(f2) = sizeof(uint8_t) + sizeof(uint16_t) + sizeof(uint8_t).

Some compilers align (u)int16_t / (u)int32_t types on word boundaries after a uint8_t by adding the necessary padding. This is usually set with a compiler option. These types of declarations are used as overlays for IrDA frames.

 © Copyright Kea Computing Ltd 2013 - All rights reserved  |  Legal Notice  |  Terms of Use  |  Kea Computing Ltd