fsmcBank1: Memory.MappedMemory @ sysbus 0xC0000000
    size: 0x10000

sram: Memory.MappedMemory @ sysbus 0x20000000
    size: 0x20000

flash: Memory.MappedMemory @ sysbus 0x08000000
    size: 0x100000

pwr: Miscellaneous.STM32WBA_PWR @ sysbus 0x46020800

usart1: UART.STM32F7_USART @ sysbus 0x40013800
    frequency: 200000000
    IRQ -> nvic@46

usart2: UART.STM32F7_USART @ sysbus 0x40004400
    frequency: 200000000
    IRQ -> nvic@47

lpuart1: UART.STM32F7_USART @ sysbus 0x46002400
    frequency: 200000000
    lowPowerMode: true
    IRQ -> nvic@48

spi1: SPI.STM32WBA_SPI @ sysbus 0x40013000
    IRQ -> nvic@45

spi3: SPI.STM32WBA_SPI @ sysbus 0x46002000
    IRQ -> nvic@63

nvic: IRQControllers.NVIC @ sysbus 0xE000E000
    priorityMask: 0xF0
    // without any divider on the way the base clock is still divided by 8
    systickFrequency: 16000000
    IRQ -> cpu@0

exti: IRQControllers.STM32WBA_EXTI @ sysbus 0x46022000
    numberOfOutputLines: 24
    [0-15] -> nvic@[11-26]

adc4: Analog.STM32WBA_ADC @ sysbus 0x46021000
    referenceVoltage: 3.0
    externalEventFrequency: 1000
    -> nvic@65

cpu: CPU.CortexM @ sysbus
    cpuType: "cortex-m33"
    nvic: nvic

gpioPortA: GPIOPort.STM32_GPIOPort @ sysbus <0x42020000, +0x400>
    modeResetValue: 0xABFFFFFF
    outputSpeedResetValue: 0x08000000
    pullUpPullDownResetValue: 0x64000000
    numberOfAFs: 16
    invertedAFPins: [[0, 1], [1, 1], [3, 14]]
    [0-15] -> exti#0@[0-15]

gpioPortB: GPIOPort.STM32_GPIOPort @ sysbus <0x42020400, +0x400>
    modeResetValue: 0xFFFFFEBF
    outputSpeedResetValue: 0x00000080
    pullUpPullDownResetValue: 0x00000100
    numberOfAFs: 16
    invertedAFPins: [[0, 1], [1, 1], [2, 1], [3, 14], [7, 1], [8, 14], [9, 1]]
    [0-15] -> exti#1@[0-15]

gpioPortC: GPIOPort.STM32_GPIOPort @ sysbus <0x42020800, +0x400>
    modeResetValue: 0xFC000000
    numberOfAFs: 16
    [0-15] -> exti#2@[0-15]

gpioPortH: GPIOPort.STM32_GPIOPort @ sysbus <0x42021C00, +0x400>
    modeResetValue: 0x000000C0
    numberOfAFs: 16
    [0-15] -> exti#7@[0-15]

rom: Memory.MappedMemory @ sysbus 0x1FFF0000
    size: 0x10000

i2c1: I2C.STM32F7_I2C @ sysbus 0x40005400
    EventInterrupt -> nvic@43
    ErrorInterrupt -> nvic@44

i2c3: I2C.STM32F7_I2C @ sysbus 0x46002800
    EventInterrupt -> nvic@54
    ErrorInterrupt -> nvic@55

timer1: Timers.STM32_Timer @ sysbus 0x40012C00
    initialLimit: 0xFFFF
    frequency: 16000000
    BreakInterrupt -> nvic@37
    UpdateInterrupt -> nvic@38
    [TriggerInterrupt, CommutationInterrupt] -> nvic@[39, 39]
    CaptureCompareInterrupt -> nvic@40

timer2: Timers.STM32_Timer @ sysbus 0x40000000
    initialLimit: 0xFFFF
    frequency: 16000000
    -> nvic@41

timer3: Timers.STM32_Timer @ sysbus 0x40000400
    initialLimit: 0xFFFF
    frequency: 16000000
    -> nvic@42

timer16: Timers.STM32_Timer @ sysbus 0x40014400
    initialLimit: 0xFFFF
    frequency: 16000000
    -> nvic@51

timer17: Timers.STM32_Timer @ sysbus 0x40014800
    initialLimit: 0xFFFF
    frequency: 16000000
    -> nvic@52

iwdg: Timers.STM32_IndependentWatchdog @ sysbus 0x40003000
    frequency: 32000
    windowOption: true
    defaultPrescaler: 0

lptim1: Timers.STM32L0_LpTimer @ sysbus 0x46004400
    frequency: 16000000
    -> nvic@49

lptim2: Timers.STM32L0_LpTimer @ sysbus 0x40009400
    frequency: 16000000
    -> nvic@50

rtc: Timers.STM32F4_RTC @ sysbus 0x46007800

flash_ctrl: MTD.STM32WBA_FlashController @ sysbus 0x40022000
    flash: flash
    // TODO: connect interrupt

rcc: Miscellaneous.STM32WBA_RCC @ sysbus 0x46020C00
    nvic: nvic
    lptim1: lptim1
    lptim2: lptim2

// Alternate function mapping connections. For more details see `stm32l071.repl`.
timer1:
    0 -> gpioPortA#01@01 | gpioPortA#11@01 | gpioPortB#02@01 | gpioPortB#08@01
    1 -> gpioPortA#00@01 | gpioPortA#12@01 | gpioPortB#01@01
    2 -> gpioPortB#00@01 | gpioPortB#04@01 | gpioPortB#09@01
    3 -> gpioPortB#03@01 | gpioPortB#07@01

timer2:
    0 -> gpioPortA#05@01 | gpioPortB#06@01 | gpioPortB#12@01
    1 -> gpioPortA#08@01
    2 -> gpioPortA#07@01
    3 -> gpioPortA#06@01

timer3:
    0 -> gpioPortA#02@02 | gpioPortA#10@02 | gpioPortB#05@02
    1 -> gpioPortA#01@02 | gpioPortA#09@02
    2 -> gpioPortA#00@02 | gpioPortB#14@02
    3 -> gpioPortB#09@02 | gpioPortB#13@02

timer16:
    0 -> gpioPortA#02@14 | gpioPortA#03@14 | gpioPortB#08@14 | gpioPortB#09@14

timer17:
    0 -> gpioPortA#01@14 | gpioPortB#03@14 | gpioPortB#04@14

sysbus:
    init:
        Tag <0xE0001004, 0xE0001008> "DWT_CYCCNT" 100
