Przeglądaj źródła

esp_rom: Small changes for esp32c3 support

Updated from internal commit 6d894813
Angus Gratton 5 lat temu
rodzic
commit
a5aac93051

+ 2 - 4
components/esp_rom/CMakeLists.txt

@@ -3,8 +3,7 @@ idf_build_get_property(target IDF_TARGET)
 idf_component_register(SRCS "patches/esp_rom_crc.c"
                             "patches/esp_rom_sys.c"
                             "patches/esp_rom_uart.c"
-                       INCLUDE_DIRS include
-                       PRIV_INCLUDE_DIRS "${target}"
+                       INCLUDE_DIRS include "${target}"
                        PRIV_REQUIRES soc hal)
 
 # Append a target linker script at the target-specific path,
@@ -33,8 +32,7 @@ if(BOOTLOADER_BUILD)
         rom_linker_script("spiflash")
 
     elseif(target STREQUAL "esp32c3")
-        # currently nothing additional here
-
+        rom_linker_script("newlib")
     endif()
 
 else() # Regular app build

+ 1 - 2
components/esp_rom/component.mk

@@ -1,6 +1,5 @@
-COMPONENT_ADD_INCLUDEDIRS := include
+COMPONENT_ADD_INCLUDEDIRS := include esp32
 COMPONENT_SRCDIRS := patches .
-COMPONENT_PRIV_INCLUDEDIRS := esp32
 
 #Linker scripts used to link the final application.
 #Warning: These linker scripts are only used when the normal app is compiled; the bootloader

+ 1 - 2
components/esp_rom/esp32c3/ld/esp32c3.rom.ld

@@ -1728,10 +1728,9 @@ ieee80211_is_tx_allowed = 0x40001860;
 ieee80211_output_pending_eb = 0x40001864;
 ieee80211_output_process = 0x40001868;
 ieee80211_set_tx_desc = 0x4000186c;
-sta_input = 0x40001870;
+rom_sta_input = 0x40001870;
 wifi_get_macaddr = 0x40001874;
 wifi_rf_phy_disable = 0x40001878;
-wifi_rf_phy_enable = 0x4000187c;
 ic_ebuf_alloc = 0x40001880;
 ieee80211_classify = 0x40001884;
 ieee80211_copy_eb_header = 0x40001888;

+ 1 - 1
components/esp_rom/include/esp32/rom/aes.h

@@ -2,7 +2,7 @@
   ROM functions for hardware AES support.
 
   It is not recommended to use these functions directly,
-  use the wrapper functions in aes/esp_aes.h instead.
+  use the wrapper functions in esp32/aes.h instead.
 
  */
 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD

+ 25 - 0
components/esp_rom/include/esp32c3/rom/apb_dma.h

@@ -0,0 +1,25 @@
+// 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.
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ets_apb_backup_init_lock_func(void(* _apb_backup_lock)(void), void(* _apb_backup_unlock)(void));
+
+#ifdef __cplusplus
+}
+#endif

+ 44 - 0
components/esp_system/port/soc/esp32c3/apb_dma.c

@@ -0,0 +1,44 @@
+
+// Copyright 2015-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 "esp_attr.h"
+#include "freertos/FreeRTOS.h"
+#include "freertos/portmacro.h"
+#include "esp32c3/rom/apb_dma.h"
+
+static portMUX_TYPE apb_backup_mutex = portMUX_INITIALIZER_UNLOCKED;
+
+static void IRAM_ATTR apb_backup_lock(void)
+{
+    if (xPortInIsrContext()) {
+        portENTER_CRITICAL_ISR(&apb_backup_mutex);
+    } else {
+        portENTER_CRITICAL(&apb_backup_mutex);
+    }
+}
+
+static void IRAM_ATTR apb_backup_unlock(void)
+{
+    if (xPortInIsrContext()) {
+        portEXIT_CRITICAL_ISR(&apb_backup_mutex);
+    } else {
+        portEXIT_CRITICAL(&apb_backup_mutex);
+    }
+}
+
+void esp_apb_backup_lock_init(void)
+{
+    ets_apb_backup_init_lock_func(apb_backup_lock, apb_backup_unlock);
+}