Skip to content

Commit 52a1c29

Browse files
committed
[assert] Remove dependency on Register implementation
This caused issues with circular imports and it is not necessary to have.
1 parent 584f5e3 commit 52a1c29

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

src/modm/architecture/interface/assert.hpp.in

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#pragma once
1313

1414
#include "assert.h"
15-
#include <modm/architecture/interface/register.hpp>
1615
%% if core.startswith("avr")
1716
#include <modm/architecture/interface/accessor_flash.hpp>
1817
%% endif
@@ -27,13 +26,13 @@ namespace modm
2726
enum class
2827
Abandonment : uint8_t
2928
{
30-
DontCare = Bit0, ///< Do not care about failure.
31-
Ignore = Bit1, ///< Ignore this failure.
32-
Fail = Bit2, ///< This failure is reason for abandonment.
33-
Debug = Bit7 ///< Only set for a debug-only failure.
29+
DontCare = 0b001, ///< Do not care about failure.
30+
Ignore = 0b010, ///< Ignore this failure.
31+
Fail = 0b100, ///< This failure is reason for abandonment.
32+
Debug = 0x80, ///< Only set for a debug-only failure.
3433
};
35-
using AbandonmentBehavior = Flags8<Abandonment>;
36-
MODM_TYPE_FLAGS(AbandonmentBehavior);
34+
/// Contains the superset of Abandonment behavior
35+
using AbandonmentBehavior = Abandonment;
3736

3837
/// Contains information about the failed assertion.
3938
struct modm_packed

src/modm/architecture/module.lb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class Assert(Module):
5353
default="release" if platform == "hosted" else "debug",
5454
enumeration=["off", "debug", "release"]))
5555

56-
module.depends(":architecture:register")
5756
if platform == "avr":
5857
module.depends(":architecture:accessor")
5958
return True

src/modm/platform/core/cortex/assert.cpp.in

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ void
5757
modm_assert_report(_modm_assertion_info *cinfo)
5858
{
5959
auto info = reinterpret_cast<modm::AssertionInfo *>(cinfo);
60-
AbandonmentBehavior behavior(info->behavior);
60+
uint8_t behavior(uint8_t(info->behavior));
6161

6262
for (const AssertionHandler *handler = &__assertion_table_start;
6363
handler < &__assertion_table_end; handler++)
6464
{
6565
%% if core.startswith("avr")
66-
behavior |= ((AssertionHandler)pgm_read_ptr(handler))(*info);
66+
behavior |= (uint8_t)((AssertionHandler)pgm_read_ptr(handler))(*info);
6767
%% else
68-
behavior |= (*handler)(*info);
68+
behavior |= (uint8_t)(*handler)(*info);
6969
%% endif
7070
}
7171

72-
info->behavior = behavior;
73-
behavior.reset(Abandonment::Debug);
74-
if ((behavior == Abandonment::DontCare) or
75-
(behavior & Abandonment::Fail))
72+
info->behavior = AbandonmentBehavior(behavior);
73+
behavior &= ~uint8_t(Abandonment::Debug);
74+
if ((behavior == uint8_t(Abandonment::DontCare)) or
75+
(behavior & uint8_t(Abandonment::Fail)))
7676
{
7777
modm_abandon(*info);
7878
%% if core.startswith("cortex-m")

0 commit comments

Comments
 (0)