16#ifndef _PICO_PLATFORM_H
17#define _PICO_PLATFORM_H
20#error pico/platform.h should not be included directly; include pico.h instead
23#include "pico/platform/compiler.h"
24#include "pico/platform/sections.h"
25#include "pico/platform/panic.h"
26#include "hardware/regs/addressmap.h"
27#include "hardware/regs/sio.h"
30#ifndef PICO_STACK_SIZE
31#define PICO_STACK_SIZE _u(0x800)
36#define PICO_HEAP_SIZE _u(0x800)
40#ifndef PICO_NO_RAM_VECTOR_TABLE
41#define PICO_NO_RAM_VECTOR_TABLE 0
45#ifndef PICO_RP2040_B0_SUPPORTED
46#define PICO_RP2040_B0_SUPPORTED 1
50#ifndef PICO_FLOAT_SUPPORT_ROM_V1
51#define PICO_FLOAT_SUPPORT_ROM_V1 1
55#ifndef PICO_DOUBLE_SUPPORT_ROM_V1
56#define PICO_DOUBLE_SUPPORT_ROM_V1 1
60#ifndef PICO_RP2040_B1_SUPPORTED
61#define PICO_RP2040_B1_SUPPORTED 1
65#ifndef PICO_RP2040_B2_SUPPORTED
66#define PICO_RP2040_B2_SUPPORTED 1
69#ifndef PICO_RAM_VECTOR_TABLE_SIZE
70#define PICO_RAM_VECTOR_TABLE_SIZE (VTABLE_FIRST_IRQ + NUM_IRQS)
74#ifndef PICO_CLKDIV_ROUND_NEAREST
75#define PICO_CLKDIV_ROUND_NEAREST 1
108 pico_default_asm_volatile(
111 :
"+l" (minimum_cycles) : :
"cc",
"memory"
116#ifndef PICO_NO_FPGA_CHECK
117#define PICO_NO_FPGA_CHECK 1
120#if PICO_NO_FPGA_CHECK
121static inline bool running_on_fpga(
void) {
return false;}
123bool running_on_fpga(
void);
130 pico_default_asm_volatile (
"bkpt #0" : : :
"memory");
139 return (*(uint32_t *) (SIO_BASE + SIO_CPUID_OFFSET));
157 pico_default_asm_volatile (
"mrs %0, ipsr" :
"=l" (exception));
161#define host_safe_hw_ptr(x) ((uintptr_t)(x))
162#define native_safe_hw_ptr(x) host_safe_hw_ptr(x)
175 GCC_Pragma(
"GCC diagnostic push")
176 GCC_Pragma(
"GCC diagnostic ignored \"-Warray-bounds\"")
177 return *(uint8_t*)0x13;
178 GCC_Pragma(
"GCC diagnostic pop")
193__asm (
"mul %0, %0, %1" :
"+l" (a) :
"l" (b) : );
195pico_default_asm (
"muls %0, %1" :
"+l" (a) :
"l" (b) :
"cc");
213#define __fast_mul(a, b) __builtin_choose_expr(__builtin_constant_p(b) && !__builtin_constant_p(a), \
214 (__builtin_popcount(b) >= 2 ? __mul_instruction(a,b) : (a)*(b)), \