app-module events & callstack config, crash diagnostics (#630)
- Apps can specify task stack depth and preferred memory placement in their manifests. - App identifiers are validated against length and character requirements. - Crash diagnostics now show the crash cause, reason, fault address, call stack, and program-counter details, with logs saved for review. - App closing is more consistent across built-in screens. There's now a dedicated function, and the old _emit() function is made private. - Crash diagnostics no longer display a QR code without a call stack. - Improved memory allocation for unrestricted requests.
This commit is contained in:
committed by
GitHub
parent
c656ee9ffd
commit
92ca046681
@@ -6,6 +6,8 @@
|
||||
#include <tactility/log.h>
|
||||
#include <tactility/time.h>
|
||||
|
||||
#include <tactility/freertos/task.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
@@ -23,9 +25,9 @@ struct Thread {
|
||||
thread_state_callback_t stateCallback = nullptr;
|
||||
void* stateCallbackContext = nullptr;
|
||||
std::string name = "unnamed";
|
||||
enum ThreadPriority priority = THREAD_PRIORITY_NORMAL;
|
||||
struct Mutex mutex = { 0 };
|
||||
configSTACK_DEPTH_TYPE stackSize = 4096;
|
||||
ThreadPriority priority = THREAD_PRIORITY_NORMAL;
|
||||
Mutex mutex = { 0 };
|
||||
configSTACK_DEPTH_TYPE stackDepth = 4096;
|
||||
portBASE_TYPE affinity = -1;
|
||||
|
||||
Thread() {
|
||||
@@ -94,7 +96,7 @@ Thread* thread_alloc(void) {
|
||||
|
||||
Thread* thread_alloc_full(
|
||||
const char* name,
|
||||
configSTACK_DEPTH_TYPE stack_size,
|
||||
size_t stack_size,
|
||||
thread_main_fn_t function,
|
||||
void* function_context,
|
||||
portBASE_TYPE affinity
|
||||
@@ -128,7 +130,8 @@ void thread_set_stack_size(Thread* thread, size_t stack_size) {
|
||||
thread->lock();
|
||||
check(stack_size > 0);
|
||||
check(thread->state == THREAD_STATE_STOPPED);
|
||||
thread->stackSize = stack_size;
|
||||
|
||||
thread->stackDepth = stack_size / sizeof(StackType_t);
|
||||
thread->unlock();
|
||||
}
|
||||
|
||||
@@ -176,14 +179,13 @@ error_t thread_start(Thread* thread) {
|
||||
thread->lock();
|
||||
check(thread->mainFunction != nullptr);
|
||||
check(thread->state == THREAD_STATE_STOPPED);
|
||||
check(thread->stackSize);
|
||||
check(thread->stackDepth);
|
||||
thread->unlock();
|
||||
|
||||
thread_set_state_internal(thread, THREAD_STATE_STARTING);
|
||||
|
||||
thread->lock();
|
||||
uint32_t stack_depth = thread->stackSize / sizeof(StackType_t);
|
||||
enum ThreadPriority priority = thread->priority;
|
||||
auto priority = static_cast<UBaseType_t>(thread->priority);
|
||||
portBASE_TYPE affinity = thread->affinity;
|
||||
thread->unlock();
|
||||
|
||||
@@ -193,9 +195,9 @@ error_t thread_start(Thread* thread) {
|
||||
result = xTaskCreatePinnedToCore(
|
||||
thread_main_body,
|
||||
thread->name.c_str(),
|
||||
stack_depth,
|
||||
thread->stackDepth,
|
||||
thread,
|
||||
(UBaseType_t)priority,
|
||||
priority,
|
||||
&thread->taskHandle,
|
||||
affinity
|
||||
);
|
||||
@@ -203,9 +205,9 @@ error_t thread_start(Thread* thread) {
|
||||
result = xTaskCreate(
|
||||
thread_main_body,
|
||||
thread->name.c_str(),
|
||||
stack_depth,
|
||||
thread->stackDepth,
|
||||
thread,
|
||||
(UBaseType_t)priority,
|
||||
priority,
|
||||
&thread->taskHandle
|
||||
);
|
||||
#endif
|
||||
@@ -213,9 +215,9 @@ error_t thread_start(Thread* thread) {
|
||||
result = xTaskCreate(
|
||||
thread_main_body,
|
||||
thread->name.c_str(),
|
||||
stack_depth,
|
||||
thread->stackDepth,
|
||||
thread,
|
||||
(UBaseType_t)priority,
|
||||
priority,
|
||||
&thread->taskHandle
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user