42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#include "app/composition_root.h"
|
|
#include "diagnostics/device_log_formatter.h"
|
|
#include <esp_heap_caps.h>
|
|
#include <esp_log.h>
|
|
|
|
#include <cJSON.h>
|
|
|
|
namespace {
|
|
|
|
constexpr const char* kTag = "BorlaFirmware2";
|
|
void* PsramCjsonMalloc(size_t size)
|
|
{
|
|
return heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
|
}
|
|
|
|
void PsramCjsonFree(void* pointer)
|
|
{
|
|
heap_caps_free(pointer);
|
|
}
|
|
} // namespace
|
|
|
|
extern "C" void app_main()
|
|
{
|
|
cJSON_Hooks cjson_hooks = {
|
|
PsramCjsonMalloc,
|
|
PsramCjsonFree,
|
|
};
|
|
cJSON_InitHooks(&cjson_hooks);///修复:全局 cJSON 钩子指向 PSRAM,防止WiFi mem fail
|
|
|
|
const bool log_identity_ready = borla::DeviceLogFormatter::Initialize();
|
|
ESP_LOGI(kTag, "starting firmware2 control and playback foundation");
|
|
if (!log_identity_ready) {
|
|
ESP_LOGW(kTag, "device MAC unavailable for log prefix");
|
|
}
|
|
|
|
static borla::CompositionRoot root;
|
|
if (!root.Initialize()) {
|
|
ESP_LOGE(kTag, "initialization incomplete; entering fault-capable loop");
|
|
}
|
|
root.Run();
|
|
}
|