hello_world_main.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* Hello World Example
  2. This example code is in the Public Domain (or CC0 licensed, at your option.)
  3. Unless required by applicable law or agreed to in writing, this
  4. software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied.
  6. */
  7. #include <stdio.h>
  8. #include "freertos/FreeRTOS.h"
  9. #include "freertos/task.h"
  10. #include "esp_system.h"
  11. #include "esp_spi_flash.h"
  12. void app_main()
  13. {
  14. printf("Hello world!\n");
  15. /* Print chip information */
  16. esp_chip_info_t chip_info;
  17. esp_chip_info(&chip_info);
  18. printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ",
  19. chip_info.cores,
  20. (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
  21. (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
  22. printf("silicon revision %d, ", chip_info.revision);
  23. printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
  24. (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
  25. for (int i = 10; i >= 0; i--) {
  26. printf("Restarting in %d seconds...\n", i);
  27. vTaskDelay(1000 / portTICK_PERIOD_MS);
  28. }
  29. printf("Restarting now.\n");
  30. fflush(stdout);
  31. esp_restart();
  32. }