Skip to content

Commit

Permalink
Merge branch 'fix/tools-gdbinit-with-elf-symbols' into 'master'
Browse files Browse the repository at this point in the history
tools: fixed elf symbols load if gdbinit specified

Closes IDF-4991 and GCC-246

See merge request espressif/esp-idf!18089
  • Loading branch information
dobairoland committed Sep 26, 2022
2 parents c51d4ab + c17a7f4 commit d08898a
Show file tree
Hide file tree
Showing 22 changed files with 590 additions and 140 deletions.
2 changes: 2 additions & 0 deletions .gitlab/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ build_non_test_components_apps:
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.elf"
- "**/build*/bootloader/*.bin"
- "**/build*/partition_table/*.bin"
- "**/build*/project_description.json"
- list_job_*.json
- size_info.txt
when: always
Expand Down
3 changes: 2 additions & 1 deletion components/bootloader/project_include.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ endif()
#
idf_build_get_property(build_dir BUILD_DIR)
set(BOOTLOADER_BUILD_DIR "${build_dir}/bootloader")
set(BOOTLOADER_ELF_FILE "${BOOTLOADER_BUILD_DIR}/bootloader.elf")
set(bootloader_binary_files
"${BOOTLOADER_BUILD_DIR}/bootloader.elf"
"${BOOTLOADER_ELF_FILE}"
"${BOOTLOADER_BUILD_DIR}/bootloader.bin"
"${BOOTLOADER_BUILD_DIR}/bootloader.map"
)
Expand Down
5 changes: 5 additions & 0 deletions docs/en/api-guides/tools/idf-tools-notes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ On Linux and macOS, it is recommended to install ninja using the OS-specific pac
.. tool-dfu-util-notes


---

.. tool-esp-rom-elfs-notes


---

.. tool-idf-python-notes
Expand Down
5 changes: 5 additions & 0 deletions docs/zh_CN/api-guides/tools/idf-tools-notes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ On Linux and macOS, it is recommended to install ninja using the OS package mana
.. tool-dfu-util-notes


---

.. tool-esp-rom-elfs-notes


---

.. tool-idf-python-notes
Expand Down
1 change: 1 addition & 0 deletions tools/cmake/project_description.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"build_dir": "${BUILD_DIR}",
"config_file": "${SDKCONFIG}",
"config_defaults": "${SDKCONFIG_DEFAULTS}",
"bootloader_elf": "${BOOTLOADER_ELF_FILE}",
"app_elf": "${PROJECT_EXECUTABLE}",
"app_bin": "${PROJECT_BIN}",
"git_revision": "${IDF_VER}",
Expand Down
35 changes: 3 additions & 32 deletions tools/idf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from importlib import import_module
from pkgutil import iter_modules
from types import FrameType
from typing import Any, Callable, Dict, List, Optional, TextIO, Union
from typing import Any, Callable, Dict, List, Optional, Union

# pyc files remain in the filesystem when switching between branches which might raise errors for incompatible
# idf.py extensions. Therefore, pyc file generation is turned off:
Expand All @@ -37,8 +37,8 @@

try:
from idf_py_actions.errors import FatalError # noqa: E402
from idf_py_actions.tools import (PropertyDict, executable_exists, get_target, idf_version, # noqa: E402
merge_action_lists, realpath)
from idf_py_actions.tools import (PROG, SHELL_COMPLETE_RUN, SHELL_COMPLETE_VAR, PropertyDict, # noqa: E402
debug_print_idf_version, get_target, merge_action_lists, print_warning, realpath)
if os.getenv('IDF_COMPONENT_MANAGER') != '0':
from idf_component_manager import idf_extensions
except ImportError:
Expand All @@ -53,23 +53,6 @@
# you have to pass env=os.environ explicitly anywhere that we create a process
os.environ['PYTHON'] = sys.executable

# Name of the program, normally 'idf.py'.
# Can be overridden from idf.bat using IDF_PY_PROGRAM_NAME
PROG = os.getenv('IDF_PY_PROGRAM_NAME', 'idf.py')

# environment variable used during click shell completion run
SHELL_COMPLETE_VAR = '_IDF.PY_COMPLETE'

# was shell completion invoked?
SHELL_COMPLETE_RUN = SHELL_COMPLETE_VAR in os.environ


# function prints warning when autocompletion is not being performed
# set argument stream to sys.stderr for errors and exceptions
def print_warning(message: str, stream: TextIO=None) -> None:
if not SHELL_COMPLETE_RUN:
print(message, file=stream or sys.stderr)


def check_environment() -> List:
"""
Expand All @@ -79,10 +62,6 @@ def check_environment() -> List:
"""
checks_output = []

if not executable_exists(['cmake', '--version']):
debug_print_idf_version()
raise FatalError("'cmake' must be available on the PATH to use %s" % PROG)

# verify that IDF_PATH env variable is set
# find the directory idf.py is in, then the parent directory of this, and assume this is IDF_PATH
detected_idf_path = realpath(os.path.join(os.path.dirname(__file__), '..'))
Expand Down Expand Up @@ -137,14 +116,6 @@ def _safe_relpath(path: str, start: Optional[str]=None) -> str:
return os.path.abspath(path)


def debug_print_idf_version() -> None:
version = idf_version()
if version:
print_warning('ESP-IDF %s' % version)
else:
print_warning('ESP-IDF version unknown')


def init_cli(verbose_output: List=None) -> Any:
# Click is imported here to run it after check_environment()
import click
Expand Down
8 changes: 8 additions & 0 deletions tools/idf_py_actions/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@

SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2']
PREVIEW_TARGETS = ['linux', 'esp32h2', 'esp32c6']

OPENOCD_TAGET_CONFIG_DEFAULT = '-f interface/ftdi/esp32_devkitj_v1.cfg -f target/{target}.cfg'
OPENOCD_TAGET_CONFIG: Dict[str, str] = {
'esp32': '-f board/esp32-wrover-kit-3.3v.cfg',
'esp32s2': '-f board/esp32s2-kaluga-1.cfg',
'esp32c3': '-f board/esp32c3-builtin.cfg',
'esp32s3': '-f board/esp32s3-builtin.cfg',
}
Loading

0 comments on commit d08898a

Please sign in to comment.