[En-Nut-Discussion] Replacing compiler.h

Nathan Moore nategoose at gmail.com
Thu Oct 4 16:29:27 CEST 2012


> for all targets and runtime libraries that are supported by this
> toolchain. Furthermore, this header will define all compiler related
> macros like _NOP
>
>  /*!
>   * \brief NOP instruction.
>   *
>   * Several Nut/OS drivers use one or more single cycle operations are
>   * for very short delays. It's implementation depends on the inline
>   * assembler and the target family.
>   */
>  #ifndef _NOP
>  #if defined(__arm__)
>  #define _NOP() __asm__ __volatile__("mov r0, r0  @ _NOP")
>  #elif defined(__AVR__) || defined(__AVR32__)
>  #define _NOP() __asm__ __volatile__("nop")
>  #endif
>  #endif
>

If other operational macros were added this code could get ugly.
I think it may be cleaner if the actual code were place in different
headers that were #included here.
This would also allow someone to easily DIFF those headers for
different platforms too see if one
platform were missing something.  It would also make it so that
changes to one platform's
implementation would be easily distinguishable from bigger changes.

Nathan


More information about the En-Nut-Discussion mailing list