ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
pc_platform.h File Reference

The one vendor/die selector for the whole library. More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define PC_VENDOR_HOST   1
 
#define PC_VENDOR_ESP   0
 
#define PC_VENDOR_STM   0
 
#define PC_VENDOR_RP   0
 
#define PC_VENDOR_TI   0
 
#define PC_VENDOR_SILICON   (PC_VENDOR_ESP || PC_VENDOR_STM || PC_VENDOR_RP || PC_VENDOR_TI)
 

Functions

uintptr_t pc_platform_context_id (void)
 

Detailed Description

The one vendor/die selector for the whole library.

Multi-vendor portability rests on a single rule: every silicon-specific layer (board profiles, the crypto accelerator HAL, the physical MAC + PHY) is partitioned into a per-vendor subdir and a common API header pulls in exactly ONE backend per build. This header owns the "which vendor" decision so nothing downstream has to re-test toolchain-specific macros - a backend keys off PC_VENDOR_*, not off CONFIG_IDF_TARGET_* / STM32* / PICO_* scattered across the tree.

Exactly one PC_VENDOR_* is 1; every other is defined 0 (so #if PC_VENDOR_ESP is always valid, never relies on an undefined-macro-is-0 fallback). The vendor is derived from the toolchain's own target macro:

  • PC_VENDOR_ESP - any Espressif target (ESP-IDF ESP_PLATFORM / Arduino-ESP32 ARDUINO_ARCH_ESP32).
  • PC_VENDOR_STM - STM32 (Arduino_Core_STM32 ARDUINO_ARCH_STM32 / STM32Cube USE_HAL_DRIVER).
  • PC_VENDOR_RP - Raspberry Pi silicon (RP2040 / RP2350: ARDUINO_ARCH_RP2040 / PICO_*).
  • PC_VENDOR_TI - Texas Instruments (__TI_COMPILER_VERSION__ or an explicit force).
  • PC_VENDOR_HOST - native / host build (unit tests): no accelerator, portable software everywhere.

ESP is detected first and stays byte-for-byte compatible with the pre-selector behavior: on every ESP build PC_VENDOR_ESP is 1, and on host builds it is 0, exactly matching the old #if defined(CONFIG_IDF_TARGET_*) test in board_profile.h.

Definition in file pc_platform.h.

Macro Definition Documentation

◆ PC_VENDOR_HOST

#define PC_VENDOR_HOST   1

Definition at line 54 of file pc_platform.h.

◆ PC_VENDOR_ESP

#define PC_VENDOR_ESP   0

Definition at line 59 of file pc_platform.h.

◆ PC_VENDOR_STM

#define PC_VENDOR_STM   0

Definition at line 62 of file pc_platform.h.

◆ PC_VENDOR_RP

#define PC_VENDOR_RP   0

Definition at line 65 of file pc_platform.h.

◆ PC_VENDOR_TI

#define PC_VENDOR_TI   0

Definition at line 68 of file pc_platform.h.

◆ PC_VENDOR_SILICON

#define PC_VENDOR_SILICON   (PC_VENDOR_ESP || PC_VENDOR_STM || PC_VENDOR_RP || PC_VENDOR_TI)

Definition at line 128 of file pc_platform.h.

Function Documentation

◆ pc_platform_context_id()

uintptr_t pc_platform_context_id ( void  )

Definition at line 17 of file portable_platform.cpp.