Skip to content

Commit

Permalink
[board] Implement modm_abandon for AVR boards
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Nov 9, 2024
1 parent d6a9872 commit b5341a8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 50 deletions.
8 changes: 7 additions & 1 deletion src/modm/board/arduino_nano/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ def prepare(module, options):
return True

def build(env):
env.outbasepath = "modm/src/modm/"
env.outbasepath = "modm/src/modm/board"
env.substitutions = {
"with_logger": True,
"with_assert": env.has_module(":architecture:assert")
}
env.template("../board.cpp.in", "board.cpp")
env.outbasepath = "modm/src/modm"
env.copy(localpath("../arduino_uno"), "board")
env.collect(":build:default.avrdude.programmer", "arduino");
env.collect(":build:default.avrdude.baudrate", "115200");
22 changes: 0 additions & 22 deletions src/modm/board/arduino_uno/board_serial.cpp

This file was deleted.

5 changes: 5 additions & 0 deletions src/modm/board/arduino_uno/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def prepare(module, options):

def build(env):
env.outbasepath = "modm/src/modm/board"
env.substitutions = {
"with_logger": True,
"with_assert": env.has_module(":architecture:assert")
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
env.collect(":build:default.avrdude.programmer", "arduino");
env.collect(":build:default.avrdude.baudrate", "115200");
11 changes: 6 additions & 5 deletions src/modm/board/board.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "board.hpp"
#include <modm/architecture/interface/delay.hpp>
#include <modm/architecture/interface/accessor.hpp>
%% if with_assert
#include <modm/architecture/interface/assert.hpp>
%% endif
Expand All @@ -37,15 +38,15 @@ modm_extern_c void
modm_abandon(const modm::AssertionInfo &info)
{
%% if with_logger
MODM_LOG_ERROR << "Assertion '" << info.name << "'";
MODM_LOG_ERROR << IFSS("Assertion '") << modm::accessor::asFlash(info.name) << IFSS("'");
if (info.context != uintptr_t(-1)) {
MODM_LOG_ERROR << " @ " << (void *) info.context <<
" (" << (uint32_t) info.context << ")";
MODM_LOG_ERROR << IFSS(" @ ") << (void *) info.context <<
IFSS(" (") << (uint32_t) info.context << IFSS(")");
}
#if MODM_ASSERTION_INFO_HAS_DESCRIPTION
MODM_LOG_ERROR << " failed!\n " << info.description << "\nAbandoning...\n";
MODM_LOG_ERROR << IFSS(" failed!\n ") << modm::accessor::asFlash(info.description) << IFSS("\nAbandoning...\n");
#else
MODM_LOG_ERROR << " failed!\nAbandoning...\n";
MODM_LOG_ERROR << IFSS(" failed!\nAbandoning...\n");
#endif
%% else
(void)info;
Expand Down
22 changes: 0 additions & 22 deletions src/modm/board/mega_2560_pro/board_serial.cpp

This file was deleted.

5 changes: 5 additions & 0 deletions src/modm/board/mega_2560_pro/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def prepare(module, options):

def build(env):
env.outbasepath = "modm/src/modm/board"
env.substitutions = {
"with_logger": True,
"with_assert": env.has_module(":architecture:assert")
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
env.collect(":build:default.avrdude.programmer", "stk500v2");
env.collect(":build:default.avrdude.baudrate", "115200");
Expand Down

0 comments on commit b5341a8

Please sign in to comment.