fsmcBank1: Memory.MappedMemory @ sysbus 0x60000000
    size: 0x10000000

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

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

flash_controller: MTD.STM32F4_FlashController @ {
        sysbus 0x40023C00;
        sysbus new Bus.BusMultiRegistration { address: 0x1FFFC000; size: 0x100; region: "optionBytes" }
    }
    flash: flash

usart1: UART.STM32_UART @ sysbus <0x40011000, +0x100>
    -> nvic@37

usart2: UART.STM32_UART @ sysbus <0x40004400, +0x100>
    -> nvic@38

usart3: UART.STM32_UART @ sysbus <0x40004800, +0x100>
    -> nvic@39

uart4: UART.STM32_UART @ sysbus <0x40004C00, +0x100>
    -> nvic@52

uart5: UART.STM32_UART @ sysbus <0x40005000, +0x100>
    -> nvic@53

can1: CAN.STMCAN @ sysbus <0x40006400, +0x400>
    [0-3] -> nvic@[19-22]

can2: CAN.STMCAN @ sysbus <0x40006800, +0x400>
    [0-3] -> nvic@[63-66]
    master: can1

nvic: IRQControllers.NVIC @ sysbus 0xE000E000
    priorityMask: 0xF0
    systickFrequency: 72000000
    IRQ -> cpu@0

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

pwr: Miscellaneous.STM32_PWR @ sysbus 0x40007000

crc: CRC.STM32_CRC @ sysbus 0x40023000
    series: STM32Series.F4

exti: IRQControllers.STM32F4_EXTI @ sysbus 0x40013C00
    numberOfOutputLines: 24
    [0-4] -> nvic@[6-10]
    [5-9] -> nvicInput23@[0-4]
    [10-15] -> nvicInput40@[0-5]
    [16, 17, 18, 22] -> nvic@[1, 41, 42, 3]

nvicInput23: Miscellaneous.CombinedInput @ none
    numberOfInputs: 5
    -> nvic@23

nvicInput40: Miscellaneous.CombinedInput @ none
    numberOfInputs: 6
    -> nvic@40

gpioPortA: GPIOPort.STM32_GPIOPort @ sysbus <0x40020000, +0x400>
    modeResetValue: 0xA8000000
    outputSpeedResetValue: 0x0C000000
    pullUpPullDownResetValue: 0x64000000
    numberOfAFs: 16
    invertedAFPins: [[5, 3], [7, 1, 3]]
    [0-15] -> exti@[0-15]

gpioPortB: GPIOPort.STM32_GPIOPort @ sysbus <0x40020400, +0x400>
    modeResetValue: 0x00000280
    outputSpeedResetValue: 0x000000C0
    pullUpPullDownResetValue: 0x00000100
    numberOfAFs: 16
    invertedAFPins: [[0, 1, 3], [1, 1, 3], [13, 1], [14, 1, 3], [15, 1, 3]]
    [0-15] -> exti@[0-15]

gpioPortC: GPIOPort.STM32_GPIOPort @ sysbus <0x40020800, +0x400>
    numberOfAFs: 16
    [0-15] -> exti@[0-15]

gpioPortD: GPIOPort.STM32_GPIOPort @ sysbus <0x40020C00, +0x400>
    numberOfAFs: 16
    [0-15] -> exti@[0-15]

gpioPortE: GPIOPort.STM32_GPIOPort @ sysbus <0x40021000, +0x400>
    numberOfAFs: 16
    invertedAFPins: [[8, 1], [10, 1], [12, 1]]
    [0-15] -> exti@[0-15]

gpioPortF: GPIOPort.STM32_GPIOPort @ sysbus <0x40021400, +0x400>
    numberOfAFs: 16
    [0-15] -> exti@[0-15]

gpioPortG: GPIOPort.STM32_GPIOPort @ sysbus <0x40021800, +0x400>
    numberOfAFs: 16
    [0-15] -> exti@[0-15]

gpioPortH: GPIOPort.STM32_GPIOPort @ sysbus <0x40021c00, +0x400>
    numberOfAFs: 16
    invertedAFPins: [[13, 3], [14, 3], [15, 3]]
    [0-15] -> exti@[0-15]

gpioPortI: GPIOPort.STM32_GPIOPort @ sysbus <0x40022000, +0x400>
    numberOfAFs: 16
    [0-15] -> exti@[0-15]

gpioPortJ: GPIOPort.STM32_GPIOPort @ sysbus <0x40022400, +0x400>
    numberOfAFs: 16
    [0-15] -> exti@[0-15]

gpioPortK: GPIOPort.STM32_GPIOPort @ sysbus <0x40022800, +0x400>
    numberOfAFs: 16
    [0-15] -> exti@[0-15]

ethernet: Network.SynopsysEthernetMAC @ sysbus 0x40028000
    -> nvic@61

rom1: Memory.MappedMemory @ sysbus 0x1FFF0000
    size: 0xC000

rom2: Memory.MappedMemory @ sysbus 0x1FFFC400
    size: 0x3C00

spi1: SPI.STM32SPI @ sysbus 0x40013000

spi2: SPI.STM32SPI @ sysbus 0x40003800
    IRQ->nvic@35
    DMARecieve->dma1@3

spi3: SPI.STM32SPI @ sysbus 0x40003C00

i2c1: I2C.STM32F1_I2C @ sysbus 0x40005400
    EventInterrupt -> nvic@31
    ErrorInterrupt -> nvic@32

i2c2: I2C.STM32F1_I2C @ sysbus 0x40005800
    EventInterrupt -> nvic@33
    ErrorInterrupt -> nvic@34

i2c3: I2C.STM32F1_I2C @ sysbus 0x40005C00
    EventInterrupt -> nvic@72
    ErrorInterrupt -> nvic@73

dma1: DMA.STM32DMA @ sysbus 0x40026000
    [0-7] -> nvic@[11-17,47]

dma2: DMA.STM32DMA @ sysbus 0x40026400
    [0-7] -> nvic@[56-60,68-70]

rng: Miscellaneous.STM32F4_RNG @ sysbus 0x50060800
    -> nvic@80

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

rtc: Timers.STM32F4_RTC @ sysbus 0x40002800
    AlarmIRQ -> nvic@41

rcc: Miscellaneous.STM32F4_RCC @ sysbus 0x40023800
    rtcPeripheral: rtc
    Timer9Reset -> timer9@255

timer1: Timers.STM32_Timer @ sysbus 0x40010000
    BreakInterrupt -> nvic@24
    UpdateInterrupt -> nvic@25
    [TriggerInterrupt, CommutationInterrupt] -> nvic@[26, 26]
    CaptureCompareInterrupt -> nvic@27
    frequency: 10000000
    initialLimit: 0xFFFF

timer2: Timers.STM32_Timer @ sysbus 0x40000000
    -> nvic@28
    frequency: 10000000
    initialLimit: 0xFFFFFFFF

timer3: Timers.STM32_Timer @ sysbus 0x40000400
    -> nvic@29
    frequency: 10000000
    initialLimit: 0xFFFF

timer4: Timers.STM32_Timer @ sysbus 0x40000800
    -> nvic@30
    frequency: 10000000
    initialLimit: 0xFFFF

timer5: Timers.STM32_Timer @ sysbus 0x40000C00
    -> nvic@50
    frequency: 10000000
    initialLimit: 0xFFFFFFFF

timer6: Timers.STM32_Timer @ sysbus 0x40001000
    -> nvic@54
    frequency: 10000000
    initialLimit: 0xFFFF

timer7: Timers.STM32_Timer @ sysbus 0x40001400
    -> nvic@55
    frequency: 10000000
    initialLimit: 0xFFFF

timer8: Timers.STM32_Timer @ sysbus 0x40010400
    BreakInterrupt -> nvic@43
    UpdateInterrupt -> nvic@44
    [TriggerInterrupt, CommutationInterrupt] -> nvic@[45, 45]
    CaptureCompareInterrupt -> nvic@46
    frequency: 10000000
    initialLimit: 0xFFFF

timer9: Timers.STM32_Timer @ sysbus 0x40014000
    -> nvic@24
    frequency: 10000000
    initialLimit: 0xFFFF

timer10: Timers.STM32_Timer @ sysbus 0x40014400
    -> nvic@25
    frequency: 10000000
    initialLimit: 0xFFFF

timer11: Timers.STM32_Timer @ sysbus 0x40014800
    -> nvic@26
    frequency: 10000000
    initialLimit: 0xFFFF

timer12: Timers.STM32_Timer @ sysbus 0x40001800
    -> nvic@43
    frequency: 10000000
    initialLimit: 0xFFFF

timer13: Timers.STM32_Timer @ sysbus 0x40001C00
    -> nvic@44
    frequency: 10000000
    initialLimit: 0xFFFF

timer14: Timers.STM32_Timer @ sysbus 0x40002000
    -> nvic@45
    frequency: 10000000
    initialLimit: 0xFFFF

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

timer2:
    0 -> gpioPortA#00@01 | gpioPortA#05@01 | gpioPortA#15@01
    1 -> gpioPortA#01@01 | gpioPortB#03@01
    2 -> gpioPortA#02@01 | gpioPortB#10@01
    3 -> gpioPortA#03@01 | gpioPortB#11@01

timer3:
    0 -> gpioPortA#06@02 | gpioPortB#04@02 | gpioPortC#06@02
    1 -> gpioPortA#07@02 | gpioPortB#05@02 | gpioPortC#07@02
    2 -> gpioPortB#00@02 | gpioPortC#08@02
    3 -> gpioPortB#01@02 | gpioPortC#09@02

timer4:
    0 -> gpioPortB#06@02 | gpioPortD#12@02
    1 -> gpioPortB#07@02 | gpioPortD#13@02
    2 -> gpioPortB#08@02 | gpioPortD#14@02
    3 -> gpioPortB#09@02 | gpioPortD#15@02

timer5:
    0 -> gpioPortA#00@02 | gpioPortH#10@02
    1 -> gpioPortA#01@02 | gpioPortH#11@02
    2 -> gpioPortA#02@02 | gpioPortH#12@02
    3 -> gpioPortA#03@02 | gpioPortI#00@02

timer8:
    0 -> gpioPortC#06@03 | gpioPortI#05@03 | gpioPortA#05@03 | gpioPortA#07@03 | gpioPortH#13@3
    1 -> gpioPortC#07@03 | gpioPortI#06@03 | gpioPortB#00@03 | gpioPortB#14@03 | gpioPortH#14@3
    2 -> gpioPortC#08@03 | gpioPortI#07@03 | gpioPortB#01@03 | gpioPortB#15@03 | gpioPortH#15@3
    3 -> gpioPortC#09@03 | gpioPortI#02@03

timer9:
    0 -> gpioPortA#02@03 | gpioPortE#05@03
    1 -> gpioPortA#03@03 | gpioPortE#06@03

timer10:
    0 -> gpioPortB#08@03 | gpioPortF#06@03

timer11:
    0 -> gpioPortB#09@03 | gpioPortF#07@03

timer12:
    0 -> gpioPortB#14@09 | gpioPortH#06@09
    1 -> gpioPortB#15@09 | gpioPortH#09@09

timer13:
    0 -> gpioPortA#06@09 | gpioPortF#08@09

timer14:
    0 -> gpioPortA#07@09 | gpioPortF#09@09

bitbandPeripherals: Miscellaneous.BitBanding @ sysbus <0x42000000, +0x2000000>
    peripheralBase: 0x40000000

bitbandSram: Miscellaneous.BitBanding @ sysbus <0x22000000, +0x200000>
    peripheralBase: 0x20000000

sysbus:
    init:
        ApplySVD @https://dl.antmicro.com/projects/renode/svd/STM32F40x.svd.gz
        Tag <0x40021000, 0x40021003> "GPIOE_MODER" 0xFFFFFFFF
        Tag <0x40021004, 0x40021007> "GPIOE_OTYPER" 0x00000008
        // FLASH and USB tags are required for CubeMX-based projects to pass the initialization phase
        Tag <0x50000010, 0x5000003f> "USB:RESET" 0x80000000
