Skip to content

Commit 12bf7e0

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 12bf7e0

File tree

14 files changed

+23
-16
lines changed

14 files changed

+23
-16
lines changed

ext/gcc/assert.cpp.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include <cstdint>
1313
#include <bits/functexcept.h>
14-
#include <modm/math/utils/bit_constants.hpp>
1514

1615
%% if options["assert_on_exception"]
1716
#include <modm/architecture/interface/assert.hpp>

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/driver/color/tcs3472.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include <stdint.h>
1919
#include <modm/architecture/interface/i2c_device.hpp>
20+
#include <modm/architecture/interface/register.hpp>
2021
#include <modm/math/utils.hpp>
2122
#include <modm/ui/color.hpp>
2223

src/modm/driver/color/tcs3472.lb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def init(module):
1919
def prepare(module, options):
2020
module.depends(
2121
":architecture:i2c.device",
22+
":architecture:register",
2223
":ui:color",
2324
":math:utils")
2425
return True

src/modm/driver/display/st7586s.lb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def init(module):
1818
def prepare(module, options):
1919
module.depends(
2020
":architecture:fiber",
21+
":architecture:register",
2122
":ui:display")
2223
return True
2324

src/modm/driver/display/st7586s_protocol.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#pragma once
1313

14+
#include <modm/architecture/interface/register.hpp>
1415
#include <modm/math/utils/endianness.hpp>
1516

1617
/// @cond

src/modm/platform/adc/at90_tiny_mega/module.lb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def prepare(module, options):
2727

2828
module.depends(
2929
":architecture:adc",
30+
":architecture:register",
3031
":architecture:interrupt",
3132
":platform:gpio",
3233
":math:algorithm")

src/modm/platform/can/common/fdcan/module.lb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def prepare(module, options):
2121

2222
module.depends(
2323
":architecture:assert",
24+
":architecture:register",
2425
":architecture:can",
2526
":architecture:clock")
2627
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)