28#ifndef MMGR_PRAET_PLATFORM_DETECTION_H
29#define MMGR_PRAET_PLATFORM_DETECTION_H
39#if defined(__arm__) || defined(__aarch64__) || defined(__thumb__)
40#define PRAET_PLATFORM_ARM 1
42#define PRAET_PLATFORM_ARM 0
52#define PRAET_PLATFORM_RISCV 1
54#define PRAET_PLATFORM_RISCV 0
64#if defined(__XTENSA__) || defined(__xtensa__)
65#define PRAET_PLATFORM_XTENSA 1
67#define PRAET_PLATFORM_XTENSA 0
73#if !PRAET_PLATFORM_ARM && !PRAET_PLATFORM_RISCV && !PRAET_PLATFORM_XTENSA
74#define PRAET_PLATFORM_HOST 1
76#define PRAET_PLATFORM_HOST 0
80 "the platform detection selected more than one architecture family, or none");
93#if defined(__ARM_ARCH_PROFILE) && (__ARM_ARCH_PROFILE == 'M')
102#define PRAET_PLATFORM_NAME "ARMv8-M"
104#define PRAET_PLATFORM_NAME "ARMv7-M"
106#define PRAET_PLATFORM_NAME "ARMv6-M"
108#elif defined(__ARM_ARCH_PROFILE) && (__ARM_ARCH_PROFILE == 'R')
109#define PRAET_PLATFORM_NAME "ARM real-time profile"
110#elif defined(__ARM_ARCH_PROFILE) && (__ARM_ARCH_PROFILE == 'A')
111#if defined(__ARM_64BIT_STATE)
112#define PRAET_PLATFORM_NAME "ARM application profile, 64 bit"
114#define PRAET_PLATFORM_NAME "ARM application profile, 32 bit"
117#define PRAET_PLATFORM_NAME "ARM, pre-Cortex"
132#if defined(__ARM_ARCH_PROFILE) && (__ARM_ARCH_PROFILE == 'M')
134#define PRAET_PLATFORM_HAS_CYCLE_COUNTER 1
136#define PRAET_PLATFORM_HAS_CYCLE_COUNTER 0
139#define PRAET_PLATFORM_HAS_CYCLE_COUNTER 1
148#if defined(__ARM_64BIT_STATE)
149#define PRAET_PLATFORM_XLEN 64u
151#define PRAET_PLATFORM_XLEN 32u
162#if defined(__ARM_FEATURE_UNALIGNED)
163#define PRAET_PLATFORM_UNALIGNED_LOADS 1
165#define PRAET_PLATFORM_UNALIGNED_LOADS 0
168#elif PRAET_PLATFORM_RISCV
176#if defined(__riscv_32e) || defined(__riscv_64e) || defined(__riscv_abi_rve)
181#if __riscv_xlen == 32
182#define PRAET_PLATFORM_NAME "RV32E"
184#define PRAET_PLATFORM_NAME "RV64E"
186#elif __riscv_xlen == 32
187#define PRAET_PLATFORM_NAME "RV32"
188#elif __riscv_xlen == 64
189#define PRAET_PLATFORM_NAME "RV64"
191#define PRAET_PLATFORM_NAME "RV128"
203#define PRAET_PLATFORM_HAS_CYCLE_COUNTER 1
210#define PRAET_PLATFORM_XLEN __riscv_xlen
219#if defined(__riscv_misaligned_fast)
220#define PRAET_PLATFORM_UNALIGNED_LOADS 1
222#define PRAET_PLATFORM_UNALIGNED_LOADS 0
225#elif PRAET_PLATFORM_XTENSA
234#if defined(__XTENSA_WINDOWED_ABI__)
239#define PRAET_PLATFORM_NAME "Xtensa, windowed ABI"
240#elif defined(__XTENSA_CALL0_ABI__)
241#define PRAET_PLATFORM_NAME "Xtensa, call0 ABI"
243#define PRAET_PLATFORM_NAME "Xtensa"
255#define PRAET_PLATFORM_HAS_CYCLE_COUNTER 1
263#define PRAET_PLATFORM_XLEN 32u
273#define PRAET_PLATFORM_UNALIGNED_LOADS 0
283#define PRAET_PLATFORM_NAME "this host"
293#define PRAET_PLATFORM_HAS_CYCLE_COUNTER 0
302#if UINTPTR_MAX > 0xFFFFFFFFu
303#define PRAET_PLATFORM_XLEN 64u
304#elif UINTPTR_MAX > 0xFFFFu
305#define PRAET_PLATFORM_XLEN 32u
307#define PRAET_PLATFORM_XLEN 16u
313#define PRAET_PLATFORM_UNALIGNED_LOADS 1
320 "EMBED_WORD_BITS is wider than this architecture's register");
330#define PRAET_PLATFORM_CLOCK_CORE 0u
The embedded_types headers every module builds on.