[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:
@@ -92,4 +92,20 @@ size_t memmgr_pool_get_free(void) {
|
||||
|
||||
size_t memmgr_pool_get_max_block(void) {
|
||||
return furi_hal_memory_max_pool_block();
|
||||
}
|
||||
|
||||
void* aligned_malloc(size_t size, size_t alignment) {
|
||||
void* p1; // original block
|
||||
void** p2; // aligned block
|
||||
int offset = alignment - 1 + sizeof(void*);
|
||||
if((p1 = (void*)malloc(size + offset)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
p2 = (void**)(((size_t)(p1) + offset) & ~(alignment - 1));
|
||||
p2[-1] = p1;
|
||||
return p2;
|
||||
}
|
||||
|
||||
void aligned_free(void* p) {
|
||||
free(((void**)p)[-1]);
|
||||
}
|
@@ -35,6 +35,21 @@ size_t memmgr_get_total_heap(void);
|
||||
*/
|
||||
size_t memmgr_get_minimum_free_heap(void);
|
||||
|
||||
/**
|
||||
* An aligned version of malloc, used when you need to get the aligned space on the heap
|
||||
* Freeing the received address is performed ONLY through the aligned_free function
|
||||
* @param size
|
||||
* @param alignment
|
||||
* @return void*
|
||||
*/
|
||||
void* aligned_malloc(size_t size, size_t alignment);
|
||||
|
||||
/**
|
||||
* Freed space obtained through the aligned_malloc function
|
||||
* @param p pointer to result of aligned_malloc
|
||||
*/
|
||||
void aligned_free(void* p);
|
||||
|
||||
/**
|
||||
* @brief Allocate memory from separate memory pool. That memory can't be freed.
|
||||
*
|
||||
|
Reference in New Issue
Block a user