Commit Graph

263 Commits

Author SHA1 Message Date
Roland Dobai
8e619642c9 Merge branch 'feat/esp_idf_size_ng_integration' into 'master'
feat(tools): esp_idf_size.ng integration

Closes IDF-8771

See merge request espressif/esp-idf!27448
2023-12-05 20:36:07 +08:00
Ivan Grokhotkov
71153c7dbb
feat(tools): add 'idf.py qemu' extension
This extension allows running programs in QEMU similar to running
them on a real chip:

- 'idf.py qemu' — builds and runs the program in QEMU. User gets
  a QEMU instance launched, and can work with it as a normal QEMU
  instance.
- 'idf.py qemu monitor' — same, but QEMU is launched in the
  background, and idf_monitor runs in the foreground, showing QEMU
  output. Compared to only running 'idf.py qemu' this enables, for
  example, automatic backtrace decoding.
- 'idf.py qemu gdb' — launches QEMU in the background and opens an
  interactive GDB prompt, connecting it to QEMU.
- 'idf.py qemu --gdb monitor' and 'idf.py gdb' in another shell:
  launches QEMU in the background, keeps it suspended until GDB is
  connected, and opens idf_monitor. GDB can be used in another shell
  to debug the application.
2023-12-03 07:45:19 +01:00
Roland Dobai
4797d744fa Merge branch 'fix/coredump_port' into 'master'
fix(tools/coredump): do not detect port when core file is used

Closes IDFGH-11552

See merge request espressif/esp-idf!27441
2023-11-30 18:40:23 +08:00
Frantisek Hrbata
18334588bc feat(tools): esp_idf_size.ng integration
This integrates esp_idf_size.ng, refactored esp-idf-size version, into
esp-idf and enables it by default. The esp_idf_size.ng may be enabled
by using the --ng option, but also via ESP_IDF_SIZE_NG env. variable,
which is used in this integration.

New -l/--legacy option is added, which enforces usage of the old version.
This option can be also set via "ESP_IDF_SIZE_LEGACY" env. variable.
This should allow to easily switch back to old version if there is any
problem.

The new version is used by default for all formats, except for the "json".

Examples:
$ idf.py size                           # uses refactored version
$ idf.py size --legacy                  # uses legacy version
$ idf.py size --l                       # uses legacy version
$ idf.py size --format json             # uses legacy version
$ idf.py size --format json2            # uses refactored version
$ export ESP_IDF_SIZE_LEGACY="1"        # use legacy version only from now on

ESP_IDF_SIZE_FORCE_TERMINAL, which forces terminal control codes(colors), is also set
when running from idf.py, so the colors are propagated even if stdout
for esp_idf_size.ng is not attached to tty.

The same changes are applied also to the idf_size.py wrapper.

There is an import check if esp_idf_size.ng is available. If not,
we switch into the legacy mode. This should cover situation when the
esp-idf has support for refactored version, but it's not installed.
This should also allow users to bind to a legacy version(<1.0.0) and the
idf.py size and idf_size.py should still work. This also allow us to
restring the version in constraints file if we need to switch back to
legacy version globally.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-11-30 09:26:51 +01:00
Alexey Lapshin
3ac31855b2 Merge branch 'contrib/github_pr_12683' into 'master'
fix(tools): fix path delimiter in gdbinit for Windows

Closes IDFGH-11562

See merge request espressif/esp-idf!27485
2023-11-30 04:57:07 +08:00
GuyBrush
090bb85a12 fix(tools): fix path delimiter in gdbinit for Windows
Merges https://github.com/espressif/esp-idf/pull/12683

Signed-off-by: Alexey Lapshin <alexey.lapshin@espressif.com>
2023-11-29 13:54:48 +04:00
Peter Dragun
59179ce54d fix(tools/coredump): do not detect port when core file is used
Closes https://github.com/espressif/esp-idf/issues/12673
2023-11-28 10:20:08 +01:00
wanglei
076aefce74 feat(esp32c5): add esp32c5 target in kconfig and tools 2023-11-28 16:14:17 +08:00
Jakub Kocka
579ecbddb8 feat(hints): Added hint for LIBUSB_ERROR_NOT_FOUND 2023-11-02 15:33:00 +01:00
Erhan Kurubas
659748748f fix(coredump-info): set default gdb timeout as 3 seconds 2023-11-01 19:41:56 +01:00
sonika.rathi
bb329accd7 fix(sd_card): update hints.yml to provide SD troubleshooting hints 2023-10-25 11:19:08 +02:00
Marius Vikhammer
d36b72ef23 fix(idf.py): fixed save-defconfig failing due to wrong argument name 2023-10-21 12:23:07 +08:00
Peter Dragun
bdcae08458 feat(tools/kconfig): add menu labels for min config
Closes https://github.com/espressif/esp-idf/issues/10358
2023-10-18 15:01:46 +02:00
Roland Dobai
51b104deac Merge branch 'feat/all_components' into 'master'
feat(tools): display hints for projects with trimmed down list of components

Closes IDF-8005 and IDF-8316

See merge request espressif/esp-idf!26297
2023-10-16 17:40:12 +08:00
Peter Dragun
95b764970e Merge branch 'feat/uf2-to-esptool' into 'master'
feat(tools): move uf2 file generation to esptool

Closes IDF-7434

See merge request espressif/esp-idf!25655
2023-10-12 16:03:16 +08:00
Alexey Lapshin
2585e53d54 Merge branch 'feature/update-toolchain-to-esp-13.1.0_new_newlib' into 'master'
Update toolchain to esp-13.2.0_20230919

Closes GCC-250, GCC-322, GCC-324, GCC-327, GCC-330, and IDF-8287

See merge request espressif/esp-idf!25073
2023-10-10 08:18:33 +08:00
Peter Dragun
9acf412a07 feat(tools): move uf2 generation to esptool 2023-10-09 15:38:30 +02:00
Darian
a10121491f Merge branch 'change/freertos_make_task_snapshot_private' into 'master'
refactor(freertos/task_snapshot): Make task snapshot private

Closes IDF-8182

See merge request espressif/esp-idf!26115
2023-10-09 16:32:18 +08:00
Alexey Lapshin
98199d50d6 change(tools): update gcc toolchain version to 13.2.0
Add Kconfig option to supress new gcc warnings
Update docs with migration guide
2023-10-09 12:13:00 +04:00
Darian Leung
2b357071f1 refactor(freertos/task_snapshot): Deprecate task_snapshot.h
This commit deprecates the `#include "freertos/task_snapshot.h" include path:

- Adds compatibility header with compile time warning
- Removes hints related to `task_snapshot.h`
- Adds entry to migration guide
2023-10-07 18:55:47 +08:00
Guillaume Souchere
cb9868e82d feat(heap): Add runtime hint on tlsf assert trigger
Catch all tlsf assertion failure and display a hint for out of bound writing since
all assertion failure are triggered when the tlsf metadata structure has been corrupted.
2023-10-05 11:57:37 +02:00
Frantisek Hrbata
64d82b54bc feat(hints): use all_component_info from project_description.json
Currently the component_requirements hint module does not work
as expected if the component list for a project is trimmed down.
With the new "all_component_info" dictionary info in project_description.json,
the module can produce hints even if cmake's COMPONENTS variable is
set.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-10-02 16:24:41 +02:00
Frantisek Hrbata
00d77e7a75 fix(hints): properly identify source component
If there is a component(child) within a component(parent), like for test_apps, the parent
component may be wrongly identified as source component for the failed include. This may
lead to a false bug report if the parent component has component, which provides the missing
header, in requirements.

Fix this by looking for the longest matching source component directory.

Suggested-by: Ivan Grokhotkov <ivan@espressif.com>
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-09-27 12:50:25 +02:00
Peter Dragun
0a8a5c0e7a fix(tools): fix autocomplete for --port option
Closes https://github.com/espressif/esp-idf/issues/7970
2023-09-06 14:32:48 +02:00
Michal Jenikovsky
e9bb33624b idf.py: gdb action incorrectly generated EOL gdbinit scripts
GDB on Windows incorrectly reads EOL in the script files causing 'gdb'
action to fail.

(gdb) source .../build/gdbinit/py_extensions
(gdb) source .../build\gdbinit\symbols
add symbol table from file "...\build\bootloader\bootloader.elf"
.../build\gdbinit\symbols:6: Error in sourced command file:
Undefined command: "".  Try "help".

Forcing line separator to '\n' resolved the issue

Signed-off-by: Michal Jenikovsky <jendo@jmsystems.sk>
2023-08-11 12:37:29 +02:00
Ivan Grokhotkov
6878ddaa4a feat(tools): idf.py: implement hints for component reqs
Implementation of hint module for component dependency. It can provide
hint about missing header directory in component's INCLUDE_DIRS or
about missing component dependency in REQUIRES or PRIV_REQUIRES.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-08-05 20:13:28 +02:00
Ivan Grokhotkov
54d4662107 feat(tools): idf_monitor: support for loadable hint provider modules
Currently hints are supported based on hints.yml only, which may be
limiting for some use cases. This introduces a generic plugin approach,
which allows to implement hint module that doesn't require entry in hints.yml.
Such module has the full command output available and it is not limited to
a single regex in hints.yml.

Note that regex in hint.yml expects the output concatenated into a single line,
but hint modules are getting the output unchanged.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-08-05 20:13:28 +02:00
Frantisek Hrbata
ed35c3a94a feat(tools): add global build context
Introduces get_build_context() helper, which allows to get build context, e.g.
project description, at places where this info is not available. The
build context is set within ensure_build_directory.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-08-05 20:13:28 +02:00
Ivan Grokhotkov
cfa1896780 Merge branch 'contrib/github_pr_11535' into 'master'
Replace deprecated flushregs alias with full gdb command (GitHub PR)

Closes IDFGH-10272

See merge request espressif/esp-idf!24752
2023-07-28 22:40:22 +08:00
Aleksei Apaseev
6532076ad6 coredump: added the chip_rev field into the coredump header 2023-07-26 10:53:28 +08:00
Aleksei Apaseev
ba51b09cb2 coredump: added the chip_rev field into the coredump header 2023-07-26 10:53:28 +08:00
Roland Dobai
f4a1567474 Merge branch 'bugfix/debug_ext_ctrl_c' into 'master'
tools: fix waiting on gdb process when interrupted with CTRL+C

Closes IDFGH-10638

See merge request espressif/esp-idf!24836
2023-07-20 23:05:53 +08:00
Ivan Grokhotkov
0ebe2cecfa
feat(system): add an error log and a hint on failed interrupt alloc
When interrupt allocation fails, esp_intr_alloc will now print a
message telling that no free interrupt was found. This message is
then checked in hints.yml, to give a link to the troubleshooting
guide.
2023-07-19 16:47:41 +02:00
Ryan Yin
354e2c4673 feat: fix: create-project & create_component with proper file permission 2023-07-17 19:32:30 +08:00
Frantisek Hrbata
ff1ce54869 fix(debug_ext): CTRL+C handling while waiting on gdb process
idf.py spawns gdb process within a thread and uses Thread.join() to wait
for the gdb process to finish. As CTRL+C(SIGINT) is used by gdb to interrupt the
running program, we catch the SIGINT while waiting on the gdb to finish,
and try Thread.join() again.

With cpython's commit

	commit a22be4943c119fecf5433d999227ff78fc2e5741
	Author: Victor Stinner <vstinner@python.org>
	Date:   Mon Sep 27 14:20:31 2021 +0200

	    bpo-45274: Fix Thread._wait_for_tstate_lock() race condition (GH-28532)

this logic doesn't work anymore, because cpython internally marks the
thread as stopped when join() is interrupted with an exception. IMHO
this is broken in cpython and there is a bug report about this
https://github.com/python/cpython/issues/90882. Problem is that
waiting on a thread to finish is based on acquiring a lock. Meaning
join() is waiting on _tstate_lock. If this wait is interrupted, the
above referenced commit adds a logic that checks if the lock is help,
meaning the thread is done and marks the thread as stopped. But there is
no way to tell if the lock was acquired by us running join() or if it's
held by someone else e.g. still by the thread bootstrap code. Meaning
the thread is still running.

I may be missing something, but I don't see any reason why to spawn gdb
process within a thread. This change removes the thread and spawns gdb
directly. Instead waiting on a thread, we wait on the process to finish,
replacing join() with wait() and avoiding this problem.

Closes https://github.com/espressif/esp-idf/issues/11871

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-07-17 08:00:23 +02:00
Daniel Mangum
647e7a2a71
fix: Replace deprecated flushregs alias with full gdb command
Usage of `flushregs` in gdb will result in the following warning:

```
Warning: 'flushregs', an alias for the command 'maintenance flush register-cache', is deprecated.
Use 'maintenance flush register-cache'.
```

This patch updates to use the recommend command.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
Merges https://github.com/espressif/esp-idf/pull/11535
2023-07-13 09:26:47 +02:00
Marek Fiala
206c46325a fix(tools): Tool curses import check
Verify that curses tool can be successfully imported on unix systems

When detected:
- installing esp-idf -> reinstall python environment
- using idf.py menuconfig -> raise error with hint message

Closes https://github.com/espressif/esp-idf/issues/11643
2023-07-12 13:23:06 +00:00
Wu Zheng Hui
4c713227ae Merge branch 'bugfix/fix_idf_monitor_parsing_pc_with_wrong_rom_elf' into 'master'
bugfix: fix idf passing wrong chip revision to idf_monitor

See merge request espressif/esp-idf!24609
2023-07-11 17:14:10 +08:00
Roland Dobai
15c4b93893 Merge branch 'asyncio_error' into 'master'
[Tools] hints: add guide to fix error with unsupported asyncio

Closes IDFGH-10485

See merge request espressif/esp-idf!24528
2023-07-11 17:05:11 +08:00
Peter Dragun
58c467f3aa fix(tools/coredump-info): pass non-default partition table offset to esp-coredump
Closes https://github.com/espressif/esp-idf/issues/11564
2023-07-10 10:42:06 +02:00
wuzhenghui
78c959b13e fix: fix idf passing wrong chip revision to idf_monitor 2023-07-05 17:30:12 +08:00
Peter Dragun
341390f928 fix(tools/hints): add guide to fix error with unsupported asyncio
Closes https://github.com/espressif/esp-idf/issues/11732
2023-07-03 10:26:26 +02:00
Armando (Dou Yiwen)
17d6768e65 Merge branch 'feature/add_target_esp32p4' into 'master'
esp32p4: introduce the target

See merge request espressif/esp-idf!24155
2023-06-14 10:16:44 +08:00
Armando
101e6a18eb esp32p4: introduce the target
Add esp32p4 target to tools and Kconfig
Create directories and files that are essential for `idf.py --preview set-target esp32p4`
2023-06-13 15:16:11 +08:00
Alexey Lapshin
07c7fe929b tools: process progression for flash action output 2023-06-12 13:56:59 +04:00
Alexey Lapshin
59206e39a0 tools: fix control characters print if hints enabled
Closes https://github.com/espressif/esp-idf/issues/11351
2023-05-22 20:18:02 +08:00
Frantisek Hrbata
a5d3c2d443 tools: fix hints processing in interactive mode
Currently hints are processed only once the process is finished and
exits with non-error exit code. In interactive mode, e.g. for monitor,
we want to process ouput lines for hints right away.

This adds a simple buffer, which keeps the last line and once EOL is
reached, it is processed for hints.

Since the original hints processing was file based, a new helper
function was added to allow processing hints in string.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-05-09 14:35:04 +02:00
laokaiyao
bf2a7b2df6 esp32h4: removed esp32h4 related codes 2023-04-23 12:03:07 +00:00
Roland Dobai
1bf382a3e1 Merge branch 'monitor_win_color' into 'master'
bug(idf_monitor, hints): fix monitor colors on windows with hints

Closes IDF-5863

See merge request espressif/esp-idf!22070
2023-04-21 20:15:38 +08:00
Peter Dragun
faa82b060c feat(esptool): allow to set force for write_flash 2023-04-17 12:53:01 +02:00