Skip to content

Commit

Permalink
Merge branch 'bugfix/serial_jtag_v5.2' into 'release/v5.2'
Browse files Browse the repository at this point in the history
fix(usb_serial_jtag): Fix issue that boot failed on esp32c3 (for v5.2)

See merge request espressif/esp-idf!29381
  • Loading branch information
ESP-Marius committed Mar 4, 2024
2 parents 4f6cca6 + 194b616 commit 7ec8266
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 6 deletions.
4 changes: 4 additions & 0 deletions components/esp_rom/esp32/Kconfig.soc_caps.in
Expand Up @@ -34,3 +34,7 @@ config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
config ESP_ROM_HAS_SW_FLOAT
bool
default y

config ESP_ROM_USB_SERIAL_DEVICE_NUM
int
default -1
1 change: 1 addition & 0 deletions components/esp_rom/esp32/esp_rom_caps.h
Expand Up @@ -14,3 +14,4 @@
#define ESP_ROM_NEEDS_SWSETUP_WORKAROUND (1) // ROM uses 32-bit time_t. A workaround is required to prevent printf functions from crashing
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano version of formatting functions
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (-1) // No USB_SERIAL_JTAG in the ROM, set -1 for Kconfig usage.
4 changes: 4 additions & 0 deletions components/esp_rom/esp32c2/Kconfig.soc_caps.in
Expand Up @@ -70,3 +70,7 @@ config ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB
config ESP_ROM_HAS_SW_FLOAT
bool
default y

config ESP_ROM_USB_SERIAL_DEVICE_NUM
int
default -1
1 change: 1 addition & 0 deletions components/esp_rom/esp32c2/esp_rom_caps.h
Expand Up @@ -23,3 +23,4 @@
#define ESP_ROM_RAM_APP_NEEDS_MMU_INIT (1) // ROM doesn't init cache MMU when it's a RAM APP, needs MMU hal to init
#define ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB (1) // ROM has the mbedtls crypto algorithm lib
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (-1) // No USB_SERIAL_JTAG in the ROM, set -1 for Kconfig usage.
4 changes: 4 additions & 0 deletions components/esp_rom/esp32s2/Kconfig.soc_caps.in
Expand Up @@ -38,3 +38,7 @@ config ESP_ROM_HAS_FLASH_COUNT_PAGES_BUG
config ESP_ROM_HAS_SW_FLOAT
bool
default y

config ESP_ROM_USB_SERIAL_DEVICE_NUM
int
default -1
1 change: 1 addition & 0 deletions components/esp_rom/esp32s2/esp_rom_caps.h
Expand Up @@ -15,3 +15,4 @@
#define ESP_ROM_USB_OTG_NUM (3) // The serial port ID (UART, USB, ...) of USB_OTG CDC in the ROM.
#define ESP_ROM_HAS_FLASH_COUNT_PAGES_BUG (1) // ROM api Cache_Count_Flash_Pages will return unexpected value
#define ESP_ROM_HAS_SW_FLOAT (1) // ROM has libgcc software floating point emulation functions
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (-1) // No USB_SERIAL_JTAG in the ROM, set -1 for Kconfig usage.
12 changes: 12 additions & 0 deletions components/esp_rom/linux/Kconfig.soc_caps.in
@@ -0,0 +1,12 @@
#####################################################
# This file is auto-generated from SoC caps
# using gen_soc_caps_kconfig.py, do not edit manually
#####################################################

config ESP_ROM_USB_OTG_NUM
int
default -1

config ESP_ROM_USB_SERIAL_DEVICE_NUM
int
default -1
8 changes: 8 additions & 0 deletions components/esp_rom/linux/esp_rom_caps.h
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#define ESP_ROM_USB_OTG_NUM (-1) // No USB_OTG CDC in the ROM, set -1 for Kconfig usage.
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (-1) // No USB_SERIAL_JTAG in the ROM, set -1 for Kconfig usage.
3 changes: 3 additions & 0 deletions components/esp_system/Kconfig
Expand Up @@ -299,6 +299,9 @@ menu "ESP System Settings"
default 0 if ESP_CONSOLE_UART_DEFAULT
default 0 if ESP_CONSOLE_UART_CUSTOM_NUM_0
default 1 if ESP_CONSOLE_UART_CUSTOM_NUM_1
default 0 if ESP_CONSOLE_NONE
# Temporarily workaround for serial_jtag usage.
default ESP_ROM_USB_SERIAL_DEVICE_NUM if ESP_CONSOLE_USB_SERIAL_JTAG
default -1 if !ESP_CONSOLE_UART

config ESP_CONSOLE_UART_TX_GPIO
Expand Down
21 changes: 15 additions & 6 deletions tools/gen_soc_caps_kconfig/gen_soc_caps_kconfig.py
@@ -1,12 +1,10 @@
#!/usr/bin/env python
#
# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0

"""
Generate Kconfig.soc_caps.in with defines from soc_caps.h
"""

import argparse
import inspect
import io
Expand All @@ -18,8 +16,19 @@
from string import Template

import pyparsing
from pyparsing import (CaselessLiteral, Char, Combine, Group, Literal, OneOrMore, # pylint: disable=unused-import
Optional, ParserElement, QuotedString, Word, alphas, hexnums, nums)
from pyparsing import alphas
from pyparsing import CaselessLiteral
from pyparsing import Char
from pyparsing import Combine
from pyparsing import Group
from pyparsing import hexnums
from pyparsing import Literal
from pyparsing import nums
from pyparsing import OneOrMore
from pyparsing import Optional
from pyparsing import ParserElement
from pyparsing import QuotedString
from pyparsing import Word

pyparsing.usePackrat = True

Expand Down Expand Up @@ -107,7 +116,7 @@ def parse_define(define_line): # type: (str) -> typing.Any[typing.Type[ParserEl

# Define value, either a hex, int or a string
hex_value = Combine(Literal('0x') + Word(hexnums) + Optional(literal_suffix).suppress())('hex_value')
int_value = Word(nums)('int_value') + ~Char('.') + Optional(literal_suffix)('literal_suffix')
int_value = Combine(Optional('-') + Word(nums))('int_value') + ~Char('.') + Optional(literal_suffix)('literal_suffix')
str_value = QuotedString('"')('str_value')

# Remove optional parenthesis around values
Expand Down

0 comments on commit 7ec8266

Please sign in to comment.