diff --git a/bootloader_components/my_boot_hooks/CMakeLists.txt b/bootloader_components/my_boot_hooks/CMakeLists.txt new file mode 100644 index 0000000..d10ad49 --- /dev/null +++ b/bootloader_components/my_boot_hooks/CMakeLists.txt @@ -0,0 +1,3 @@ +idf_component_register(SRCS "hooks.c" + INCLUDE_DIRS "include" +) diff --git a/bootloader_components/my_boot_hooks/hooks.c b/bootloader_components/my_boot_hooks/hooks.c new file mode 100644 index 0000000..c824c5d --- /dev/null +++ b/bootloader_components/my_boot_hooks/hooks.c @@ -0,0 +1,25 @@ +#include "hooks.h" + +#include "esp_log.h" + +const static char *TAG = "booloader_hook"; + +/* Function used to tell the linker to include this file + * with all its symbols. + */ +void bootloader_hooks_include(void) +{ +} + +void bootloader_before_init(void) +{ + /* Keep in my mind that a lot of functions cannot be called from here + * as system initialization has not been performed yet, including + * BSS, SPI flash, or memory protection. */ + ESP_LOGI(TAG, "This hook is called BEFORE bootloader initialization"); +} + +void bootloader_after_init(void) +{ + ESP_LOGI(TAG, "This hook is called AFTER bootloader initialization"); +} diff --git a/bootloader_components/my_boot_hooks/include/hooks.h b/bootloader_components/my_boot_hooks/include/hooks.h new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/bootloader_components/my_boot_hooks/include/hooks.h @@ -0,0 +1 @@ +#pragma once