Commit 248da088 authored by Marti Bolivar's avatar Marti Bolivar Committed by Fabio Utzig
Browse files

Move bootsim-specific assert behavior behind mcuboot_config.h

Continue removing platform-specific conditional compilation from
bootutil by adding a new MCUBOOT_HAVE_ASSERT_H configuration option
and associated header file. Right now, that's only used by the
simulator.

That leaves just bootutil_log.h with platform-specific contents, but
since it's meant to be an abstraction layer for logging, we'll let it
stand for now.

Signed-off-by: default avatarMarti Bolivar <marti@opensourcefoundries.com>
parent f9bfddd6
Loading
Loading
Loading
Loading
+2 −2
Changes for boot/bootutil/src/bootutil_priv.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@
extern "C" {
#endif

#ifdef __BOOTSIM__
#include "bootsim.h"
#ifdef MCUBOOT_HAVE_ASSERT_H
#include "mcuboot_config/mcuboot_assert.h"
#else
#define ASSERT assert
#endif
+9
Changes for samples/mcuboot_config/mcuboot_config.template.h: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -82,4 +82,13 @@
 * as desirable. */
#define MCUBOOT_MAX_IMG_SECTORS 128

/*
 * Assertions
 */

/* Uncomment if your platform has its own mcuboot_config/mcuboot_assert.h.
 * If so, it must provide an ASSERT macro for use by bootutil. Otherwise,
 * "assert" is used. */
/* #define MCUBOOT_HAVE_ASSERT_H */

#endif /* __MCUBOOT_CONFIG_H__ */
+1
Changes for sim/mcuboot-sys/build.rs: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ fn main() {
    let mut conf = gcc::Build::new();
    conf.define("__BOOTSIM__", None);
    conf.define("MCUBOOT_USE_FLASH_AREA_GET_SECTORS", None);
    conf.define("MCUBOOT_HAVE_ASSERT_H", None);
    conf.define("MCUBOOT_MAX_IMG_SECTORS", Some("128"));

    if validate_slot0 {
+1 −2
Changes for sim/mcuboot-sys/csupport/bootsim.h: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
#ifndef H_BOOTSIM_
#define H_BOOTSIM_

void sim_assert(int, const char *test, const char *, unsigned int, const char *);
#define ASSERT(x) sim_assert((x), #x, __FILE__, __LINE__, __func__)
#include "mcuboot_config/mcuboot_assert.h"

#endif
+7
Changes for sim/mcuboot-sys/csupport/mcuboot_config/mcuboot_assert.h: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
#ifndef __MCUBOOT_ASSERT_H__
#define __MCUBOOT_ASSERT_H__

void sim_assert(int, const char *test, const char *, unsigned int, const char *);
#define ASSERT(x) sim_assert((x), #x, __FILE__, __LINE__, __func__)

#endif  /* __MCUBOOT_ASSERT_H__ */