Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers compiler_port.h Source File

compiler_port.h

Go to the documentation of this file.
00001 /**
00002  * @file compiler_port.h
00003  * @brief Compiler specific definitions
00004  *
00005  * @section License
00006  *
00007  * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License
00011  * as published by the Free Software Foundation; either version 2
00012  * of the License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00022  *
00023  * @author Oryx Embedded SARL (www.oryx-embedded.com)
00024  * @version 1.7.6
00025  **/
00026 
00027 #ifndef _COMPILER_PORT_H
00028 #define _COMPILER_PORT_H
00029 
00030 //Dependencies
00031 #include <stddef.h>
00032 #include <stdint.h>
00033 #include <inttypes.h>
00034 
00035 //Types
00036 typedef char char_t;
00037 typedef signed int int_t;
00038 typedef unsigned int uint_t;
00039 typedef uint32_t systime_t;
00040 
00041 #if !defined(R_TYPEDEFS_H) && !defined(USE_CHIBIOS_2)
00042    typedef int bool_t;
00043 #endif
00044 
00045 #if defined(__linux__)
00046    #define PRIuSIZE "zu"
00047    #define PRIuTIME "lu"
00048 #elif defined(_WIN32)
00049    #define PRIuSIZE "Iu"
00050    #define PRIuTIME "lu"
00051 #elif defined(__XC32)
00052    #define PRIuSIZE "u"
00053    #define PRIuTIME "u"
00054 #elif defined(__CWCC__)
00055    #define PRIu8 "u"
00056    #define PRIu16 "u"
00057    #define PRIu32 "u"
00058    #define PRIx8 "x"
00059    #define PRIx16 "x"
00060    #define PRIx32 "x"
00061    #define PRIX8 "X"
00062    #define PRIX16 "X"
00063    #define PRIX32 "X"
00064    #define PRIuSIZE "u"
00065    #define PRIuTIME "u"
00066 #else
00067    #define PRIuSIZE "u"
00068    #define PRIuTIME "lu"
00069 #endif
00070 
00071 #if defined(__CC_ARM)
00072    #undef PRIu8
00073    #define PRIu8 "u"
00074    #undef PRIu16
00075    #define PRIu16 "u"
00076 #endif
00077 
00078 //CodeWarrior compiler?
00079 #if defined(__CWCC__)
00080    typedef uint32_t time_t;
00081    int strcasecmp(const char *s1, const char *s2);
00082    int strncasecmp(const char *s1, const char *s2, size_t n);
00083    char *strtok_r(char *s, const char *delim, char **last);
00084 //TI ARM C compiler?
00085 #elif defined(__TI_ARM__)
00086    int strcasecmp(const char *s1, const char *s2);
00087    int strncasecmp(const char *s1, const char *s2, size_t n);
00088    char *strtok_r(char *s, const char *delim, char **last);
00089 #endif
00090 
00091 //Microchip XC32 compiler?
00092 #if defined(__XC32)
00093    #define sprintf _sprintf
00094    int sprintf(char * str, const char * format, ...);
00095    int strcasecmp(const char *s1, const char *s2);
00096    int strncasecmp(const char *s1, const char *s2, size_t n);
00097    char *strtok_r(char *s, const char *delim, char **last);
00098 #endif
00099 
00100 //GCC compiler?
00101 #if defined(__GNUC__)
00102    #undef __start_packed
00103    #define __start_packed
00104    #undef __end_packed
00105    #define __end_packed __attribute__((__packed__))
00106 //Keil MDK-ARM compiler?
00107 #elif defined(__CC_ARM)
00108    #pragma anon_unions
00109    #undef __start_packed
00110    #define __start_packed __packed
00111    #undef __end_packed
00112    #define __end_packed
00113 //IAR C compiler?
00114 #elif defined(__IAR_SYSTEMS_ICC__)
00115    #undef __start_packed
00116    #define __start_packed __packed
00117    #undef __end_packed
00118    #define __end_packed
00119 //CodeWarrior compiler?
00120 #elif defined(__CWCC__)
00121    #undef __start_packed
00122    #define __start_packed
00123    #undef __end_packed
00124    #define __end_packed
00125 //TI ARM C compiler?
00126 #elif defined(__TI_ARM__)
00127    #undef __start_packed
00128    #define __start_packed
00129    #undef __end_packed
00130    #define __end_packed __attribute__((__packed__))
00131 //Win32 compiler?
00132 #elif defined(_WIN32)
00133    #undef interface
00134    #undef __start_packed
00135    #define __start_packed
00136    #undef __end_packed
00137    #define __end_packed
00138 #endif
00139 
00140 #endif
00141