Loading...
Searching...
No Matches
flipper_application.h
Go to the documentation of this file.
1
5#pragma once
6
8#include "elf/elf_api_interface.h"
9
10#include <furi.h>
11#include <storage/storage.h>
12
13#include <stdbool.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19typedef enum {
20 FlipperApplicationPreloadStatusSuccess = 0,
21 FlipperApplicationPreloadStatusInvalidFile,
22 FlipperApplicationPreloadStatusNotEnoughMemory,
23 FlipperApplicationPreloadStatusInvalidManifest,
24 FlipperApplicationPreloadStatusApiTooOld,
25 FlipperApplicationPreloadStatusApiTooNew,
26 FlipperApplicationPreloadStatusTargetMismatch,
27} FlipperApplicationPreloadStatus;
28
29typedef enum {
30 FlipperApplicationLoadStatusSuccess = 0,
31 FlipperApplicationLoadStatusUnspecifiedError,
32 FlipperApplicationLoadStatusMissingImports,
33} FlipperApplicationLoadStatus;
34
39const char* flipper_application_preload_status_to_string(FlipperApplicationPreloadStatus status);
40
45const char* flipper_application_load_status_to_string(FlipperApplicationLoadStatus status);
46
48
49typedef struct {
50 const char* name;
51 uint32_t address;
53
54typedef struct {
55 uint32_t mmap_entry_count;
57 uint32_t debug_link_size;
58 uint8_t* debug_link;
60
67 flipper_application_alloc(Storage* storage, const ElfApiInterface* api_interface);
68
73
81FlipperApplicationPreloadStatus
82 flipper_application_preload(FlipperApplication* app, const char* path);
83
91FlipperApplicationPreloadStatus
93
99
104FlipperApplicationLoadStatus flipper_application_map_to_memory(FlipperApplication* app);
105
114
120
123typedef int32_t (*FlipperApplicationEntryPoint)(void*);
124
127typedef struct {
128 const char* appid;
129 const uint32_t ep_api_version;
130 const void* entry_point;
132
135typedef const FlipperAppPluginDescriptor* (*FlipperApplicationPluginEntryPoint)(void);
136
143
153 FuriString* path,
154 Storage* storage,
155 uint8_t** icon_ptr,
156 FuriString* item_name);
157
158#ifdef __cplusplus
159}
160#endif
Flipper application manifest.
void flipper_application_free(FlipperApplication *app)
Destroy FlipperApplication object.
Definition flipper_application.c:71
const char * flipper_application_preload_status_to_string(FlipperApplicationPreloadStatus status)
Get text description of preload status.
Definition flipper_application.c:273
FlipperApplicationPreloadStatus flipper_application_preload(FlipperApplication *app, const char *path)
Validate elf file and load application metadata.
Definition flipper_application.c:203
bool flipper_application_is_plugin(FlipperApplication *app)
Check if application is a plugin (not a runnable standalone app)
Definition flipper_application.c:66
int32_t(* FlipperApplicationEntryPoint)(void *)
Entry point prototype for standalone applications.
Definition flipper_application.h:123
FlipperApplicationLoadStatus flipper_application_map_to_memory(FlipperApplication *app)
Load sections and process relocations for already pre-loaded application.
Definition flipper_application.c:215
const FlipperApplicationManifest * flipper_application_get_manifest(FlipperApplication *app)
Get pointer to application manifest for preloaded application.
Definition flipper_application.c:210
const FlipperAppPluginDescriptor * flipper_application_plugin_get_descriptor(FlipperApplication *app)
Get plugin descriptor for preloaded plugin.
Definition flipper_application.c:308
FlipperApplicationPreloadStatus flipper_application_preload_manifest(FlipperApplication *app, const char *path)
Validate elf file and load application manifest.
Definition flipper_application.c:194
FuriThread * flipper_application_alloc_thread(FlipperApplication *app, const char *args)
Allocate application thread at entry point address, using app name and stack size from metadata.
Definition flipper_application.c:251
bool flipper_application_load_name_and_icon(FuriString *path, Storage *storage, uint8_t **icon_ptr, FuriString *item_name)
Load name and icon from FAP file.
Definition flipper_application.c:334
const char * flipper_application_load_status_to_string(FlipperApplicationLoadStatus status)
Get text description of load status.
Definition flipper_application.c:294
FlipperApplication * flipper_application_alloc(Storage *storage, const ElfApiInterface *api_interface)
Initialize FlipperApplication object.
Definition flipper_application.c:54
APIs for working with storages, directories and files.
Interface for ELF loader to resolve symbols.
Definition elf_api_interface.h:9
An object that describes a plugin - must be returned by plugin's entry point.
Definition flipper_application.h:127
Definition flipper_application.c:11
Definition application_manifest.h:36
Definition flipper_application.h:49
Definition flipper_application.h:54
Definition string.c:4
Definition thread.c:38
Definition storage_i.h:23