Skip to content

Instantly share code, notes, and snippets.

View christal87's full-sized avatar

Chris christal87

View GitHub Profile
@christal87
christal87 / task_stats.c
Created January 21, 2025 14:11
Function example to get most FreeRTOS task stats while debugging esp-idf projects through a UART only
#include "esp_log.h" //log macro fn, printf() custom formatters
#include "freertos/task.h" //TaskStatus_t, uxTaskGetNumberOfTasks(), uxTaskGetSystemState(), vTaskDelay(), uxTaskGetStackHighWaterMark(), uxTaskPriorityGet()
#define ARRAY_SIZE_OFFSET 5 //Increase this if print_real_time_stats returns prematurely
/* Print FreeRTOS task statistics for every task such as run time, percentage, priority, stack high water mark */
esp_err_t print_real_time_stats(TickType_t xTicksToWait) {
//must have 'configGENERATE_RUN_TIME_STATS' macro enabled
assert(configGENERATE_RUN_TIME_STATS);
@christal87
christal87 / CubeProgCLI_production_flash_verify.sh
Created January 21, 2025 13:52
Simple helper script to (irreversibly!!!) download and verify firmware into an STM32 MCU using CubeProgrammer's CLI
#!/bin/bash
CUBEProgrammerCLI_PATH="/your/path/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin"
FirmwareImage_PATH="${HOME}/your/path/project/firmware.bin"
${CUBEProgrammerCLI_PATH}/STM32_Programmer_CLI -c port=SWD mode=UR -score
if [ $? -eq 0 ]
then
echo "MCU query successful, moving on!"
@christal87
christal87 / errno.md
Last active January 2, 2025 17:56
Linux main error code cheat sheet