固件与单片机编程
Firmware & microcontroller programming
Configure peripherals, build and flash firmware, verify behavior in a simulator or on logs.
20 条本项目编写的提案 · 分类 v1.1 · 新增基准运行 0 次。下方验证方式与部分得分规则是设计,不是执行结果。
- 典型应用
- STM32CubeIDE · Arduino IDE · PlatformIO
- 小类 GUI 需求标签
HY· 混合
任务提案 · 20
展开查看完整原文与建议检查方式;两种界面均保留提案英文原文。
R02.06.01.01-T01 Set up DMA UART echo with idle-line detection on an STM32
原始指令
In STM32CubeIDE, project fixtures/nucleo_f446_echo targets a NUCLEO-F446RE. Configure USART2 at 115200 8N1 on PA2/PA3 with DMA circular RX and idle-line interrupt, and echo each received line back prefixed with 'RX:'. Build and test in the provided Renode platform script.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · STM32CubeMX · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
click· 指向与点击code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Grader parses the .ioc (USART2 async, baud, DMA1 Stream5 circular) and runs the ELF in Renode: feeds 50 lines of 1–200 bytes at random gaps; every reply must equal 'RX:'+line with no drops. Build must come from the CubeIDE managed project (Debug config).
建议部分得分
25% .ioc peripheral config; 15% DMA circular + idle IRQ; 50% echo correctness over 50 lines; 10% clean build
R02.06.01.01-T02 Solve an STM32 clock tree for 180 MHz SYSCLK with USB at 48 MHz
原始指令
In STM32CubeMX for the STM32F446RE, set an 8 MHz HSE bypass source and configure PLLs so SYSCLK is 180 MHz, APB1 45 MHz, APB2 90 MHz and the USB OTG FS clock exactly 48 MHz. Regenerate code into fixtures/f446_clock and build.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeMX · STM32CubeIDE
- 交互表面
desk· 桌面 GUI- GUI 需求 · 任务设定
G2· GUI 必要- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
click· 指向与点击vis· 视觉判断- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Grader parses .ioc RCC values and runs the built ELF in Renode reading back RCC registers: SYSCLK 180 MHz, PCLK1 45, PCLK2 90, 48 MHz domain exact, flash latency 5 WS, overdrive enabled. CubeMX script mode (-s/-q) is blocked for the agent; the .ioc must be saved by CubeMX (version header) and regenerate with an empty diff, so hand-edited RCC values are detected.
建议部分得分
40% SYSCLK and bus clocks; 30% USB 48 MHz exact; 15% flash latency/overdrive; 15% regenerates cleanly
R02.06.01.01-T03 Blink with millis() and a debounced button in the Arduino IDE
原始指令
In the Arduino IDE with the Wokwi simulator project fixtures/uno_blink, make the LED on pin 13 blink at 2 Hz without delay(), and toggle blinking on/off with a button on pin 2 using 30 ms software debounce. Bounce noise is simulated by the circuit.
- 平台
mac· macOSwin· Windows- 应用
- Arduino IDE · Wokwi
- 交互表面
desk· 桌面 GUI- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令click· 指向与点击- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 1 / 5
建议验证方式
Wokwi CI runs 10 s with scripted button presses including 5 ms bounce bursts: logic analyzer on pin 13 shows 250±5 ms half-periods while enabled and steady low when disabled; exactly one toggle per press. Sketch must not call delay().
建议部分得分
40% 2 Hz timing; 40% debounced toggle; 20% no delay()
R02.06.01.01-T04 Port an Arduino sketch to PlatformIO with native unit tests
原始指令
Port fixtures/esp32_weather (Arduino IDE sketch with 3 .ino tabs) to a PlatformIO project for esp32dev, split the parser into lib/ with a header, and add Unity tests for the parser that run in the native environment.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- PlatformIO · VS Code
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 2 / 5
建议验证方式
Grader runs 'pio run -e esp32dev' (builds) and 'pio test -e native' (≥8 tests pass); hidden extra parser tests also pass against lib/. Firmware output in Wokwi for 30 s matches the original sketch's serial log line-for-line.
建议部分得分
30% esp32 build; 30% native tests; 20% hidden parser tests; 20% identical runtime log
R02.06.01.01-T05 Add a BME280 sensor through a Zephyr devicetree overlay
原始指令
fixtures/zephyr_env (Zephyr 3.6, nrf52840dk) needs a BME280 on I2C0 (SDA P0.26, SCL P0.27, addr 0x76). Write the devicetree overlay and Kconfig, read temperature/pressure/humidity every 2 s via the sensor API and log them. Test in the provided Renode setup with an emulated BME280.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- Zephyr · nRF Connect for VS Code · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令click· 指向与点击- 工作产物
WP06· 代码 / 工程- 条件
tutorial· 阅读文档 / 教程- 提案难度
- 4 / 5
建议验证方式
west build succeeds; zephyr.dts contains bme280@76 on i2c0 with the pins. Renode run: sensor model set to 3 scripted values; log lines match within ±0.1 °C, ±10 Pa, ±0.5 %RH and are 2±0.1 s apart.
建议部分得分
25% overlay and pins; 15% Kconfig; 45% values logged correctly; 15% timing
R02.06.01.01-T06 Fix a FreeRTOS priority-inversion stall on an STM32
原始指令
fixtures/f4_rtos_logger (STM32CubeIDE, FreeRTOS) sometimes stalls the high-priority control task for >50 ms. Using the CubeIDE FreeRTOS views and the Renode trace, find the inversion between the logger and SD tasks and fix it without changing task priorities.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · FreeRTOS · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令click· 指向与点击vis· 视觉判断- 工作产物
WP06· 代码 / 工程- 条件
hidden· 隐藏 / 过期状态- 提案难度
- 4 / 5
建议验证方式
Grader runs 60 s in Renode with the stress script and records control-task timestamps via a GPIO: max period jitter ≤2 ms, zero deadline misses. Task priorities unchanged (static check of osThreadAttr); fix must use a mutex with priority inheritance or restructure the lock.
建议部分得分
20% root cause written to output/rca.md; 60% jitter and deadlines; 20% priorities unchanged
R02.06.01.01-T07 Generate a 25 kHz PWM on a timer channel
原始指令
In fixtures/fan_ctrl (STM32CubeIDE, STM32F103C8), configure TIM3 CH1 on PA6 for 25 kHz PWM with duty set from a UART command 'D=<0..100>' (default 37.5%). Verify in Renode with the GPIO capture script.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · STM32CubeMX · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
click· 指向与点击code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Renode captures PA6 edges: frequency 25 kHz ±0.5%, default duty 37.5±0.5%; after 'D=80' duty 80±0.5% within 1 period; invalid commands ignored. .ioc must show TIM3 PWM Generation CH1.
建议部分得分
35% frequency; 25% default duty; 30% UART duty update; 10% .ioc config
R02.06.01.01-T08 Sample three ADC channels with circular DMA and averaging
原始指令
In fixtures/f446_adc, configure ADC1 to scan IN0, IN1, IN4 continuously with circular DMA, average 64 samples per channel and print millivolts once per second on USART2. The Renode model drives known voltages on the pins.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
click· 指向与点击code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Renode feeds 5 voltage steps per channel; printed values must match within ±5 mV at 1.00±0.05 s intervals. .ioc scan mode with 3 ranks in correct order; DMA circular half-word.
建议部分得分
30% ADC scan config; 20% DMA; 40% printed values correct; 10% interval
R02.06.01.01-T09 Implement a dual-slot UART firmware updater with rollback
原始指令
Extend fixtures/f4_boot so the bootloader accepts a new image over UART (XMODEM-1K), writes it to the inactive slot, verifies its CRC32 and header, swaps on success, and rolls back if the new app fails to confirm boot within 3 resets. Test in Renode.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
long· 长流程- 提案难度
- 5 / 5
建议验证方式
Renode scenarios: good image boots and reports v2; corrupted CRC image rejected and v1 boots; image that never confirms rolls back to v1 after 3 resets; power cut mid-write (Renode reset) leaves a bootable v1. Linker scripts place slots at spec addresses.
建议部分得分
20% XMODEM transfer; 20% CRC/header check; 30% swap + confirm; 30% rollback and power-cut safety
R02.06.01.01-T10 Enter STOP mode between RTC wakeups
原始指令
fixtures/l4_sensor (STM32L476) polls a sensor in a busy loop. Make it sample every 10 s using RTC wakeup and STOP2 mode between samples, restoring clocks after wakeup so USART logging still works at 115200.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · STM32CubeMX · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
click· 指向与点击code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Renode run of 120 s: 12 samples logged at 10±0.1 s; CPU in STOP2 ≥98% of time (PWR register trace); UART output not garbled (baud check). .ioc RTC wakeup enabled.
建议部分得分
30% RTC wakeup period; 40% STOP2 residency; 20% clock restore/UART; 10% config
R02.06.01.01-T11 Diagnose a HardFault from a crash log and fix it
原始指令
fixtures/f4_parser crashes with a HardFault after receiving input/crash_input.bin. Use STM32CubeIDE's Fault Analyzer and the call stack in the debugger (Renode GDB server) to find the faulting instruction and fix the root cause, writing the fault registers you observed to output/fault.txt.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · Renode · GDB
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
click· 指向与点击code· 代码与命令vis· 视觉判断- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
output/fault.txt must contain CFSR and faulting PC equal to the reference. Fixed ELF in Renode processes crash_input.bin and 200 fuzz cases without fault; unit tests pass.
建议部分得分
30% correct CFSR/PC; 50% no fault on inputs; 20% tests pass
R02.06.01.01-T12 Publish ESP32 sensor data over MQTT in QEMU
原始指令
In fixtures/esp_mqtt (ESP-IDF 5.2), connect via the QEMU OpenCores Ethernet to the local Mosquitto broker at 10.0.2.2, publish a JSON reading every 5 s to topic lab/esp/1, subscribe to lab/esp/1/cmd, and handle 'interval=<s>' commands persisted in NVS.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- ESP-IDF · QEMU · Mosquitto
- 交互表面
term· 终端desk· 桌面 GUI- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Grader runs QEMU 60 s: broker log shows ≥11 JSON messages with schema-valid fields at 5±0.2 s; sending interval=2 changes cadence; after QEMU reboot the 2 s interval persists. idf.py build clean.
建议部分得分
25% connects; 30% publishes valid JSON on time; 25% command handling; 20% NVS persistence
R02.06.01.01-T13 Show DS18B20 temperature on an I2C LCD in Wokwi
原始指令
In fixtures/uno_thermo (Arduino IDE + Wokwi), read a DS18B20 on pin 4 and show 'T: 23.5 C' (one decimal) on a 16x2 I2C LCD at 0x27 every second; show 'SENSOR ERR' if the sensor is disconnected.
- 平台
mac· macOSwin· Windows- 应用
- Arduino IDE · Wokwi
- 交互表面
desk· 桌面 GUI- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
G2· GUI 必要- 交互原语
code· 代码与命令click· 指向与点击- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 2 / 5
建议验证方式
Wokwi CI scenario sets temperatures 23.5, -4.0, 85.0 and disconnects the sensor: LCD buffer text must match exactly within 1.5 s of each change.
建议部分得分
60% formatted temperatures (3 cases); 25% error text; 15% update rate
R02.06.01.01-T14 Shrink firmware to fit 64 KB of flash
原始指令
fixtures/f103_meter builds to 71 KB but the STM32F103C8 has 64 KB. Reduce it below 60 KB without removing features: tune optimization and LTO, replace float printf with a fixed-point formatter, and drop unused HAL modules. All unit and Renode tests must pass.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · arm-none-eabi-gcc · Renode
- 交互表面
term· 终端desk· 桌面 GUI- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
arm-none-eabi-size: text+data ≤60 KB. Renode functional suite (15 checks of serial output) passes; printed values identical to the original firmware's log. Feature flags unchanged.
建议部分得分
40% size target; 40% functional suite; 20% identical output formatting
R02.06.01.01-T15 Accept only a CAN ID range with hardware filters
原始指令
In fixtures/f4_can (STM32CubeIDE), configure bxCAN at 500 kbit/s with hardware filters so only standard IDs 0x100–0x10F reach FIFO0, and reply to ID 0x105 requests with a status frame on 0x585. No software ID filtering is allowed.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令click· 指向与点击- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Renode CAN hub injects 500 frames across IDs: RX FIFO interrupt count equals the in-range count exactly; 0x105 requests get a 0x585 reply ≤1 ms with correct payload. Static check rejects software ID comparisons in the RX callback.
建议部分得分
25% bitrate config; 40% filter bank correct; 25% reply; 10% no software filtering
R02.06.01.01-T16 Add an independent watchdog and fix the path that starves it
原始指令
fixtures/f4_pump must recover from hangs. Enable IWDG with a 500 ms timeout, kick it only from the main supervisor after all tasks report alive, and fix the flash-erase routine that currently blocks for 800 ms.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令click· 指向与点击- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Renode: normal 120 s run has zero watchdog resets including 3 flash erases; injected task hang causes a reset within 500–550 ms and the reset reason is logged as IWDG. IWDG prescaler/reload give 500 ms ±5%.
建议部分得分
25% IWDG timing; 35% no spurious resets; 30% hang triggers reset; 10% reason logged
R02.06.01.01-T17 Configure a PIC16 UART and timer with MPLAB Code Configurator
原始指令
In MPLAB X with MCC, set up fixtures/pic16_logger (PIC16F18446): 32 MHz HFINTOSC, EUSART at 9600 baud on RB7/RB5, and TMR0 interrupt every 100 ms that prints an incrementing counter. Simulate in the MPLAB simulator with the UART output window.
- 平台
mac· macOSwin· Windows- 应用
- MPLAB X IDE · MPLAB Code Configurator
- 交互表面
desk· 桌面 GUI- GUI 需求 · 任务设定
G2· GUI 必要- GUI 需求 · 普通权限
G2· GUI 必要- 交互原语
click· 指向与点击vis· 视觉判断- 工作产物
WP06· 代码 / 工程- 条件
tutorial· 阅读文档 / 教程- 提案难度
- 3 / 5
建议验证方式
Grader parses the .mc3 configuration and generated sources (oscillator, baud generator, PPS pins, TMR0 period) and runs the hex in the MPLAB simulator via mdb: UART stimulus log shows counter lines every 100±1 ms. MCC has no documented CLI; the .mc3 must be saved by MCC (its header) and regenerate identically, and writes to it by non-MPLAB processes are logged.
建议部分得分
30% oscillator and PPS; 25% UART baud; 25% TMR0 period; 20% simulated output
R02.06.01.01-T18 Migrate an STM32F4 HAL project to an STM32G4
原始指令
Migrate fixtures/f4_motor (STM32F446RE, HAL, CubeIDE) to an STM32G474RE: recreate the pinout and peripheral setup (TIM1 complementary PWM with dead time, ADC injected conversions, USART2, SPI1) in CubeMX, port the application code, and keep timing behavior identical in Renode.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · STM32CubeMX · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
HY· 混合- 交互原语
click· 指向与点击code· 代码与命令geom· 精确几何- 工作产物
WP06· 代码 / 工程- 条件
long· 长流程- 提案难度
- 5 / 5
建议验证方式
Grader compares .ioc pin assignments to a mapping table; Renode captures TIM1 PWM (20 kHz, dead time 500 ns ±10 ns), ADC injected trigger timing and UART protocol replies against the F4 reference trace: all within tolerance. Build zero warnings.
建议部分得分
25% pinout mapping; 30% PWM + dead time; 25% ADC trigger timing; 20% protocol parity
R02.06.01.01-T19 Write a SPI NOR flash driver and verify it on a Renode model
原始指令
Write a W25Q64 driver for fixtures/f4_storage: read JEDEC ID, sector erase, page program across page boundaries, fast read, and busy polling with timeouts. Expose a CLI over UART ('id', 'erase <addr>', 'write <addr> <hex>', 'read <addr> <len>').
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- STM32CubeIDE · Renode
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Renode with a W25Q64 model: 'id' prints EF4017; scripted write spanning a page boundary reads back identical; erase sets 0xFF; busy timeout path returns error when the model stalls. SPI mode 0 and ≤ model's max clock.
建议部分得分
15% JEDEC ID; 35% cross-page write/read; 20% erase; 30% busy/timeouts and SPI config
R02.06.01.01-T20 Tune a motor speed PID in a software-in-the-loop simulator
原始指令
fixtures/dc_motor_sil runs the firmware's control loop (PlatformIO, native target) against a DC-motor plant model. Implement anti-windup PI(D) control at 1 kHz and tune gains so a 0→1500 rpm step settles to ±2% within 0.5 s with ≤5% overshoot, and a 30% load step recovers within 0.3 s.
- 平台
mac· macOSwin· Windowslin· Linux- 应用
- PlatformIO · VS Code
- 交互表面
desk· 桌面 GUIterm· 终端- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令vis· 视觉判断- 工作产物
WP07· 仿真结果- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Grader runs the SIL harness with hidden plant parameters (±10% variations, 5 cases): settling time, overshoot and load-recovery computed from logged rpm; pass per case if all three meet spec. Loop period must stay 1 kHz.
建议部分得分
20% controller implemented; 50% step specs across 5 plants; 30% load-step recovery
已有研究映射
当前映射未给此小类指定基准参考。