Просмотр исходного кода

system: Log a warning when booting bootloader or app configured for FPGA use

Such a firmware may appear to work on normal chip, but not everything will function as expected.
Angus Gratton 5 лет назад
Родитель
Сommit
8dbb14b469
2 измененных файлов с 11 добавлено и 3 удалено
  1. 10 2
      components/esp_common/src/fpga_overrides.c
  2. 1 1
      tools/cmake/targets.cmake

+ 10 - 2
components/esp_common/src/fpga_overrides.c

@@ -13,17 +13,25 @@
 // limitations under the License.
 #include "sdkconfig.h"
 #include "soc/soc.h"
-#include "soc/system_reg.h"
 #include "soc/rtc.h"
 #include "soc/rtc_cntl_reg.h"
+#include "esp_log.h"
 #include "esp_rom_sys.h"
 #include "esp_rom_uart.h"
 #include "esp_attr.h"
 
+static const char *TAG = "fpga";
+
 extern void ets_update_cpu_frequency(uint32_t ticks_per_us);
 
+static void s_warn(void)
+{
+    ESP_EARLY_LOGW(TAG, "Project configuration is for internal FPGA use, not all functions will work");
+}
+
 void bootloader_clock_configure(void)
 {
+    s_warn();
     esp_rom_uart_tx_wait_idle(0);
 
     uint32_t xtal_freq_mhz = 40;
@@ -48,7 +56,7 @@ void IRAM_ATTR bootloader_fill_random(void *buffer, size_t length)
 
 void esp_clk_init(void)
 {
-
+    s_warn();
 }
 
 void esp_perip_clk_init(void)

+ 1 - 1
tools/cmake/targets.cmake

@@ -32,7 +32,7 @@ macro(__target_init)
     set(env_idf_env_fpga $ENV{IDF_ENV_FPGA})
     if(${env_idf_env_fpga})
         idf_build_set_property(__IDF_ENV_FPGA "y")
-        message(STATUS "IDF_ENV_FPGA is set, building for FPGA environment")
+        message(NOTICE "IDF_ENV_FPGA is set, building for FPGA environment")
     endif()
 endmacro()