Commit Graph

6 Commits

Author SHA1 Message Date
Tiago Medicci Serrano 223c5a3722 xtensa/esp32_esp32s2_esp32s3: enable syslog bufferring
By enabling the syslog buffering on xtensa-based devices, it's
possible to ensure concurrent tasks will not mess with the syslog
messages.
2023-06-02 10:17:54 +08:00
Alan Carvalho de Assis f0289577bf boards: Update all boards config after updating NSH_CMDPARMS 2023-01-23 03:04:51 +08:00
Tiago Medicci Serrano d3ffeb40a7 libc/machine/xtensa: make longjmp safe against context switch
In order to turn longjmp context-switch safe, it's necessary
to disable interrupts before modifying windowbase and windowstart.
Otherwise, after a context switch, windowstart and windowbase
would be different, leading to a wrongly set windowstart bit due to
longjmp writing it based on the windowbase before the context switch.
This corrupts the registers at the next window overflow reaching
that wrongly set bit.

*Background:*
This PR is related to an issue first observed on ESP-IDF
https://github.com/espressif/esp-idf/issues/5229 and it was, then,
checked on NuttX using a test application.

*The test application:*
To check if the problem affects ESP32, ESP32-S2 and ESP32-S3 on
NuttX, it was created an application based on:
https://en.cppreference.com/w/c/program/longjmp

The application creates 16 tasks (`#define NUMBER_OF_TASKS  16`)
that implements the following daemon:

```
static int setjmp_longjmp_daemon(int argc, char *argv[])
{
  for (int i = 0; i < NUMBER_OF_TASKS * 2; i++)
    {
      jmp_buf env;

      volatile int count = 0;
      if (setjmp(env) != UINT16_MAX)
        {
          foo(&env, ++count);
        }
    }

  sem_post(&g_sem);

  return EXIT_SUCCESS;
}
```

The main function also initializes a semaphore to avoid application
exiting before tasks return successfully:

```
  sem_init(&g_sem, 0, -NUMBER_OF_TASKS);
```

Finally, the round-robin interval was lowered to 1ms to raise the
chances of the longjmp being interrupted by a context switch
(`CONFIG_RR_INTERVAL=1).

This setup was able to reproduce the problem prior to this patch
being applied.
2022-11-22 19:34:44 +01:00
YAMAMOTO Takashi 864f43b562 esp32*: Disable CONFIG_RAW_BINARY
Because it uses the same filename as esp32 Config.mk. (nuttx.bin)
2022-05-27 13:41:51 +03:00
Petro Karashchenko dab5bb6bd3 boards/Kconfig: introduce ARCH_BOARD_COMMON option
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-11 16:00:00 +08:00
Gustavo Henrique Nihei 4a29fa903b xtensa/esp32s3: Enable SMP support
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-03-09 10:42:50 +08:00