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

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

flash: Memory.MappedMemory @ sysbus 0x00000000
    size: 0x20000000

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

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

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

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

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

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

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

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

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

exti: IRQControllers.STM32F4_EXTI @ sysbus 0x40010400
    numberOfOutputLines: 19
    [0-4] -> nvic@[6-10]
    [5-9] -> nvicInput23@[0-4]
    [10-15] -> nvicInput40@[0-5]

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

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

gpioPortA: GPIOPort.STM32F1GPIOPort @ sysbus <0x40010800, +0x400>
    invertedAFPins: [[7, 1]]
    [0-15] -> exti@[0-15]

gpioPortB: GPIOPort.STM32F1GPIOPort @ sysbus <0x40010C00, +0x400>
    invertedAFPins: [[13, 1], [14, 1], [15, 1], [0, 1], [1, 1]]
    [0-15] -> exti@[0-15]

gpioPortC: GPIOPort.STM32F1GPIOPort @ sysbus <0x40011000, +0x400>
    [0-15] -> exti@[0-15]

gpioPortD: GPIOPort.STM32F1GPIOPort @ sysbus <0x40011400, +0x400>
    [0-15] -> exti@[0-15]

gpioPortE: GPIOPort.STM32F1GPIOPort @ sysbus <0x40011800, +0x400>
    invertedAFPins: [[8, 1], [10, 1], [12, 1]]
    [0-15] -> exti@[0-15]

gpioPortF: GPIOPort.STM32F1GPIOPort @ sysbus <0x40011C00, +0x400>
    [0-15] -> exti@[0-15]

gpioPortG: GPIOPort.STM32F1GPIOPort @ sysbus <0x40012000, +0x400>
    [0-15] -> exti@[0-15]

timer1: Timers.STM32_Timer @ sysbus 0x40012c00
    -> nvic@25
    frequency: 10000000
    initialLimit: 0xFFFF

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

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: 0xFFFF

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 0x40013400
    -> nvic@44
    frequency: 10000000
    initialLimit: 0xFFFF

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

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

timer11: Timers.STM32_Timer @ sysbus 0x40015400
    -> 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

afio: GPIOPort.STM32F1AFIO @ sysbus 0x40010000
    gpioPorts: [gpioPortA, gpioPortB, gpioPortC, gpioPortD, gpioPortE, gpioPortF, gpioPortG]

// Alternate function connections
// The syntax is:
//     gpioPort#pinNumber@timerNumber
// Meaning `1 -> gpioPortA#2@5` connects output 1 to pin 2 of GPIO port A and it receives its signal from timer 5
timer1:
    0 -> gpioPortA#08@01 | gpioPortE#09@01 | gpioPortB#13@01 | gpioPortA#07@01 | gpioPortE#08@01
    1 -> gpioPortA#09@01 | gpioPortE#11@01 | gpioPortB#14@01 | gpioPortB#00@01 | gpioPortE#10@01
    2 -> gpioPortA#10@01 | gpioPortE#13@01 | gpioPortB#15@01 | gpioPortB#01@01 | gpioPortE#12@01
    3 -> gpioPortA#11@01 | gpioPortE#14@01

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

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

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

timer5:
    3 -> gpioPortA#03@05

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

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

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

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

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

sysbus:
    init:
        ApplySVD @https://dl.antmicro.com/projects/renode/svd/STM32F103.svd.gz
        Tag <0x40021000, 0x40021003> "RCC_CR" 0x0A020083
