2020-11-14 16:24:38 +00:00
|
|
|
#include "app-template.h"
|
|
|
|
#include "stm32_adafruit_sd.h"
|
|
|
|
#include "fnv1a-hash.h"
|
2021-01-11 14:52:35 +00:00
|
|
|
#include "filesystem-api.h"
|
2021-01-13 21:23:34 +00:00
|
|
|
#include "cli/cli.h"
|
|
|
|
#include "callback-connector.h"
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
// event enumeration type
|
|
|
|
typedef uint8_t event_t;
|
|
|
|
|
|
|
|
class SdTestState {
|
|
|
|
public:
|
|
|
|
// state data
|
|
|
|
static const uint8_t lines_count = 6;
|
|
|
|
const char* line[lines_count];
|
|
|
|
|
|
|
|
// state initializer
|
|
|
|
SdTestState() {
|
|
|
|
for(uint8_t i = 0; i < lines_count; i++) {
|
|
|
|
line[i] = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// events class
|
|
|
|
class SdTestEvent {
|
|
|
|
public:
|
|
|
|
// events enum
|
|
|
|
static const event_t EventTypeTick = 0;
|
|
|
|
static const event_t EventTypeKey = 1;
|
|
|
|
|
|
|
|
// payload
|
|
|
|
union {
|
|
|
|
InputEvent input;
|
|
|
|
} value;
|
|
|
|
|
|
|
|
// event type
|
|
|
|
event_t type;
|
|
|
|
};
|
|
|
|
|
|
|
|
// our app derived from base AppTemplate class
|
|
|
|
// with template variables <state, events>
|
|
|
|
class SdTest : public AppTemplate<SdTestState, SdTestEvent> {
|
|
|
|
public:
|
|
|
|
// vars
|
|
|
|
GpioPin* red_led_record;
|
|
|
|
GpioPin* green_led_record;
|
|
|
|
const uint32_t benchmark_data_size = 4096;
|
|
|
|
uint8_t* benchmark_data;
|
2021-01-11 14:52:35 +00:00
|
|
|
FS_Api* fs_api;
|
2020-11-14 16:24:38 +00:00
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
// consts
|
|
|
|
static const uint32_t BENCHMARK_ERROR = UINT_MAX;
|
|
|
|
|
2020-11-14 16:24:38 +00:00
|
|
|
// funcs
|
|
|
|
void run();
|
2020-12-14 10:50:32 +00:00
|
|
|
void render(Canvas* canvas);
|
2020-11-14 16:24:38 +00:00
|
|
|
template <class T> void set_text(std::initializer_list<T> list);
|
|
|
|
template <class T> void set_error(std::initializer_list<T> list);
|
2021-02-10 08:56:05 +00:00
|
|
|
void wait_for_button(InputKey input_button);
|
|
|
|
bool ask(InputKey input_button_cancel, InputKey input_button_ok);
|
2020-11-14 16:24:38 +00:00
|
|
|
void blink_red();
|
|
|
|
void set_red();
|
|
|
|
void blink_green();
|
|
|
|
|
|
|
|
// "tests"
|
|
|
|
void detect_sd_card();
|
|
|
|
void show_warning();
|
|
|
|
void get_sd_card_info();
|
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
bool prepare_benchmark_data();
|
2020-11-14 16:24:38 +00:00
|
|
|
void free_benchmark_data();
|
|
|
|
void write_benchmark();
|
2021-01-13 21:23:34 +00:00
|
|
|
uint32_t
|
|
|
|
write_benchmark_internal(const uint32_t size, const uint32_t tcount, bool silent = false);
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
void read_benchmark();
|
2021-01-13 21:23:34 +00:00
|
|
|
uint32_t read_benchmark_internal(
|
|
|
|
const uint32_t size,
|
|
|
|
const uint32_t count,
|
|
|
|
File* file,
|
|
|
|
bool silent = false);
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
void hash_benchmark();
|
2021-01-13 21:23:34 +00:00
|
|
|
|
|
|
|
// cli tests
|
|
|
|
void cli_read_benchmark(string_t args, void* _ctx);
|
|
|
|
void cli_write_benchmark(string_t args, void* _ctx);
|
2020-11-14 16:24:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// start app
|
|
|
|
void SdTest::run() {
|
|
|
|
// create pin
|
|
|
|
GpioPin red_led = led_gpio[0];
|
|
|
|
GpioPin green_led = led_gpio[1];
|
|
|
|
|
|
|
|
// TODO open record
|
|
|
|
red_led_record = &red_led;
|
|
|
|
green_led_record = &green_led;
|
|
|
|
|
|
|
|
// configure pin
|
|
|
|
gpio_init(red_led_record, GpioModeOutputOpenDrain);
|
|
|
|
gpio_init(green_led_record, GpioModeOutputOpenDrain);
|
|
|
|
|
2020-11-19 12:25:32 +00:00
|
|
|
app_ready();
|
|
|
|
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
fs_api = static_cast<FS_Api*>(furi_record_open("sdcard"));
|
2021-01-11 14:52:35 +00:00
|
|
|
|
|
|
|
if(fs_api == NULL) {
|
|
|
|
set_error({"cannot get sdcard api"});
|
|
|
|
exit();
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
2021-01-11 14:52:35 +00:00
|
|
|
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
Cli* cli = static_cast<Cli*>(furi_record_open("cli"));
|
2021-01-13 21:23:34 +00:00
|
|
|
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
// read_benchmark and write_benchmark signatures are same. so we must use tags
|
|
|
|
auto cli_read_cb = cbc::obtain_connector<0>(this, &SdTest::cli_read_benchmark);
|
|
|
|
cli_add_command(cli, "sd_read_test", cli_read_cb, this);
|
2021-01-13 21:23:34 +00:00
|
|
|
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
auto cli_write_cb = cbc::obtain_connector<1>(this, &SdTest::cli_write_benchmark);
|
|
|
|
cli_add_command(cli, "sd_write_test", cli_write_cb, this);
|
2021-01-13 21:23:34 +00:00
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
detect_sd_card();
|
2020-11-14 16:24:38 +00:00
|
|
|
get_sd_card_info();
|
2021-01-11 14:52:35 +00:00
|
|
|
show_warning();
|
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
set_text({"preparing benchmark data"});
|
|
|
|
bool data_prepared = prepare_benchmark_data();
|
|
|
|
if(data_prepared) {
|
|
|
|
set_text({"benchmark data prepared"});
|
|
|
|
} else {
|
|
|
|
set_error({"cannot allocate buffer", "for benchmark data"});
|
|
|
|
}
|
|
|
|
|
2020-11-14 16:24:38 +00:00
|
|
|
write_benchmark();
|
|
|
|
read_benchmark();
|
|
|
|
hash_benchmark();
|
|
|
|
free_benchmark_data();
|
|
|
|
|
|
|
|
set_text({
|
|
|
|
"test complete",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"press BACK to exit",
|
|
|
|
});
|
2021-02-10 08:56:05 +00:00
|
|
|
wait_for_button(InputKeyBack);
|
2020-11-14 16:24:38 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
// detect sd card insertion
|
|
|
|
void SdTest::detect_sd_card() {
|
|
|
|
const uint8_t str_buffer_size = 40;
|
|
|
|
const uint8_t dots_animation_size = 4;
|
|
|
|
char str_buffer[str_buffer_size];
|
|
|
|
const char dots[dots_animation_size][4] = {"", ".", "..", "..."};
|
|
|
|
uint8_t i = 0;
|
|
|
|
|
|
|
|
// detect sd card pin
|
2021-01-11 14:52:35 +00:00
|
|
|
while(fs_api->common.get_fs_info(NULL, NULL) == FSE_NOT_READY) {
|
2020-11-14 16:24:38 +00:00
|
|
|
delay(100);
|
|
|
|
|
|
|
|
snprintf(str_buffer, str_buffer_size, "Waiting%s", dots[i]);
|
|
|
|
set_text({static_cast<const char*>(str_buffer), "Please insert sd card"});
|
|
|
|
|
|
|
|
if(i < (dots_animation_size - 1)) {
|
|
|
|
i++;
|
|
|
|
} else {
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
blink_green();
|
|
|
|
}
|
|
|
|
|
|
|
|
// show warning about test
|
|
|
|
void SdTest::show_warning() {
|
|
|
|
set_text(
|
|
|
|
{"!!Warning!!",
|
|
|
|
"during the tests",
|
2021-01-11 14:52:35 +00:00
|
|
|
"files can be overwritten",
|
2020-11-14 16:24:38 +00:00
|
|
|
"or data on card may be lost",
|
|
|
|
"",
|
|
|
|
"press UP DOWN OK to continue"});
|
|
|
|
|
2021-02-10 08:56:05 +00:00
|
|
|
wait_for_button(InputKeyUp);
|
|
|
|
wait_for_button(InputKeyDown);
|
|
|
|
wait_for_button(InputKeyOk);
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// get info about sd card, label, sn
|
|
|
|
// sector, cluster, total and free size
|
|
|
|
void SdTest::get_sd_card_info() {
|
|
|
|
const uint8_t str_buffer_size = 26;
|
2021-01-11 14:52:35 +00:00
|
|
|
char str_buffer[2][str_buffer_size];
|
|
|
|
FS_Error result;
|
|
|
|
uint64_t bytes_total, bytes_free;
|
2020-11-14 16:24:38 +00:00
|
|
|
int __attribute__((unused)) snprintf_count = 0;
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
result = fs_api->common.get_fs_info(&bytes_total, &bytes_free);
|
|
|
|
if(result != FSE_OK) set_error({"get_fs_info error", fs_api->error.get_desc(result)});
|
2020-11-14 16:24:38 +00:00
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
snprintf(
|
|
|
|
str_buffer[0], str_buffer_size, "%lu KB total", static_cast<uint32_t>(bytes_total / 1024));
|
|
|
|
snprintf(
|
|
|
|
str_buffer[1], str_buffer_size, "%lu KB free", static_cast<uint32_t>(bytes_free / 1024));
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
set_text(
|
|
|
|
{static_cast<const char*>(str_buffer[0]),
|
|
|
|
static_cast<const char*>(str_buffer[1]),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"press OK to continue"});
|
|
|
|
|
|
|
|
blink_green();
|
|
|
|
|
2021-02-10 08:56:05 +00:00
|
|
|
wait_for_button(InputKeyOk);
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare benchmark data (allocate data in ram)
|
2021-01-13 21:23:34 +00:00
|
|
|
bool SdTest::prepare_benchmark_data() {
|
|
|
|
bool result = true;
|
2020-11-14 16:24:38 +00:00
|
|
|
benchmark_data = static_cast<uint8_t*>(malloc(benchmark_data_size));
|
|
|
|
|
|
|
|
if(benchmark_data == NULL) {
|
2021-01-13 21:23:34 +00:00
|
|
|
result = false;
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for(size_t i = 0; i < benchmark_data_size; i++) {
|
|
|
|
benchmark_data[i] = static_cast<uint8_t>(i);
|
|
|
|
}
|
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
return result;
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SdTest::free_benchmark_data() {
|
|
|
|
free(benchmark_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// write speed test
|
|
|
|
void SdTest::write_benchmark() {
|
|
|
|
const uint32_t b1_size = 1;
|
|
|
|
const uint32_t b8_size = 8;
|
|
|
|
const uint32_t b32_size = 32;
|
|
|
|
const uint32_t b256_size = 256;
|
|
|
|
const uint32_t b4096_size = 4096;
|
|
|
|
|
|
|
|
const uint32_t benchmark_data_size = 16384 * 4;
|
|
|
|
|
|
|
|
uint32_t benchmark_bps = 0;
|
|
|
|
|
|
|
|
const uint8_t str_buffer_size = 32;
|
|
|
|
char str_buffer[6][str_buffer_size] = {"", "", "", "", "", ""};
|
|
|
|
auto string_list = {
|
|
|
|
static_cast<const char*>(str_buffer[0]),
|
|
|
|
static_cast<const char*>(str_buffer[1]),
|
|
|
|
static_cast<const char*>(str_buffer[2]),
|
|
|
|
static_cast<const char*>(str_buffer[3]),
|
|
|
|
static_cast<const char*>(str_buffer[4]),
|
|
|
|
static_cast<const char*>(str_buffer[5])};
|
|
|
|
|
|
|
|
set_text({"write speed test", "procedure can be lengthy", "please wait"});
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 1b test
|
|
|
|
benchmark_bps = write_benchmark_internal(b1_size, benchmark_data_size / b1_size);
|
|
|
|
snprintf(str_buffer[0], str_buffer_size, "1-byte: %lu bps", benchmark_bps);
|
|
|
|
set_text(string_list);
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 8b test
|
|
|
|
benchmark_bps = write_benchmark_internal(b8_size, benchmark_data_size / b8_size);
|
|
|
|
snprintf(str_buffer[1], str_buffer_size, "8-byte: %lu bps", benchmark_bps);
|
|
|
|
set_text(string_list);
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 32b test
|
|
|
|
benchmark_bps = write_benchmark_internal(b32_size, benchmark_data_size / b32_size);
|
|
|
|
snprintf(str_buffer[2], str_buffer_size, "32-byte: %lu bps", benchmark_bps);
|
|
|
|
set_text(string_list);
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 256b test
|
|
|
|
benchmark_bps = write_benchmark_internal(b256_size, benchmark_data_size / b256_size);
|
|
|
|
snprintf(str_buffer[3], str_buffer_size, "256-byte: %lu bps", benchmark_bps);
|
|
|
|
set_text(string_list);
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 4096b test
|
|
|
|
benchmark_bps = write_benchmark_internal(b4096_size, benchmark_data_size / b4096_size);
|
|
|
|
snprintf(str_buffer[4], str_buffer_size, "4096-byte: %lu bps", benchmark_bps);
|
|
|
|
snprintf(str_buffer[5], str_buffer_size, "press OK to continue");
|
|
|
|
set_text(string_list);
|
|
|
|
|
|
|
|
blink_green();
|
|
|
|
|
2021-02-10 08:56:05 +00:00
|
|
|
wait_for_button(InputKeyOk);
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
uint32_t SdTest::write_benchmark_internal(const uint32_t size, const uint32_t count, bool silent) {
|
|
|
|
uint32_t start_tick, stop_tick, benchmark_bps = 0, benchmark_time, bytes_written;
|
2021-01-11 14:52:35 +00:00
|
|
|
File file;
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
const uint8_t str_buffer_size = 32;
|
|
|
|
char str_buffer[str_buffer_size];
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.open(&file, "write.test", FSAM_WRITE, FSOM_OPEN_ALWAYS)) {
|
2021-01-13 21:23:34 +00:00
|
|
|
if(!silent) {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "in %lu-byte write test", size);
|
|
|
|
set_error({"cannot open file ", static_cast<const char*>(str_buffer)});
|
|
|
|
} else {
|
|
|
|
benchmark_bps = BENCHMARK_ERROR;
|
|
|
|
}
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
start_tick = osKernelGetTickCount();
|
|
|
|
for(size_t i = 0; i < count; i++) {
|
2021-01-11 14:52:35 +00:00
|
|
|
bytes_written = fs_api->file.write(&file, benchmark_data, size);
|
|
|
|
if(bytes_written != size || file.error_id != FSE_OK) {
|
2021-01-13 21:23:34 +00:00
|
|
|
if(!silent) {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "in %lu-byte write test", size);
|
|
|
|
set_error({"cannot write to file ", static_cast<const char*>(str_buffer)});
|
|
|
|
} else {
|
|
|
|
benchmark_bps = BENCHMARK_ERROR;
|
|
|
|
break;
|
|
|
|
}
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stop_tick = osKernelGetTickCount();
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.close(&file)) {
|
2021-01-13 21:23:34 +00:00
|
|
|
if(!silent) {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "in %lu-byte write test", size);
|
|
|
|
set_error({"cannot close file ", static_cast<const char*>(str_buffer)});
|
|
|
|
} else {
|
|
|
|
benchmark_bps = BENCHMARK_ERROR;
|
|
|
|
}
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
if(benchmark_bps != BENCHMARK_ERROR) {
|
|
|
|
benchmark_time = stop_tick - start_tick;
|
|
|
|
benchmark_bps = (count * size) * osKernelGetTickFreq() / benchmark_time;
|
|
|
|
}
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
return benchmark_bps;
|
|
|
|
}
|
|
|
|
|
|
|
|
// read speed test
|
|
|
|
void SdTest::read_benchmark() {
|
|
|
|
const uint32_t benchmark_data_size = 16384 * 8;
|
|
|
|
uint32_t bytes_written;
|
|
|
|
uint32_t benchmark_bps = 0;
|
|
|
|
|
|
|
|
const uint8_t str_buffer_size = 32;
|
|
|
|
char str_buffer[6][str_buffer_size] = {"", "", "", "", "", ""};
|
|
|
|
auto string_list = {
|
|
|
|
static_cast<const char*>(str_buffer[0]),
|
|
|
|
static_cast<const char*>(str_buffer[1]),
|
|
|
|
static_cast<const char*>(str_buffer[2]),
|
|
|
|
static_cast<const char*>(str_buffer[3]),
|
|
|
|
static_cast<const char*>(str_buffer[4]),
|
|
|
|
static_cast<const char*>(str_buffer[5])};
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
File file;
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
const uint32_t b1_size = 1;
|
|
|
|
const uint32_t b8_size = 8;
|
|
|
|
const uint32_t b32_size = 32;
|
|
|
|
const uint32_t b256_size = 256;
|
|
|
|
const uint32_t b4096_size = 4096;
|
|
|
|
|
|
|
|
// prepare data for read test
|
|
|
|
set_text({"prepare data", "for read speed test", "procedure can be lengthy", "please wait"});
|
|
|
|
delay(100);
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.open(&file, "read.test", FSAM_WRITE, FSOM_OPEN_ALWAYS)) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot open file ", "in prepare read"});
|
|
|
|
}
|
|
|
|
|
|
|
|
for(size_t i = 0; i < benchmark_data_size / b4096_size; i++) {
|
2021-01-11 14:52:35 +00:00
|
|
|
bytes_written = fs_api->file.write(&file, benchmark_data, b4096_size);
|
|
|
|
if(bytes_written != b4096_size || file.error_id != FSE_OK) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot write to file ", "in prepare read"});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.close(&file)) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot close file ", "in prepare read"});
|
|
|
|
}
|
|
|
|
|
|
|
|
// test start
|
|
|
|
set_text({"read speed test", "procedure can be lengthy", "please wait"});
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// open file
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.open(&file, "read.test", FSAM_READ, FSOM_OPEN_EXISTING)) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot open file ", "in read benchmark"});
|
|
|
|
}
|
|
|
|
|
|
|
|
// 1b test
|
|
|
|
benchmark_bps = read_benchmark_internal(b1_size, benchmark_data_size / b1_size, &file);
|
|
|
|
snprintf(str_buffer[0], str_buffer_size, "1-byte: %lu bps", benchmark_bps);
|
|
|
|
set_text(string_list);
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 8b test
|
|
|
|
benchmark_bps = read_benchmark_internal(b8_size, benchmark_data_size / b8_size, &file);
|
|
|
|
snprintf(str_buffer[1], str_buffer_size, "8-byte: %lu bps", benchmark_bps);
|
|
|
|
set_text(string_list);
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 32b test
|
|
|
|
benchmark_bps = read_benchmark_internal(b32_size, benchmark_data_size / b32_size, &file);
|
|
|
|
snprintf(str_buffer[2], str_buffer_size, "32-byte: %lu bps", benchmark_bps);
|
|
|
|
set_text(string_list);
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 256b test
|
|
|
|
benchmark_bps = read_benchmark_internal(b256_size, benchmark_data_size / b256_size, &file);
|
|
|
|
snprintf(str_buffer[3], str_buffer_size, "256-byte: %lu bps", benchmark_bps);
|
|
|
|
set_text(string_list);
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// 4096b test
|
|
|
|
benchmark_bps = read_benchmark_internal(b4096_size, benchmark_data_size / b4096_size, &file);
|
|
|
|
snprintf(str_buffer[4], str_buffer_size, "4096-byte: %lu bps", benchmark_bps);
|
|
|
|
snprintf(str_buffer[5], str_buffer_size, "press OK to continue");
|
|
|
|
set_text(string_list);
|
|
|
|
|
|
|
|
// close file
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.close(&file)) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot close file ", "in read test"});
|
|
|
|
}
|
|
|
|
|
|
|
|
blink_green();
|
|
|
|
|
2021-02-10 08:56:05 +00:00
|
|
|
wait_for_button(InputKeyOk);
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
uint32_t SdTest::read_benchmark_internal(
|
|
|
|
const uint32_t size,
|
|
|
|
const uint32_t count,
|
|
|
|
File* file,
|
|
|
|
bool silent) {
|
|
|
|
uint32_t start_tick, stop_tick, benchmark_bps = 0, benchmark_time, bytes_readed;
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
const uint8_t str_buffer_size = 32;
|
|
|
|
char str_buffer[str_buffer_size];
|
|
|
|
uint8_t* read_buffer;
|
|
|
|
|
|
|
|
read_buffer = static_cast<uint8_t*>(malloc(size));
|
|
|
|
|
|
|
|
if(read_buffer == NULL) {
|
2021-01-13 21:23:34 +00:00
|
|
|
if(!silent) {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "in %lu-byte read test", size);
|
|
|
|
set_error({"cannot allocate memory", static_cast<const char*>(str_buffer)});
|
|
|
|
} else {
|
|
|
|
benchmark_bps = BENCHMARK_ERROR;
|
|
|
|
}
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
fs_api->file.seek(file, 0, true);
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
start_tick = osKernelGetTickCount();
|
|
|
|
for(size_t i = 0; i < count; i++) {
|
2021-01-11 14:52:35 +00:00
|
|
|
bytes_readed = fs_api->file.read(file, read_buffer, size);
|
|
|
|
if(bytes_readed != size || file->error_id != FSE_OK) {
|
2021-01-13 21:23:34 +00:00
|
|
|
if(!silent) {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "in %lu-byte read test", size);
|
|
|
|
set_error({"cannot read from file ", static_cast<const char*>(str_buffer)});
|
|
|
|
} else {
|
|
|
|
benchmark_bps = BENCHMARK_ERROR;
|
|
|
|
break;
|
|
|
|
}
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stop_tick = osKernelGetTickCount();
|
|
|
|
|
|
|
|
free(read_buffer);
|
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
if(benchmark_bps != BENCHMARK_ERROR) {
|
|
|
|
benchmark_time = stop_tick - start_tick;
|
|
|
|
benchmark_bps = (count * size) * osKernelGetTickFreq() / benchmark_time;
|
|
|
|
}
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
return benchmark_bps;
|
|
|
|
}
|
|
|
|
|
|
|
|
// hash benchmark, store data to sd with known hash
|
|
|
|
// then read, calculate hash and compare both hashes
|
|
|
|
void SdTest::hash_benchmark() {
|
|
|
|
uint32_t mcu_data_hash = FNV_1A_INIT;
|
|
|
|
uint32_t sdcard_data_hash = FNV_1A_INIT;
|
|
|
|
uint8_t* read_buffer;
|
|
|
|
uint32_t bytes_readed;
|
|
|
|
|
|
|
|
uint32_t bytes_written;
|
|
|
|
|
|
|
|
const uint8_t str_buffer_size = 32;
|
|
|
|
char str_buffer[3][str_buffer_size] = {"", "", ""};
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
File file;
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
const uint32_t b4096_size = 4096;
|
|
|
|
const uint32_t benchmark_count = 20;
|
|
|
|
|
|
|
|
// prepare data for hash test
|
|
|
|
set_text({"prepare data", "for hash test"});
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// write data to test file and calculate hash
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.open(&file, "hash.test", FSAM_WRITE, FSOM_OPEN_ALWAYS)) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot open file ", "in prepare hash"});
|
|
|
|
}
|
|
|
|
|
|
|
|
for(uint32_t i = 0; i < benchmark_count; i++) {
|
|
|
|
mcu_data_hash = fnv1a_buffer_hash(benchmark_data, b4096_size, mcu_data_hash);
|
2021-01-11 14:52:35 +00:00
|
|
|
bytes_written = fs_api->file.write(&file, benchmark_data, b4096_size);
|
2020-11-14 16:24:38 +00:00
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(bytes_written != b4096_size || file.error_id != FSE_OK) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot write to file ", "in prepare hash"});
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(str_buffer[0], str_buffer_size, "writing %lu of %lu x 4k", i, benchmark_count);
|
|
|
|
set_text({"prepare data", "for hash test", static_cast<const char*>(str_buffer[0])});
|
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.close(&file)) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot close file ", "in prepare hash"});
|
|
|
|
}
|
|
|
|
|
|
|
|
// show hash of data located in mcu memory
|
|
|
|
snprintf(str_buffer[0], str_buffer_size, "hash in mcu 0x%lx", mcu_data_hash);
|
|
|
|
set_text({str_buffer[0]});
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
// read data from sd card and calculate hash
|
|
|
|
read_buffer = static_cast<uint8_t*>(malloc(b4096_size));
|
|
|
|
|
|
|
|
if(read_buffer == NULL) {
|
|
|
|
set_error({"cannot allocate memory", "in hash test"});
|
|
|
|
}
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.open(&file, "hash.test", FSAM_READ, FSOM_OPEN_EXISTING)) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot open file ", "in hash test"});
|
|
|
|
}
|
|
|
|
|
|
|
|
for(uint32_t i = 0; i < benchmark_count; i++) {
|
2021-01-11 14:52:35 +00:00
|
|
|
bytes_readed = fs_api->file.read(&file, read_buffer, b4096_size);
|
2020-11-14 16:24:38 +00:00
|
|
|
sdcard_data_hash = fnv1a_buffer_hash(read_buffer, b4096_size, sdcard_data_hash);
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(bytes_readed != b4096_size || file.error_id != FSE_OK) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot read from file ", "in hash test"});
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(str_buffer[1], str_buffer_size, "reading %lu of %lu x 4k", i, benchmark_count);
|
|
|
|
set_text({str_buffer[0], str_buffer[1]});
|
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
|
2021-01-11 14:52:35 +00:00
|
|
|
if(!fs_api->file.close(&file)) {
|
2020-11-14 16:24:38 +00:00
|
|
|
set_error({"cannot close file ", "in hash test"});
|
|
|
|
}
|
|
|
|
|
|
|
|
free(read_buffer);
|
|
|
|
|
|
|
|
snprintf(str_buffer[1], str_buffer_size, "hash in sdcard 0x%lx", sdcard_data_hash);
|
|
|
|
if(mcu_data_hash == sdcard_data_hash) {
|
|
|
|
snprintf(str_buffer[2], str_buffer_size, "hashes are equal, press OK");
|
|
|
|
set_text(
|
|
|
|
{static_cast<const char*>(str_buffer[0]),
|
|
|
|
static_cast<const char*>(str_buffer[1]),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
static_cast<const char*>(str_buffer[2])});
|
|
|
|
} else {
|
|
|
|
snprintf(str_buffer[2], str_buffer_size, "hash error, press BACK to exit");
|
|
|
|
set_error(
|
|
|
|
{static_cast<const char*>(str_buffer[0]),
|
|
|
|
static_cast<const char*>(str_buffer[1]),
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
static_cast<const char*>(str_buffer[2])});
|
|
|
|
}
|
|
|
|
|
|
|
|
blink_green();
|
|
|
|
|
2021-02-10 08:56:05 +00:00
|
|
|
wait_for_button(InputKeyOk);
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 21:23:34 +00:00
|
|
|
void SdTest::cli_read_benchmark(string_t args, void* _ctx) {
|
|
|
|
SdTest* _this = static_cast<SdTest*>(_ctx);
|
|
|
|
|
|
|
|
const uint32_t benchmark_data_size = 16384 * 8;
|
|
|
|
uint32_t bytes_written;
|
|
|
|
uint32_t benchmark_bps = 0;
|
|
|
|
File file;
|
|
|
|
|
|
|
|
const uint32_t b1_size = 1;
|
|
|
|
const uint32_t b8_size = 8;
|
|
|
|
const uint32_t b32_size = 32;
|
|
|
|
const uint32_t b256_size = 256;
|
|
|
|
const uint32_t b4096_size = 4096;
|
|
|
|
|
|
|
|
const uint8_t str_buffer_size = 64;
|
|
|
|
char str_buffer[str_buffer_size];
|
|
|
|
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("preparing benchmark data\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
bool data_prepared = _this->prepare_benchmark_data();
|
|
|
|
if(data_prepared) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("benchmark data prepared\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: cannot allocate buffer for benchmark data\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare data for read test
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("prepare data for read speed test, procedure can be lengthy, please wait\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
|
|
|
|
if(!_this->fs_api->file.open(&file, "read.test", FSAM_WRITE, FSOM_OPEN_ALWAYS)) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: cannot open file in prepare read\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for(size_t i = 0; i < benchmark_data_size / b4096_size; i++) {
|
|
|
|
bytes_written = _this->fs_api->file.write(&file, benchmark_data, b4096_size);
|
|
|
|
if(bytes_written != b4096_size || file.error_id != FSE_OK) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: cannot write to file in prepare read\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!_this->fs_api->file.close(&file)) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: cannot close file in prepare read\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// test start
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("read speed test, procedure can be lengthy, please wait\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
|
|
|
|
// open file
|
|
|
|
if(!_this->fs_api->file.open(&file, "read.test", FSAM_READ, FSOM_OPEN_EXISTING)) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: cannot open file in read benchmark\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 1b test
|
|
|
|
benchmark_bps =
|
|
|
|
_this->read_benchmark_internal(b1_size, benchmark_data_size / b1_size, &file, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 1-byte read test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "1-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 8b test
|
|
|
|
benchmark_bps =
|
|
|
|
_this->read_benchmark_internal(b8_size, benchmark_data_size / b8_size, &file, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 8-byte read test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "8-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 32b test
|
|
|
|
benchmark_bps =
|
|
|
|
_this->read_benchmark_internal(b32_size, benchmark_data_size / b32_size, &file, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 32-byte read test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "32-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 256b test
|
|
|
|
benchmark_bps =
|
|
|
|
_this->read_benchmark_internal(b256_size, benchmark_data_size / b256_size, &file, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 256-byte read test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "256-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 4096b test
|
|
|
|
benchmark_bps =
|
|
|
|
_this->read_benchmark_internal(b4096_size, benchmark_data_size / b4096_size, &file, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 4096-byte read test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(
|
|
|
|
str_buffer, str_buffer_size, "4096-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// close file
|
|
|
|
if(!_this->fs_api->file.close(&file)) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: cannot close file\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_this->free_benchmark_data();
|
|
|
|
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("test completed\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SdTest::cli_write_benchmark(string_t args, void* _ctx) {
|
|
|
|
SdTest* _this = static_cast<SdTest*>(_ctx);
|
|
|
|
|
|
|
|
const uint32_t b1_size = 1;
|
|
|
|
const uint32_t b8_size = 8;
|
|
|
|
const uint32_t b32_size = 32;
|
|
|
|
const uint32_t b256_size = 256;
|
|
|
|
const uint32_t b4096_size = 4096;
|
|
|
|
|
|
|
|
const uint32_t benchmark_data_size = 16384 * 4;
|
|
|
|
|
|
|
|
uint32_t benchmark_bps = 0;
|
|
|
|
|
|
|
|
const uint8_t str_buffer_size = 64;
|
|
|
|
char str_buffer[str_buffer_size];
|
|
|
|
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("preparing benchmark data\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
bool data_prepared = _this->prepare_benchmark_data();
|
|
|
|
if(data_prepared) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("benchmark data prepared\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: cannot allocate buffer for benchmark data\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("write speed test, procedure can be lengthy, please wait\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
|
|
|
|
// 1b test
|
|
|
|
benchmark_bps = _this->write_benchmark_internal(b1_size, benchmark_data_size / b1_size, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 1-byte write test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "1-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 8b test
|
|
|
|
benchmark_bps = _this->write_benchmark_internal(b8_size, benchmark_data_size / b8_size, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 8-byte write test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "8-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 32b test
|
|
|
|
benchmark_bps =
|
|
|
|
_this->write_benchmark_internal(b32_size, benchmark_data_size / b32_size, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 32-byte write test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "32-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 256b test
|
|
|
|
benchmark_bps =
|
|
|
|
_this->write_benchmark_internal(b256_size, benchmark_data_size / b256_size, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 256-byte write test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(str_buffer, str_buffer_size, "256-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 4096b test
|
|
|
|
benchmark_bps =
|
|
|
|
_this->write_benchmark_internal(b4096_size, benchmark_data_size / b4096_size, true);
|
|
|
|
if(benchmark_bps == BENCHMARK_ERROR) {
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("error: in 4096-byte write test\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
} else {
|
|
|
|
snprintf(
|
|
|
|
str_buffer, str_buffer_size, "4096-byte: %lu bytes per second\r\n", benchmark_bps);
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf(str_buffer);
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_this->free_benchmark_data();
|
|
|
|
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("test completed\r\n");
|
2021-01-13 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
2020-11-14 16:24:38 +00:00
|
|
|
// wait for button press
|
2021-02-10 08:56:05 +00:00
|
|
|
void SdTest::wait_for_button(InputKey input_button) {
|
2020-11-14 16:24:38 +00:00
|
|
|
SdTestEvent event;
|
|
|
|
osMessageQueueReset(event_queue);
|
|
|
|
while(1) {
|
|
|
|
osStatus_t result = osMessageQueueGet(event_queue, &event, NULL, osWaitForever);
|
|
|
|
|
|
|
|
if(result == osOK && event.type == SdTestEvent::EventTypeKey) {
|
2021-02-10 08:56:05 +00:00
|
|
|
if(event.value.input.type == InputTypeShort) {
|
|
|
|
if(event.value.input.key == InputKeyBack) {
|
2020-11-14 16:24:38 +00:00
|
|
|
exit();
|
|
|
|
} else {
|
2021-02-10 08:56:05 +00:00
|
|
|
if(event.value.input.key == input_button) {
|
2020-11-14 16:24:38 +00:00
|
|
|
blink_green();
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
blink_red();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
osMessageQueueReset(event_queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ask user to proceed or cancel
|
2021-02-10 08:56:05 +00:00
|
|
|
bool SdTest::ask(InputKey input_button_cancel, InputKey input_button_ok) {
|
2020-11-14 16:24:38 +00:00
|
|
|
bool return_result;
|
|
|
|
SdTestEvent event;
|
|
|
|
osMessageQueueReset(event_queue);
|
|
|
|
while(1) {
|
|
|
|
osStatus_t result = osMessageQueueGet(event_queue, &event, NULL, osWaitForever);
|
|
|
|
|
|
|
|
if(result == osOK && event.type == SdTestEvent::EventTypeKey) {
|
2021-02-10 08:56:05 +00:00
|
|
|
if(event.value.input.type == InputTypeShort) {
|
|
|
|
if(event.value.input.key == InputKeyBack) {
|
2020-11-14 16:24:38 +00:00
|
|
|
exit();
|
|
|
|
} else {
|
2021-02-10 08:56:05 +00:00
|
|
|
if(event.value.input.key == input_button_ok) {
|
2020-11-14 16:24:38 +00:00
|
|
|
blink_green();
|
|
|
|
return_result = true;
|
|
|
|
break;
|
2021-02-10 08:56:05 +00:00
|
|
|
} else if(event.value.input.key == input_button_cancel) {
|
2020-11-14 16:24:38 +00:00
|
|
|
blink_green();
|
|
|
|
return_result = false;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
blink_red();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
osMessageQueueReset(event_queue);
|
|
|
|
return return_result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// blink red led
|
|
|
|
void SdTest::blink_red() {
|
|
|
|
gpio_write(red_led_record, 0);
|
|
|
|
delay(50);
|
|
|
|
gpio_write(red_led_record, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// light up red led
|
|
|
|
void SdTest::set_red() {
|
|
|
|
gpio_write(red_led_record, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// blink green led
|
|
|
|
void SdTest::blink_green() {
|
|
|
|
gpio_write(green_led_record, 0);
|
|
|
|
delay(50);
|
|
|
|
gpio_write(green_led_record, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// set text, but with infinite loop
|
|
|
|
template <class T> void SdTest::set_error(std::initializer_list<T> list) {
|
|
|
|
set_text(list);
|
|
|
|
set_red();
|
2021-02-10 08:56:05 +00:00
|
|
|
wait_for_button(InputKeyBack);
|
2020-11-14 16:24:38 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
// set text, sort of variadic function
|
|
|
|
template <class T> void SdTest::set_text(std::initializer_list<T> list) {
|
|
|
|
uint8_t line_position = 0;
|
|
|
|
acquire_state();
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("------------------------\r\n");
|
2020-11-14 16:24:38 +00:00
|
|
|
|
|
|
|
// set line strings from args
|
|
|
|
for(auto element : list) {
|
|
|
|
state.line[line_position] = element;
|
|
|
|
printf("%s\n", element);
|
|
|
|
line_position++;
|
|
|
|
if(line_position == state.lines_count) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// set empty lines
|
|
|
|
for(; line_position < state.lines_count; line_position++) {
|
|
|
|
state.line[line_position] = "";
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("\r\n");
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 00:09:33 +00:00
|
|
|
printf("------------------------\r\n");
|
2020-11-14 16:24:38 +00:00
|
|
|
release_state();
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
update_gui();
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// render app
|
2020-12-14 10:50:32 +00:00
|
|
|
void SdTest::render(Canvas* canvas) {
|
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
|
canvas_set_font(canvas, FontSecondary);
|
2020-11-14 16:24:38 +00:00
|
|
|
for(uint8_t i = 0; i < state.lines_count; i++) {
|
2020-12-14 10:50:32 +00:00
|
|
|
canvas_draw_str(canvas, 0, (i + 1) * 10, state.line[i]);
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// app enter function
|
2021-02-12 17:24:34 +00:00
|
|
|
extern "C" int32_t sd_card_test(void* p) {
|
2020-11-14 16:24:38 +00:00
|
|
|
SdTest* app = new SdTest();
|
|
|
|
app->run();
|
2021-02-12 17:24:34 +00:00
|
|
|
return 0;
|
2020-11-14 16:24:38 +00:00
|
|
|
}
|