7#ifndef _PICO_PLATFORM_COMPILER_H
8#define _PICO_PLATFORM_COMPILER_H
18#include "hardware/platform_defs.h"
25#define __printflike(a,b) __picolibc_format(printf,a,b)
29#define PICO_C_COMPILER_IS_CLANG 1
31#define PICO_C_COMPILER_IS_GNU 1
33#elif defined __ICCARM__
35#define __aligned(x) __attribute__((__aligned__(x)))
37#ifndef __always_inline
38#define __always_inline __attribute__((__always_inline__))
41#define __noinline __attribute__((__noinline__))
44#define __packed __attribute__((__packed__))
47#define __printflike(a, b)
50#define __unused __attribute__((__unused__))
53#define __used __attribute__((__used__))
56#define __CONCAT1(a, b) a ## b
59#define __CONCAT(a, b) __CONCAT1(a, b)
66static inline uint __builtin_ctz(uint x) {
67 extern uint32_t __ctzsi2(uint32_t);
70#define __builtin_expect(x, y) (x)
71#define __builtin_isnan(x) __iar_isnan(x)
73#error Unsupported toolchain
76#define __weak __attribute__((weak))
78#include "pico/types.h"
82#define GCC_Like_Pragma _Pragma
84#define GCC_Like_Pragma(x)
89#define Clang_Pragma _Pragma
91#define Clang_Pragma(x)
95#if PICO_C_COMPILER_IS_GNU
96#define GCC_Pragma _Pragma
114#define __packed_aligned __packed __aligned(4)
125#if PICO_C_COMPILER_IS_GNU && (__GNUC__ <= 6 || (__GNUC__ == 7 && (__GNUC_MINOR__ < 3 || !defined(__cplusplus))))
126#define __force_inline inline __always_inline
128#define __force_inline __always_inline
135#define count_of(a) (sizeof(a)/sizeof((a)[0]))
142#define MAX(a, b) ((a)>(b)?(a):(b))
149#define MIN(a, b) ((b)>(a)?(a):(b))
152#ifdef __ARM_ARCH_ISA_THUMB
153#define pico_default_asm(...) __asm (".syntax unified\n" __VA_ARGS__)
154#define pico_default_asm_volatile(...) __asm volatile (".syntax unified\n" __VA_ARGS__)
155#define pico_default_asm_goto(...) __asm goto (".syntax unified\n" __VA_ARGS__)
156#define pico_default_asm_volatile_goto(...) __asm volatile goto (".syntax unified\n" __VA_ARGS__)
158#define pico_default_asm(...) __asm (__VA_ARGS__)
159#define pico_default_asm_volatile(...) __asm volatile (__VA_ARGS__)
160#define pico_default_asm_goto(...) __asm goto (__VA_ARGS__)
161#define pico_default_asm_volatile_goto(...) __asm volatile goto (__VA_ARGS__)
177 pico_default_asm_volatile (
"" : : :
"memory");
186#define __check_type_compatible(type_a, type_b) static_assert(__builtin_types_compatible_p(type_a, type_b), __STRING(type_a) " is not compatible with " __STRING(type_b));
188#define WRAPPER_FUNC(x) __wrap_ ## x
189#define REAL_FUNC(x) __real_ ## x
200#define PICO_ASSEMBLER_IS_CLANG 1
202#define PICO_ASSEMBLER_IS_GNU 1
204#elif defined __ICCARM__
206#error Unsupported toolchain
209#define WRAPPER_FUNC_NAME(x) __wrap_##x