app_wrapper.c 745 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: CC0-1.0
  5. */
  6. #include <stdio.h>
  7. #include "sdkconfig.h"
  8. #include "freertos/FreeRTOS.h"
  9. #include "freertos/task.h"
  10. /**
  11. * Declare the symbol pointing to the former implementation of esp_restart function
  12. */
  13. extern void __real_esp_restart(void);
  14. /**
  15. * Redefine esp_restart function to print a message before actually restarting
  16. */
  17. void __wrap_esp_restart(void)
  18. {
  19. printf("Restarting in progress...\n");
  20. /* Call the former implementation to actually restart the board */
  21. __real_esp_restart();
  22. }
  23. void app_main(void)
  24. {
  25. printf("Restarting in 5 seconds...\n");
  26. vTaskDelay(5000 / portTICK_PERIOD_MS);
  27. esp_restart();
  28. }