Merge branch 'refactor/g0_for_xtensa' into 'master'

G0: Support Xtensa targets for G0-only compilation

Closes IDF-3087

See merge request espressif/esp-idf!18538
This commit is contained in:
Zim Kalinowski
2022-06-23 07:28:37 +08:00
32 changed files with 85 additions and 76 deletions
@@ -11,7 +11,7 @@
#include "soc/apb_saradc_reg.h"
#include "soc/system_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
void bootloader_random_enable(void)
{
@@ -11,7 +11,7 @@
#include "soc/apb_saradc_reg.h"
#include "soc/system_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
void bootloader_random_enable(void)
{
@@ -11,8 +11,8 @@
#include "soc/apb_saradc_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/sens_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "hal/regi2c_ctrl.h"
#include "soc/regi2c_saradc.h"
void bootloader_random_enable(void)
{
@@ -13,7 +13,7 @@
#include "esp_check.h"
#include "soc/rtc_cntl_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
#include "esp_log.h"
#include "esp_efuse_rtc_calib.h"
#include "hal/temperature_sensor_ll.h"
+1 -1
View File
@@ -392,7 +392,7 @@ TEST_CASE("test_adc_single_cali_time", "[adc][ignore][manual]")
#include "esp_sleep.h"
#include "esp_private/regi2c_ctrl.h"
#if REGI2C_ANA_CALI_PD_WORKAROUND
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
#endif
//ADC Channels
@@ -1,9 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "soc/regi2c_saradc.h"
@@ -1,9 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "soc/regi2c_saradc.h"
@@ -1,9 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "soc/regi2c_saradc.h"
+2 -2
View File
@@ -9,7 +9,7 @@
#include <stdint.h>
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "regi2c_ctrl.h"
#include "hal/regi2c_ctrl.h"
static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
@@ -58,7 +58,7 @@ void IRAM_ATTR regi2c_exit_critical(void)
* This is a workaround, and is fixed on later chips
*/
#if REGI2C_ANA_CALI_PD_WORKAROUND
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
static DRAM_ATTR uint8_t reg_val[REGI2C_ANA_CALI_BYTE_NUM];
@@ -17,7 +17,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
#include "soc/apb_saradc_struct.h"
#include "soc/soc.h"
#include "soc/soc_caps.h"
@@ -17,7 +17,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
#include "soc/apb_saradc_struct.h"
#include "soc/soc.h"
#include "soc/soc_caps.h"
+2 -2
View File
@@ -8,9 +8,9 @@
#include "hal/brownout_hal.h"
#include "soc/rtc_cntl_struct.h"
#include "soc/rtc_cntl_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_brownout.h"
#include "esp_attr.h"
#include "hal/regi2c_ctrl.h"
#include "soc/regi2c_brownout.h"
void brownout_hal_config(const brownout_hal_config_t *cfg)
{
+3 -2
View File
@@ -17,8 +17,9 @@
#include "soc/apb_saradc_reg.h"
#include "soc/rtc_cntl_struct.h"
#include "soc/rtc_cntl_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_defs.h"
#include "hal/regi2c_ctrl.h"
#include "soc/regi2c_saradc.h"
#ifdef __cplusplus
extern "C" {
@@ -16,7 +16,7 @@
#include <stdbool.h>
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
#include "soc/apb_saradc_struct.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/sens_struct.h"
+2 -2
View File
@@ -8,9 +8,9 @@
#include "hal/brownout_hal.h"
#include "soc/rtc_cntl_struct.h"
#include "soc/rtc_cntl_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_brownout.h"
#include "esp_attr.h"
#include "hal/regi2c_ctrl.h"
#include "soc/regi2c_brownout.h"
void brownout_hal_config(const brownout_hal_config_t *cfg)
+3 -3
View File
@@ -18,9 +18,9 @@
#include "soc/apb_saradc_reg.h"
#include "soc/rtc_cntl_struct.h"
#include "soc/rtc_cntl_reg.h"
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_defs.h"
#include "hal/regi2c_ctrl.h"
#include "soc/regi2c_saradc.h"
#ifdef __cplusplus
extern "C" {
@@ -5,6 +5,7 @@
*/
#pragma once
#include <stddef.h> /* For NULL declaration */
#include <stdint.h>
#include <stdbool.h>
#include "soc/soc_caps.h"
@@ -12,6 +12,7 @@
#pragma once
#include <stddef.h> /* For size_t type */
#include "soc/hwcrypto_reg.h"
#define SHA256_BLOCK_SZ 64
@@ -5,6 +5,7 @@
*/
#pragma once
#include <stddef.h> /* For NULL declaration */
#include <stdint.h>
#include <stdbool.h>
#include "hal/misc.h"
@@ -16,7 +16,7 @@
#include <stdbool.h>
#include "esp_private/regi2c_ctrl.h"
#include "regi2c_saradc.h"
#include "soc/regi2c_saradc.h"
#include "soc/apb_saradc_struct.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/sens_struct.h"
@@ -5,6 +5,14 @@
*/
#pragma once
/**
* When compiling G0-layer only, we can't depend on `esp_hw_support` component.
* However, `esp_private/regi2c_ctrl.h` is part of that component.
* Thus, if we don't have this header file in our compilation unit, we should use
* ROM functions.
* The main difference is that `regi2c_ctrl.h` implementation protects the functions
* with mutex. ROM functions must be protected explicitly by the user.
*/
#if __has_include("esp_private/regi2c_ctrl.h")
#include "esp_private/regi2c_ctrl.h"
#else
+15 -3
View File
@@ -30,13 +30,25 @@
#include <stdlib.h>
#include <xtensa/config/core.h>
#include "freertos/FreeRTOS.h"
#include "freertos/portable.h"
#include "esp_attr.h"
#include "xtensa/xtensa_api.h"
#include "sdkconfig.h"
#include "esp_rom_sys.h"
/*
* When compiling for G0-only, we don't have FreeRTOS component.
* In fact, FreeRTOS component is only used for the core configuration, so
* the macro portNUM_PROCESSORS and the macro/function xPortGetCoreID need to
* be defined.
*/
#if __has_include("freertos/FreeRTOS.h")
#include "freertos/FreeRTOS.h"
#include "freertos/portable.h"
#else
_Static_assert(portNUM_PROCESSORS == 1, "G0-only Xtensa builds can only be compiled in single-core mode");
#define xPortGetCoreID() 0
#endif
#if XCHAL_HAVE_EXCEPTIONS
/* Handler table is in xtensa_intr_asm.S */
+16 -2
View File
@@ -1,4 +1,10 @@
/*
* SPDX-FileCopyrightText: 2015-2019 Cadence Design Systems, Inc.
*
* SPDX-License-Identifier: MIT
*
* SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
*/
/*
* Copyright (c) 2015-2019 Cadence Design Systems, Inc.
*
@@ -31,7 +37,15 @@
#include <xtensa/config/core.h>
#include "xtensa/xtensa_context.h"
#include "freertos/FreeRTOSConfig.h"
/*
* When compiling for G0-only, we don't have FreeRTOS component.
* In fact, FreeRTOS component is only used for the configuration, so only the
* macro portNUM_PROCESSORS needs to be defined (in the build file).
*/
#if __has_include("freertos/FreeRTOSConfig.h")
#include "freertos/FreeRTOSConfig.h"
#endif
#if XCHAL_HAVE_INTERRUPTS