Commit 41c568ab authored by Artur Tynecki's avatar Artur Tynecki Committed by David Brown
Browse files

mbed: Add enable MCUboot logging parameter and fix logging configuration



This commit add option for a user to enable MCUboot logging from project
configuration level.
Now, logging from MCUboot's sources will be printed in the same way as
mbed-os logs.
Co-created by @AGlass0fMilk - George Beckstein

Signed-off-by: default avatarArtur Tynecki <artur.tynecki@mobica.com>
Signed-off-by: default avatarGeorge Beckstein <george.beckstein@gmail.com>
parent a9101667
...@@ -36,13 +36,6 @@ ...@@ -36,13 +36,6 @@
#define MCUBOOT_LOG_LEVEL MCUBOOT_LOG_LEVEL_OFF #define MCUBOOT_LOG_LEVEL MCUBOOT_LOG_LEVEL_OFF
#endif #endif
#if MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_OFF
#define MBED_CONF_MBED_TRACE_ENABLE 0
#else
#define MBED_CONF_MBED_TRACE_ENABLE 1
#define MCUBOOT_HAVE_LOGGING
#endif
#if MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_ERROR #if MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_ERROR
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_ERROR #define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_ERROR
#elif MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_WARNING #elif MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_WARNING
......
...@@ -64,6 +64,12 @@ ...@@ -64,6 +64,12 @@
"accepted_values": [true, null], "accepted_values": [true, null],
"value": null "value": null
}, },
"log-enable": {
"help": "Enable MCUboot logging. Must also enable mbed-trace",
"macro_name": "MCUBOOT_HAVE_LOGGING",
"accepted_values": [true, null],
"value": null
},
"log-level": { "log-level": {
"help": "Verbosity of MCUboot logging.", "help": "Verbosity of MCUboot logging.",
"macro_name": "MCUBOOT_LOG_LEVEL", "macro_name": "MCUBOOT_LOG_LEVEL",
......
...@@ -50,10 +50,12 @@ int main() ...@@ -50,10 +50,12 @@ int main()
{ {
int rc; int rc;
#ifdef MCUBOOT_HAVE_LOGGING
mbed_trace_init(); mbed_trace_init();
#if MCUBOOT_LOG_BOOTLOADER_ONLY #if MCUBOOT_LOG_BOOTLOADER_ONLY
mbed_trace_include_filters_set("MCUb,BL"); mbed_trace_include_filters_set("MCUb,BL");
#endif #endif //MCUBOOT_LOG_BOOTLOADER_ONLY
#endif //MCUBOOT_HAVE_LOGGING
tr_info("Starting MCUboot"); tr_info("Starting MCUboot");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment