Commit a4b4b0f0 authored by Carlos Falgueras García's avatar Carlos Falgueras García Committed by Andrzej Puzdrowski
Browse files

bootutil: Refactor MCUBOOT_LOG_MODULE_(DECLARE|REGISTER) macros



The "MCUBOOT_LOG_MODULE_(DECLARE|REGISTER)" macros should have a name
coherent with the rest of the logs macors, ie "BOOT_LOG_*". Also,
"bootutil_log.h" should define them as empty when the logs are disabled and
as "MCUBOOT_LOG_MODULE_*" when they are not.

With this change, the mcuboot user doesn't have to define
MCUBOOT_LOG_MODULE_* macros if the logs don't going to be used.

Signed-off-by: default avatarCarlos Falgueras García <carlos.falgueras@wslw.es>
parent 2ae1f165
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@

#include "serial_recovery_cbor.h"

MCUBOOT_LOG_MODULE_DECLARE(mcuboot);
BOOT_LOG_MODULE_DECLARE(mcuboot);

#define BOOT_SERIAL_INPUT_MAX   512
#define BOOT_SERIAL_OUT_MAX     128
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ extern "C" {
#define BOOT_LOG_DBG(...) MCUBOOT_LOG_DBG(__VA_ARGS__)
#define BOOT_LOG_SIM(...) MCUBOOT_LOG_SIM(__VA_ARGS__)

#define BOOT_LOG_MODULE_DECLARE(module)  MCUBOOT_LOG_MODULE_DECLARE(module)
#define BOOT_LOG_MODULE_REGISTER(module) MCUBOOT_LOG_MODULE_REGISTER(module)

#else

#define BOOT_LOG_ERR(...) IGNORE(__VA_ARGS__)
@@ -44,6 +47,9 @@ extern "C" {
#define BOOT_LOG_DBG(...) IGNORE(__VA_ARGS__)
#define BOOT_LOG_SIM(...) IGNORE(__VA_ARGS__)

#define BOOT_LOG_MODULE_DECLARE(module)
#define BOOT_LOG_MODULE_REGISTER(module)

#endif /* MCUBOOT_HAVE_LOGGING */

#ifdef __cplusplus
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
#include "bootutil/enc_key.h"
#endif

MCUBOOT_LOG_MODULE_DECLARE(mcuboot);
BOOT_LOG_MODULE_DECLARE(mcuboot);

/* Currently only used by imgmgr */
int boot_current_slot;
+2 −2
Original line number Diff line number Diff line
@@ -51,9 +51,9 @@
#endif

#ifdef CONFIG_MCUBOOT
MCUBOOT_LOG_MODULE_DECLARE(mcuboot);
BOOT_LOG_MODULE_DECLARE(mcuboot);
#else
MCUBOOT_LOG_MODULE_REGISTER(mcuboot_util);
BOOT_LOG_MODULE_REGISTER(mcuboot_util);
#endif

const uint32_t boot_img_magic[] = {
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@

#include "mcuboot_config/mcuboot_config.h"

MCUBOOT_LOG_MODULE_DECLARE(mcuboot);
BOOT_LOG_MODULE_DECLARE(mcuboot);

static struct boot_loader_state boot_data;

Loading