7#ifndef _PICO_PLATFORM_H_
8#define _PICO_PLATFORM_H_
19#include "hardware/platform_defs.h"
25#ifndef PICO_STACK_SIZE
26#define PICO_STACK_SIZE _u(0x800)
31#define PICO_HEAP_SIZE _u(0x800)
35#ifndef PICO_NO_RAM_VECTOR_TABLE
36#define PICO_NO_RAM_VECTOR_TABLE 0
40#ifndef PICO_RP2040_B0_SUPPORTED
41#define PICO_RP2040_B0_SUPPORTED 1
45#ifndef PICO_FLOAT_SUPPORT_ROM_V1
46#define PICO_FLOAT_SUPPORT_ROM_V1 1
50#ifndef PICO_DOUBLE_SUPPORT_ROM_V1
51#define PICO_DOUBLE_SUPPORT_ROM_V1 1
56#ifndef PICO_RP2040_B1_SUPPORTED
57#define PICO_RP2040_B1_SUPPORTED 1
61#ifndef PICO_RP2040_B2_SUPPORTED
62#define PICO_RP2040_B2_SUPPORTED 1
70#include "pico/types.h"
96#define __after_data(group) __attribute__((section(".after_data." group)))
110#define __not_in_flash(group) __attribute__((section(".time_critical." group)))
127#define __scratch_x(group) __attribute__((section(".scratch_x." group)))
144#define __scratch_y(group) __attribute__((section(".scratch_y." group)))
161#define __uninitialized_ram(group) __attribute__((section(".uninitialized_ram." #group))) group
175#define __in_flash(group) __attribute__((section(".flashdata" group)))
191#define __not_in_flash_func(func_name) __not_in_flash(__STRING(func_name)) func_name
210#define __time_critical_func(func_name) __not_in_flash_func(func_name)
224#define __no_inline_not_in_flash_func(func_name) __noinline __not_in_flash_func(func_name)
226#define __packed_aligned __packed __aligned(4)
236#if defined(__GNUC__) && __GNUC__ <= 7
237#define __force_inline inline __always_inline
239#define __force_inline __always_inline
246#define count_of(a) (sizeof(a)/sizeof((a)[0]))
253#define MAX(a, b) ((a)>(b)?(a):(b))
260#define MIN(a, b) ((b)>(a)?(a):(b))
283 __asm__
volatile (
"" : : :
"memory");
294#define host_safe_hw_ptr(x) ((uintptr_t)(x))
295#define native_safe_hw_ptr(x) host_safe_hw_ptr(x)
313void __attribute__((noreturn))
panic(
const char *fmt, ...);
316#ifndef PICO_NO_FPGA_CHECK
317#define PICO_NO_FPGA_CHECK 0
320#if PICO_NO_FPGA_CHECK
321static inline bool running_on_fpga(
void) {
return false;}
323bool running_on_fpga(
void);
337 return *(uint8_t*)0x13;
360 asm (
"mul %0, %1" :
"+l" (a) :
"l" (b) : );
377#define __fast_mul(a, b) __builtin_choose_expr(__builtin_constant_p(b) && !__builtin_constant_p(a), \
378(__builtin_popcount(b) >= 2 ? __mul_instruction(a,b) : (a)*(b)), \
387#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));
396#define WRAPPER_FUNC(x) __wrap_ ## x
397#define REAL_FUNC(x) __real_ ## x
405#define WRAPPER_FUNC_NAME(x) __wrap_##x
406#define SECTION_NAME(x) .text.##x
407#define RAM_SECTION_NAME(x) .time_critical.##x