-
Notifications
You must be signed in to change notification settings - Fork 136
ESP32: add support to light sleep #1789
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
base: release-0.6
Are you sure you want to change the base?
ESP32: add support to light sleep #1789
Conversation
778ca20 to
0cb4308
Compare
| } | ||
| #endif | ||
|
|
||
| static term nif_esp_gpio_wakeup_enable(Context *ctx, int argc, term argv[]) |
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.
I would call this gpio:wakeup_enable/2 to match with the esp-idf function name.
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.
this means we are leaking more ESP32 specific stuff into GPIO module. I think they can be made somehow generic, but I'm not sure how.
|
There is something that I'd like to here the opinion about: Should we use the |
We could use BEAM documentation reads:
|
0cb4308 to
4d62044
Compare
This is an interesting suggestion, and might be useful to expose an API for pushing other “monitored” events, like acquiring or loosing a network connection. I think some standardized notification system would be good, but it should be opt in, so extra resources are not consumed if they are not used. |
bigint: misc fixes Those bugs were unlikely causing a crash, but still code wasn't correct. As an additional change: add `size_align_up_pow2` and similar utilities to `utils.h` since they are also required in intn.h as well. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Previous names, such as intn_2_digits_to_int64 were pretty cryptic. Signed-off-by: Davide Bettio <davide@uninstall.it>
Names with `mn` prefix were less readable. Signed-off-by: Davide Bettio <davide@uninstall.it>
Also remove INTN_ABS_OUT_LEN and INTN_NEG_OUT_LEN macros, since intn doesn't use anymore 2-complement. Signed-off-by: Davide Bettio <davide@uninstall.it>
…or-platforms-with-3-operands JIT: optimize shift right for platforms with 3 operands Continuation of atomvm#1838 These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Use a cache to remember tail calls that were already implemented and replace further implementations of the same tail call with a jump to the previous implementation. Coverage shows that all cases are covered in libs/estdlib/src and libs/jit/src: OP_RETURN: 50 misses, 1735 hits (97%) OP_JUMP/OP_CALL_LAST/OP_CALL_ONLY: 656 misses, 389 hits (37%) OP_CALL_LAST: 220 misses, 206 hits (48%) OP_FUNC_INFO: 58 misses, 1619 hits (97%) Signed-off-by: Paul Guyot <pguyot@kallisys.net>
Signed-off-by: Paul Guyot <pguyot@kallisys.net>
Improve intn function names Function names such as intn_addmn` were quite unreadable, let's just remove `mn` suffix. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Document `intn` Continuation of atomvm#1929 These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Documentation wasn't correct, they were already accepting non-normalized integers: - intn_to_string() - intn_to_integer_bytes() - intn_required_unsigned_integer_bytes() Changed to support integers not in normal form: - intn_to_double Signed-off-by: Davide Bettio <davide@uninstall.it>
Remove valgrind-suppressions.sup.license. Signed-off-by: Davide Bettio <davide@uninstall.it>
Aarch64: add tests for better coverage These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Support unnormalized intn Fix documentation about functions accepting big integers in not-normalized form, and extend intn_to_double to accept them. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Remove unused file Remove valgrind-suppressions.sup.license. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
…-reduce-binary-size JIT: factorize tail calls to reduce binary size Continuation of atomvm#1900 These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Add a new `term_reuse_binary` to reuse a refc binary, taking advantage of private_append compiler optimization. Add handling of out of memory errors in term_alloc_refc_binary by raising out of memory error instead of aborting. Update `and_/3` signature in JIT backends to handle and with a new register, and performed few optimizations accordingly by removing unnecessary copy. Signed-off-by: Paul Guyot <pguyot@kallisys.net>
Implement support for private_append These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
This function name is going to be used from term.h. Also since it is a static helper, put verb first. Signed-off-by: Davide Bettio <davide@uninstall.it>
Replace duplicated code with new functions in term.h. Signed-off-by: Davide Bettio <davide@uninstall.it>
Use `term_initialize_bigint` instead of `term_intn_data` + `intn_copy` Signed-off-by: Davide Bettio <davide@uninstall.it>
`term_create_uninitialized_intn` -> `term_create_uninitialized_bigint` `term_intn_to_term_size` -> `term_bigint_size_requirements` Also add doxygen documentation. Signed-off-by: Davide Bettio <davide@uninstall.it>
Rename it to BOXED_BIGINT_HEAP_SIZE, and clarify that it must be always used, in order to have the suitable size for allocating space for the bigint term with its boxed header. Signed-off-by: Davide Bettio <davide@uninstall.it>
Use better names than bn1, bn2 (such as big1, big2), etc... Signed-off-by: Davide Bettio <davide@uninstall.it>
Move before all arithmetic and bitwise functions bitwise helpers. Signed-off-by: Davide Bettio <davide@uninstall.it>
Update it in order to build Range.ex. Signed-off-by: Davide Bettio <davide@uninstall.it>
Elixir: Range: fix compile error with Elixir 1.8 These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
IO.warn is not available, and the 1.19 internal function consolidate changed a tiny bit. Signed-off-by: Peter M <petermm@gmail.com>
Fix Protocol.ex warnings IO.warn is not available, and the 1.19 internal function consolidate changed a tiny bit. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Just update v5.5.1 -> v5.5.2. No other updates are available. Update also esp32-mkimage.yaml and esp32-simtest.yaml. Signed-off-by: Davide Bettio <davide@uninstall.it>
CI: esp32-build: update latest esp-idf Just update v5.5.1 -> v5.5.2. No other updates are available. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Switch from CMAKE_BINARY_DIR found when configuring with cmake to determining the paths at runtime. This allows configuring and building with the espressif/esp-idf docker image, and later running the escript in the host environment with OTP (and optionally Elixir and/or Gleam) installed. Signed-off-by: Winford <winford@object.stream>
Determine paths for ESP32 mkimage.sh at runtime These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Signed-off-by: schnittchen <schnittchen@das-labor.org>
Fix error log These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
CI was having some odd failures, just update it. Signed-off-by: Davide Bettio <davide@uninstall.it>
Update node and nvm script. Signed-off-by: Davide Bettio <davide@uninstall.it>
These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Start disabling them on MCU targets. Signed-off-by: Davide Bettio <davide@uninstall.it>
Start phasing out old OTP versions Start disabling them on MCU targets. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
AVM_PRINT_PROCESS_CRASH_DUMPS was introduced with bcfdcc6 (PR atomvm#1799), but the option hasn't been exposed / set on embedded targets (such as esp32, stm32 and rp2). The reason is that esp32 CMakeLists.txt doesn't include the root CMakeLists.txt, and the libAtomVM one doesn't have that option defined (it is defined on the root CMakeLists.txt), so that option didn't have a default value. Signed-off-by: Davide Bettio <davide@uninstall.it>
Signed-off-by: Peter M <petermm@gmail.com>
…dded-plat Enable/Make AVM_PRINT_PROCESS_CRASH_DUMPS work on embedded platforms These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
CI: Fix freebsd nxdomain failure These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
|
lgtm, there is also some docs over here:
AtomVM/doc/src/build-instructions.md Line 384 in 6330d9f
that needs updating |
Add missing `/erlang`. Signed-off-by: Davide Bettio <davide@uninstall.it>
Doc: distributed-erlang.md: fix example file path These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Support to OTP version < 26 is not compiled by default. Signed-off-by: Davide Bettio <davide@uninstall.it>
emscripten: phase out old OTP version (< 26) These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Supercedes: atomvm#2063 CI: Only test release-v5.4 and 5.5.2 for ESP32P4, due to their support for both P4 revisions. Changelog fixes and additions. Other minor fixes related to CI. Signed-off-by: Peter M <petermm@gmail.com>
Signed-off-by: Peter M <petermm@gmail.com>
Fix ESP32-P4 builds and deep_sleep_hold Supercedes: atomvm#2063 CI: Only test release-v5.4 and 5.5.2 for ESP32P4, due to their support for both P4 revisions. Changelog fixes and additions. Other minor fixes related to CI. (simulator has gotten task_wdt support but, it's currently broken P4) These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Allow putting ESP32 to light sleep, and wake it up using a GPIO or a timer. Signed-off-by: Davide Bettio <davide@uninstall.it>
4d62044 to
a07cef1
Compare
| if (n <= 64) { | ||
| union maybe_unsigned_int64 value; | ||
| bool status = bitstring_extract_integer( | ||
| ((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term Error
| bool status; | ||
| switch (n) { | ||
| case 16: | ||
| status = bitstring_extract_f16(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term Error
| status = bitstring_extract_f16(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); | ||
| break; | ||
| case 32: | ||
| status = bitstring_extract_f32(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term Error
| status = bitstring_extract_f32(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); | ||
| break; | ||
| case 64: | ||
| status = bitstring_extract_f64(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term Error
Allow putting ESP32 to light sleep, and wake it up using a GPIO or a timer.
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later