Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
vendors/espressif: esp-idf-v4.4.2 -> esp32s2-related
Browse files Browse the repository at this point in the history
- Refactored CMakeLists.txt
- Updated sdkconfig.defaults
- Updated partition table to align both the app partitions
  • Loading branch information
laukik-hase committed Oct 7, 2022
1 parent 0a31ab4 commit d26a7ce
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 103 deletions.
42 changes: 22 additions & 20 deletions vendors/espressif/boards/esp32s2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,42 @@ afr_glob_src(driver_src DIRECTORY "${esp_idf_dir}" RECURSE)

set(
kernel_inc_dirs
"${extra_components_dir}/freertos/include"
"${esp_idf_dir}/components/app_update/include/"
"${esp_idf_dir}/components/bootloader_support/include"
"${esp_idf_dir}/components/esp32s2/include"
"${esp_idf_dir}/components/esp_event/include"
"${esp_idf_dir}/components/efuse/include"
"${esp_idf_dir}/components/driver/include"
"${esp_idf_dir}/components/efuse/esp32s2/include"
"${esp_idf_dir}/components/efuse/include"
"${esp_idf_dir}/components/esp_common/include"
"${esp_idf_dir}/components/esp_event/include"
"${esp_idf_dir}/components/esp_hw_support/include"
"${esp_idf_dir}/components/esp_hw_support/include/soc"
"${esp_idf_dir}/components/esp_ringbuf/include/"
"${esp_idf_dir}/components/esp_rom/include"
"${esp_idf_dir}/components/esp_system/include"
"${esp_idf_dir}/components/esp_timer/include"
"${esp_idf_dir}/components/hal/include"
"${esp_idf_dir}/components/hal/esp32s2/include"
"${esp_idf_dir}/components/hal/platform_port/include"
"${esp_idf_dir}/components/heap/include"
"${esp_idf_dir}/components/log/include"
"${esp_idf_dir}/components/mbedtls/port/include"
"${esp_idf_dir}/components/newlib/platform_include"
"${esp_idf_dir}/components/nvs_flash/include"
"${esp_idf_dir}/components/pthread/include"
"${esp_idf_dir}/components/newlib/platform_include"
"${esp_idf_dir}/components/soc/src/esp32s2/include"
"${esp_idf_dir}/components/soc/soc/esp32s2/include"
"${esp_idf_dir}/components/soc/esp32s2/include"
"${esp_idf_dir}/components/soc/include"
"${esp_idf_dir}/components/spi_flash/include"
"${esp_idf_dir}/components/tcpip_adapter/include"
"${esp_idf_dir}/components/vfs/include"
"${esp_idf_dir}/components/esp_ringbuf/include/"
"${extra_components_dir}/freertos/include"
"${esp_idf_dir}/components/mbedtls/port/include"
"${esp_idf_dir}/components/xtensa/esp32s2/include/xtensa"
"${esp_idf_dir}/components/xtensa/esp32s2/include"
"${esp_idf_dir}/components/xtensa/include"
"${esp_idf_dir}/components/esp_rom/include"
"${esp_idf_dir}/components/esp_timer/include"
"${esp_idf_dir}/components/esp_common/include"
"${esp_idf_dir}/components/esp_system/include"
"${esp_idf_dir}/components/tcpip_adapter/include"
)

if(ECC608_IN_USE)
set(mchp_dir "${AFR_VENDORS_DIR}/microchip")
set(ecc608a_dir "${mchp_dir}/secure_elements")
list(APPEND kernel_inc_dirs
"${esp_idf_dir}/components/esp_ringbuf/include"
"${board_dir}/config_files/ecc608a_pkcs11_config"
)
else()
Expand Down Expand Up @@ -157,7 +159,7 @@ target_include_directories(
"${esp_idf_dir}/components/esp_wifi/include"
"${esp_idf_dir}/components/esp_netif/include"
"${esp_idf_dir}/components/esp_eth/include"
"${esp_idf_dir}/components/soc/soc/include"
"${esp_idf_dir}/components/soc/include"
)

target_sources(
Expand Down Expand Up @@ -247,7 +249,7 @@ endif()
target_include_directories(
AFR::pkcs11_implementation::mcu_port
INTERFACE
"${esp_idf_dir}/components/soc/soc/include"
"${esp_idf_dir}/components/soc/include"
)

# Secure sockets
Expand Down Expand Up @@ -305,7 +307,7 @@ target_include_directories(
INTERFACE
"${afr_ports_dir}/common_io/include"
"${AFR_ROOT_DIR}/libraries/abstractions/common_io/test"
"${esp_idf_dir}/components/soc/soc/include"
"${esp_idf_dir}/components/soc/include"
)


Expand Down Expand Up @@ -341,7 +343,7 @@ target_include_directories(
AFR::ota::mcu_port
INTERFACE
"${afr_ports_dir}/ota_pal_for_aws"
"${esp_idf_dir}/components/soc/soc/include"
"${esp_idf_dir}/components/soc/include"
)
target_link_libraries(
AFR::ota::mcu_port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@
/* Required for configuration-dependent settings */
#include "xtensa_config.h"

/* The arch-specific FreeRTOSConfig_arch.h in port/<arch>/include. */
#include "freertos/FreeRTOSConfig_arch.h"

#ifndef __ASSEMBLER__
#include <stdlib.h> /* for abort() */
#include "esp32s2/rom/ets_sys.h"
#include <sys/reent.h>
#include "soc/cpu.h"
#include "esp_attr.h"

#if CONFIG_SYSVIEW_ENABLE
#if CONFIG_APPTRACE_SV_ENABLE
#include "SEGGER_SYSVIEW_FreeRTOS.h"
#undef INLINE // to avoid redefinition
#endif
Expand Down Expand Up @@ -80,7 +83,7 @@
#define configMAX_PRIORITIES ( 25U )
#endif

#ifndef CONFIG_ESP32_APPTRACE_ENABLE
#ifndef CONFIG_APPTRACE_ENABLE
#define configMINIMAL_STACK_SIZE 768U
#else
/* The apptrace module requires at least 2KB of stack per task. */
Expand Down Expand Up @@ -120,23 +123,6 @@
#define configISR_STACK_SIZE CONFIG_FREERTOS_ISR_STACKSIZE
#endif

/* configASSERT behaviour */
#if defined(CONFIG_FREERTOS_ASSERT_DISABLE)
#define configASSERT(a) /* assertions disabled */
#elif defined(CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE)
#define configASSERT(a) if (!(a)) { \
( void ) ets_printf("%s:%d (%s)- assert failed!\n", \
__FILE__, __LINE__, __FUNCTION__); \
}
#else /* CONFIG_FREERTOS_ASSERT_FAIL_ABORT */
#define configASSERT(a) if (!(a)) { \
( void ) ets_printf("%s:%d (%s)- assert failed!\n", \
__FILE__, __LINE__, __FUNCTION__); \
abort(); \
}
#endif


#ifndef __ASSEMBLER__
/* The function that implements FreeRTOS printf style output, and the macro
* that maps the configPRINTF() macros to that function. */
Expand Down Expand Up @@ -178,7 +164,15 @@
#if configUSE_TICKLESS_IDLE
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP CONFIG_FREERTOS_IDLE_TIME_BEFORE_SLEEP
#endif //configUSE_TICKLESS_IDLE
#define configENABLE_TASK_SNAPSHOT 1

#define configRECORD_STACK_HIGH_ADDRESS 1

#if CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT
#define configENABLE_TASK_SNAPSHOT 1
#endif
#ifndef configENABLE_TASK_SNAPSHOT
#define configENABLE_TASK_SNAPSHOT 0
#endif

#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1

Expand Down Expand Up @@ -339,23 +333,6 @@
void * const pxCreatedTask,
const int xCoreID );

static inline bool IRAM_ATTR xPortCanYield(void)
{
uint32_t ps_reg = 0;

//Get the current value of PS (processor status) register
RSR(PS, ps_reg);

/*
* intlevel = (ps_reg & 0xf);
* excm = (ps_reg >> 4) & 0x1;
* CINTLEVEL is max(excm * EXCMLEVEL, INTLEVEL), where EXCMLEVEL is 3.
* However, just return true, only intlevel is zero.
*/

return ((ps_reg & PS_INTLEVEL_MASK) == 0);
}

#define xTaskGetIdleTaskHandleForCPU(i) xTaskGetIdleTaskHandle()

#define xTaskGetCurrentTaskHandleForCPU(i) xTaskGetCurrentTaskHandle()
Expand Down Expand Up @@ -416,10 +393,12 @@
#define configXT_BOARD 1 /* Board mode. */
#define configXT_SIMULATOR 0

#ifndef UNTESTED_FUNCTION
#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
#define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0)
#define UNTESTED_FUNCTION() { esp_rom_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0)
#else
#define UNTESTED_FUNCTION()
#endif
#endif

#endif /* #define FREERTOS_CONFIG_H */
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define _IOT_BLE_CONFIG_H_

/* Device name for this peripheral device. */
#define IOT_BLE_DEVICE_COMPLETE_LOCAL_NAME "ESP32"
#define IOT_BLE_DEVICE_COMPLETE_LOCAL_NAME "ESP32S2"

/* Include BLE default config at bottom to set the default values for the configurations which are not overridden */
#include "iot_ble_config_defaults.h"
Expand Down
12 changes: 6 additions & 6 deletions vendors/espressif/boards/esp32s2/aws_demos/partition-table.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Name, Type, SubType, Offset, Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
nvs, data, nvs, 0x10000, 0x6000
otadata, data, ota, 0x16000, 0x2000
phy_init, data, phy, 0x18000, 0x1000
ota_0, 0, ota_0, 0x20000, 1500K
ota_1, 0, ota_1, , 1500K
storage, data, nvs, , 0x10000
nvs, data, nvs, 0x10000, 24K,
otadata, data, ota, , 8K,
phy_init, data, phy, , 4K,
ota_0, app, ota_0, , 1536K,
ota_1, app, ota_1, , 1536K,
storage, data, nvs, , 64K
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition-table.csv"
CONFIG_PARTITION_TABLE_FILENAME="partition-table.csv"
CONFIG_TIMER_TASK_STACK_DEPTH=3584
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3584
CONFIG_FREERTOS_TIMER_TASK_PRIORITY=5
CONFIG_FREERTOS_LEGACY_HOOKS=y
CONFIG_FREERTOS_LEGACY_IDLE_HOOK=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@
/* Required for configuration-dependent settings */
#include "xtensa_config.h"

/* The arch-specific FreeRTOSConfig_arch.h in port/<arch>/include. */
#include "freertos/FreeRTOSConfig_arch.h"

#ifndef __ASSEMBLER__
#include <stdlib.h> /* for abort() */
#include "esp32s2/rom/ets_sys.h"
#include <sys/reent.h>
#include "soc/cpu.h"
#include "esp_attr.h"

#if CONFIG_SYSVIEW_ENABLE
#if CONFIG_APPTRACE_SV_ENABLE
#include "SEGGER_SYSVIEW_FreeRTOS.h"
#undef INLINE // to avoid redefinition
#endif
Expand Down Expand Up @@ -83,7 +86,7 @@
#define configMAX_PRIORITIES ( 25U )
#endif

#ifndef CONFIG_ESP32_APPTRACE_ENABLE
#ifndef CONFIG_APPTRACE_ENABLE
#define configMINIMAL_STACK_SIZE 768U
#else
/* The apptrace module requires at least 2KB of stack per task. */
Expand Down Expand Up @@ -168,7 +171,15 @@
#if configUSE_TICKLESS_IDLE
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP CONFIG_FREERTOS_IDLE_TIME_BEFORE_SLEEP
#endif //configUSE_TICKLESS_IDLE
#define configENABLE_TASK_SNAPSHOT 1

#define configRECORD_STACK_HIGH_ADDRESS 1

#if CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT
#define configENABLE_TASK_SNAPSHOT 1
#endif
#ifndef configENABLE_TASK_SNAPSHOT
#define configENABLE_TASK_SNAPSHOT 0
#endif

#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1

Expand Down Expand Up @@ -316,23 +327,6 @@
void * const pxCreatedTask,
const int xCoreID );

static inline bool IRAM_ATTR xPortCanYield(void)
{
uint32_t ps_reg = 0;

//Get the current value of PS (processor status) register
RSR(PS, ps_reg);

/*
* intlevel = (ps_reg & 0xf);
* excm = (ps_reg >> 4) & 0x1;
* CINTLEVEL is max(excm * EXCMLEVEL, INTLEVEL), where EXCMLEVEL is 3.
* However, just return true, only intlevel is zero.
*/

return ((ps_reg & PS_INTLEVEL_MASK) == 0);
}

#define xTaskGetIdleTaskHandleForCPU(i) xTaskGetIdleTaskHandle()

#define xTaskGetCurrentTaskHandleForCPU(i) xTaskGetCurrentTaskHandle()
Expand Down Expand Up @@ -393,12 +387,13 @@
#define configXT_BOARD 1 /* Board mode. */
#define configXT_SIMULATOR 0

#ifndef UNTESTED_FUNCTION
#if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
#define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0)
#else
#define UNTESTED_FUNCTION()
#endif

#endif

/* The size of the output buffer is set to maximum length required by the tests,
* which is the length enough to accomodate largest error string written to
Expand Down
12 changes: 6 additions & 6 deletions vendors/espressif/boards/esp32s2/aws_tests/partition-table.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Name, Type, SubType, Offset, Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
nvs, data, nvs, 0x10000, 0x6000
otadata, data, ota, 0x16000, 0x2000
phy_init, data, phy, 0x18000, 0x1000
ota_0, 0, ota_0, 0x20000, 1500K
ota_1, 0, ota_1, , 1500K
storage, data, nvs, , 0x10000
nvs, data, nvs, 0x10000, 24K,
otadata, data, ota, , 8K,
phy_init, data, phy, , 4K,
ota_0, app, ota_0, , 1536K,
ota_1, app, ota_1, , 1536K,
storage, data, nvs, , 64K
15 changes: 6 additions & 9 deletions vendors/espressif/boards/esp32s2/aws_tests/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
CONFIG_ESP_INT_WDT=
CONFIG_ESP_TASK_WDT=
CONFIG_ESP_INT_WDT=n
CONFIG_ESP_TASK_WDT=n
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition-table.csv"
CONFIG_PARTITION_TABLE_FILENAME="partition-table.csv"
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=16
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=64
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=64
CONFIG_TIMER_TASK_STACK_DEPTH=3584
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3584
CONFIG_FREERTOS_TIMER_TASK_PRIORITY=6
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_PTHREAD_MUTEX_TIMEDLOCK=
CONFIG_PTHREAD_MUTEX_TIMEDLOCK=n
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=8192
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
CONFIG_MBEDTLS_CMAC_C=y
CONFIG_MBEDTLS_ECP_RESTARTABLE=y
CONFIG_FREERTOS_LEGACY_IDLE_HOOK=
CONFIG_FREERTOS_LEGACY_TICK_HOOK=
CONFIG_FREERTOS_LEGACY_IDLE_HOOK=n
CONFIG_FREERTOS_LEGACY_TICK_HOOK=n
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y
CONFIG_ESPTOOLPY_BAUD_921600B=y
Expand Down

0 comments on commit d26a7ce

Please sign in to comment.