Manipulating GPIO inside Bootloader Hooks
Posted: Wed Feb 02, 2022 1:19 pm
Hi,
I am trying to use the Bootloader_Hooks to set a specific critical pin to output and specific level, earlier than app_main().
(Great feature BTW)
I tried to extent the example project, but I am not sure how to set this up - which Cmake changes to I need? Which functions do I use to manipulate GPIO while hooking to the bootloader? Which include files?
See below example to get an idea of what it is I am trying to achieve
(ESP IDF version ESP-IDF v5.0-dev-1426-ge899edd793 with Eclipse)
/////////////
hooks.c
/////////////
#include "esp_log.h"
????
#include "hal/gpio_hal.h"
????
.....
void bootloader_after_init(void) {
ESP_LOGI("HOOK", "This hook is called AFTER bootloader initialization");
gpio_ll_output_enable (&GPIO, GPIO_NUM_33);
gpio_ll_set_level (&GPIO, GPIO_NUM_33, 1);
}
I am trying to use the Bootloader_Hooks to set a specific critical pin to output and specific level, earlier than app_main().
(Great feature BTW)
I tried to extent the example project, but I am not sure how to set this up - which Cmake changes to I need? Which functions do I use to manipulate GPIO while hooking to the bootloader? Which include files?
See below example to get an idea of what it is I am trying to achieve
(ESP IDF version ESP-IDF v5.0-dev-1426-ge899edd793 with Eclipse)
/////////////
hooks.c
/////////////
#include "esp_log.h"
????
#include "hal/gpio_hal.h"
????
.....
void bootloader_after_init(void) {
ESP_LOGI("HOOK", "This hook is called AFTER bootloader initialization");
gpio_ll_output_enable (&GPIO, GPIO_NUM_33);
gpio_ll_set_level (&GPIO, GPIO_NUM_33, 1);
}