Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1/*
2* Copyright (c) 2025 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _PICO_PLATFORM_COMMON_H
8#define _PICO_PLATFORM_COMMON_H
9
20
21// PICO_CONFIG: PICO_PLATFORM_TEST_HEADER, Unquoted path to a header to include here so a test can inject code/defines into every translation unit, group=pico_platform
22#ifdef PICO_PLATFORM_TEST_HEADER
23#include __PICO_XSTRING(PICO_PLATFORM_TEST_HEADER)
24#endif
25
26// PICO_CONFIG: PICO_MINIMAL_STORED_VECTOR_TABLE, Only store a very minimal vector table in the binary on Arm, type=bool, default=0, advanced=true, group=pico_crt0
27#ifndef PICO_MINIMAL_STORED_VECTOR_TABLE
28#define PICO_MINIMAL_STORED_VECTOR_TABLE 0
29#endif
30
31#if PICO_MINIMAL_STORED_VECTOR_TABLE && (PICO_NO_FLASH && !defined(__riscv))
32#if PICO_NUM_VTABLE_IRQS
33#warning PICO_NUM_VTABLE_IRQS is specied with PICO_MINIMAL_STORED_VECTOR_TABLE for NO_FLASH Arm binary; ignored
34#undef PICO_NUM_VTABLE_IRQS
35#endif
36#define PICO_NUM_VTABLE_IRQS 0
37#else
38// PICO_CONFIG: PICO_NUM_VTABLE_IRQS, Number of IRQ handlers in the vector table - can be lowered to save space if you aren't using some higher IRQs, type=int, default=NUM_IRQS, group=hardware_irq
39#ifndef PICO_NUM_VTABLE_IRQS
40#define PICO_NUM_VTABLE_IRQS NUM_IRQS
41#endif
42#endif
43
44#ifndef __ASSEMBLER__
45
46// PICO_CONFIG: PICO_NO_FPGA_CHECK, Remove the FPGA platform check for small code size reduction, type=bool, default=1, advanced=true, group=pico_runtime
47#ifndef PICO_NO_FPGA_CHECK
48#define PICO_NO_FPGA_CHECK 1
49#endif
50
51// PICO_CONFIG: PICO_NO_SIM_CHECK, Remove the SIM platform check for small code size reduction, type=bool, default=1, advanced=true, group=pico_runtime
52#ifndef PICO_NO_SIM_CHECK
53#define PICO_NO_SIM_CHECK 1
54#endif
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60#if PICO_NO_FPGA_CHECK
61static inline bool running_on_fpga(void) {return false;}
62#else
63bool running_on_fpga(void);
64#endif
65
66#if PICO_NO_SIM_CHECK
67static inline bool running_in_sim(void) {return false;}
68#else
69bool running_in_sim(void);
70#endif
71
78#ifndef tight_loop_contents
80#endif
81
90#ifndef blocked_waiter_wakeup
91static __force_inline void blocked_waiter_wakeup(__unused bool timed_out) {}
92#endif
93
94#define host_safe_hw_ptr(x) ((uintptr_t)(x))
95#define native_safe_hw_ptr(x) host_safe_hw_ptr(x)
96
97#ifdef __cplusplus
98}
99#endif
100#endif // __ASSEMBLER__
101
102
103#endif
#define __force_inline
Attribute to force inlining of a function regardless of optimization level.
Definition compiler.h:128
static __force_inline void tight_loop_contents(void)
No-op function for the body of tight loops.
Definition common.h:79
static __force_inline void blocked_waiter_wakeup(__unused bool timed_out)
No-op function to record that a blocked waiter has woken up.
Definition common.h:91