eren-terzioglu opened a new pull request, #17141:
URL: https://github.com/apache/nuttx/pull/17141
## Summary
This MR created to prevent ULP shared memory area access among the examples.
<!-- 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/risc-v/esp32c6: Add ULP shared memory encapsulation
Add ULP shared memory encapsulation for esp32c6
## Impact
<!-- Please fill the following sections with YES/NO and provide a brief
explanation -->
Impact on user: Yes, ULP shared memory variables only can be accessed using
POSIX calls
<!-- 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: Yes, ULP examples that uses ULP variables on HP
core will be affected
<!-- 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 -->
### Building
<!-- Provide how to build the test for each SoC being tested -->
Before building it a file created called `ulp_blink.c` into
`nuttx/boards/risc-v/esp32c6/common/etc` and file content looks like this:
```
// nuttx/boards/risc-v/esp32c6/common/etc/ulp_blink.c
#include <stdint.h>
#include <stdbool.h>
#include "ulp_lp_core_gpio.h"
#define GPIO_PIN 0
#define nop() __asm__ __volatile__ ("nop")
bool gpio_level_previous = true;
int main(void)
{
while (1)
{
ulp_lp_core_gpio_set_level(GPIO_PIN, gpio_level_previous);
/* Delay */
for (int i = 0; i < 10000; i++)
{
nop();
}
}
return 0;
}
```
ULP code inspired from [ESP-IDF ulp gpio
example](https://github.com/espressif/esp-idf/tree/master/examples/system/ulp/lp_core/gpio).
After all these changes `esp32c6-devkitc:ulp` config used to test it. Here
is the command:
```
make -j distclean && ./tools/configure.sh esp32c6-devkitc:ulp &&
kconfig-tweak --set-str CONFIG_ESPRESSIF_ULP_PROJECT_PATH
"boards/risc-v/esp32c6/common/etc" && make olddefconfig && make -j && make
download ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BAUD=921600 ESPTOOL_BINDIR=../esp-bin
```
Additional to that a small example created like this for HP Core:
```
#include <nuttx/config.h>
#include <inttypes.h>
#include <stdio.h>
#include "espressif/esp_rtc_gpio.h"
#include <nuttx/fs/ioctl.h>
#include <sys/ioctl.h>
#include "nuttx/symtab.h"
#include <fcntl.h>
#include <inttypes.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int fd;
uint32_t first_status = 1;
uint32_t read_result;
struct symtab_s sym =
{
.sym_name = "ulp_gpio_level_previous",
.sym_value = &read_result,
};
fd = open("/dev/ulp", O_WRONLY);
if (fd < 0)
{
printf("Failed to open ULP: %d\n", errno);
return -1;
}
ioctl(fd, FIONREAD, &sym);
first_status = read_result;
read_result = !read_result;
/* Chaging LP GPIO status from a variable on HP core */
printf("First GPIO level: %ld\n", first_status);
printf("Expected GPIO level: %ld\n", read_result);
ioctl(fd, FIONWRITE, &sym);
read_result = first_status;
while(first_status == read_result)
{
read_result = esp_rtcio_read(PIN);
printf("Pin status: %d\n", read_result);
sleep(1);
}
printf("Cheking done. Exiting.\n");
return OK;
}
```
### Running
<!-- Provide how to run the test for each SoC being tested -->
HP Core example run.
### Results
<!-- Provide tests' results and runtime logs -->
GPIO0 should change every time that example runs.
--
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]