[FL-2627] Flipper applications: SDK, build and debug system (#1387)
* Added support for running applications from SD card (FAPs - Flipper Application Packages) * Added plugin_dist target for fbt to build FAPs * All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default * Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them * Added debugging support for FAPs with fbt debug & VSCode * Added public firmware API with automated versioning Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
41
applications/main/fap_loader/elf_cpp/elf_hashtable_entry.h
Normal file
41
applications/main/fap_loader/elf_cpp/elf_hashtable_entry.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct sym_entry {
|
||||
uint32_t hash;
|
||||
uint32_t address;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
|
||||
#define API_METHOD(x, ret_type, args_type) \
|
||||
sym_entry { \
|
||||
.hash = elf_gnu_hash(#x), .address = (uint32_t)(static_cast<ret_type(*) args_type>(x)) \
|
||||
}
|
||||
|
||||
#define API_VARIABLE(x, var_type) \
|
||||
sym_entry { \
|
||||
.hash = elf_gnu_hash(#x), .address = (uint32_t)(&(x)), \
|
||||
}
|
||||
|
||||
constexpr bool operator<(const sym_entry& k1, const sym_entry& k2) {
|
||||
return k1.hash < k2.hash;
|
||||
}
|
||||
|
||||
constexpr uint32_t elf_gnu_hash(const char* s) {
|
||||
uint32_t h = 0x1505;
|
||||
for(unsigned char c = *s; c != '\0'; c = *++s) {
|
||||
h = (h << 5) + h + c;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user