-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all F4 and G4 MCU targets and check for SYSTEM_HSE_MHZ define
echo "=== Scanning all F4 and G4 MCU targets ==="
echo ""
# Find all config.h files in configs directory
for config_file in configs/*/config.h; do
if [ -f "$config_file" ]; then
# Extract target name from path
target_name=$(echo "$config_file" | sed 's|configs/\(.*\)/config.h|\1|')
# Check if it's an F4 or G4 MCU
mcu_type=$(grep -E "^\s*#define\s+TARGET_MCU\s+" "$config_file" | awk '{print $3}')
if [[ "$mcu_type" =~ STM32F4 ]] || [[ "$mcu_type" =~ STM32G4 ]]; then
# Check if SYSTEM_HSE_MHZ is defined (case insensitive)
has_hse=$(grep -i "^\s*#define\s\+SYSTEM_HSE_MHZ\s\+" "$config_file")
if [ -z "$has_hse" ]; then
echo "❌ MISSING: $target_name (MCU: $mcu_type)"
else
hse_value=$(echo "$has_hse" | awk '{print $3}')
echo "✓ HAS: $target_name (MCU: $mcu_type, HSE: ${hse_value}MHz)"
fi
fi
fi
done
echo ""
echo "=== Summary ==="
echo "Targets with F4/G4 MCUs missing SYSTEM_HSE_MHZ:"
for config_file in configs/*/config.h; do
if [ -f "$config_file" ]; then
target_name=$(echo "$config_file" | sed 's|configs/\(.*\)/config.h|\1|')
mcu_type=$(grep -E "^\s*#define\s+TARGET_MCU\s+" "$config_file" | awk '{print $3}')
if [[ "$mcu_type" =~ STM32F4 ]] || [[ "$mcu_type" =~ STM32G4 ]]; then
has_hse=$(grep -i "^\s*#define\s\+SYSTEM_HSE_MHZ\s\+" "$config_file")
if [ -z "$has_hse" ]; then
echo " - $target_name ($mcu_type)"
fi
fi
fi
done
Length of output: 108
🏁 Script executed:
#!/bin/bash
# Let's see what MCU types are actually defined and check the pattern
echo "=== Checking all TARGET_MCU definitions ==="
echo ""
# Check all config.h files for TARGET_MCU
for config_file in configs/*/config.h; do
if [ -f "$config_file" ]; then
target_name=$(echo "$config_file" | sed 's|configs/\(.*\)/config.h|\1|')
mcu_line=$(grep "define.*TARGET_MCU" "$config_file")
if [ -n "$mcu_line" ]; then
echo "$target_name: $mcu_line"
fi
fi
done | head -20
echo ""
echo "=== Checking BETAFPVG473_V2 specifically ==="
cat configs/BETAFPVG473_V2/config.h
echo ""
echo "=== Count of MCU types ==="
for config_file in configs/*/config.h; do
if [ -f "$config_file" ]; then
grep "define.*TARGET_MCU" "$config_file" | awk '{print $3}'
fi
done | sort | uniq -c | sort -rn
Length of output: 4138
🏁 Script executed:
#!/bin/bash
# Find all F4 and G4 MCU targets and check for SYSTEM_HSE_MHZ define (corrected)
echo "=== Scanning F4 and G4 MCU targets for SYSTEM_HSE_MHZ ==="
echo ""
missing_targets=()
has_hse_targets=()
# Find all config.h files in configs directory
for config_file in configs/*/config.h; do
if [ -f "$config_file" ]; then
# Extract target name from path
target_name=$(echo "$config_file" | sed 's|configs/\(.*\)/config.h|\1|')
# Check if it's an F4 or G4 MCU (using FC_TARGET_MCU)
mcu_type=$(grep "define.*FC_TARGET_MCU" "$config_file" | awk '{print $3}')
if [[ "$mcu_type" =~ STM32F4 ]] || [[ "$mcu_type" =~ STM32G4 ]]; then
# Check if SYSTEM_HSE_MHZ is defined
has_hse=$(grep "^\s*#define\s\+SYSTEM_HSE_MHZ\s\+" "$config_file")
if [ -z "$has_hse" ]; then
echo "❌ MISSING: $target_name (MCU: $mcu_type)"
missing_targets+=("$target_name ($mcu_type)")
else
hse_value=$(echo "$has_hse" | awk '{print $3}')
has_hse_targets+=("$target_name ($mcu_type, HSE: ${hse_value}MHz)")
fi
fi
fi
done
echo ""
echo "=== SUMMARY ==="
echo ""
echo "F4/G4 targets WITH SYSTEM_HSE_MHZ: ${#has_hse_targets[@]}"
echo "F4/G4 targets MISSING SYSTEM_HSE_MHZ: ${#missing_targets[@]}"
echo ""
if [ ${#missing_targets[@]} -gt 0 ]; then
echo "Targets missing SYSTEM_HSE_MHZ define:"
printf '%s\n' "${missing_targets[@]}"
fi
echo ""
echo "=== Sample of targets WITH HSE defined ==="
printf '%s\n' "${has_hse_targets[@]}" | head -10
Length of output: 3826
@ot0tot: I've completed a comprehensive scan of all F4 and G4 MCU targets in the repository. Here are the findings:
Summary
Total F4/G4 targets: 270
- ✅ With SYSTEM_HSE_MHZ defined: 221 targets
- ❌ Missing SYSTEM_HSE_MHZ: 49 targets
Targets Missing SYSTEM_HSE_MHZ
STM32G47X (G4) - 9 targets missing:
- AIRBOTG4AIO
- GEPRC_TAKER_G473AIO
- KAKUTEG4AIO
- LUXHDAIO-G4
- LUXMICROAIO
- MAMBAG4
- NUCLEOG474
- SUB250_REDFOX_G473AIO
- TAKERG4AIO
STM32F405 (F4) - 28 targets missing:
ACCIF405, AIKONF4V2, ALIENFLIGHTF4, CADDXF4, CADDX_PROTOS_F4, CYCLONEF405_PRO, DAKEFPVF405, DREAMFLYF405, EAGLEF405, FF_RACEPIT, FF_RACEPIT_MINI, FLAOF405X8, FLYCOLORF4, HAKRCF405V2, HGLRCF405V2, MAMBAF405US, MAMBAF405US_I2C, MAMBAF405_2022A, MAMBAF405_2022B, NEUTRONRCF407, OMNIBUSF4NANOV7, RUSRACE_F4, SKYSTARSF405AIO, STELLARF4, STELLARF4V2, TCMM405V3, VGOODRCF405_DJI
STM32F411 (F4) - 11 targets missing:
ATOMRCF411, FLYWOOF411_5IN1_AIO, FOSSF4ELRS, GEELANGF411, GEPRCF411SX1280, HAKRCF411D, JHEF411HD, MAMBAF411, NEUTRONRCF411AIO, NEUTRONRCF411SX1280, TCMMF411, VGOODRCF411_DJI
STM32F446 (F4) - 1 target missing:
NUCLEOF446
Note
This PR correctly adds the SYSTEM_HSE_MHZ define to BETAFPVG473_V2. Would you like me to help track these other 48 missing targets by creating an issue for follow-up?
🧠 Learnings used
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T17:15:05.111Z
Learning: For Betaflight board configuration reviews, when analyzing TIMER_PIN_MAPPING definitions in config.h files, perform a comprehensive verification by: (1) Clone or access the betaflight/betaflight repository and look up each pin's timer definitions from the appropriate timer_stm32*.c file (e.g., timer_stm32h7xx.c for STM32H743, timer_stm32f4xx.c for STM32F405, etc.). (2) For each TIMER_PIN_MAP entry, verify that the timer occurrence index specified actually exists in the timer definition file for that pin. Non-existent occurrences will cause build or runtime errors. (3) Check if any timer occurrence being used is a complementary channel (ending in "N" like TIM1_CH2N, TIM8_CH3N). Complementary channels are not suitable for motor/servo control and must not be actively selected. (4) Verify that each timer channel uses a unique DMA index on MCUs with DMAMUX (like STM32H7). For MCUs without DMAMUX (like STM32F4/F7), verify non-conflicting DMA stream requests according to the appropriate DMA request mapping for that platform. Use sequential indices (0,1,2,3,4,5,6,7...) with -1 reserved only for pins that don't require DMA. (5) Verify that LED_STRIP_PIN has a valid DMA index (not -1) on platforms with DMAMUX, because WS2812/addressable LEDs require DMA for timing-critical operations. (6) Check that all defined CLKIN pins (like GYRO_1_CLKIN_PIN, GYRO_2_CLKIN_PIN) are included in the TIMER_PIN_MAPPING with appropriate timer occurrence and DMA -1. This systematic verification must be performed for all new or modified TIMER_PIN_MAPPING definitions before approval.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, F411 MCU, SPI-based RX, and BMI270 gyro are deprecated platforms as of September 16, 2024. New target submissions using these should be flagged.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, maintainer information must be included in target submissions according to the Requirements for Submission of New and Updated Targets.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, the manufacturer must be registered in the Manufacturers.md file. Always verify that the MANUFACTURER_ID in config.h has a corresponding entry in Manufacturers.md.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T21:01:01.473Z
Learning: For Betaflight board configuration reviews, when blocking issues are identified after an initial approval, immediately dismiss/withdraw the approval by using `gh pr review <PR_NUMBER> --repo betaflight/config --request-changes --body "<reason>"` to change the review state to CHANGES_REQUESTED. This actively manages approval status to ensure it accurately reflects the current mergability state of the PR.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T21:03:53.169Z
Learning: For Betaflight board configuration reviews, schematics are mandatory for the overall review process according to the Config Target Guidance, but they do NOT need to be provided publicly in the GitHub PR itself. Schematics review is conducted through a separate/private channel. Do not flag "missing schematics in PR" as a blocking issue.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:17:04.545Z
Learning: For Betaflight board configuration reviews, hardware design must follow the Manufacturer Design Guidelines: proper power regulation with good ground/power planes and decoupling, redundant solder pads or castellations for durability, oversized mounting holes for M3 stack robustness, clear silkscreen pin labels and revision marking, and high-speed signals routed away from noisy power traces.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, schematics are mandatory for all new target submissions. Submissions without schematics for review should be rejected according to the Config Target Guidance.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, STM32 F4 and F7 based designs with more than 4 motor outputs are not accepted for new submissions after December 3, 2024. This is an official timeline restriction from the Config Target Guidance.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, clones and poor quality designs will be denied during target assessment according to the official Config Target Guidance.
Originally posted by @coderabbitai[bot] in #1007 (comment)