zephyr: use SYS_LOG instead of printk
Easier to manage and can be easily disabled via config.
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
index 026fc92..960dcf2 100644
--- a/boot/zephyr/main.c
+++ b/boot/zephyr/main.c
@@ -15,10 +15,13 @@
*/
#include <zephyr.h>
-#include <misc/printk.h>
#include <flash.h>
#include <asm_inline.h>
+#define SYS_LOG_DOMAIN "BOOTLOADER"
+#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
+#include <logging/sys_log.h>
+
#if defined(MCUBOOT_TARGET_CONFIG)
#include MCUBOOT_TARGET_CONFIG
#else
@@ -43,34 +46,39 @@
struct vector_table *vt;
int rc;
+ SYS_LOG_INF("Starting bootloader");
+
os_heap_init();
boot_flash_device = device_get_binding(FLASH_DRIVER_NAME);
if (!boot_flash_device) {
- printk("Flash device not found\n");
+ SYS_LOG_ERR("Flash device not found");
while (1)
;
}
rc = boot_go(&rsp);
if (rc != 0) {
- printk("Unable to find bootable image\n");
+ SYS_LOG_ERR("Unable to find bootable image");
while (1)
;
}
- printk("Bootloader chain: 0x%x\n", rsp.br_image_addr);
+ SYS_LOG_INF("Bootloader chainload address: 0x%x", rsp.br_image_addr);
vt = (struct vector_table *)(rsp.br_image_addr +
rsp.br_hdr->ih_hdr_size);
irq_lock();
_MspSet(vt->msp);
+ SYS_LOG_INF("Setting vector table to %p", vt);
+
/* Not all targets set the VTOR, so just set it. */
_scs_relocate_vector_table((void *) vt);
+ SYS_LOG_INF("Jumping to the first image slot");
((void (*)(void))vt->reset)();
- printk("Never should get here\n");
+ SYS_LOG_ERR("Never should get here");
while (1)
;
}