RTO1/UE/u01/CLAUDE.md

2.8 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Context

University exercise (RTO, "UE u01") for an STM32F072VBTx (Cortex-M0) board. The git root is two levels up (rto1/); UE/ holds exercises, VO/ holds lecture slides (PDF). The exercise spec is doc/u01.pdf. Code comments are partly German.

Build

Keil µVision 5 project Apus.uvprojx, target Apus, ARM Compiler 6 (armclang V6.23). There is no Makefile, linter, or test suite. Command-line build:

"C:/Users/gaems/AppData/Local/Keil_v5/UV4/UV4.exe" -b Apus.uvprojx -j0 -o build_log.txt

(-r for rebuild, -f to flash.) Output goes to output/ (Apus.axf, Apus.build_log.htm), map file to listing/. These build artifacts and the .uvguix.* / .uvoptx IDE state files are committed to git, so they show up as modified after every build.

  • Global defines: STM32F072,USE_STDPERIPH_DRIVER. Include paths: src, stm32f0-stdperiph, src/Devices, src/Tasks — so BSP headers are included as "BSP/Led.h", task headers directly.
  • New .c files must be added to the project's file groups in Apus.uvprojx (or via the µVision IDE), otherwise they are not compiled.

Architecture

  • Superloop, no RTOS (yet). src/main.c initializes the BSP, then calls each task function (TaskCounter, TaskKey, TaskLed, TaskWatch, TaskPoti, TaskMandelbrot) once per loop iteration, clearing the TFT at the start of each iteration. Tasks are plain void TaskX(void) functions in src/Tasks/ (aggregated by TaskAll.h) that keep state in static locals and draw their own row on the TFT (Tft_DrawString(10, 18 + row*24, ...), 16x24 font).
  • Timing measurement via GPIO. src/Debug.c drives GPIOB pins as logic-analyzer probes; debug_t maps each task (and the SysTick ISR) to a pin. main.c wraps every task call in Debug_Set/Debug_Unset; the double toggle on the mandelbrot pin at loop start measures the probe overhead. When adding a task, add an enum entry in Debug.h and its pin to the mask in Debug_Init.
  • SysTick (src/BSP/systick.c) fires every 1 ms and increments a private msTicks counter (also toggles the systick debug pin).
  • BSP (src/BSP/): Key, Led, Adc (potentiometer), TftDisplay — thin wrappers over the vendored ST Standard Peripheral Library in stm32f0-stdperiph/. Device/CMSIS/startup files live in src/Devices/. Don't modify vendored code.
  • src/StdDef.h provides BOOL/TRUE/FALSE/NULL_PTR; use these instead of <stdbool.h>. assert() failures land in __aeabi_assert in main.c (infinite loop for inspection in the debugger).