Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-candidate' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Nov 1, 2022
2 parents 3ab17e5 + a50fb2a commit 8d0faae
Show file tree
Hide file tree
Showing 644 changed files with 13,478 additions and 2,654 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
**Compiled firmware for commit `${{steps.names.outputs.commit_sha}}`:**
- [📦 Update package](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz)
- [📥 DFU file](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-full-${{steps.names.outputs.suffix}}.dfu)
- [☁️ Web/App updater](https://my.flipp.dev/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.branch_name}}&version=${{steps.names.outputs.commit_sha}})
- [☁️ Web/App updater](https://lab.flipper.net/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.branch_name}}&version=${{steps.names.outputs.commit_sha}})
edit-mode: replace

compact:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pvs_studio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jobs:
pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
pvs-studio-analyzer analyze \
@.pvsoptions \
--disableLicenseExpirationCheck \
-j$(grep -c processor /proc/cpuinfo) \
-f build/f7-firmware-DC/compile_commands.json \
-o PVS-Studio.log
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'Unit tests'

on:
pull_request:

env:
TARGETS: f7
DEFAULT_TARGET: f7

jobs:
main:
runs-on: [self-hosted, FlipperZeroTest]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: 'Get flipper from device manager (mock)'
id: device
run: |
echo "flipper=/dev/ttyACM0" >> $GITHUB_OUTPUT
- name: 'Compile unit tests firmware'
id: compile
run: |
FBT_TOOLCHAIN_PATH=/opt ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1
- name: 'Wait for flipper to finish updating'
id: connect
if: steps.compile.outcome == 'success'
run: |
python3 ./scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
- name: 'Format flipper SD card'
id: format
if: steps.connect.outcome == 'success'
run: |
./scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext
- name: 'Copy assets and unit tests data to flipper'
id: copy
if: steps.format.outcome == 'success'
run: |
./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/resources /ext
./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/unit_tests /ext/unit_tests
- name: 'Run units and validate results'
if: steps.copy.outcome == 'success'
run: |
python3 ./scripts/testing/units.py ${{steps.device.outputs.flipper}}
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
[submodule "lib/microtar"]
path = lib/microtar
url = https://github.com/amachronic/microtar.git
[submodule "lib/scons"]
path = lib/scons
url = https://github.com/SCons/scons.git
[submodule "lib/mbedtls"]
path = lib/mbedtls
url = https://github.com/Mbed-TLS/mbedtls.git
[submodule "lib/cxxheaderparser"]
path = lib/cxxheaderparser
url = https://github.com/robotpy/cxxheaderparser.git
[submodule "applications/plugins/dap_link/lib/free-dap"]
path = applications/plugins/dap_link/lib/free-dap
url = https://github.com/ataradov/free-dap.git
2 changes: 1 addition & 1 deletion .vscode/example/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"configurations": [
{
"name": "Win32",
"compilerPath": "${workspaceFolder}/toolchain/i686-windows/bin/arm-none-eabi-gcc.exe",
"compilerPath": "${workspaceFolder}/toolchain/x86_64-windows/bin/arm-none-eabi-gcc.exe",
"intelliSenseMode": "gcc-arm",
"compileCommands": "${workspaceFolder}/build/latest/compile_commands.json",
"configurationProvider": "ms-vscode.cpptools",
Expand Down
19 changes: 19 additions & 0 deletions .vscode/example/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@
]
// "showDevDebugOutput": "raw",
},
{
"name": "Attach FW (DAP)",
"cwd": "${workspaceFolder}",
"executable": "./build/latest/firmware.elf",
"request": "attach",
"type": "cortex-debug",
"servertype": "openocd",
"device": "cmsis-dap",
"svdFile": "./debug/STM32WB55_CM4.svd",
"rtos": "FreeRTOS",
"configFiles": [
"interface/cmsis-dap.cfg",
"./debug/stm32wbx.cfg",
],
"postAttachCommands": [
"source debug/flipperapps.py",
],
// "showDevDebugOutput": "raw",
},
{
"name": "fbt debug",
"type": "python",
Expand Down
6 changes: 3 additions & 3 deletions .vscode/example/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"cortex-debug.enableTelemetry": false,
"cortex-debug.variableUseNaturalFormat": true,
"cortex-debug.showRTOS": true,
"cortex-debug.armToolchainPath.windows": "${workspaceFolder}/toolchain/i686-windows/bin",
"cortex-debug.armToolchainPath.windows": "${workspaceFolder}/toolchain/x86_64-windows/bin",
"cortex-debug.armToolchainPath.linux": "${workspaceFolder}/toolchain/x86_64-linux/bin",
"cortex-debug.armToolchainPath.osx": "${workspaceFolder}/toolchain/x86_64-darwin/bin",
"cortex-debug.openocdPath.windows": "${workspaceFolder}/toolchain/i686-windows/openocd/bin/openocd.exe",
"cortex-debug.openocdPath.windows": "${workspaceFolder}/toolchain/x86_64-windows/openocd/bin/openocd.exe",
"cortex-debug.openocdPath.linux": "${workspaceFolder}/toolchain/x86_64-linux/openocd/bin/openocd",
"cortex-debug.openocdPath.osx": "${workspaceFolder}/toolchain/x86_64-darwin/openocd/bin/openocd",
"cortex-debug.gdbPath.windows": "${workspaceFolder}/toolchain/i686-windows/bin/arm-none-eabi-gdb-py.bat",
"cortex-debug.gdbPath.windows": "${workspaceFolder}/toolchain/x86_64-windows/bin/arm-none-eabi-gdb-py.bat",
"cortex-debug.gdbPath.linux": "${workspaceFolder}/toolchain/x86_64-linux/bin/arm-none-eabi-gdb-py",
"cortex-debug.gdbPath.osx": "${workspaceFolder}/toolchain/x86_64-darwin/bin/arm-none-eabi-gdb-py",
"editor.formatOnSave": true,
Expand Down
4 changes: 2 additions & 2 deletions .vscode/example/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@
"label": "[Debug] Build FAPs",
"group": "build",
"type": "shell",
"command": "./fbt plugin_dist"
"command": "./fbt fap_dist"
},
{
"label": "[Release] Build FAPs",
"group": "build",
"type": "shell",
"command": "./fbt COMPACT=1 DEBUG=0 plugin_dist"
"command": "./fbt COMPACT=1 DEBUG=0 fap_dist"
},
{
"label": "[Debug] Launch App on Flipper",
Expand Down
16 changes: 12 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,9 @@ Depends(fap_dist, firmware_env["FW_EXTAPPS"]["validators"].values())
Alias("fap_dist", fap_dist)
# distenv.Default(fap_dist)

plugin_resources_dist = list(
distenv.Install(f"#/assets/resources/apps/{dist_entry[0]}", dist_entry[1])
for dist_entry in firmware_env["FW_EXTAPPS"]["dist"].values()
distenv.Depends(
firmware_env["FW_RESOURCES"], firmware_env["FW_EXTAPPS"]["resources_dist"]
)
distenv.Depends(firmware_env["FW_RESOURCES"], plugin_resources_dist)


# Target for bundling core2 package for qFlipper
Expand Down Expand Up @@ -291,6 +289,16 @@ distenv.PhonyTarget(
"@echo $( ${BLACKMAGIC_ADDR} $)",
)


# Find STLink probe ids
distenv.PhonyTarget(
"get_stlink",
distenv.Action(
lambda **kw: distenv.GetDevices(),
None,
),
)

# Prepare vscode environment
vscode_dist = distenv.Install("#.vscode", distenv.Glob("#.vscode/example/*"))
distenv.Precious(vscode_dist)
Expand Down
1 change: 1 addition & 0 deletions applications/debug/file_browser_test/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ App(
stack_size=2 * 1024,
order=150,
fap_category="Debug",
fap_icon_assets="icons",
)
2 changes: 1 addition & 1 deletion applications/debug/file_browser_test/file_browser_app.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "assets_icons.h"
#include <file_browser_test_icons.h>
#include "file_browser_app_i.h"
#include "gui/modules/file_browser.h"
#include <furi.h>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions applications/debug/unit_tests/nfc/nfc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define NFC_TEST_RESOURCES_DIR EXT_PATH("unit_tests/nfc/")
#define NFC_TEST_SIGNAL_SHORT_FILE "nfc_nfca_signal_short.nfc"
#define NFC_TEST_SIGNAL_LONG_FILE "nfc_nfca_signal_long.nfc"
#define NFC_TEST_DICT_PATH EXT_PATH("unit_tests/mf_classic_dict.nfc")

static const char* nfc_test_file_type = "Flipper NFC test";
static const uint32_t nfc_test_file_version = 1;
Expand Down Expand Up @@ -220,11 +221,78 @@ MU_TEST(mf_classic_dict_test) {
furi_string_free(temp_str);
}

MU_TEST(mf_classic_dict_load_test) {
Storage* storage = furi_record_open(RECORD_STORAGE);
mu_assert(storage != NULL, "storage != NULL assert failed\r\n");

// Delete unit test dict file if exists
if(storage_file_exists(storage, NFC_TEST_DICT_PATH)) {
mu_assert(
storage_simply_remove(storage, NFC_TEST_DICT_PATH),
"remove == true assert failed\r\n");
}

// Create unit test dict file
Stream* file_stream = file_stream_alloc(storage);
mu_assert(file_stream != NULL, "file_stream != NULL assert failed\r\n");
mu_assert(
file_stream_open(file_stream, NFC_TEST_DICT_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS),
"file_stream_open == true assert failed\r\n");

// Write unit test dict file
char key_str[] = "a0a1a2a3a4a5";
mu_assert(
stream_write_cstring(file_stream, key_str) == strlen(key_str),
"write == true assert failed\r\n");
// Close unit test dict file
mu_assert(file_stream_close(file_stream), "file_stream_close == true assert failed\r\n");

// Load unit test dict file
MfClassicDict* instance = NULL;
instance = mf_classic_dict_alloc(MfClassicDictTypeUnitTest);
mu_assert(instance != NULL, "mf_classic_dict_alloc\r\n");
uint32_t total_keys = mf_classic_dict_get_total_keys(instance);
mu_assert(total_keys == 1, "total_keys == 1 assert failed\r\n");

// Read key
uint64_t key_ref = 0xa0a1a2a3a4a5;
uint64_t key_dut = 0;
FuriString* temp_str = furi_string_alloc();
mu_assert(
mf_classic_dict_get_next_key_str(instance, temp_str),
"get_next_key_str == true assert failed\r\n");
mu_assert(furi_string_cmp_str(temp_str, key_str) == 0, "invalid key loaded\r\n");
mu_assert(mf_classic_dict_rewind(instance), "mf_classic_dict_rewind == 1 assert failed\r\n");
mu_assert(
mf_classic_dict_get_next_key(instance, &key_dut),
"get_next_key == true assert failed\r\n");
mu_assert(key_dut == key_ref, "invalid key loaded\r\n");
furi_string_free(temp_str);
mf_classic_dict_free(instance);

// Check that MfClassicDict added new line to the end of the file
mu_assert(
file_stream_open(file_stream, NFC_TEST_DICT_PATH, FSAM_READ, FSOM_OPEN_EXISTING),
"file_stream_open == true assert failed\r\n");
mu_assert(stream_seek(file_stream, -1, StreamOffsetFromEnd), "seek == true assert failed\r\n");
uint8_t last_char = 0;
mu_assert(stream_read(file_stream, &last_char, 1) == 1, "read == true assert failed\r\n");
mu_assert(last_char == '\n', "last_char == '\\n' assert failed\r\n");
mu_assert(file_stream_close(file_stream), "file_stream_close == true assert failed\r\n");

// Delete unit test dict file
mu_assert(
storage_simply_remove(storage, NFC_TEST_DICT_PATH), "remove == true assert failed\r\n");
stream_free(file_stream);
furi_record_close(RECORD_STORAGE);
}

MU_TEST_SUITE(nfc) {
nfc_test_alloc();

MU_RUN_TEST(nfc_digital_signal_test);
MU_RUN_TEST(mf_classic_dict_test);
MU_RUN_TEST(mf_classic_dict_load_test);

nfc_test_free();
}
Expand Down
30 changes: 12 additions & 18 deletions applications/debug/unit_tests/subghz/subghz_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#include <lib/subghz/transmitter.h>
#include <lib/subghz/subghz_keystore.h>
#include <lib/subghz/subghz_file_encoder_worker.h>
#include <lib/subghz/protocols/registry.h>
#include <lib/subghz/protocols/protocol_items.h>
#include <flipper_format/flipper_format_i.h>

#define TAG "SubGhz TEST"
#define KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes")
#define CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo")
#define NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s")
#define TEST_RANDOM_DIR_NAME EXT_PATH("unit_tests/subghz/test_random_raw.sub")
#define TEST_RANDOM_COUNT_PARSE 233
#define TEST_RANDOM_COUNT_PARSE 232
#define TEST_TIMEOUT 10000

static SubGhzEnvironment* environment_handler;
Expand Down Expand Up @@ -43,6 +43,8 @@ static void subghz_test_init(void) {
environment_handler, CAME_ATOMO_DIR_NAME);
subghz_environment_set_nice_flor_s_rainbow_table_file_name(
environment_handler, NICE_FLOR_S_DIR_NAME);
subghz_environment_set_protocol_registry(
environment_handler, (void*)&subghz_protocol_registry);

receiver_handler = subghz_receiver_alloc_init(environment_handler);
subghz_receiver_set_filter(receiver_handler, SubGhzProtocolFlag_Decodable);
Expand Down Expand Up @@ -413,11 +415,11 @@ MU_TEST(subghz_decoder_honeywell_wdb_test) {
"Test decoder " SUBGHZ_PROTOCOL_HONEYWELL_WDB_NAME " error\r\n");
}

MU_TEST(subghz_decoder_magellen_test) {
MU_TEST(subghz_decoder_magellan_test) {
mu_assert(
subghz_decoder_test(
EXT_PATH("unit_tests/subghz/magellen_raw.sub"), SUBGHZ_PROTOCOL_MAGELLEN_NAME),
"Test decoder " SUBGHZ_PROTOCOL_MAGELLEN_NAME " error\r\n");
EXT_PATH("unit_tests/subghz/magellan_raw.sub"), SUBGHZ_PROTOCOL_MAGELLAN_NAME),
"Test decoder " SUBGHZ_PROTOCOL_MAGELLAN_NAME " error\r\n");
}

MU_TEST(subghz_decoder_intertechno_v3_test) {
Expand All @@ -435,13 +437,6 @@ MU_TEST(subghz_decoder_clemsa_test) {
"Test decoder " SUBGHZ_PROTOCOL_CLEMSA_NAME " error\r\n");
}

MU_TEST(subghz_decoder_oregon2_test) {
mu_assert(
subghz_decoder_test(
EXT_PATH("unit_tests/subghz/oregon2_raw.sub"), SUBGHZ_PROTOCOL_OREGON2_NAME),
"Test decoder " SUBGHZ_PROTOCOL_OREGON2_NAME " error\r\n");
}

//test encoders
MU_TEST(subghz_encoder_princeton_test) {
mu_assert(
Expand Down Expand Up @@ -545,10 +540,10 @@ MU_TEST(subghz_encoder_honeywell_wdb_test) {
"Test encoder " SUBGHZ_PROTOCOL_HONEYWELL_WDB_NAME " error\r\n");
}

MU_TEST(subghz_encoder_magellen_test) {
MU_TEST(subghz_encoder_magellan_test) {
mu_assert(
subghz_encoder_test(EXT_PATH("unit_tests/subghz/magellen.sub")),
"Test encoder " SUBGHZ_PROTOCOL_MAGELLEN_NAME " error\r\n");
subghz_encoder_test(EXT_PATH("unit_tests/subghz/magellan.sub")),
"Test encoder " SUBGHZ_PROTOCOL_MAGELLAN_NAME " error\r\n");
}

MU_TEST(subghz_encoder_intertechno_v3_test) {
Expand Down Expand Up @@ -600,10 +595,9 @@ MU_TEST_SUITE(subghz) {
MU_RUN_TEST(subghz_decoder_doitrand_test);
MU_RUN_TEST(subghz_decoder_phoenix_v2_test);
MU_RUN_TEST(subghz_decoder_honeywell_wdb_test);
MU_RUN_TEST(subghz_decoder_magellen_test);
MU_RUN_TEST(subghz_decoder_magellan_test);
MU_RUN_TEST(subghz_decoder_intertechno_v3_test);
MU_RUN_TEST(subghz_decoder_clemsa_test);
MU_RUN_TEST(subghz_decoder_oregon2_test);

MU_RUN_TEST(subghz_encoder_princeton_test);
MU_RUN_TEST(subghz_encoder_came_test);
Expand All @@ -622,7 +616,7 @@ MU_TEST_SUITE(subghz) {
MU_RUN_TEST(subghz_encoder_doitrand_test);
MU_RUN_TEST(subghz_encoder_phoenix_v2_test);
MU_RUN_TEST(subghz_encoder_honeywell_wdb_test);
MU_RUN_TEST(subghz_encoder_magellen_test);
MU_RUN_TEST(subghz_encoder_magellan_test);
MU_RUN_TEST(subghz_encoder_intertechno_v3_test);
MU_RUN_TEST(subghz_encoder_clemsa_test);

Expand Down
24 changes: 24 additions & 0 deletions applications/examples/example_images/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Application icons
To use icons, do the following:
* add a line to the application manifest: `fap_icon_assets="folder"`, where `folder` points to the folder where your icons are located
* add `#include "application_id_icons.h"` to the application code, where `application_id` is the appid from the manifest
* every icon in the folder will be available as a `I_icon_name` variable, where `icon_name` is the name of the icon file without the extension

## Example
We have an application with the following manifest:
```
App(
appid="example_images",
...
fap_icon_assets="images",
)
```

So the icons are in the `images` folder and will be available in the generated `example_images_icons.h` file.

The example code is located in `example_images_main.c` and contains the following line:
```
#include "example_images_icons.h"
```

Image `dolphin_71x25.png` is available as `I_dolphin_71x25`.
Loading

0 comments on commit 8d0faae

Please sign in to comment.