7 #ifndef _PICO_PLATFORM_H 8 #define _PICO_PLATFORM_H 19 #include "hardware/platform_defs.h" 20 #include "hardware/regs/addressmap.h" 21 #include "hardware/regs/sio.h" 27 #ifndef PICO_STACK_SIZE 28 #define PICO_STACK_SIZE _u(0x800) 32 #ifndef PICO_HEAP_SIZE 33 #define PICO_HEAP_SIZE _u(0x800) 37 #ifndef PICO_NO_RAM_VECTOR_TABLE 38 #define PICO_NO_RAM_VECTOR_TABLE 0 42 #ifndef PICO_RP2040_B0_SUPPORTED 43 #define PICO_RP2040_B0_SUPPORTED 1 47 #ifndef PICO_FLOAT_SUPPORT_ROM_V1 48 #define PICO_FLOAT_SUPPORT_ROM_V1 1 52 #ifndef PICO_DOUBLE_SUPPORT_ROM_V1 53 #define PICO_DOUBLE_SUPPORT_ROM_V1 1 58 #ifndef PICO_RP2040_B1_SUPPORTED 59 #define PICO_RP2040_B1_SUPPORTED 1 63 #ifndef PICO_RP2040_B2_SUPPORTED 64 #define PICO_RP2040_B2_SUPPORTED 1 71 #include <sys/cdefs.h> 72 #include "pico/types.h" 98 #define __after_data(group) __attribute__((section(".after_data." group))) 112 #define __not_in_flash(group) __attribute__((section(".time_critical." group))) 129 #define __scratch_x(group) __attribute__((section(".scratch_x." group))) 146 #define __scratch_y(group) __attribute__((section(".scratch_y." group))) 163 #define __uninitialized_ram(group) __attribute__((section(".uninitialized_data." #group))) group 177 #define __in_flash(group) __attribute__((section(".flashdata." group))) 193 #define __not_in_flash_func(func_name) __not_in_flash(__STRING(func_name)) func_name 212 #define __time_critical_func(func_name) __not_in_flash_func(func_name) 226 #define __no_inline_not_in_flash_func(func_name) __noinline __not_in_flash_func(func_name) 228 #define __packed_aligned __packed __aligned(4) 238 #if defined(__GNUC__) && (__GNUC__ <= 6 || (__GNUC__ == 7 && (__GNUC_MINOR__ < 3 || !defined(__cplusplus)))) 239 #define __force_inline inline __always_inline 241 #define __force_inline __always_inline 248 #define count_of(a) (sizeof(a)/sizeof((a)[0])) 255 #define MAX(a, b) ((a)>(b)?(a):(b)) 262 #define MIN(a, b) ((b)>(a)?(a):(b)) 285 __asm__
volatile (
"" : : :
"memory");
296 #define host_safe_hw_ptr(x) ((uintptr_t)(x)) 297 #define native_safe_hw_ptr(x) host_safe_hw_ptr(x) 315 void __attribute__((noreturn))
panic(
const char *fmt, ...);
318 #define panic_compact(...) panic(__VA_ARGS__) 320 #define panic_compact(...) panic("") 324 #ifndef PICO_NO_FPGA_CHECK 325 #define PICO_NO_FPGA_CHECK 0 328 #if PICO_NO_FPGA_CHECK 329 static inline bool running_on_fpga(
void) {
return false;}
331 bool running_on_fpga(
void);
345 #pragma GCC diagnostic push 346 #pragma GCC diagnostic ignored "-Warray-bounds" 347 return *(uint8_t*)0x13;
348 #pragma GCC diagnostic pop 371 asm (
"mul %0, %1" :
"+l" (a) :
"l" (b) : );
388 #define __fast_mul(a, b) __builtin_choose_expr(__builtin_constant_p(b) && !__builtin_constant_p(a), \ 389 (__builtin_popcount(b) >= 2 ? __mul_instruction(a,b) : (a)*(b)), \ 398 #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)); 407 asm (
"mrs %0, ipsr" :
"=l" (exception));
411 #define WRAPPER_FUNC(x) __wrap_ ## x 412 #define REAL_FUNC(x) __real_ ## x 437 :
"+r" (minimum_cycles) : :
"memory" 447 return (*(uint32_t *) (SIO_BASE + SIO_CPUID_OFFSET));
450 #else // __ASSEMBLER__ 452 #define WRAPPER_FUNC_NAME(x) __wrap_##x 453 #define SECTION_NAME(x) .text.##x 454 #define RAM_SECTION_NAME(x) .time_critical.##x 456 #endif // !__ASSEMBLER__