7#ifndef _PICO_PLATFORM_COMPILER_H
8#define _PICO_PLATFORM_COMPILER_H
18#include "hardware/platform_defs.h"
26#define PICO_C_COMPILER_IS_CLANG 1
28#define PICO_C_COMPILER_IS_GNU 1
30#elif defined __ICCARM__
32#define __aligned(x) __attribute__((__aligned__(x)))
34#ifndef __always_inline
35#define __always_inline __attribute__((__always_inline__))
38#define __noinline __attribute__((__noinline__))
41#define __packed __attribute__((__packed__))
44#define __printflike(a, b)
47#define __unused __attribute__((__unused__))
50#define __used __attribute__((__used__))
53#define __CONCAT1(a, b) a ## b
56#define __CONCAT(a, b) __CONCAT1(a, b)
63static inline uint __builtin_ctz(uint x) {
64 extern uint32_t __ctzsi2(uint32_t);
67#define __builtin_expect(x, y) (x)
68#define __builtin_isnan(x) __iar_isnan(x)
70#error Unsupported toolchain
73#define __weak __attribute__((weak))
75#include "pico/types.h"
79#define GCC_Like_Pragma _Pragma
81#define GCC_Like_Pragma(x)
86#define Clang_Pragma _Pragma
88#define Clang_Pragma(x)
92#if PICO_C_COMPILER_IS_GNU
93#define GCC_Pragma _Pragma
111#define __packed_aligned __packed __aligned(4)
122#if PICO_C_COMPILER_IS_GNU && (__GNUC__ <= 6 || (__GNUC__ == 7 && (__GNUC_MINOR__ < 3 || !defined(__cplusplus))))
123#define __force_inline inline __always_inline
125#define __force_inline __always_inline
132#define count_of(a) (sizeof(a)/sizeof((a)[0]))
139#define MAX(a, b) ((a)>(b)?(a):(b))
146#define MIN(a, b) ((b)>(a)?(a):(b))
149#ifdef __ARM_ARCH_ISA_THUMB
150#define pico_default_asm(...) __asm (".syntax unified\n" __VA_ARGS__)
151#define pico_default_asm_volatile(...) __asm volatile (".syntax unified\n" __VA_ARGS__)
152#define pico_default_asm_goto(...) __asm goto (".syntax unified\n" __VA_ARGS__)
154#define pico_default_asm(...) __asm (__VA_ARGS__)
155#define pico_default_asm_volatile(...) __asm volatile (__VA_ARGS__)
156#define pico_default_asm_goto(...) __asm goto (__VA_ARGS__)
172 pico_default_asm_volatile (
"" : : :
"memory");
181#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));
183#define WRAPPER_FUNC(x) __wrap_ ## x
184#define REAL_FUNC(x) __real_ ## x
195#define PICO_ASSEMBLER_IS_CLANG 1
197#define PICO_ASSEMBLER_IS_GNU 1
199#elif defined __ICCARM__
201#error Unsupported toolchain
204#define WRAPPER_FUNC_NAME(x) __wrap_##x