Add PICO_NO_FPGA_CHECK define to remove FPGA check and save some bytes
This commit is contained in:
parent
b9c75803e6
commit
b63e54c14d
@ -63,7 +63,17 @@ void __attribute__((noreturn)) panic_unsupported();
|
|||||||
|
|
||||||
void __attribute__((noreturn)) panic(const char *fmt, ...);
|
void __attribute__((noreturn)) panic(const char *fmt, ...);
|
||||||
|
|
||||||
|
// PICO_CONFIG: PICO_NO_FPGA_CHECK, Remove the FPGA platform check for small code size reduction, type=bool, default=0, advanced=true, group=pico_runtime
|
||||||
|
#ifndef PICO_NO_FPGA_CHECK
|
||||||
|
#define PICO_NO_FPGA_CHECK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PICO_NO_FPGA_CHECK
|
||||||
|
static inline bool running_on_fpga() {return false;}
|
||||||
|
#else
|
||||||
bool running_on_fpga();
|
bool running_on_fpga();
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t rp2040_chip_version();
|
uint8_t rp2040_chip_version();
|
||||||
|
|
||||||
static inline uint8_t rp2040_rom_version() {
|
static inline uint8_t rp2040_rom_version() {
|
||||||
|
@ -9,9 +9,19 @@
|
|||||||
#include "hardware/regs/tbman.h"
|
#include "hardware/regs/tbman.h"
|
||||||
#include "hardware/regs/sysinfo.h"
|
#include "hardware/regs/sysinfo.h"
|
||||||
|
|
||||||
|
// Note we leave the FPGA check in by default so that we can run bug repro
|
||||||
|
// binaries coming in from the wild on the FPGA platform. It takes up around
|
||||||
|
// 48 bytes if you include all the calls, so you can pass PICO_NO_FPGA_CHECK=1
|
||||||
|
// to remove it. The FPGA check is used to skip initialisation of hardware
|
||||||
|
// (mainly clock generators and oscillators) that aren't present on FPGA.
|
||||||
|
|
||||||
|
#if !PICO_NO_FPGA_CHECK
|
||||||
|
// Inline stub provided in header if this code is unused (so folding can be
|
||||||
|
// done in each TU instead of relying on LTO)
|
||||||
bool running_on_fpga() {
|
bool running_on_fpga() {
|
||||||
return !!((*(io_ro_32 *)TBMAN_BASE) & TBMAN_PLATFORM_FPGA_BITS);
|
return !!((*(io_ro_32 *)TBMAN_BASE) & TBMAN_PLATFORM_FPGA_BITS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MANUFACTURER_RPI 0x927
|
#define MANUFACTURER_RPI 0x927
|
||||||
#define PART_RP2 0x2
|
#define PART_RP2 0x2
|
||||||
|
Loading…
Reference in New Issue
Block a user