eren-terzioglu opened a new pull request, #17237: URL: https://github.com/apache/nuttx/pull/17237
Note: Please merge https://github.com/apache/nuttx/pull/17235 first ## Summary <!-- This field should contain a summary of the changes. It will be pre-filled with the commit's message and descriptions. Adjust it accordingly --> * arch/xtensa/esp32[-s3]: Add ULP RISCV coprocessor wakeup board support Add ULP RISC-V coprocessor wakeup board support for esp32s3 * arch/xtensa/esp32[-s3]: Add ULP RISCV coprocessor wakeup Add ULP RISCV coprocessor wakeup support for esp32s3 ## Impact <!-- Please fill the following sections with YES/NO and provide a brief explanation --> Impact on user: Yes, ULP RISC-V coprocessor can wake up HP core <!-- Does it impact user's applications? How? --> Impact on build: No <!-- Does it impact on building NuttX? How? (please describe the required changes on the build system) --> Impact on hardware: No <!-- Does it impact a specific hardware supported by NuttX? --> Impact on documentation: No <!-- Does it impact the existing documentation? Please provide additional documentation to reflect that --> Impact on security: No <!-- Does it impact NuttX's security? --> Impact on compatibility: No <!-- Does it impact compatibility between previous and current versions? Is this a breaking change? --> ## Testing <!-- Please provide all the testing procedure. Consider that upstream reviewers should be able to reproduce the same testing performed internally --> `esp32s3-devkit:pm` used as a base with these options added: ``` CONFIG_ESP32S3_ULP_COPROC_ENABLED=y CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM=8000 CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM=8000 CONFIG_PM_ULP_WAKEUP=y CONFIG_PM_SLEEP_WAKEUP_SEC=25 ``` To test this feature an example created, here are the snippets: ``` // HP core application #include <nuttx/config.h> #include <nuttx/power/pm.h> #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> #include <inttypes.h> #include "ulp/ulp/ulp_main.h" #include "ulp/ulp/ulp_code.h" #include "esp32s3_pm.h" void load_ulp_wakeup_binary(void) { int fd; fd = open("/dev/ulp", O_WRONLY); if (fd < 0) { printf("Failed to open ULP: %d\n", errno); return; } write(fd, ulp_wakeup_bin, ulp_wakeup_bin_len); } int main(int argc, char *argv[]) { int ulp_fd; ulp_fd = open("/dev/ulp", O_WRONLY); if (ulp_fd < 0) { printf("Failed to open ULP: %d\n", errno); return ERROR; } load_ulp_wakeup_binary(); // esp32s3_pmsleep can be used for deep sleep as well esp32s3_pmstandby(CONFIG_PM_ALARM_SEC * 1000000 + CONFIG_PM_ALARM_NSEC / 1000); return OK; } ``` ``` // LP core application #include <stdint.h> #include <stdio.h> #include <stdbool.h> #include "ulp_riscv.h" #include "ulp_riscv_utils.h" #include "ulp_riscv_print.h" #include "sdkconfig.h" #define nop() __asm__ __volatile__ ("nop") int main(void) { while (1) { /* Delay */ for (int i = 0; i < 1000000; i++) { nop(); } ulp_riscv_wakeup_main_processor(); } /* ulp_lp_core_halt() is called automatically when main exits */ return 0; } ``` ### Building <!-- Provide how to build the test for each SoC being tested --> NuttX build process applied to related config. Assuming we updated `pm` config with related options ``` make -j distclean && ./tools/configure.sh esp32s3-devkit:pm && make -j && make download ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BAUD=921600 ESPTOOL_BINDIR=./ ``` ### Running <!-- Provide how to run the test for each SoC being tested --> Example run ### Results <!-- Provide tests' results and runtime logs --> Device should got into sleep and nsh would be unresponsive for a few seconds but it needs to return back less than 25 seconds (or whatever assigned to `CONFIG_PM_SLEEP_WAKEUP_SEC`) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
