-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47f42bc
commit d760edc
Showing
5 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Import("env") | ||
|
||
env.Append( | ||
LINT_SOURCES=[ | ||
Dir("."), | ||
] | ||
) | ||
|
||
|
||
libenv = env.Clone(FW_LIB_NAME="furi") | ||
libenv.ApplyLibFlags() | ||
|
||
sources = libenv.GlobRecursive("*.c") | ||
|
||
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources) | ||
libenv.Install("${LIB_DIST_DIR}", lib) | ||
Return("lib") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "flipper.h" | ||
#include <applications.h> | ||
#include <furi.h> | ||
#include <furi_hal_version.h> | ||
#include <furi_hal_memory.h> | ||
#include <furi_hal_rtc.h> | ||
|
||
#include <FreeRTOS.h> | ||
|
||
#define TAG "Flipper" | ||
|
||
static void flipper_print_version(const char* target, const Version* version) { | ||
if(version) { | ||
FURI_LOG_I( | ||
TAG, | ||
"\r\n\t%s version:\t%s\r\n" | ||
"\tBuild date:\t\t%s\r\n" | ||
"\tGit Commit:\t\t%s (%s)%s\r\n" | ||
"\tGit Branch:\t\t%s", | ||
target, | ||
version_get_version(version), | ||
version_get_builddate(version), | ||
version_get_githash(version), | ||
version_get_gitbranchnum(version), | ||
version_get_dirty_flag(version) ? " (dirty)" : "", | ||
version_get_gitbranch(version)); | ||
} else { | ||
FURI_LOG_I(TAG, "No build info for %s", target); | ||
} | ||
} | ||
|
||
void flipper_init(void) { | ||
flipper_print_version("Firmware", furi_hal_version_get_firmware_version()); | ||
|
||
FURI_LOG_I(TAG, "Boot mode %d, starting services", furi_hal_rtc_get_boot_mode()); | ||
|
||
for(size_t i = 0; i < FLIPPER_SERVICES_COUNT; i++) { | ||
FURI_LOG_D(TAG, "Starting service %s", FLIPPER_SERVICES[i].name); | ||
|
||
FuriThread* thread = furi_thread_alloc_ex( | ||
FLIPPER_SERVICES[i].name, | ||
FLIPPER_SERVICES[i].stack_size, | ||
FLIPPER_SERVICES[i].app, | ||
NULL); | ||
furi_thread_mark_as_service(thread); | ||
furi_thread_set_appid(thread, FLIPPER_SERVICES[i].appid); | ||
|
||
furi_thread_start(thread); | ||
} | ||
|
||
FURI_LOG_I(TAG, "Startup complete"); | ||
} | ||
|
||
void vApplicationGetIdleTaskMemory( | ||
StaticTask_t** tcb_ptr, | ||
StackType_t** stack_ptr, | ||
uint32_t* stack_size) { | ||
*tcb_ptr = memmgr_alloc_from_pool(sizeof(StaticTask_t)); | ||
*stack_ptr = memmgr_alloc_from_pool(sizeof(StackType_t) * configIDLE_TASK_STACK_DEPTH); | ||
*stack_size = configIDLE_TASK_STACK_DEPTH; | ||
} | ||
|
||
void vApplicationGetTimerTaskMemory( | ||
StaticTask_t** tcb_ptr, | ||
StackType_t** stack_ptr, | ||
uint32_t* stack_size) { | ||
*tcb_ptr = memmgr_alloc_from_pool(sizeof(StaticTask_t)); | ||
*stack_ptr = memmgr_alloc_from_pool(sizeof(StackType_t) * configTIMER_TASK_STACK_DEPTH); | ||
*stack_size = configTIMER_TASK_STACK_DEPTH; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
void flipper_init(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "furi.h" | ||
#include <string.h> | ||
|
||
#include <FreeRTOS.h> | ||
#include <queue.h> | ||
|
||
void furi_init(void) { | ||
furi_check(!furi_kernel_is_irq_or_masked()); | ||
furi_check(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED); | ||
|
||
furi_log_init(); | ||
furi_record_init(); | ||
} | ||
|
||
void furi_run(void) { | ||
furi_check(!furi_kernel_is_irq_or_masked()); | ||
furi_check(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED); | ||
|
||
#if(__ARM_ARCH_7A__ == 0U) | ||
/* Service Call interrupt might be configured before kernel start */ | ||
/* and when its priority is lower or equal to BASEPRI, svc instruction */ | ||
/* causes a Hard Fault. */ | ||
NVIC_SetPriority(SVCall_IRQn, 0U); | ||
#endif | ||
|
||
/* Start the kernel scheduler */ | ||
vTaskStartScheduler(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include <stdlib.h> | ||
|
||
#include "core/check.h" | ||
#include "core/common_defines.h" | ||
#include "core/event_flag.h" | ||
#include "core/kernel.h" | ||
#include "core/log.h" | ||
#include "core/memmgr.h" | ||
#include "core/memmgr_heap.h" | ||
#include "core/message_queue.h" | ||
#include "core/mutex.h" | ||
#include "core/pubsub.h" | ||
#include "core/record.h" | ||
#include "core/semaphore.h" | ||
#include "core/thread.h" | ||
#include "core/timer.h" | ||
#include "core/string.h" | ||
#include "core/stream_buffer.h" | ||
|
||
#include <furi_hal_gpio.h> | ||
|
||
// Workaround for math.h leaking through HAL in older versions | ||
#include <math.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void furi_init(void); | ||
|
||
void furi_run(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |