Firmware Development Notes

Quick Start with MCU + RTOS

Typical MCUs (STM32, ESP32-C3, NXP Kinetis, etc.) have limited resources and need an RTOS to manage tasks.

Minimal Task Template (FreeRTOS)

void vTaskBlink(void *pv){
  for(;;){
    HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
    vTaskDelay(pdMS_TO_TICKS(500));
  }
}
xTaskCreate(vTaskBlink, "blink", 128, NULL, 1, NULL);
vTaskStartScheduler();

The resulting bin file is usually < 64 KB and can be flashed directly.

Embedded Linux Highlights

When using an MPU (i.MX6/8, RK3566, Allwinner V3s) Linux flows like a "small PC".

Buildroot One-Line Build

git clone https://github.com/buildroot/buildroot.git
cd buildroot
make menuconfig          # choose board & packages
make -j$(nproc)          # generates sdcard.img

Burn the image to an SD card and boot; final size 50-200 MB.