New logging and more (#446)
- `TT_LOG_*` macros are replaced by `Logger` via `#include<Tactility/Logger.h>` - Changed default timezone to Europe/Amsterdam - Fix for logic bug in unPhone hardware - Fix for init/deinit in DRV2605 driver - Other fixes - Removed optimization that broke unPhone (disabled the moving of heap-related functions to flash)
This commit is contained in:
committed by
GitHub
parent
719f7bcece
commit
f620255c41
@@ -4,18 +4,17 @@
|
||||
#include <Tactility/app/ElfApp.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/StringUtils.h>
|
||||
|
||||
#include <esp_elf.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace tt::app {
|
||||
|
||||
constexpr auto* TAG = "ElfApp";
|
||||
static auto LOGGER = Logger("ElfApp");
|
||||
|
||||
static std::string getErrorCodeString(int error_code) {
|
||||
switch (error_code) {
|
||||
@@ -72,7 +71,7 @@ private:
|
||||
|
||||
bool startElf() {
|
||||
const std::string elf_path = std::format("{}/elf/{}.elf", appPath, CONFIG_IDF_TARGET);
|
||||
TT_LOG_I(TAG, "Starting ELF %s", elf_path.c_str());
|
||||
LOGGER.info("Starting ELF {}", elf_path);
|
||||
assert(elfFileData == nullptr);
|
||||
|
||||
size_t size = 0;
|
||||
@@ -86,7 +85,7 @@ private:
|
||||
|
||||
if (esp_elf_init(&elf) != ESP_OK) {
|
||||
lastError = "Failed to initialize";
|
||||
TT_LOG_E(TAG, "%s", lastError.c_str());
|
||||
LOGGER.error("{}", lastError);
|
||||
elfFileData = nullptr;
|
||||
return false;
|
||||
}
|
||||
@@ -95,7 +94,7 @@ private:
|
||||
if (relocate_result != 0) {
|
||||
// Note: the result code maps to values from cstdlib's errno.h
|
||||
lastError = getErrorCodeString(-relocate_result);
|
||||
TT_LOG_E(TAG, "Application failed to load: %s", lastError.c_str());
|
||||
LOGGER.error("Application failed to load: {}", lastError);
|
||||
elfFileData = nullptr;
|
||||
return false;
|
||||
}
|
||||
@@ -105,7 +104,7 @@ private:
|
||||
|
||||
if (esp_elf_request(&elf, 0, argc, argv) != ESP_OK) {
|
||||
lastError = "Executable returned error code";
|
||||
TT_LOG_E(TAG, "%s", lastError.c_str());
|
||||
LOGGER.error("{}", lastError);
|
||||
esp_elf_deinit(&elf);
|
||||
elfFileData = nullptr;
|
||||
return false;
|
||||
@@ -116,7 +115,7 @@ private:
|
||||
}
|
||||
|
||||
void stopElf() {
|
||||
TT_LOG_I(TAG, "Cleaning up ELF");
|
||||
LOGGER.info("Cleaning up ELF");
|
||||
|
||||
if (shouldCleanupElf) {
|
||||
esp_elf_deinit(&elf);
|
||||
@@ -164,7 +163,7 @@ public:
|
||||
}
|
||||
|
||||
void onDestroy(AppContext& appContext) override {
|
||||
TT_LOG_I(TAG, "Cleaning up app");
|
||||
LOGGER.info("Cleaning up app");
|
||||
if (manifest != nullptr) {
|
||||
if (manifest->onDestroy != nullptr) {
|
||||
manifest->onDestroy(&appContext, data);
|
||||
@@ -223,7 +222,7 @@ void setElfAppParameters(
|
||||
}
|
||||
|
||||
std::shared_ptr<App> createElfApp(const std::shared_ptr<AppManifest>& manifest) {
|
||||
TT_LOG_I(TAG, "createElfApp");
|
||||
LOGGER.info("createElfApp");
|
||||
assert(manifest != nullptr);
|
||||
assert(manifest->appLocation.isExternal());
|
||||
return std::make_shared<ElfApp>(manifest->appLocation.getPath());
|
||||
|
||||
Reference in New Issue
Block a user