add Chapter12
This commit is contained in:
222
Chapter12/cpp_hal/renode_scripts/stm32f0.repl
Normal file
222
Chapter12/cpp_hal/renode_scripts/stm32f0.repl
Normal file
@@ -0,0 +1,222 @@
|
||||
nvic: IRQControllers.NVIC @ sysbus 0xE000E000
|
||||
priorityMask: 0xF0
|
||||
systickFrequency: 8000000
|
||||
IRQ -> cpu@0
|
||||
|
||||
exti: IRQControllers.STM32F4_EXTI @ sysbus 0x40010400
|
||||
numberOfOutputLines: 32
|
||||
[0, 1] -> nvicInput5@[0, 1]
|
||||
[2, 3] -> nvicInput6@[0, 1]
|
||||
[4-15] -> nvicInput7@[0-11]
|
||||
[21, 22] -> nvicInput12@[0, 1]
|
||||
[25] -> nvicInput27@[0]
|
||||
[26] -> nvicInput28@[0]
|
||||
[28] -> nvicInput29@[0]
|
||||
[18, 23, 27] -> nvic@[31, 23, 30]
|
||||
|
||||
nvicInput5: Miscellaneous.CombinedInput @ none
|
||||
numberOfInputs: 2
|
||||
-> nvic@5
|
||||
|
||||
nvicInput6: Miscellaneous.CombinedInput @ none
|
||||
numberOfInputs: 2
|
||||
-> nvic@6
|
||||
|
||||
nvicInput7: Miscellaneous.CombinedInput @ none
|
||||
numberOfInputs: 12
|
||||
-> nvic@7
|
||||
|
||||
nvicInput12: Miscellaneous.CombinedInput @ none
|
||||
numberOfInputs: 3
|
||||
-> nvic@12
|
||||
|
||||
nvicInput27: Miscellaneous.CombinedInput @ none
|
||||
numberOfInputs: 2
|
||||
-> nvic@27
|
||||
|
||||
nvicInput28: Miscellaneous.CombinedInput @ none
|
||||
numberOfInputs: 2
|
||||
-> nvic@28
|
||||
|
||||
nvicInput29: Miscellaneous.CombinedInput @ none
|
||||
numberOfInputs: 7
|
||||
-> nvic@29
|
||||
|
||||
cpu: CPU.CortexM @ sysbus
|
||||
cpuType: "cortex-m0"
|
||||
nvic: nvic
|
||||
PerformanceInMips: 100
|
||||
|
||||
usart1: UART.STM32F7_USART @ sysbus 0x40013800
|
||||
frequency: 200000000
|
||||
IRQ -> nvicInput27@1
|
||||
|
||||
usart2: UART.STM32F7_USART @ sysbus 0x40004400
|
||||
frequency: 4000000
|
||||
IRQ -> nvicInput28@1
|
||||
|
||||
usart3: UART.STM32F7_USART @ sysbus 0x40004800
|
||||
frequency: 200000000
|
||||
IRQ -> nvicInput29@1
|
||||
|
||||
usart4: UART.STM32F7_USART @ sysbus 0x40004C00
|
||||
frequency: 200000000
|
||||
IRQ -> nvicInput29@2
|
||||
|
||||
usart5: UART.STM32F7_USART @ sysbus 0x40005000
|
||||
frequency: 200000000
|
||||
IRQ -> nvicInput29@3
|
||||
|
||||
usart6: UART.STM32F7_USART @ sysbus 0x40011400
|
||||
frequency: 200000000
|
||||
IRQ -> nvicInput29@4
|
||||
|
||||
usart7: UART.STM32F7_USART @ sysbus 0x40011800
|
||||
frequency: 200000000
|
||||
IRQ -> nvicInput29@5
|
||||
|
||||
gpioPortA: GPIOPort.STM32_GPIOPort @ sysbus <0x48000000, +0x400>
|
||||
modeResetValue: 0x28000000
|
||||
pullUpPullDownResetValue: 0x24000000
|
||||
numberOfAFs: 8
|
||||
[0-15] -> exti@[0-15]
|
||||
|
||||
gpioPortB: GPIOPort.STM32_GPIOPort @ sysbus <0x48000400, +0x400>
|
||||
modeResetValue: 0x00000000
|
||||
pullUpPullDownResetValue: 0x00000000
|
||||
numberOfAFs: 8
|
||||
[0-15] -> exti@[0-15]
|
||||
|
||||
gpioPortC: GPIOPort.STM32_GPIOPort @ sysbus <0x48000800, +0x400>
|
||||
modeResetValue: 0x00000000
|
||||
pullUpPullDownResetValue: 0x00000000
|
||||
numberOfAFs: 8
|
||||
[0-15] -> exti@[0-15]
|
||||
|
||||
gpioPortD: GPIOPort.STM32_GPIOPort @ sysbus <0x48000C00, +0x400>
|
||||
modeResetValue: 0x00000000
|
||||
pullUpPullDownResetValue: 0x00000000
|
||||
numberOfAFs: 8
|
||||
[0-15] -> exti@[0-15]
|
||||
|
||||
gpioPortE: GPIOPort.STM32_GPIOPort @ sysbus <0x48001000, +0x400>
|
||||
modeResetValue: 0x00000000
|
||||
pullUpPullDownResetValue: 0x00000000
|
||||
numberOfAFs: 8
|
||||
[0-15] -> exti@[0-15]
|
||||
|
||||
gpioPortF: GPIOPort.STM32_GPIOPort @ sysbus <0x48001400, +0x400>
|
||||
modeResetValue: 0x28000000
|
||||
pullUpPullDownResetValue: 0x24000000
|
||||
numberOfAFs: 8
|
||||
[0-15] -> exti@[0-15]
|
||||
|
||||
i2c1: I2C.STM32F7_I2C @ sysbus 0x40005400
|
||||
|
||||
i2c2: I2C.STM32F7_I2C @ sysbus 0x40005800
|
||||
|
||||
spi1: SPI.STM32SPI @ sysbus 0x40013000
|
||||
IRQ -> nvic@25
|
||||
|
||||
spi2: SPI.STM32SPI @ sysbus 0x40003800
|
||||
IRQ -> nvic@26
|
||||
|
||||
timer1: Timers.STM32_Timer @ sysbus <0x40012C00, +0x400>
|
||||
frequency: 10000000
|
||||
initialLimit: 0xFFFF
|
||||
-> nvic@14
|
||||
|
||||
timer2: Timers.STM32_Timer @ sysbus <0x40000000, +0x400>
|
||||
frequency: 10000000
|
||||
initialLimit: 0xFFFFFFFF
|
||||
-> nvic@15
|
||||
|
||||
timer3: Timers.STM32_Timer @ sysbus <0x40000400, +0x400>
|
||||
frequency: 10000000
|
||||
initialLimit: 0xFFFF
|
||||
-> nvic@16
|
||||
|
||||
timer6: Timers.STM32_Timer @ sysbus <0x40001000, +0x400>
|
||||
frequency: 10000000
|
||||
initialLimit: 0xFFFF
|
||||
|
||||
timer7: Timers.STM32_Timer @ sysbus <0x40001400, +0x400>
|
||||
frequency: 10000000
|
||||
initialLimit: 0xFFFF
|
||||
-> nvic@18
|
||||
|
||||
timer14: Timers.STM32_Timer @ sysbus <0x40002000, +0x400>
|
||||
frequency: 10000000
|
||||
initialLimit: 0xFFFF
|
||||
-> nvic@19
|
||||
|
||||
timer15: Timers.STM32_Timer @ sysbus <0x40014000, +0x400>
|
||||
frequency: 10000000
|
||||
initialLimit: 0xFFFF
|
||||
-> nvic@20
|
||||
|
||||
timer16: Timers.STM32_Timer @ sysbus <0x40014400, +0x400>
|
||||
frequency: 8000000
|
||||
initialLimit: 99
|
||||
-> nvic@21
|
||||
|
||||
timer17: Timers.STM32_Timer @ sysbus <0x40014800, +0x400>
|
||||
frequency: 10000000
|
||||
initialLimit: 0xFFFF
|
||||
-> nvic@22
|
||||
|
||||
can: CAN.STMCAN @ sysbus <0x40006400, +0x400>
|
||||
|
||||
rtc: Timers.STM32F4_RTC @ sysbus 0x40002800
|
||||
// missing TamperIRQ, TimeStampIRQ, WakeupEventIRQ
|
||||
AlarmIRQ -> exti@17
|
||||
|
||||
rcc: Python.PythonPeripheral @ sysbus 0x40021000
|
||||
size: 0x400
|
||||
initable: true
|
||||
script: '''
|
||||
if request.isInit:
|
||||
lastVal = 0
|
||||
elif request.isRead:
|
||||
request.value = lastVal
|
||||
elif request.isWrite:
|
||||
lastVal = request.value
|
||||
|
||||
self.NoisyLog("%s on FLIPFLOP at 0x%x, value 0x%x" % (str(request.type), request.offset, request.value))
|
||||
'''
|
||||
|
||||
DMA: Python.PythonPeripheral @ sysbus 0x40020000
|
||||
size: 0x400
|
||||
script: '''
|
||||
if request.isWrite and request.offset in (0x10, 0x24, 0x38):
|
||||
# writing base address - we write some positive value there in case initialization awaits output
|
||||
sysbus.WriteDoubleWord(request.value, 0x40E33333)
|
||||
self.NoisyLog("0x%x written with value 0x40E33333" % request.value)
|
||||
'''
|
||||
|
||||
adc: Analog.STM32F0_ADC @ sysbus 0x40012400
|
||||
referenceVoltage: 3.3
|
||||
externalEventFrequency: 1000
|
||||
-> nvicInput12@2
|
||||
|
||||
crc: CRC.STM32F0_CRC @ sysbus 0x40023000
|
||||
configurablePoly: false // Only STM32F07x and STM32F09x implements configurablePoly: true
|
||||
|
||||
sysbus:
|
||||
init:
|
||||
Tag <0x40002C00, 0x40002FFF> "WWDG"
|
||||
Tag <0x40003000, 0x400033FF> "IWDG"
|
||||
Tag <0x40005C00, 0x40005FFF> "USB "
|
||||
Tag <0x40006000, 0x400063FF> "USB/CAN SRAM"
|
||||
Tag <0x40006C00, 0x40006FFF> "CRS"
|
||||
Tag <0x40007000, 0x400073FF> "PWR"
|
||||
Tag <0x40007400, 0x400077FF> "DAC"
|
||||
Tag <0x40007800, 0x40007BFF> "CEC"
|
||||
Tag <0x40010000, 0x400103FF> "SYSCFGCOMP"
|
||||
Tag <0x40015800, 0x40015BFF> "DBGMCU"
|
||||
Tag <0x40020000, 0x400203FF> "DMA"
|
||||
Tag <0x40020400, 0x400207FF> "DMA2"
|
||||
Tag <0x40022000, 0x400223FF> "FLASH_INTERFACE"
|
||||
Tag <0x40023000, 0x400233FF> "CRC"
|
||||
Tag <0x40024000, 0x400243FF> "TSC"
|
||||
Tag <0x40021004 4> "RCC_CFGR" 0x0
|
||||
10
Chapter12/cpp_hal/renode_scripts/stm32f072.repl
Normal file
10
Chapter12/cpp_hal/renode_scripts/stm32f072.repl
Normal file
@@ -0,0 +1,10 @@
|
||||
using "./stm32f0.repl"
|
||||
|
||||
flash: Memory.MappedMemory @ sysbus 0x08000000
|
||||
size: 0x20000
|
||||
|
||||
sram: Memory.MappedMemory @ sysbus 0x20000000
|
||||
size: 0x4000
|
||||
|
||||
crc:
|
||||
configurablePoly: true
|
||||
23
Chapter12/cpp_hal/renode_scripts/stm32f072.resc
Normal file
23
Chapter12/cpp_hal/renode_scripts/stm32f072.resc
Normal file
@@ -0,0 +1,23 @@
|
||||
using sysbus
|
||||
|
||||
mach create
|
||||
machine LoadPlatformDescription $ORIGIN/stm32f072.repl
|
||||
machine LoadPlatformDescriptionFromString "button1: Miscellaneous.Button @ gpioPortA 4 { IRQ -> gpioPortA@4 }"
|
||||
machine LoadPlatformDescriptionFromString "button2: Miscellaneous.Button @ gpioPortA 5 { IRQ -> gpioPortA@5 }"
|
||||
machine LoadPlatformDescriptionFromString "button3: Miscellaneous.Button @ gpioPortA 6 { IRQ -> gpioPortA@6 }"
|
||||
machine LoadPlatformDescriptionFromString "button4: Miscellaneous.Button @ gpioPortA 7 { IRQ -> gpioPortA@7 }"
|
||||
machine LoadPlatformDescriptionFromString "button5: Miscellaneous.Button @ gpioPortA 8 { IRQ -> gpioPortA@8 }"
|
||||
machine LoadPlatformDescriptionFromString "button6: Miscellaneous.Button @ gpioPortA 9 { IRQ -> gpioPortA@9 }"
|
||||
|
||||
$bin?=$ORIGIN/../build/bare.elf
|
||||
|
||||
showAnalyzer usart2
|
||||
|
||||
macro reset
|
||||
"""
|
||||
sysbus LoadELF $bin
|
||||
"""
|
||||
|
||||
runMacro $reset
|
||||
|
||||
start
|
||||
23
Chapter12/cpp_hal/renode_scripts/stm32f072_debug.resc
Normal file
23
Chapter12/cpp_hal/renode_scripts/stm32f072_debug.resc
Normal file
@@ -0,0 +1,23 @@
|
||||
using sysbus
|
||||
|
||||
mach create
|
||||
machine LoadPlatformDescription $ORIGIN/stm32f072.repl
|
||||
machine LoadPlatformDescriptionFromString "button1: Miscellaneous.Button @ gpioPortA 4 { IRQ -> gpioPortA@4 }"
|
||||
machine LoadPlatformDescriptionFromString "button2: Miscellaneous.Button @ gpioPortA 5 { IRQ -> gpioPortA@5 }"
|
||||
machine LoadPlatformDescriptionFromString "button3: Miscellaneous.Button @ gpioPortA 6 { IRQ -> gpioPortA@6 }"
|
||||
machine LoadPlatformDescriptionFromString "button4: Miscellaneous.Button @ gpioPortA 7 { IRQ -> gpioPortA@7 }"
|
||||
machine LoadPlatformDescriptionFromString "button5: Miscellaneous.Button @ gpioPortA 8 { IRQ -> gpioPortA@8 }"
|
||||
machine LoadPlatformDescriptionFromString "button6: Miscellaneous.Button @ gpioPortA 9 { IRQ -> gpioPortA@9 }"
|
||||
|
||||
$bin?=$ORIGIN/../build/bare.elf
|
||||
|
||||
showAnalyzer usart2
|
||||
|
||||
macro reset
|
||||
"""
|
||||
sysbus LoadELF $bin
|
||||
"""
|
||||
|
||||
runMacro $reset
|
||||
|
||||
machine StartGdbServer 3333
|
||||
Reference in New Issue
Block a user