Hi Felipe,

What exactly is your problem regarding light sleep and Wi-Fi?

If I'm not mistaken, some hooks must be implemented in the Wi-Fi driver
too. My suggestion: take a look at IDF's implementation and try light sleep
with/without Wi-Fi: compare the `sdkconfig.h` enabling/disabling light
sleep. Then, check which configs are on the Wi-Fi related files.

Looking towards hearing from you soon.

Best regards,

Em seg., 11 de nov. de 2024 às 17:52, Felipe Moura Oliveira <
moura....@gmail.com> escreveu:

> Hello everyone,
>
> Tiago, actually I am able to compile and run light sleep using nsh
> configuration, but it's failing when I am using wifi configuration. I tried
> it by myself but I cannot solve it, can you give some help please?
> I push a draft to you look it easely:
> https://github.com/apache/nuttx/pull/14726
>
> You can config a work example running the following cmd:
> ./tools/configure.sh esp32c6-devkitc:sleep_test
>
> This config basically is nsh + CONFIG_ESP_AUTO_SLEEP=y and
> CONFIG_EXAMPLES_HELLO=y. Auto_sleep is new config done by me,
>
> Please, change hello_main.c with the code below:
>
>
> /****************************************************************************
> * apps/examples/hello/hello_main.c
> */
>
> #include <nuttx/config.h>
> #include <stdio.h>
> #include <stdint.h>
> #include <time.h>
> #include <unistd.h>
> #include <pthread.h>
> #include <stdlib.h>
>
>
> /****************************************************************************
> * Definitions
>
> ****************************************************************************/
>
> #define NUM_THREADS 5
>
>
> /****************************************************************************
> * Private Data
>
> ****************************************************************************/
>
> struct thread_info {
> int thread_id;
> unsigned int sleep_time;
> };
>
>
> /****************************************************************************
> * Private Functions
>
> ****************************************************************************/
>
> void *thread_func(void *arg)
> {
> struct thread_info *tinfo = (struct thread_info *)arg;
> volatile uint32_t i = 0;
> struct timespec ts_start, ts_end;
> time_t elapsed;
>
> // Get the start time
> clock_gettime(CLOCK_MONOTONIC, &ts_start);
>
> while (1)
> {
> i++;
> clock_gettime(CLOCK_MONOTONIC, &ts_end);
> elapsed = ts_end.tv_sec - ts_start.tv_sec;
> printf("Hello, World!! [Thread %d] Iteration: %lu | Elapsed time: %ld
> seconds\n",
> tinfo->thread_id, i, (long)elapsed);
> ts_start = ts_end;
> sleep(tinfo->sleep_time);
> }
>
> return NULL;
> }
>
>
> /****************************************************************************
> * Public Functions
>
> ****************************************************************************/
>
>
> /****************************************************************************
> * main
>
> ****************************************************************************/
>
> int main(int argc, FAR char *argv[])
> {
> pthread_t threads[NUM_THREADS];
> struct thread_info tinfo[NUM_THREADS];
> int ret;
>
> unsigned int sleep_times[NUM_THREADS] = {15, 11, 30, 70, 25};
>
> for (int i = 0; i < NUM_THREADS; i++)
> {
> tinfo[i].thread_id = i + 1;
> tinfo[i].sleep_time = sleep_times[i];
>
> ret = pthread_create(&threads[i], NULL, thread_func, &tinfo[i]);
> if (ret != 0)
> {
> printf("Error creating thread %d: %d\n", i + 1, ret);
> exit(EXIT_FAILURE);
> }
> }
> int app_ret = 0;
> if (app_ret == -1) {
> printf("Error executing command\n");
> } else {
> printf("Application finished with return code: %d\n", app_ret);
> }
>
> while (1)
> {
> printf("Hello, World!! [Main Thread]\n");
> sleep(10);
> }
>
> return 0;
> }
>
>
>
> You will see output below:
> nsh> hello
> Aplicação finalizou com código de retorno: 0
> Hello, World!! [Main Thread]
> Hello, World!! [Thread 1] Iteração: 1 | Tempo decorrido: 0 segundos
> Hello, World!! [Thread 2] It*pmu_*eração: 1 | Tempo decorrido: 0 segundos
> Hello, World!! [Thread 3] Iteração: 1 | Tempo decorrido: 0 segundos
> Hello, World!! [Thread 4] Iteração: 1 | Tempo decorrido: 0 segundos
> Hello, World!! [Thread 5] Iteração: 1 | Tempo decorrido: 0 segundos
> *pmu_*Hello, World!! [Main Thread]
> Hello, World!! [Thread 2] Iteração: 2 | Tempo decorrido: 11 segundos
> Hello, World!! [Thread 1] Iteração: 2 | Tempo decorrido: 16 segundos
>
> I was able to power consumption below 1 mA when mcu is in idle mode, so it
> is in light sleep.
>
> Later, making a distclean, running wifi config and adding
> CONFIG_ESP_AUTO_SLEEP=y and CONFIG_EXAMPLES_HELLO=y, you will see that the
> mcu goes to sleep and not return.
>
> Em seg., 4 de nov. de 2024 às 08:48, Tiago Medicci Serrano <
> tiago.medi...@gmail.com> escreveu:
>
> > Hi Felipe, good to hear about your progress here!
> >
> > These functions are ROM-defined functions. By checking the TRM, you can
> see
> > a read-only flash partition that holds some functions (widely used
> > functions, like malloc and internal functions).
> >
> > ets_get_cpu_frequency
> > <
> >
> https://github.com/espressif/esp-hal-3rdparty/blob/1a1545b6ffb54029259ba8691d9ee200bfda2471/components/esp_rom/esp32c6/ld/esp32c6.rom.ld#L32
> > >
> > is
> > one of these internal functions. They are defined directly at the linker
> > script.
> >
> > If I understood correctly, these functions are crashing when it's being
> > called, right? If so, can you:
> >
> >    1. Share the crash dump
> >    2. Use GDB and try to check where/why it fails: it may trying to
> access
> >    some prohibited memory region or even trying to call an unregistered
> >    callback.
> >
> > Thanks!
> >
> > Em sex., 1 de nov. de 2024 às 13:41, Felipe Moura Oliveira <
> > moura....@gmail.com> escreveu:
> >
> > > Hello everyone,
> > >
> > > Tiago, I am trying to work with light sleep for now, after it work will
> > go
> > > ahead with deep sleep. To run in light sleep I don't need to change
> > linker
> > > so I was able to build and flash without "image" issues.
> > > Now I am facing other kind of issue:
> > > Some functions refers to "ets" function and I don't know how handle
> this,
> > > for instance:
> > >
> > > /**
> > > * @brief Get the real CPU ticks per us
> > > *
> > > * @return CPU ticks per us
> > > */
> > > uint32_t esp_rom_get_cpu_ticks_per_us(void);
> > >
> > > This function is necessary in the *sleep_modes.c* file. During execute
> > code
> > > I am facing crash when this function is called, its happen because its
> > > implementation is a reference to other function:
> > >
> > >
> >
> arch/risc-v/src/esp32c6/esp-hal-3rdparty/components/esp_rom/esp32c6/ld/esp32c6.rom.api.ld:46:PROVIDE
> > > ( *esp_rom_get_cpu_ticks_per_us* = ets_get_cpu_frequency );
> > >
> > > I cannot find *ets_get_cpu_frequency*, so how should I handle it?
> > >
> > > PS: I have another situation like this, when I try to call
> > > *esp_rom_set_cpu_ticks_per_us* function.
> > >
> > > Regards.
> > >
> > > Em ter., 29 de out. de 2024 às 13:24, Felipe Moura Oliveira <
> > > moura....@gmail.com> escreveu:
> > >
> > > > Hello Tiago.
> > > >
> > > > Please look de draft here:
> https://github.com/apache/nuttx/pull/14548
> > > >
> > > > This branch will refer to the updated 3rd-party in my repo.
> > > >
> > > > You only need to enable PM in menuconfig and it will be enough to see
> > > > changes.
> > > >
> > > > Em ter., 29 de out. de 2024 às 13:10, Tiago Medicci Serrano <
> > > > tiago.medi...@gmail.com> escreveu:
> > > >
> > > >> Hi Felipe,
> > > >>
> > > >> Can you share your PR as a draft on GH to make it easier to check
> the
> > > >> files
> > > >> (and the build process)?
> > > >>
> > > >> Em ter., 29 de out. de 2024 às 12:41, Felipe Moura Oliveira <
> > > >> moura....@gmail.com> escreveu:
> > > >>
> > > >> > Hello Tiago,
> > > >> >
> > > >> > I "finished" the port, but after it my esp32c6 dev kit is
> resetting.
> > > >> Maybe
> > > >> > the issue is related my changes in
> > > >> > boards/risc-v/esp32c6/common/scripts/esp32c6_sections.ld. Can you
> > give
> > > >> some
> > > >> > tips about how to go ahead?
> > > >> >
> > > >> > Below you can see nuttx report:
> > > >> > Build:Sep 19 2022
> > > >> > rst:0x7 (TG0_WDT_HPSYS),boot:0x7f (SPI_FAST_FLASH_BOOT)
> > > >> > Saved PC:0x40018bea
> > > >> > SPIWP:0xee
> > > >> > mode:DIO, clock div:2
> > > >> > load:0x40800000,len:0x61e0
> > > >> > load:0x408061e0,len:0xc34
> > > >> > load:0x50000000,len:0x20
> > > >> > load:0x5000001e,len:0x24
> > > >> > Invalid image block, can't boot.
> > > >> > ets_main.c 331
> > > >> > ESP-ROM:esp32c6-20220919
> > > >> >
> > > >> > Em ter., 29 de out. de 2024 às 08:46, Felipe Moura Oliveira <
> > > >> > moura....@gmail.com> escreveu:
> > > >> >
> > > >> > > Hello everyone,
> > > >> > >
> > > >> > > I was able to solve linker issues, editing the linker by
> myself. I
> > > >> need
> > > >> > to
> > > >> > > finish more than one build issue before testing it, so I will
> see
> > > if I
> > > >> > made
> > > >> > > the right changes in linker.
> > > >> > >
> > > >> > > Em seg., 28 de out. de 2024 às 16:01, Felipe Moura Oliveira <
> > > >> > > moura....@gmail.com> escreveu:
> > > >> > >
> > > >> > >> *Hello everyone, Tiago,*
> > > >> > >>
> > > >> > >> I have made progress with the build issue I was encountering
> and
> > am
> > > >> now
> > > >> > >> "stuck" at what I believe is one of the final stages. I am
> > > >> experiencing
> > > >> > the
> > > >> > >> following compilation error:
> > > >> > >> LD: nuttx
> > > >> > >> riscv-none-elf-ld: warning:
> > > >> > /home/felipe-moura/nuttxspace/nuttx-felipe/nuttx
> > > >> > >> has a LOAD segment with RWX permissions
> > > >> > >> riscv-none-elf-ld:
> > > >> /home/felipe-moura/nuttxspace/nuttx-felipe/staging/
> > > >> > >> libarch.a(sleep_modes.o): in function
> > > >> > >> `esp_set_deep_sleep_wake_stub_default_entry':
> > > >> > >> sleep_modes.c:(.rtc.text.4+0x0): undefined reference to
> > > >> > >> `_rtc_force_fast_end'
> > > >> > >> riscv-none-elf-ld: sleep_modes.c:(.rtc.text.4+0x4): undefined
> > > >> reference
> > > >> > >> to `_rtc_text_start'
> > > >> > >> riscv-none-elf-ld: sleep_modes.c:(.rtc.text.4+0x8): undefined
> > > >> reference
> > > >> > >> to `_rtc_force_fast_end'
> > > >> > >> riscv-none-elf-ld: sleep_modes.c:(.rtc.text.4+0xc): undefined
> > > >> reference
> > > >> > >> to `_rtc_text_start'
> > > >> > >> riscv-none-elf-ld:
> > > >> > >>
> > > >> >
> > > >>
> > >
> >
> /home/felipe-moura/nuttxspace/nuttx-felipe/staging/libarch.a(sleep_cpu.o):
> > > >> > >> in function `esp_sleep_cpu_retention':
> > > >> > >> sleep_cpu.c:(.iram1.8+0x200): undefined reference to
> > > >> > >> `rv_core_critical_regs_save'
> > > >> > >> riscv-none-elf-ld: sleep_cpu.c:(.iram1.8+0x21e): undefined
> > > reference
> > > >> to
> > > >> > >> `rv_core_critical_regs_restore'
> > > >> > >> riscv-none-elf-ld: sleep_cpu.c:(.iram1.8+0x226): undefined
> > > reference
> > > >> to
> > > >> > >> `rv_core_critical_regs_restore'
> > > >> > >> make[1]: *** [Makefile:189: nuttx] Error 1
> > > >> > >> make: *** [tools/Unix.mk:551: nuttx] Error 2
> > > >> > >>
> > > >> > >> I would greatly appreciate your assistance.
> > > >> > >>
> > > >> > >> Focusing on the item _rtc_text_start, I see that it is defined
> in
> > > the
> > > >> > >> file:
> > > >> > >>
> > > >>
> > arch/risc-v/src/chip/esp-hal-3rdparty/components/esp_system/ld/esp32c6/
> > > >> > >> sections.ld.in
> > > >> > >>
> > > >> > >> However, I am unsure how to add this file to the complete
> linking
> > > >> > >> process. I added this file to hal_esp32c6.mk, but I received
> the
> > > >> > >> following error:
> > > >> > >> LD: nuttx
> > > >> > >>
> > > >> >
> > > >>
> > >
> riscv-none-elf-ld:/home/felipe-moura/nuttxspace/nuttx-felipe/arch/risc-v/
> > > >> > >> src/chip/esp-hal-3rdparty/components/esp_system/ld/esp32c6/
> > > >> > >> sections.ld.in.tmp:113 cannot move location counter backwards
> > (from
> > > >> > >> 40809800 to 40800000)
> > > >> > >> make[1]: *** [Makefile:189: nuttx] Error 1
> > > >> > >> make: *** [tools/Unix.mk:551: nuttx] Error 2
> > > >> > >>
> > > >> > >>
> > > >> > >> Does anyone have any tips or suggestions that could help me
> move
> > > >> forward
> > > >> > >> with this process?
> > > >> > >>
> > > >> > >> Thank you in advance for your help.
> > > >> > >>
> > > >> > >> *Best regards,*
> > > >> > >>
> > > >> > >>
> > > >> > >> Em sex., 25 de out. de 2024 às 12:02, Tiago Medicci Serrano <
> > > >> > >> tiago.medi...@gmail.com> escreveu:
> > > >> > >>
> > > >> > >>> Hi Felipe,
> > > >> > >>>
> > > >> > >>> The RTC GPIO is a feature of the GPIO/RTC driver, so a
> > substitute
> > > >> for
> > > >> > >>> this
> > > >> > >>> function should be part
> > > >> > >>> of `nuttx/arch/risc-v/src/common/espressif/esp_rtc_gpio.c`.
> That
> > > >> being
> > > >> > >>> said, you can either implement it (and define it as a macro,
> on
> > > >> HAL) or
> > > >> > >>> you
> > > >> > >>> can either ignore these functions related to GPIO wakeup from
> > > sleep
> > > >> for
> > > >> > >>> now
> > > >> > >>> (using, for instance, the `#ifndef __NuttX__`). It's up to
> you:
> > if
> > > >> the
> > > >> > >>> GPIO
> > > >> > >>> wakeup isn't mandatory, it'd go baby steps, removing this
> > feature
> > > >> for
> > > >> > >>> now.
> > > >> > >>>
> > > >> > >>> Best regards,
> > > >> > >>>
> > > >> > >>> Em sex., 25 de out. de 2024 às 09:33, Felipe Moura Oliveira <
> > > >> > >>> moura....@gmail.com> escreveu:
> > > >> > >>>
> > > >> > >>> > Hello Tiago,
> > > >> > >>> >
> > > >> > >>> > Thank you for your assistance earlier.
> > > >> > >>> >
> > > >> > >>> > I would like to discuss further the necessity of the
> > > >> > >>> > esp_driver_gpio/include/rtc_io.h file, which is only
> available
> > > in
> > > >> the
> > > >> > >>> IDF.
> > > >> > >>> >
> > > >> > >>> > In sleep_modes.c, there is the following code snippet:
> > > >> > >>> > esp_err_t esp_sleep_enable_ext1_wakeup_io(uint64_t io_mask,
> > > >> > >>> > esp_sleep_ext1_wakeup_mode_t level_mode)
> > > >> > >>> > {
> > > >> > >>> > if (io_mask == 0 && level_mode > ESP_EXT1_WAKEUP_ANY_HIGH) {
> > > >> > >>> > return ESP_ERR_INVALID_ARG;
> > > >> > >>> > }
> > > >> > >>> > // Translate bit map of GPIO numbers into the bit map of RTC
> > IO
> > > >> > numbers
> > > >> > >>> > uint32_t rtc_gpio_mask = 0;
> > > >> > >>> > for (int gpio = 0; io_mask; ++gpio, io_mask >>= 1) {
> > > >> > >>> > if ((io_mask & 1) == 0) {
> > > >> > >>> > continue;
> > > >> > >>> > }
> > > >> > >>> > if (!esp_sleep_is_valid_wakeup_gpio(gpio)) {
> > > >> > >>> > ESP_LOGE(TAG, "Not an RTC IO: GPIO%d", gpio);
> > > >> > >>> > return ESP_ERR_INVALID_ARG;
> > > >> > >>> > }
> > > >> > >>> > rtc_gpio_mask |= BIT(rtc_io_number_get(gpio));
> > > >> > >>> > }
> > > >> > >>> >
> > > >> > >>> > I believe this code is essential for compilation. The
> function
> > > >> > >>> > rtc_io_number_get is located at the following path in the
> IDF:
> > > >> > >>> > components/esp_driver_gpio/include/driver/rtc_io.h.
> > > >> > >>> >
> > > >> > >>> > However, the esp_driver_gpio folder is not present in the
> > > >> 3rd-party
> > > >> > >>> > directory. In this case, what is the recommended procedure
> to
> > > >> > proceed?
> > > >> > >>> >
> > > >> > >>> > Thank you again for your support.
> > > >> > >>> >
> > > >> > >>> > Em sex., 25 de out. de 2024 às 08:52, Tiago Medicci Serrano
> <
> > > >> > >>> > tiago.medi...@gmail.com> escreveu:
> > > >> > >>> >
> > > >> > >>> > > Hi Felipe,
> > > >> > >>> > >
> > > >> > >>> > > `esp_private/pm_impl.h` is from the component `esp_pm` of
> > > >> ESP-IDF,
> > > >> > >>> which
> > > >> > >>> > is
> > > >> > >>> > > a driver directly. Same for
> > `esp_driver_gpio/include/rtc_io.h`
> > > >> > >>> (here, a
> > > >> > >>> > > detail: I wasn't able to find this path on IDF, so make
> sure
> > > you
> > > >> > are
> > > >> > >>> > > checking under the `release/v5.1` branch, which the HAL
> was
> > > >> based).
> > > >> > >>> The
> > > >> > >>> > HAL
> > > >> > >>> > > repository doesn't contain ESP-IDF drivers, which are
> always
> > > >> > >>> implemented
> > > >> > >>> > on
> > > >> > >>> > > NuttX. For `esp_cpu.h`, it's already on HAL (at
> > > >> > >>> > >
> > > `esp-hal-3rdparty/components/esp_hw_support/include/esp_cpu.h`).
> > > >> > >>> > >
> > > >> > >>> > > The files under
> `esp-hal-3rdparty/components/esp_hw_support`
> > > >> > >>> > > (`sleep_modes.c`, for instance) MAY be used to implement
> the
> > > >> > driver.
> > > >> > >>> This
> > > >> > >>> > > is, mostly, a wrapping layer under the function of
> `esp_rom`
> > > and
> > > >> > >>> `hal`
> > > >> > >>> > > components. However, they still may refer to ESP-IDF
> > drivers.
> > > >> That
> > > >> > >>> being
> > > >> > >>> > > said, you can check if removing such dependencies is
> > possible.
> > > >> We
> > > >> > >>> usually
> > > >> > >>> > > do that with conditional macros. A good starting point is
> to
> > > >> check
> > > >> > >>> for
> > > >> > >>> > > `#ifdef __NuttX__` on these sources and headers: we use
> them
> > > to
> > > >> > >>> > remove/add
> > > >> > >>> > > headers and functions that aren't available on
> NuttX/needed
> > by
> > > >> > NuttX.
> > > >> > >>> > >
> > > >> > >>> > > Best regards,
> > > >> > >>> > >
> > > >> > >>> > > Em qui., 24 de out. de 2024 às 19:46, Felipe Moura
> Oliveira
> > <
> > > >> > >>> > > moura....@gmail.com> escreveu:
> > > >> > >>> > >
> > > >> > >>> > > > Hello all,
> > > >> > >>> > > >
> > > >> > >>> > > > Tiago,
> > > >> > >>> > > >
> > > >> > >>> > > > I have a question regarding the porting process.
> > > >> Specifically, I
> > > >> > >>> need
> > > >> > >>> > to
> > > >> > >>> > > > add the sleep_modes.c file to the compilation process.
> Am
> > I
> > > on
> > > >> > the
> > > >> > >>> > right
> > > >> > >>> > > > path with this approach?
> > > >> > >>> > > >
> > > >> > >>> > > > To achieve this, I modified the hal_esp32c6.mk file by
> > > adding
> > > >> > >>> > > > sleep_modes.c.
> > > >> > >>> > > > However, I am facing some issues: within sleep_modes.c,
> > some
> > > >> > >>> #include
> > > >> > >>> > > > statements reference files that are not available in the
> > > >> > 3rd-party
> > > >> > >>> > > > directory but are only present in the IDF. For example:
> > > >> > >>> > > >
> > > >> > >>> > > >    - esp_private/pm_impl.h
> > > >> > >>> > > >    - esp_cpu.h
> > > >> > >>> > > >    - components/esp_driver_gpio/include/rtc_io.h
> > > >> > >>> > > >
> > > >> > >>> > > > I need those includes because sleep_modes.c uses
> function
> > > from
> > > >> > >>> there.
> > > >> > >>> > > >
> > > >> > >>> > > > Could you please advise if it's possible to incorporate
> > > these
> > > >> IDF
> > > >> > >>> > folders
> > > >> > >>> > > > into the 3rd-party directory, or if that approach is not
> > > >> > >>> recommended?
> > > >> > >>> > > >
> > > >> > >>> > > > Thank you for your assistance.
> > > >> > >>> > > >
> > > >> > >>> > > > Best regards,
> > > >> > >>> > > >
> > > >> > >>> > > > Em qua., 23 de out. de 2024 às 15:21, Tiago Medicci
> > Serrano
> > > <
> > > >> > >>> > > > tiago.medi...@gmail.com> escreveu:
> > > >> > >>> > > >
> > > >> > >>> > > > > Hi,
> > > >> > >>> > > > >
> > > >> > >>> > > > > Just another note to guide your development: we don't
> > > >> develop
> > > >> > >>> > anything
> > > >> > >>> > > on
> > > >> > >>> > > > > `esp-hal-3rdparty`: most of the code we use from it is
> > > >> derived
> > > >> > >>> from
> > > >> > >>> > the
> > > >> > >>> > > > > path
> > > >> > >>> > > > >
> > > >> > >>> > > > >
> > > >> > >>> > > >
> > > >> > >>> > >
> > > >> > >>> >
> > > >> > >>>
> > > >> >
> > > >>
> > >
> >
> https://github.com/espressif/esp-hal-3rdparty/tree/release/v5.1.c/components/hal
> > > >> > >>> > > > > (essentially, header files from
> > > >> > >>> `components/hal/<chip>/include/hal`,
> > > >> > >>> > > > except
> > > >> > >>> > > > > for some of the sources files that use the hal
> functions
> > > at
> > > >> > >>> > > > > `components/hal` to implement some function we may
> use).
> > > You
> > > >> > can
> > > >> > >>> > take a
> > > >> > >>> > > > > look at the branch `
> > > >> > >>> > > > >
> > > >> > >>> >
> > > >> >
> > https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c`
> <https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c>
> > <https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c>
> > > <https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c>
> > > >> <
> https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c
> > >
> > > >> > <
> > https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c
> > > >
> > > >> > >>> <
> > > >>
> https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c>
> > > >> > >>> > <
> > > >> >
> > https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c>
> > > >> > >>> > > <
> > > >> > >>>
> > > >>
> https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c>
> > > >> > >>> > > > <
> > > >> > >>>
> > > >>
> https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c>
> > > >> > >>> > > > > <
> > > >> > >>> >
> > > >>
> https://github.com/espressif/esp-hal-3rdparty/commits/release/v5.1.c
> > > >> > >
> > > >> > >>> > > > and
> > > >> > >>> > > > > especially the commits beginning
> > > >> > >>> > > > > with faaa46ebfb37fba4250de831efbbf2862958c344 to check
> > the
> > > >> kind
> > > >> > >>> of
> > > >> > >>> > > > changes
> > > >> > >>> > > > > we do in hal. Essentially, we create a wrapper layer
> to
> > > >> make it
> > > >> > >>> > > > independent
> > > >> > >>> > > > > of the host OS.
> > > >> > >>> > > > >
> > > >> > >>> > > > > *Drivers must always be implemented on NuttX!*
> > > >> > >>> > > > >
> > > >> > >>> > > > > That being said, you can either 1) try to adapt the
> > > >> > >>> implementation of
> > > >> > >>> > > > other
> > > >> > >>> > > > > devices to use the HAL functions or 2) get some
> > > inspiration
> > > >> on
> > > >> > >>> how
> > > >> > >>> > IDF
> > > >> > >>> > > > > implements PM. I'd stick with the 2nd option before
> > simply
> > > >> > >>> trying to
> > > >> > >>> > > > adapt
> > > >> > >>> > > > > an existing implementation (from ESP32-C3 legacy or
> from
> > > >> > >>> > > ESP32/ESP32-S3).
> > > >> > >>> > > > >
> > > >> > >>> > > > > Best regards,
> > > >> > >>> > > > >
> > > >> > >>> > > > > Em qua., 23 de out. de 2024 às 13:35, Felipe Moura
> > > Oliveira
> > > >> <
> > > >> > >>> > > > > moura....@gmail.com> escreveu:
> > > >> > >>> > > > >
> > > >> > >>> > > > > > Hello Tiago.
> > > >> > >>> > > > > >
> > > >> > >>> > > > > > Thank you for clarification, I will follow your
> > > >> instructions.
> > > >> > >>> > > > > >
> > > >> > >>> > > > > > Em qua., 23 de out. de 2024 às 13:01, Tiago Medicci
> > > >> Serrano <
> > > >> > >>> > > > > > tiago.medi...@gmail.com> escreveu:
> > > >> > >>> > > > > >
> > > >> > >>> > > > > > > Hi Felipe,
> > > >> > >>> > > > > > >
> > > >> > >>> > > > > > > Just complementing: use your forked version of the
> > HAL
> > > >> > >>> during the
> > > >> > >>> > > > > > > development. As soon as you have a working
> version,
> > > you
> > > >> can
> > > >> > >>> > submit
> > > >> > >>> > > on
> > > >> > >>> > > > > the
> > > >> > >>> > > > > > > official repository.
> > > >> > >>> > > > > > >
> > > >> > >>> > > > > > > Best regards,
> > > >> > >>> > > > > > >
> > > >> > >>> > > > > > > Em qua., 23 de out. de 2024 às 12:58, Tiago
> Medicci
> > > >> > Serrano <
> > > >> > >>> > > > > > > tiago.medi...@gmail.com> escreveu:
> > > >> > >>> > > > > > >
> > > >> > >>> > > > > > > > Hi Felipe,
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > > Thanks for asking! You should follow the path
> > using
> > > >> the
> > > >> > >>> > functions
> > > >> > >>> > > > on
> > > >> > >>> > > > > > > > esp-hal-3rdparty. You can fork the repository
> and
> > > use
> > > >> > >>> > > > > > > >
> > > >> > >>> > >
> > > >> `ESP_HAL_3RDPARTY_VERSION=b4c723a119344b4b71d69819019d55637fb570fd
> > > >> > >>> > > > > > > > ESP_HAL_3RDPARTY_URL="g...@github.com:
> > > >> > >>> > > > tmedicci/esp-hal-3rdparty.git"`
> > > >> > >>> > > > > > env
> > > >> > >>> > > > > > > > vars (globally or before the make command) to
> use
> > > your
> > > >> > >>> version
> > > >> > >>> > of
> > > >> > >>> > > > the
> > > >> > >>> > > > > > > HAL.
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > > I just wanted to share some thoughts: using the
> > HAL
> > > >> > >>> enables us
> > > >> > >>> > to
> > > >> > >>> > > > > make
> > > >> > >>> > > > > > > the
> > > >> > >>> > > > > > > > feature available for all the Espressif devices
> > > >> (please
> > > >> > >>> don't
> > > >> > >>> > > > bother
> > > >> > >>> > > > > > with
> > > >> > >>> > > > > > > > that now, as soon as you submit it, we can test
> > for
> > > >> the
> > > >> > >>> other
> > > >> > >>> > > > devices
> > > >> > >>> > > > > > and
> > > >> > >>> > > > > > > > eventually make any adjustments). Although it's
> > > >> possible
> > > >> > to
> > > >> > >>> > > > > reimplement
> > > >> > >>> > > > > > > > these functions on NuttX, we don't recommend
> that
> > > >> because
> > > >> > >>> of
> > > >> > >>> > the
> > > >> > >>> > > > > first
> > > >> > >>> > > > > > > > statement (the ability to use for the other
> > > devices):
> > > >> in
> > > >> > >>> that
> > > >> > >>> > > case
> > > >> > >>> > > > we
> > > >> > >>> > > > > > > > wouldn't be able to support the feature. You can
> > > take
> > > >> a
> > > >> > >>> look on
> > > >> > >>> > > IDF
> > > >> > >>> > > > > for
> > > >> > >>> > > > > > > > some inspiration on how it's implemented.
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > > Please let me know if you have any questions.
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > > Best regards,
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > > Em qua., 23 de out. de 2024 às 12:38, Felipe
> Moura
> > > >> > >>> Oliveira <
> > > >> > >>> > > > > > > > moura....@gmail.com> escreveu:
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > >> Hello everyone,
> > > >> > >>> > > > > > > >>
> > > >> > >>> > > > > > > >> Our project has reached a point where we need
> the
> > > >> Power
> > > >> > >>> > Manager
> > > >> > >>> > > > > > > >> functionality, which is not yet available in
> the
> > > >> > ESP32C6.
> > > >> > >>> I am
> > > >> > >>> > > > > > studying
> > > >> > >>> > > > > > > to
> > > >> > >>> > > > > > > >> start the implementation, but I am confused
> about
> > > the
> > > >> > >>> correct
> > > >> > >>> > > way
> > > >> > >>> > > > to
> > > >> > >>> > > > > > > >> approach this.
> > > >> > >>> > > > > > > >>
> > > >> > >>> > > > > > > >> There is a Power Manager implementation for the
> > > >> ESP32C3,
> > > >> > >>> but
> > > >> > >>> > it
> > > >> > >>> > > > > seems
> > > >> > >>> > > > > > to
> > > >> > >>> > > > > > > >> follow the legacy methodology. In fact, the
> file
> > > >> > >>> > esp32c3_idle.c
> > > >> > >>> > > is
> > > >> > >>> > > > > > > located
> > > >> > >>> > > > > > > >> in the path arch/risc-v/src/esp32c3-legacy. In
> > this
> > > >> > >>> > methodology,
> > > >> > >>> > > > > > > functions
> > > >> > >>> > > > > > > >> are re-implemented from the Espressif driver.
> For
> > > >> > >>> example, the
> > > >> > >>> > > > > > function
> > > >> > >>> > > > > > > >> esp32c3_light_sleep_start(), which is currently
> > > >> > available
> > > >> > >>> in
> > > >> > >>> > > > > > > >> esp32c6/esp-hal-3rdparty/.../sleep_modes.c.
> > > >> > >>> > > > > > > >>
> > > >> > >>> > > > > > > >> I tried using the implementations from
> > > >> esp-hal-3rdparty
> > > >> > to
> > > >> > >>> > > develop
> > > >> > >>> > > > > the
> > > >> > >>> > > > > > > >> Power Manager for the ESP32C6 in NuttX, but the
> > > files
> > > >> > >>> still
> > > >> > >>> > have
> > > >> > >>> > > > > many
> > > >> > >>> > > > > > > >> dependencies on items that are not present in
> > > NuttX.
> > > >> > >>> > > > > > > >>
> > > >> > >>> > > > > > > >> My question is: Should I try to make the Power
> > > >> Manager
> > > >> > >>> work
> > > >> > >>> > > using
> > > >> > >>> > > > > the
> > > >> > >>> > > > > > > >> functions in esp-hal-3rdparty, even if it
> > requires
> > > >> > making
> > > >> > >>> > > changes
> > > >> > >>> > > > to
> > > >> > >>> > > > > > the
> > > >> > >>> > > > > > > >> 3rd-party code? Or should I re-implement the
> > > >> functions
> > > >> > >>> within
> > > >> > >>> > > > NuttX,
> > > >> > >>> > > > > > > even
> > > >> > >>> > > > > > > >> if, in this case, there are functions with the
> > same
> > > >> > scope
> > > >> > >>> and
> > > >> > >>> > > > > > > >> implementation in different files, where one is
> > > >> > compiled,
> > > >> > >>> and
> > > >> > >>> > > the
> > > >> > >>> > > > > > other
> > > >> > >>> > > > > > > is
> > > >> > >>> > > > > > > >> not?
> > > >> > >>> > > > > > > >>
> > > >> > >>> > > > > > > >>
> > > >> > >>> > > > > > > >> --
> > > >> > >>> > > > > > > >> *Felipe Moura de Oliveira*
> > > >> > >>> > > > > > > >> *Universidade Federal de Minas Gerais*
> > > >> > >>> > > > > > > >> Linkedin <
> > > >> > >>> > https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> > > >> > >>> > > > > > > >> <https://twitter.com/FelipeMOliveir?lang=pt-br
> >
> > > >> > >>> > > > > > > >>
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > > --
> > > >> > >>> > > > > > > > Tiago Medicci Serrano
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > > > Embedded Software Engineer
> > > >> > >>> > > > > > > > MSc Electronics/Microelectronics
> > > >> > >>> > > > > > > > m: +55 (19) 981403886 <+55+(19)+981403886>
> > > >> > >>> > > > > > > > e: tiago.medi...@gmail.com
> > > >> > >>> > > > > > > > a: Campinas, Brazil
> > > >> > >>> > > > > > > > Follow me:
> > > >> > >>> > > > > > > > <
> > https://www.linkedin.com/in/tiago-serrano-924458b6
> > > >
> > > >> > >>> > > > > > > > <https://github.com/tmedicci>
> > > >> > >>> > > > > > > >
> > > >> > >>> > > > > > >
> > > >> > >>> > > > > > >
> > > >> > >>> > > > > > > --
> > > >> > >>> > > > > > > Tiago Medicci Serrano
> > > >> > >>> > > > > > >
> > > >> > >>> > > > > > > Embedded Software Engineer
> > > >> > >>> > > > > > > MSc Electronics/Microelectronics
> > > >> > >>> > > > > > > m: +55 (19) 981403886 <+55+(19)+981403886>
> > > >> > >>> > > > > > > e: tiago.medi...@gmail.com
> > > >> > >>> > > > > > > a: Campinas, Brazil
> > > >> > >>> > > > > > > Follow me:
> > > >> > >>> > > > > > > <
> https://www.linkedin.com/in/tiago-serrano-924458b6
> > >
> > > >> > >>> > > > > > > <https://github.com/tmedicci>
> > > >> > >>> > > > > > >
> > > >> > >>> > > > > >
> > > >> > >>> > > > > >
> > > >> > >>> > > > > > --
> > > >> > >>> > > > > > *Felipe Moura de Oliveira*
> > > >> > >>> > > > > > *Universidade Federal de Minas Gerais*
> > > >> > >>> > > > > > Linkedin <
> > > >> > https://www.linkedin.com/in/felipe-oliveira-75a651a0
> > > >> > >>> >
> > > >> > >>> > > > > > <https://twitter.com/FelipeMOliveir?lang=pt-br>
> > > >> > >>> > > > > >
> > > >> > >>> > > > >
> > > >> > >>> > > > >
> > > >> > >>> > > > > --
> > > >> > >>> > > > > Tiago Medicci Serrano
> > > >> > >>> > > > >
> > > >> > >>> > > > > Embedded Software Engineer
> > > >> > >>> > > > > MSc Electronics/Microelectronics
> > > >> > >>> > > > > m: +55 (19) 981403886 <+55+(19)+981403886>
> > > >> > >>> > > > > e: tiago.medi...@gmail.com
> > > >> > >>> > > > > a: Campinas, Brazil
> > > >> > >>> > > > > Follow me:
> > > >> > >>> > > > > <https://www.linkedin.com/in/tiago-serrano-924458b6>
> > > >> > >>> > > > > <https://github.com/tmedicci>
> > > >> > >>> > > > >
> > > >> > >>> > > >
> > > >> > >>> > > >
> > > >> > >>> > > > --
> > > >> > >>> > > > *Felipe Moura de Oliveira*
> > > >> > >>> > > > *Universidade Federal de Minas Gerais*
> > > >> > >>> > > > Linkedin <
> > > >> https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> > > >> > >>> > > > <https://twitter.com/FelipeMOliveir?lang=pt-br>
> > > >> > >>> > > >
> > > >> > >>> > >
> > > >> > >>> > >
> > > >> > >>> > > --
> > > >> > >>> > > Tiago Medicci Serrano
> > > >> > >>> > >
> > > >> > >>> > > Embedded Software Engineer
> > > >> > >>> > > MSc Electronics/Microelectronics
> > > >> > >>> > > m: +55 (19) 981403886 <+55+(19)+981403886>
> > > >> > >>> > > e: tiago.medi...@gmail.com
> > > >> > >>> > > a: Campinas, Brazil
> > > >> > >>> > > Follow me:
> > > >> > >>> > > <https://www.linkedin.com/in/tiago-serrano-924458b6>
> > > >> > >>> > > <https://github.com/tmedicci>
> > > >> > >>> > >
> > > >> > >>> >
> > > >> > >>> >
> > > >> > >>> > --
> > > >> > >>> > *Felipe Moura de Oliveira*
> > > >> > >>> > *Universidade Federal de Minas Gerais*
> > > >> > >>> > Linkedin <
> > https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> > > >> > >>> > <https://twitter.com/FelipeMOliveir?lang=pt-br>
> > > >> > >>> >
> > > >> > >>>
> > > >> > >>
> > > >> > >>
> > > >> > >> --
> > > >> > >> *Felipe Moura de Oliveira*
> > > >> > >> *Universidade Federal de Minas Gerais*
> > > >> > >> Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0
> >
> > > >> > >> <https://twitter.com/FelipeMOliveir?lang=pt-br>
> > > >> > >>
> > > >> > >
> > > >> > >
> > > >> > > --
> > > >> > > *Felipe Moura de Oliveira*
> > > >> > > *Universidade Federal de Minas Gerais*
> > > >> > > Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> > > >> > > <https://twitter.com/FelipeMOliveir?lang=pt-br>
> > > >> > >
> > > >> >
> > > >> >
> > > >> > --
> > > >> > *Felipe Moura de Oliveira*
> > > >> > *Universidade Federal de Minas Gerais*
> > > >> > Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> > > >> > <https://twitter.com/FelipeMOliveir?lang=pt-br>
> > > >> >
> > > >>
> > > >
> > > >
> > > > --
> > > > *Felipe Moura de Oliveira*
> > > > *Universidade Federal de Minas Gerais*
> > > > Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> > > > <https://twitter.com/FelipeMOliveir?lang=pt-br>
> > > >
> > >
> > >
> > > --
> > > *Felipe Moura de Oliveira*
> > > *Universidade Federal de Minas Gerais*
> > > Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> > > <https://twitter.com/FelipeMOliveir?lang=pt-br>
> > >
> >
>
>
> --
> *Felipe Moura de Oliveira*
> *Universidade Federal de Minas Gerais*
> Linkedin <https://www.linkedin.com/in/felipe-oliveira-75a651a0>
> <https://twitter.com/FelipeMOliveir?lang=pt-br>
>

Reply via email to