Skip to content

MaticBabnik/badhal

Repository files navigation

BadHAL

A Hobby-grade HAL/BSP for the STM32-H750-disco board.

TODO

  • Tune memory timings
  • Doom
  • Ethernet + network stack
  • UDP pixelflut
  • Build a pixelflut wall @ DCTF27 or something.

BSP features

  • System clock setup (480MHz + QSPI + LTDC)
  • Setup for external SDRAM (8 MiB @ 0x9000_0000)
  • Header only include fault handlers (crash.h)

HAL Drivers

  • usart (blocking only for now)
  • nvic
  • clock (subset of RCC; work in progress)
  • mpu
  • gpio
  • debug (SWO logging)
  • qspi
  • ltdc

Libraries

  • badfs (a simple read-only filesystem for QSPI flash)
  • text (a simple text rendering library for LTDC)
  • sprintf (stb_sprintf)

Other features

  • SysTick and sys_delay
  • FPU setup
  • I-Cache, D-Cache and branch predictor setup
  • C23 only codebase with a couple intrinsics

Building

On Arch Linux (btw) you can grab all deps by doing

sudo pacman -Syu --needed \
    cmake \
    arm-none-eabi-gcc \
    arm-none-eabi-gdb \
    arm-none-eabi-newlib \
    arm-none-eabi-binutils \
    stlink

If targeting clang also grab clang, lld, and baremetal-compiler-rt(AUR).

Otherwise hunt down these deps for your system of choice. Make sure your compiler is new enough for C23

Then you can setup the project by doing

cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release

# you can also set:
# -DGCC_PREFIX="/path/to/your/gcc/arm-none-eabi"
# -- or --
# -DUSE_CLANG=ON
# -DCLANG_PATH="/path/to/folder/containing/clang/"
# -DCLANG_RTLIB_PATH="/dir/libclang_rt.builtins-armv7em.a"

And then build and flash with

cd build
ninja burn # has build as a dependency

Debugging

The project is setup for VSCode debugging with Cortex-Debug. Pressing F5 should start a debug session.

Make sure you rebuild and flash before debugging.

Docs / learning

You should check the following docs in order from most to least specific:

There are also the specific manuals for the DK components:

Shoutout:

About

A bad STM32 H750 Hardware Abstraction Layer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors