Skip to content

Commit 955a7c8

Browse files
committed
remove(make_image): Remove the make_image command in favor of other workflows
BREAKING CHANGE
1 parent 8016455 commit 955a7c8

File tree

7 files changed

+10
-124
lines changed

7 files changed

+10
-124
lines changed

docs/en/esptool/advanced-commands.rst

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -160,23 +160,6 @@ This will read 4 bytes from SFDP address 16.
160160

161161
esptool.py chip_id
162162

163-
.. _make-image:
164-
165-
Assemble a Firmware Image: ``make_image``
166-
-----------------------------------------
167-
168-
``make_image`` allows you to manually assemble a firmware image from binary segments (such as those extracted from objcopy). For example:
169-
170-
::
171-
172-
esptool.py --chip esp8266 make_image -f app.text.bin -a 0x40100000 -f app.data.bin -a 0x3ffe8000 -f app.rodata.bin -a 0x3ffe8c00 app.flash.bin
173-
174-
This command does not require a serial connection.
175-
176-
.. note::
177-
178-
In general, it is better to create an ELF image (including any binary data as part of the ELF, by using objcopy or other tools) and then use ``elf2image`` to generate the ``.bin`` file.
179-
180163
.. _run:
181164

182165
Boot Application Code: ``run``

docs/en/esptool/basic-commands.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,5 +340,4 @@ The following commands are less commonly used, or only of interest to advanced u
340340
* :ref:`write-flash-status`
341341
* :ref:`read-flash-sfdp`
342342
:esp8266: * :ref:`chip-id`
343-
:esp8266: * :ref:`make-image`
344343
:esp8266: * :ref:`run`

docs/en/esptool/scripting.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ The following commands can run without the need for a connected chip:
172172

173173
.. autofunction:: esptool.cmds.image_info
174174

175-
.. autofunction:: esptool.cmds.make_image
176-
177175
------------
178176

179177
Utility Functions

docs/en/migration-guide.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,12 @@ The ``--ignore-flash-encryption-efuse-setting`` option of the :ref:`write_flash
171171
**Migration Steps:**
172172

173173
1. Rename the ``--ignore-flash-encryption-efuse-setting`` to ``--ignore-flash-enc-efuse`` in any existing ``write_flash`` commands in scripts/CI pipelines.
174+
175+
``make_image`` Command Removal
176+
******************************
177+
178+
The ``make_image`` command for the ESP8266 has been **removed in v5**. This command has been deprecated in favor of using **objcopy** (or other tools) to generate ELF images and then using ``elf2image`` to create the final ``.bin`` file.
179+
180+
**Migration Steps:**
181+
182+
1. Replace any ``make_image`` workflows with the recommended way of assembling firmware images using **objcopy** and ``elf2image``.

esptool/__init__.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"get_security_info",
1616
"image_info",
1717
"load_ram",
18-
"make_image",
1918
"merge_bin",
2019
"read_flash",
2120
"read_flash_status",
@@ -55,7 +54,6 @@
5554
get_security_info,
5655
image_info,
5756
load_ram,
58-
make_image,
5957
merge_bin,
6058
read_flash,
6159
read_flash_status,
@@ -168,7 +166,6 @@
168166
"write_flash_status",
169167
"read_flash_sfdp",
170168
"chip_id",
171-
"make_image",
172169
"run",
173170
"get_security_info",
174171
],
@@ -633,26 +630,6 @@ def image_info_cli(ctx, filename):
633630
image_info(filename, ctx.obj["chip"])
634631

635632

636-
@cli.command("make_image")
637-
@click.argument("output", type=click.Path())
638-
@click.option(
639-
"--segfile",
640-
"-f",
641-
multiple=True,
642-
type=click.Path(exists=True),
643-
help="Segment input file",
644-
)
645-
@click.option(
646-
"--segaddr", "-a", multiple=True, type=AnyIntType(), help="Segment base address"
647-
)
648-
@click.option(
649-
"--entrypoint", "-e", type=AnyIntType(), default=0, help="Address of entry point"
650-
)
651-
def make_image_cli(output, segfile, segaddr, entrypoint):
652-
"""Create an application image from binary files"""
653-
make_image(segfile, segaddr, output, entrypoint)
654-
655-
656633
@cli.command("elf2image")
657634
@click.argument("input", type=click.Path(exists=True))
658635
@click.option(

esptool/cmds.py

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from serial import SerialException
1717
from typing import BinaryIO
1818

19-
from .bin_image import ELFFile, ImageSegment, LoadFirmwareImage
19+
from .bin_image import ELFFile, LoadFirmwareImage
2020
from .bin_image import (
2121
ESP8266ROMFirmwareImage,
2222
ESP8266V2FirmwareImage,
@@ -1911,53 +1911,6 @@ def get_key_from_value(dict, val):
19111911
log.print(f"Compile time: {bootloader_desc['date_time']}")
19121912

19131913

1914-
def make_image(
1915-
segfile: list[str],
1916-
segaddr: list[int],
1917-
output: str | None = None,
1918-
entrypoint: int = 0,
1919-
) -> bytes | None:
1920-
"""
1921-
Assemble an ESP8266 firmware image using binary segments. ESP8266-only.
1922-
1923-
Args:
1924-
segfile: List of file paths containing binary segment data.
1925-
segaddr: List of memory addresses corresponding to each segment.
1926-
output: Path to save the output firmware image file.
1927-
If None, the function returns the image as bytes.
1928-
entrypoint: Entry point address for the firmware.
1929-
1930-
Returns:
1931-
None if output is provided; otherwise, returns the assembled
1932-
firmware image as bytes.
1933-
"""
1934-
log.print("Creating ESP8266 image...")
1935-
image = ESP8266ROMFirmwareImage()
1936-
if len(segfile) == 0:
1937-
raise FatalError("No segments specified")
1938-
if len(segfile) != len(segaddr):
1939-
raise FatalError(
1940-
"Number of specified files does not match the number of specified addresses"
1941-
)
1942-
for seg, addr in zip(segfile, segaddr):
1943-
with open(seg, "rb") as f:
1944-
data = f.read()
1945-
image.segments.append(ImageSegment(addr, data))
1946-
image.entrypoint = entrypoint
1947-
if output is not None:
1948-
# Save image to the provided file path.
1949-
image.save(output)
1950-
log.print("Successfully created ESP8266 image.")
1951-
return None
1952-
else:
1953-
# Save image to a BytesIO buffer and return the bytes.
1954-
buf = io.BytesIO()
1955-
image.save(buf)
1956-
result = buf.getvalue()
1957-
log.print("Successfully created ESP8266 image.")
1958-
return result
1959-
1960-
19611914
def merge_bin(
19621915
addr_filename: list[tuple[int, BinaryIO]],
19631916
output: str,

test/test_esptool.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,39 +1533,6 @@ def test_read_get_chip_features(self):
15331533
esp._port.close()
15341534

15351535

1536-
@pytest.mark.skipif(
1537-
arg_chip != "esp8266", reason="Make image option is supported only on ESP8266"
1538-
)
1539-
class TestMakeImage(EsptoolTestCase):
1540-
def verify_image(self, offset, length, image, compare_to):
1541-
with open(image, "rb") as f:
1542-
f.seek(offset)
1543-
rb = f.read(length)
1544-
with open(compare_to, "rb") as f:
1545-
ct = f.read()
1546-
if len(rb) != len(ct):
1547-
print(
1548-
f"WARNING: Expected length {len(ct)} doesn't match comparison {len(rb)}"
1549-
)
1550-
print(f"Readback {len(rb)} bytes")
1551-
self.diff(rb, ct)
1552-
1553-
def test_make_image(self):
1554-
output = self.run_esptool(
1555-
"make_image test"
1556-
" -a 0x0 -f images/sector.bin -a 0x1000 -f images/fifty_kb.bin"
1557-
)
1558-
try:
1559-
assert "Successfully created ESP8266 image." in output
1560-
assert os.path.exists("test0x00000.bin")
1561-
self.verify_image(16, 4096, "test0x00000.bin", "images/sector.bin")
1562-
self.verify_image(
1563-
4096 + 24, 50 * 1024, "test0x00000.bin", "images/fifty_kb.bin"
1564-
)
1565-
finally:
1566-
os.remove("test0x00000.bin")
1567-
1568-
15691536
@pytest.mark.skipif(
15701537
"ESPTOOL_TEST_USB_OTG" in os.environ or arg_preload_port is not False,
15711538
reason="Boot mode strapping pin pulled constantly low, "

0 commit comments

Comments
 (0)