mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 14:44:32 +02:00
Merge branch 'bugfix/linux_target_gen_partition_table' into 'master'
multiple fixes for linux target Closes IDF-6641 See merge request espressif/esp-idf!21993
This commit is contained in:
@@ -7,5 +7,3 @@ set(COMPONENTS main)
|
|||||||
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
||||||
|
|
||||||
project(partition_api_test)
|
project(partition_api_test)
|
||||||
|
|
||||||
add_dependencies(partition_api_test.elf partition-table)
|
|
||||||
|
@@ -8,11 +8,10 @@ Source the IDF environment as usual.
|
|||||||
|
|
||||||
Once this is done, build the application:
|
Once this is done, build the application:
|
||||||
```bash
|
```bash
|
||||||
idf.py build partition-table
|
idf.py build
|
||||||
```
|
```
|
||||||
Note that for the time being, `partition-table` target needs to be built manually.
|
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
```bash
|
```bash
|
||||||
`build/partition_api_test.elf`
|
idf.py monitor
|
||||||
```
|
```
|
||||||
|
@@ -19,10 +19,8 @@ First, make sure that the target is set to Linux. Run `idf.py --preview set-targ
|
|||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
IDF monitor doesn't work yet for Linux. You have to run the app manually:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/test_rom_host.elf
|
idf.py monitor
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example Output
|
## Example Output
|
||||||
@@ -30,7 +28,7 @@ IDF monitor doesn't work yet for Linux. You have to run the app manually:
|
|||||||
Ideally, all tests pass, which is indicated by "All tests passed" in the last line:
|
Ideally, all tests pass, which is indicated by "All tests passed" in the last line:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./build/test_rom_host.elf
|
$ idf.py monitor
|
||||||
test
|
test
|
||||||
===============================================================================
|
===============================================================================
|
||||||
All tests passed (8 assertions in 6 test cases)
|
All tests passed (8 assertions in 6 test cases)
|
||||||
|
@@ -19,10 +19,8 @@ First, make sure that the target is set to Linux. Run `idf.py --preview set-targ
|
|||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
IDF monitor doesn't work yet for Linux. You have to run the app manually:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/test_log_host.elf
|
idf.py monitor
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example Output
|
## Example Output
|
||||||
@@ -30,7 +28,7 @@ IDF monitor doesn't work yet for Linux. You have to run the app manually:
|
|||||||
Ideally, all tests pass, which is indicated by "All tests passed" in the last line:
|
Ideally, all tests pass, which is indicated by "All tests passed" in the last line:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./build/test_log_host.elf
|
$ idf.py monitor
|
||||||
===============================================================================
|
===============================================================================
|
||||||
All tests passed (8 assertions in 6 test cases)
|
All tests passed (8 assertions in 6 test cases)
|
||||||
```
|
```
|
||||||
|
@@ -8,5 +8,3 @@ set(COMPONENTS main)
|
|||||||
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
||||||
|
|
||||||
project(nvs_host_test)
|
project(nvs_host_test)
|
||||||
|
|
||||||
add_dependencies(nvs_host_test.elf partition-table)
|
|
||||||
|
@@ -33,10 +33,8 @@ First, make sure that the target is set to Linux. Run `idf.py --preview set-targ
|
|||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
IDF monitor doesn't work yet for Linux. You have to run the app manually:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/host_nvs_page_test.elf
|
idf.py monitor
|
||||||
```
|
```
|
||||||
|
|
||||||
## Coverage
|
## Coverage
|
||||||
@@ -48,7 +46,7 @@ To generate the coverage, run: `idf.py coverage`. Afterwards, you can view the c
|
|||||||
Ideally, all tests pass, which is indicated by the last two log lines after the dashed line:
|
Ideally, all tests pass, which is indicated by the last two log lines after the dashed line:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
build/host_nvs_page_test.elf
|
$ idf.py monitor
|
||||||
../main/nvs_page_test.cpp:880:test_Page_load_reading_header_fails:PASS
|
../main/nvs_page_test.cpp:880:test_Page_load_reading_header_fails:PASS
|
||||||
../main/nvs_page_test.cpp:881:test_Page_load_reading_data_fails:PASS
|
../main/nvs_page_test.cpp:881:test_Page_load_reading_data_fails:PASS
|
||||||
../main/nvs_page_test.cpp:882:test_Page_load__uninitialized_page_has_0xfe:PASS
|
../main/nvs_page_test.cpp:882:test_Page_load__uninitialized_page_has_0xfe:PASS
|
||||||
|
@@ -96,6 +96,24 @@ else()
|
|||||||
"Either change partition table in menuconfig or create this input file.")
|
"Either change partition table in menuconfig or create this input file.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(${target} STREQUAL "linux" AND EXISTS ${partition_csv})
|
||||||
|
# partition-table target is normally invoked as a dependency of 'flash' target.
|
||||||
|
# However, when building for "linux" target, 'flash' target doesn't exist,
|
||||||
|
# so we need to attach the partition table build to the executable target.
|
||||||
|
#
|
||||||
|
# The problem is that the executable target is not yet defined
|
||||||
|
# when the component CMakeLists.txt file is evaluated, so we
|
||||||
|
# can only get it as a generator expression. But generator expressions
|
||||||
|
# can't be used in 'add_dependencies':
|
||||||
|
# https://gitlab.kitware.com/cmake/cmake/-/issues/19467
|
||||||
|
#
|
||||||
|
# Therefore attach partition-table to the internal __idf_build_target
|
||||||
|
# target. This is a hack, since that target name is an implementation detail
|
||||||
|
# of the build system.
|
||||||
|
|
||||||
|
add_dependencies(__idf_build_target partition-table)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add signing steps
|
# Add signing steps
|
||||||
if(CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME)
|
if(CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME)
|
||||||
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
|
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
|
||||||
|
@@ -22,4 +22,5 @@ set_property(
|
|||||||
DIRECTORY
|
DIRECTORY
|
||||||
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "../image.bin")
|
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "../image.bin")
|
||||||
|
|
||||||
add_dependencies(host_test_spiffs.elf partition-table image.bin)
|
|
||||||
|
add_dependencies(host_test_spiffs.elf image.bin)
|
||||||
|
@@ -13,5 +13,5 @@ idf.py build
|
|||||||
|
|
||||||
# Run
|
# Run
|
||||||
```bash
|
```bash
|
||||||
build/host_test_spiffs.elf
|
idf.py monitor
|
||||||
```
|
```
|
||||||
|
@@ -7,8 +7,8 @@ from elftools.elf.elffile import ELFFile
|
|||||||
|
|
||||||
class PcAddressMatcher(object):
|
class PcAddressMatcher(object):
|
||||||
"""
|
"""
|
||||||
Class for detecting potentional addresses which will consequently run through the external addr2line command to
|
Class for detecting potential addresses which will consequently run through the external addr2line command to
|
||||||
indentify and print information about it.
|
identify and print information about it.
|
||||||
|
|
||||||
The input to this class is the path to the ELF file. Addresses of sections with executable flag are stored and
|
The input to this class is the path to the ELF file. Addresses of sections with executable flag are stored and
|
||||||
used later for lookup.
|
used later for lookup.
|
||||||
@@ -18,6 +18,14 @@ class PcAddressMatcher(object):
|
|||||||
self.intervals = []
|
self.intervals = []
|
||||||
try:
|
try:
|
||||||
with open(elf_path, 'rb') as f:
|
with open(elf_path, 'rb') as f:
|
||||||
|
# Is this an ELF file?
|
||||||
|
elf_magic = f.read(4)
|
||||||
|
if elf_magic != b'\x7fELF':
|
||||||
|
# Probably not an ELF file
|
||||||
|
# (could be Mach-O format on macOS, for example)
|
||||||
|
raise NotImplementedError()
|
||||||
|
f.seek(0)
|
||||||
|
|
||||||
elf = ELFFile(f)
|
elf = ELFFile(f)
|
||||||
|
|
||||||
for section in elf.iter_sections():
|
for section in elf.iter_sections():
|
||||||
@@ -30,13 +38,15 @@ class PcAddressMatcher(object):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# ELF file is just an optional argument
|
# ELF file is just an optional argument
|
||||||
pass
|
pass
|
||||||
|
except NotImplementedError:
|
||||||
|
pass
|
||||||
|
|
||||||
# sort them in order to have faster lookup
|
# sort them in order to have faster lookup
|
||||||
self.intervals = sorted(self.intervals)
|
self.intervals = sorted(self.intervals)
|
||||||
|
|
||||||
def is_executable_address(self, addr): # type: (int) -> bool
|
def is_executable_address(self, addr): # type: (int) -> bool
|
||||||
"""
|
"""
|
||||||
Returns True/False depending on of "addr" is in one of the ELF sections with executable flag set.
|
Returns True/False if "addr" is in one of the ELF sections with executable flag set.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for start, end in self.intervals:
|
for start, end in self.intervals:
|
||||||
|
Reference in New Issue
Block a user