diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 3788e97bc1..ef84997304 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -122,7 +122,7 @@ menu "ESP32-specific" endchoice # insert non-chip-specific items here - source "$IDF_PATH/components/esp_common/Kconfig.spiram.common" + source "$IDF_PATH/components/esp_hw_support/Kconfig.spiram.common" config SPIRAM_CACHE_WORKAROUND bool "Enable workaround for bug in SPI RAM cache for Rev1 ESP32s" diff --git a/components/esp32s2/Kconfig b/components/esp32s2/Kconfig index 9ff302f698..b4aa25dfd2 100644 --- a/components/esp32s2/Kconfig +++ b/components/esp32s2/Kconfig @@ -192,7 +192,7 @@ menu "ESP32S2-specific" endchoice # insert non-chip-specific items here - source "$IDF_PATH/components/esp_common/Kconfig.spiram.common" + source "$IDF_PATH/components/esp_hw_support/Kconfig.spiram.common" endmenu diff --git a/components/esp32s3/Kconfig b/components/esp32s3/Kconfig index a083bd6a57..6e17dddd0c 100644 --- a/components/esp32s3/Kconfig +++ b/components/esp32s3/Kconfig @@ -242,7 +242,7 @@ menu "ESP32S3-Specific" endchoice # insert non-chip-specific items here - source "$IDF_PATH/components/esp_common/Kconfig.spiram.common" + source "$IDF_PATH/components/esp_hw_support/Kconfig.spiram.common" endmenu diff --git a/components/esp_common/CMakeLists.txt b/components/esp_common/CMakeLists.txt index 27b1e9b01a..7818a4b6a8 100644 --- a/components/esp_common/CMakeLists.txt +++ b/components/esp_common/CMakeLists.txt @@ -1,8 +1,5 @@ idf_build_get_property(target IDF_TARGET) -if(CONFIG_IDF_ENV_FPGA) - list(APPEND srcs "src/fpga_overrides.c") -endif() if(BOOTLOADER_BUILD) # For bootloader, all we need from esp_common is headers @@ -16,7 +13,6 @@ else() "src/esp_err.c" "src/esp_err_to_name.c" "src/freertos_hooks.c" - "src/mac_addr.c" "src/stack_check.c" "src/task_wdt.c" "src/int_wdt.c") diff --git a/components/esp_common/Kconfig b/components/esp_common/Kconfig index ab0c2277bd..d7aabd92d8 100644 --- a/components/esp_common/Kconfig +++ b/components/esp_common/Kconfig @@ -286,24 +286,6 @@ menu "Common ESP-related" Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging stuff, e.g. GCOV data dump. - config ESP_MAC_ADDR_UNIVERSE_WIFI_STA - bool - - config ESP_MAC_ADDR_UNIVERSE_WIFI_AP - bool - - config ESP_MAC_ADDR_UNIVERSE_BT - bool - - config ESP_MAC_ADDR_UNIVERSE_BT_OFFSET - int - default 2 if ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR - default 1 if ESP32_UNIVERSAL_MAC_ADDRESSES_TWO - default 1 - - config ESP_MAC_ADDR_UNIVERSE_ETH - bool - config ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY # Invisible option that is set by SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY, but # exists even if SPIRAM is not supported diff --git a/components/esp_common/src/fpga_overrides.c b/components/esp_common/src/fpga_overrides.c deleted file mode 100644 index b309bef623..0000000000 --- a/components/esp_common/src/fpga_overrides.c +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2010-2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#include "sdkconfig.h" -#include "soc/soc.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; -#ifdef CONFIG_IDF_TARGET_ESP32S2 - uint32_t apb_freq_hz = 20000000; -#else - uint32_t apb_freq_hz = 40000000; -#endif // CONFIG_IDF_TARGET_ESP32S2 - ets_update_cpu_frequency(apb_freq_hz / 1000000); - REG_WRITE(RTC_CNTL_STORE5_REG, (apb_freq_hz >> 12) | ((apb_freq_hz >> 12) << 16)); - REG_WRITE(RTC_CNTL_STORE4_REG, (xtal_freq_mhz) | ((xtal_freq_mhz) << 16)); -} - -/* Placed in IRAM since test_apps expects it to be */ -void IRAM_ATTR bootloader_fill_random(void *buffer, size_t length) -{ - uint8_t *buffer_bytes = (uint8_t *)buffer; - for (int i = 0; i < length; i++) { - buffer_bytes[i] = 0x5A; - } -} - -void esp_clk_init(void) -{ - s_warn(); -} - -void esp_perip_clk_init(void) -{ - -} - -/** - * @brief No-op function, used to force linking this file - * - */ -void esp_common_include_fpga_overrides(void) -{ -} diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index 7b8994d950..879b1999ca 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -7,7 +7,9 @@ endif() set(srcs "compare_set.c" "cpu_util.c") if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "clk_ctrl_os.c") + list(APPEND srcs "clk_ctrl_os.c" "mac_addr.c") +endif() + endif() idf_component_register(SRCS ${srcs} diff --git a/components/esp_hw_support/Kconfig b/components/esp_hw_support/Kconfig new file mode 100644 index 0000000000..1098919b7e --- /dev/null +++ b/components/esp_hw_support/Kconfig @@ -0,0 +1,26 @@ +menu "Hardware Settings" + menu "MAC Config" + config ESP_UNIVERSAL_MAC_ADDRESSES + int + default 2 if ESP32_UNIVERSAL_MAC_ADDRESSES_TWO + default 4 if ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR + + config ESP_MAC_ADDR_UNIVERSE_WIFI_STA + bool + + config ESP_MAC_ADDR_UNIVERSE_WIFI_AP + bool + + config ESP_MAC_ADDR_UNIVERSE_BT + bool + + config ESP_MAC_ADDR_UNIVERSE_BT_OFFSET + int + default 2 if ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR + default 1 if ESP32_UNIVERSAL_MAC_ADDRESSES_TWO + default 1 + + config ESP_MAC_ADDR_UNIVERSE_ETH + bool + endmenu +endmenu diff --git a/components/esp_common/Kconfig.spiram.common b/components/esp_hw_support/Kconfig.spiram.common similarity index 100% rename from components/esp_common/Kconfig.spiram.common rename to components/esp_hw_support/Kconfig.spiram.common diff --git a/components/esp_hw_support/component.mk b/components/esp_hw_support/component.mk index 867056fdc0..f3c83d7505 100644 --- a/components/esp_hw_support/component.mk +++ b/components/esp_hw_support/component.mk @@ -5,5 +5,6 @@ COMPONENT_ADD_LDFRAGMENTS := linker.lf port/$(IDF_TARGET)/rtc_clk.o: CFLAGS += -fno-jump-tables -fno-tree-switch-conversion ifdef IS_BOOTLOADER_BUILD -COMPONENT_OBJEXCLUDE += clk_ctrl_os.o +COMPONENT_OBJEXCLUDE += clk_ctrl_os.o mac_addr.o + endif diff --git a/components/esp_common/include/esp_crc.h b/components/esp_hw_support/include/esp_crc.h similarity index 100% rename from components/esp_common/include/esp_crc.h rename to components/esp_hw_support/include/esp_crc.h diff --git a/components/esp_common/include/esp_fault.h b/components/esp_hw_support/include/esp_fault.h similarity index 100% rename from components/esp_common/include/esp_fault.h rename to components/esp_hw_support/include/esp_fault.h diff --git a/components/esp_common/include/esp_interface.h b/components/esp_hw_support/include/esp_interface.h similarity index 100% rename from components/esp_common/include/esp_interface.h rename to components/esp_hw_support/include/esp_interface.h diff --git a/components/esp_common/src/mac_addr.c b/components/esp_hw_support/mac_addr.c similarity index 100% rename from components/esp_common/src/mac_addr.c rename to components/esp_hw_support/mac_addr.c