@@ -25,6 +25,8 @@ You can also specify additional options to ``disassemble.py`` as follows:
2525+--------------------------+----------------------------------------------------------------+
2626| Option| Description|
2727+==========================+================================================================+
28+ | ``-c `` or ``--mcpu ``| Choose ULP variant: either esp32 or esp32s2|
29+ +--------------------------+----------------------------------------------------------------+
2830| ``-h ``| Show help text|
2931+--------------------------+----------------------------------------------------------------+
3032| | ``-m <bytes sequence>`` || Disassemble a provided sequence of hex bytes|
@@ -43,18 +45,31 @@ specified file.
4345Note that the ULP header is validates and files with unknown magic bytes will be
4446rejected. The correct 4 magic bytes at the start of a ULP binary are ``ulp\x00 ``.
4547
46- Example:
48+ Example disassembling an ESP32 ULP binary :
4749
4850..code-block ::shell
4951
5052 $ micropython -m tools.disassemble path/to/binary.ulp
5153 .text
5254 0000 040000d0 LD r0, r1, 0
53- 0004 0e0400d0 LD r2, r3, 1
55+ 0004 0e0000d0 LD r2, r3, 0
56+ 0008 04000068 ST r0, r1, 0
57+ 000c 0b000068 ST r3, r2, 0
58+ .data
59+ 0010 00000000< empty>
60+
61+ Example disassembling an ESP32-S2 ULP binary:
62+
63+ ..code-block ::shell
64+
65+ $ micropython -m tools.disassemble -c esp32s2 path/to/binary.ulp
66+ .text
67+ 0000 040000d0 LD r0, r1, 0
68+ 0004 0e0000d0 LD r2, r3, 0
5469 0008 84010068 ST r0, r1, 0
55- 000c8b090068 ST r3, r2,2
70+ 000c8b010068 ST r3, r2,0
5671 .data
57- 0000 00000000< empty>
72+ 0010 00000000< empty>
5873
5974
6075 Disassembling a byte sequence
@@ -129,18 +144,20 @@ For example:
129144 Disassembling on device
130145-----------------------------
131146
132- The disassembler also works when used on an ESP32.
147+ The disassembler also works when used on an ESP32 device .
133148
134149To use the disassembler on a real device:
135150
136151* ensure ``micropython-esp32-ulp `` is installed on the device (see `docs/index.rst </docs/index.rst >`_).
137- * upload ``tools/disassemble.py `` to the device (any directory will do)
138- * run the following:
152+ * upload ``tools/disassemble.py `` ``tools/decode.py `` and ``tools/decode_s2.py `` to the device
153+ (any directory will do, as long as those 3 files are in the same directory)
154+ * the following example code assumes you placed the 3 files into the device's "root" directory
155+ * run the following (note, we must specify which the cpu the binary is for):
139156
140157 ..code-block ::python
141158
142159from disassembleimport disassemble_file
143160# then either:
144- disassemble_file(' path/to/file.ulp' )# normal mode
161+ disassemble_file(' path/to/file.ulp' , cpu = ' esp32s2 ' )# normal mode
145162# or:
146- disassemble_file(' path/to/file.ulp' ,True )# verbose mode
163+ disassemble_file(' path/to/file.ulp' ,cpu = ' esp32s2 ' , verbose = True )# verbose mode