tin  1.5.9
profile.h
Go to the documentation of this file.
1 // Copyright (c) 2026 Tinverse LLC. All rights reserved.
2 // SPDX-License-Identifier: LicenseRef-Tinverse-Commercial
3 
13 
14 #pragma once
15 
16 namespace tsm::platform {
17 
18 namespace detail {
19 
20 #if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
21 inline constexpr bool compiler_exceptions_enabled = true;
22 #else
23 inline constexpr bool compiler_exceptions_enabled = false;
24 #endif
25 
26 #if defined(__GXX_RTTI) || defined(_CPPRTTI)
27 inline constexpr bool compiler_rtti_enabled = true;
28 #else
29 inline constexpr bool compiler_rtti_enabled = false;
30 #endif
31 
32 } // namespace detail
33 
40 {
41  static constexpr bool heap_allowed = true;
42  static constexpr bool exceptions_allowed = true;
43  static constexpr bool rtti_allowed = true;
44  static constexpr bool host_threads_available = true;
45  static constexpr bool wall_clock_available = true;
46  static constexpr bool tick_driven_time = true;
47 };
48 
51 {
52  static constexpr bool heap_allowed = false;
53  static constexpr bool exceptions_allowed = false;
54  static constexpr bool rtti_allowed = false;
55  static constexpr bool host_threads_available = false;
56  static constexpr bool wall_clock_available = false;
57  static constexpr bool tick_driven_time = true;
58 };
59 
62 {
63  static constexpr bool heap_allowed = false;
64  static constexpr bool exceptions_allowed = false;
65  static constexpr bool rtti_allowed = false;
66  static constexpr bool host_threads_available = false;
67  static constexpr bool wall_clock_available = false;
68  static constexpr bool tick_driven_time = true;
69 };
70 
73 {
74  static constexpr bool heap_allowed = false;
75  static constexpr bool exceptions_allowed = false;
76  static constexpr bool rtti_allowed = false;
77  static constexpr bool host_threads_available = false;
78  static constexpr bool wall_clock_available = false;
79  static constexpr bool tick_driven_time = true;
80 };
81 
84 {
85  static constexpr bool heap_allowed = false;
86  static constexpr bool exceptions_allowed = false;
87  static constexpr bool rtti_allowed = false;
88  static constexpr bool host_threads_available = true;
89  static constexpr bool wall_clock_available = true;
90  static constexpr bool tick_driven_time = true;
91 };
92 
95 {
96  static constexpr bool heap_allowed = false;
97  static constexpr bool exceptions_allowed = false;
98  static constexpr bool rtti_allowed = false;
99  static constexpr bool host_threads_available = false;
100  static constexpr bool wall_clock_available = false;
101  static constexpr bool tick_driven_time = true;
102 };
103 
108 template<typename Profile>
109 consteval bool
111 {
112  return (Profile::exceptions_allowed ||
114  (Profile::rtti_allowed || !detail::compiler_rtti_enabled);
115 }
116 
118 template<typename Profile>
119 consteval void
121 {
122  static_assert(Profile::exceptions_allowed ||
124  "tsm: target profile requires exceptions to be disabled");
125  static_assert(Profile::rtti_allowed || !detail::compiler_rtti_enabled,
126  "tsm: target profile requires RTTI to be disabled");
127 }
128 
129 } // namespace tsm::platform
constexpr bool compiler_rtti_enabled
Definition: profile.h:29
constexpr bool compiler_exceptions_enabled
Definition: profile.h:23
Definition: profile.h:16
consteval void enforce_compiler_profile()
Require the active compiler configuration to match Profile.
Definition: profile.h:120
consteval bool compiler_satisfies_profile()
Definition: profile.h:110
Bare-metal ARM profile for superloop or interrupt-woken deployments.
Definition: profile.h:51
static constexpr bool host_threads_available
Definition: profile.h:55
static constexpr bool tick_driven_time
Definition: profile.h:57
static constexpr bool heap_allowed
Definition: profile.h:52
static constexpr bool rtti_allowed
Definition: profile.h:54
static constexpr bool exceptions_allowed
Definition: profile.h:53
static constexpr bool wall_clock_available
Definition: profile.h:56
FreeRTOS profile for task-notification and queue-backed deployments.
Definition: profile.h:62
static constexpr bool heap_allowed
Definition: profile.h:63
static constexpr bool host_threads_available
Definition: profile.h:66
static constexpr bool tick_driven_time
Definition: profile.h:68
static constexpr bool rtti_allowed
Definition: profile.h:65
static constexpr bool exceptions_allowed
Definition: profile.h:64
static constexpr bool wall_clock_available
Definition: profile.h:67
Definition: profile.h:40
static constexpr bool heap_allowed
Definition: profile.h:41
static constexpr bool tick_driven_time
Definition: profile.h:46
static constexpr bool host_threads_available
Definition: profile.h:44
static constexpr bool wall_clock_available
Definition: profile.h:45
static constexpr bool exceptions_allowed
Definition: profile.h:42
static constexpr bool rtti_allowed
Definition: profile.h:43
QNX Neutrino 7.x profile for pulse-woken realtime process deployments.
Definition: profile.h:84
static constexpr bool exceptions_allowed
Definition: profile.h:86
static constexpr bool heap_allowed
Definition: profile.h:85
static constexpr bool tick_driven_time
Definition: profile.h:90
static constexpr bool wall_clock_available
Definition: profile.h:89
static constexpr bool host_threads_available
Definition: profile.h:88
static constexpr bool rtti_allowed
Definition: profile.h:87
Conservative production profile for safety-oriented embedded builds.
Definition: profile.h:95
static constexpr bool heap_allowed
Definition: profile.h:96
static constexpr bool wall_clock_available
Definition: profile.h:100
static constexpr bool exceptions_allowed
Definition: profile.h:97
static constexpr bool rtti_allowed
Definition: profile.h:98
static constexpr bool host_threads_available
Definition: profile.h:99
static constexpr bool tick_driven_time
Definition: profile.h:101
Zephyr profile for k_poll, semaphore, and tick-backed deployments.
Definition: profile.h:73
static constexpr bool exceptions_allowed
Definition: profile.h:75
static constexpr bool rtti_allowed
Definition: profile.h:76
static constexpr bool tick_driven_time
Definition: profile.h:79
static constexpr bool heap_allowed
Definition: profile.h:74
static constexpr bool host_threads_available
Definition: profile.h:77
static constexpr bool wall_clock_available
Definition: profile.h:78