mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-16 20:52:57 +08:00
9bbf8f43fb
RTOS driver evicted as it did not play nice with stdio etc. Implemented a minimal driver to fully support Lua console on UART0. Output on UART0 done via stdout (provided by the IDF). Input and setup handled via driver_console/console.c. In addition to the direct input function console_getc(), the driver also registers in the syscall tables to enable regular stdio input functions to work (yay!). The Lua VM is still using the direct interface since it's less overhead, but does also work when going through stdin/fd 0. Auto-bauding on the console is not yet functional; revisit when the UART docs are available. Module registration/linking/enabling moved over to be Kconfig based. See updates to base_nodemcu/include/module.h and base_nodemcu/Kconfig for details. The sdk-overrides directory/approach is no longer used. The IDF is simply too different to the old RTOS SDK - we need to adapt our code directly instead. Everything in app/ is now unused, and will need to be gradually migrated into components/ though it is probably better to migrate straight from the latest dev branch.
36 lines
838 B
C
36 lines
838 B
C
#include "rtos_dbg.h"
|
|
#include <freertos/FreeRTOSConfig.h>
|
|
#include <stdio.h>
|
|
|
|
extern struct {
|
|
uint32_t *pxTopOfStack;
|
|
uint32_t x[5];
|
|
uint32_t y[5];
|
|
unsigned uxPriority;
|
|
uint32_t *pxStack;
|
|
signed char pcTaskName[configMAX_TASK_NAME_LEN];
|
|
} *pxCurrentTCB;
|
|
|
|
void rtos_dbg_task_print (const char *file, uint32_t line)
|
|
{
|
|
printf(">>dbg: %s:%d in RTOS task \"%s\": prio %d\n",
|
|
file,
|
|
line,
|
|
pxCurrentTCB->pcTaskName,
|
|
pxCurrentTCB->uxPriority
|
|
);
|
|
}
|
|
|
|
|
|
void rtos_dbg_stack_print (const char *file, uint32_t line)
|
|
{
|
|
uint32_t fill = 0xa5a5a5a5u;
|
|
uint32_t nwords = 0;
|
|
uint32_t *p = (uint32_t*)pxCurrentTCB->pxStack;
|
|
for (;p < pxCurrentTCB->pxTopOfStack && *p == fill; ++p)
|
|
++nwords;
|
|
|
|
printf(">>dbg: %s:%d in RTOS task \"%s\": %u stack untouched\n",
|
|
file, line, pxCurrentTCB->pcTaskName, nwords * 4);
|
|
}
|