8000 add reference to battery-powered applications to advanced usage in RE… · lmarkrol/micropython-esp32-ulp@26048c8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 26048c8

Browse files
committed
add reference to battery-powered applications to advanced usage in README
While py-esp32-ulp could be used on a PC to generate the ULP binary, which in turn could be uploaded to an ESP32, this workflow can also be realised using binutils-esp32ulp on the PC. py-esp32-ulp makes it easy to work directly on the ESP32 to assemble code for the ULP. However, the ESP32 is rather slow at doing this, which becomes relevant in battery-powered applications, where every second of sleep time is valuable. The documentation therefore no longer refers to the use-case of assembling ULP code on a PC, and adds a short reference to battery- powered applications as one reason, why one might want to split the assembly and load phase and store the ULP binary into a file.
1 parent cefeb9d commit 26048c8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ Advanced usage
8686

8787
In real world applications, you might want to separate the assembly stage from
8888
the loading/running stage, to avoid having to assemble the code on every startup.
89+
This can be useful for battery-powered applications, where every second of sleep
90+
time matters.
91+
92+
Splitting the assembly and load stage can be combined with other techniques to
93+
for example implement a caching mechansim for the ULP binary, which automatically
94+
updates the binary every time the assembly source code changes.
8995

9096
The ``esp32_ulp.assemble_file`` function stores the assembled and linked binary
9197
into a file with a ``.ulp`` extension, which can later be loaded directly without
@@ -99,16 +105,6 @@ assembling the source again.
99105
import esp32_ulp
100106
esp32_ulp.assemble_file('code.S') # this results in code.ulp
101107
102-
Alternatively you can assemble the source on a PC with MicroPython, and transfer
103-
the resulting ULP binary to the ESP32.
104-
105-
.. code-block:: python
106-
107-
git clone https://github.com/ThomasWaldmann/py-esp32-ulp
108-
cd py-esp32-ulp
109-
micropython -m esp32_ulp path/to/code.S # this results in path/to/code.ulp
110-
# now upload path/to/code.ulp to the ESP32
111-
112108
2. The above prints out the offsets of all global symbols/labels. For the next step,
113109
you will need to note down the offset of the label, which represents the entry
114110
point to your code.
@@ -135,6 +131,10 @@ assembling the source again.
135131
# 2 words * 4 = 8 bytes
136132
ulp.run(2*4) # specify the offset of the entry point label
137133
134+
To update the binary every time the source code changes, you would need a mechanism
135+
to detect that the source code changed. Whenever needed, manually re-running the
136+
``assemble_file`` function as shown above, would also work.
137+
138138

139139
Preprocessor
140140
------------

0 commit comments

Comments
 (0)
0