cmake_minimum_required(VERSION 3.22)

# Add HAL library
add_library(hal STATIC)

# Add HAL sources
target_sources(hal PRIVATE
    Src/hal.c
    Src/hal_gpio.c
    Src/hal_delay.c
    Src/hal_uart.c
    Src/hal_spi.c
    Src/hal_eth.c
    # STM32F4 specific sources
    Src/arch/stm32f4/hal_stm32f4.c
    Src/arch/stm32f4/hal_stm32f4_gpio.c
    Src/arch/stm32f4/hal_stm32f4_uart.c
    Src/arch/stm32f4/hal_stm32f4_delay.c
    Src/arch/stm32f4/hal_stm32f4_spi.c
    Src/arch/stm32f4/hal_stm32f4_eth.c
)

# Add HAL include directories
target_include_directories(hal PUBLIC
    Inc
    Inc/arch/stm32f4
)

# Link HAL dependencies
target_link_libraries(hal PRIVATE
    stm32cubemx
)
