Files
2026-10-16 18:25:42 +02:00

78 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Frässpindel – HNP
Firmware für die Ansteuerung einer Frässpindel und eines Schrittmotors (L6474) auf einem
**STM32H755ZI** (Dual-Core: Cortex-M7 + Cortex-M4). Projekt im Rahmen von
*Hardwarenahes Programmieren von Echtzeitsystemen*.
Die eigentliche Anwendung läuft auf dem **Cortex-M7** unter FreeRTOS. Der Cortex-M4 wird nur
gestartet und über OpenAMP/HSEM synchronisiert.
## Projektstruktur
```
.
├── stepper_h7/ STM32CubeIDE-/Makefile-Projekt
│ ├── CM7/ Anwendung (Cortex-M7, FreeRTOS)
│ ├── CM4/ Cortex-M4
│ ├── Common/ gemeinsamer Startcode
│ ├── Drivers/ STM32 HAL / CMSIS
│ ├── Middlewares/ OpenAMP
│ └── stepper_h7.ioc CubeMX-Konfiguration
├── libs/ externe Bibliotheken (über relative Pfade eingebunden)
│ ├── FreeRTOS-LTS/
│ ├── LibL6474/ Schrittmotortreiber
│ ├── LibRTOSConsole/ Konsole über UART
│ ├── LibSpindle/ Spindelansteuerung
│ └── LibHALMockup/, LibCMocka/ Unit-Tests
├── spec/ Pflichtenheft, Interfacespezifikation, Laborbericht
└── doc/ Schaltpläne, Registerbeschreibungen
```
`stepper_h7` referenziert `../libs` relativ. Die Ordnerstruktur muss deshalb erhalten bleiben.
## Hardware
| Funktion | Pin | Makro (`CM7/Core/Inc/main.h`) |
|------------|------|------------------------------------------|
| LED grün | PB0 | `LED_GREEN_GPIO_Port`, `LED_GREEN_Pin` |
| LED gelb | PE1 | `LED_YELLOW_GPIO_Port`, `LED_YELLOW_Pin` |
| LED rot | PB14 | `LED_RED_GPIO_Port`, `LED_RED_Pin` |
| User-Taste | PC13 | `USR_BUTTON_GPIO_Port`, `USR_BUTTON_Pin` |
| Debug-UART | PD8/PD9 (USART3, 115200 Baud) | |
## Bauen und Flashen
### Variante A: STM32CubeIDE (Windows / macOS / Linux)
1. *File → Import → Existing Projects into Workspace* und `stepper_h7` auswählen
(`stepper_h7_CM7` und `stepper_h7_CM4` werden mit importiert).
2. `stepper_h7_CM7` (und `stepper_h7_CM4`) bauen.
3. Eine Debug-Konfiguration anlegen. Die `.launch`-Dateien sind bewusst nicht im Repo, weil sie
rechnerspezifische Pfade enthalten.
### Variante B: VS Code + Makefile
Voraussetzungen:
- [STM32CubeCLT](https://www.st.com/en/development-tools/stm32cubeclt.html)
(enthält `arm-none-eabi-gcc`, ST-LINK-GDB-Server, CubeProgrammer)
- Umgebungsvariable `STM32CLT_PATH` auf das CubeCLT-Installationsverzeichnis setzen
- `make` (macOS: `xcode-select --install`)
- VS-Code-Extensions: *Cortex-Debug*, *RTOS Views*, *C/C++*, *Serial Monitor*
```sh
cd stepper_h7
make cm7 -j # nur Cortex-M7
make all -j # M7 + M4
make clean
```
Debuggen über `stepper_h7.code-workspace` und die Konfiguration *Debug CM7 ST-Link V3*.
## Nicht im Repository
- Build-Ausgaben (`Debug/`, `build/`)
- Hersteller-Datenblätter (`doc/Datasheets/`), z. B. das
[STM32H7 Reference Manual (RM0399)](https://www.st.com/resource/en/reference_manual/rm0399-stm32h745755-and-stm32h747757-advanced-armbased-32bit-mcus-stmicroelectronics.pdf)
- Windows-spezifische Dateien (MSVC-Projekte, DLLs/EXEs von CMocka)