The goal of this project is to create a new target (STM32H725/H735) for betaflight (BF), using an existing target as a template, and to document the process on the way for future devs who want to do similar contributions.
For a new target in BF, we need
- Working hardware to play with
- some template for the code
- linker scripts
- startup code
- a BF-compatible linker script
- BF-compatible startup code
- Adjustments to peripheral setup and usage, if required
- Tons of patience along the way
- Support from the BF devs; platform of choice is discord
1 - Working Hardware
We have the "Chonker" (see project links), a custom PCB with the target MCU on it. It also features footprints for various peripherals usually found on a quadcopter (IMU, Barometer, Flash, LEDs) but most of that is not populated. There's an SWD header for debugging and a nucleo board that brings an ST-Link programmer/debugger to the table:
2 - Template
Since the H725/H735 target might be similar to an existing target from the H7 family, let's start with the H743 and see what we can use and how it might align with the H725.
3 and 4 - Linker script and Startup code
The Linker script tells the linker what memory areas exist on the MCU (different flavors of flash and RAM, their addresses and sizes) and what data goes where (executable code to flash, variables to RAM, initialization data to flash again, and so on).
The startup code is what is executed before entering main() and is highly MCU- and also application-specific. We'll have to find out what preconditions must be created before entering main so that the actual application can run on the properly prepared system. This includes initialization of power supplies, clock forest, and initialized variables.
We'll use the H743 linker scripts and startup code as a general guidance.
5 - Peripheral setup and usage
I expect this to be tricky - it's hard to tell what exactly BF expects here, but let's relax. It'll be a long way until we actually get to this point.
6 and 7 - Patience and Support
Since we're working on a new target, some Chonker boards were sent out to selected BF devs to support this project. However, that's not a "give hardware, receive code" trade.