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 > > > >>> > > > 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> >