-
Notifications
You must be signed in to change notification settings - Fork 25
Updated docs, less ugly imports and a useful example #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great stuff, only found some typos / phrasing things.
0680495
to
a7c8d86
Compare
Thanks for the feedback. Fixed/improved all the cases. Some wording the blink assembly was chosen to explain how the assembler opcodes (e.g. "jump eq" means, jump if last ALU operation result was zero), but I moved that explanation into brackets now with an explanation of the intent as the main comment. Definitely clearer now. Thanks for mentioning. I amended the commits and force pushed. |
When running unit tests on the ESP32, the current directory is root, while on the PC (or in the GitHub Actions), the tests/ directory is the current directory. Unit tests that rely on fixture files fails because of this. Now test scripts can look for fixture files relative to their own path to make them independent of the current directory.
This allows for comparing binaries generated on the ESP32 with those generated on the PC with binutils-esp32ulp. During testing on the ESP32, given that there is no binutils-esp32ulp, only the py-esp32-ulp part of the compat tests can run. Calculating the SHA1 for each resulting file from the compat tests, then allows comparing those hashes with hashes calculated on the PC.
If code outside our main entry point, e.g. our examples, wanted to use the src_to_binary function, it needed an ugly import of esp32_ulp.__main__. With this change the import becomes cleaner, e.g. `from esp32_ulp import src_to_binary`. The original "main" method, which took a filename as input and resulted in a ULP binary file as output, is now also more cleanly available as assemble_file() inside the esp32_ulp module. Fixes micropython#39.
This example makes the ULP turn on and off GPIO2 at regular intervals. If one attaches an LED to GPIO2 and GND, it would blink with a period of approximately 500ms for on and off each. The example defines all needed RTC constants, so it is usable even without a populated Defines DB. The example ends with a loop showing the contents of two memory fields, which the ULP code updates. This allows seeing that the ULP is working. (Can be useful for running the example, even when there is no LED connected to GPIO2). Fixes micropython#12.
Also, what versions and devices everything was tested on. Everything was tested all the way back to v1.10 today, and the current code works correctly. However, MicroPython v1.11 has a bug related to loading the ULP binary, so while py-esp32-ulp produces correct binaries on that version, they can not actually be used on the same version. To avoid explaining all this detail, MicroPython v1.12 was chosen as the minimum supported version. (Actually MicroPython v1.12 massively reduced its own memory consumption, which makes it much better for py-esp32-ulp anyway, especially when assembling larger sources.) Fixes micropython#48.
Add detail on what is not supported. Change from "alpha" to "beta" for expressing the relative quality level of this software.
a7c8d86
to
afe0517
Compare
Thanks! |
A few more changes for version 1.0.
This change fixes:
Apart from the above fixes, the code has now been extensively tested on ESP32 devices.
It was tested on:
The following was tested on each device:
02_compat_rtc_tests.sh
script) pass with a few exceptions (see below). On the PC the test script clones test sources from Github repos, so these sources were manually copied to the ESP32. Again SHA1 hashes were used to compare the output with binutils-esp32-ulp.02_compat_rtc_tests.sh tests that did not pass - due to memory limits:
esp32ulp_all.s
is a relatively long file, butesp32ulp_globals.s
not so much, so I will still look a little into memory usage. However, I would say, those 2 scripts are "contrived examples" and all the "real" examples from the public sources worked, including the new blink example, and some longer real code I am using in an actual device.I am not sure those memory issues should further hold up v1.0 (other than that I will do a sanity check, as to why the rather short
esp32ulp_globals.s
needs so much memory - it seems the large number of symbols may be the reason).