-
Notifications
You must be signed in to change notification settings - Fork 0
/
agp.resc
116 lines (91 loc) · 2.83 KB
/
agp.resc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
:name: agp-system
:description: Emulates the air-gradient-pro bootloader and firmware
#path add @/tmp/agp_rr_cache
using sysbus
mach create "agp"
include @renode/peripherals/STM32F4_RCC.cs
include @renode/peripherals/STM32_Timer.cs
include @renode/peripherals/STM32_UART.cs
include @renode/peripherals/ENC28J60.cs
include @renode/peripherals/SH1106.cs
include @renode/peripherals/SGP41.cs
include @renode/peripherals/SHT31.cs
include @renode/peripherals/PMS5003.cs
include @renode/peripherals/S8LP.cs
$firmware_bin = @firmware/target/thumbv7em-none-eabihf/release/air-gradient-pro
$bootloader_bin = @bootloader/target/thumbv7em-none-eabihf/release/bootloader
$tap ?= "renode-tap0"
python "import _random"
python "rand = _random.Random()"
$id1 = `python "print rand.getrandbits(32)"`
$id2 = `python "print rand.getrandbits(32)"`
$id3 = `python "print rand.getrandbits(32)"`
machine LoadPlatformDescription @renode/platform/stm32f411.repl
machine LoadPlatformDescriptionFromString
"""
led: Miscellaneous.LED @ gpioPortC
gpioPortC:
13 -> led@0
ethernet: Network.ENC28J60_CUSTOM @ spi2i2s2
-> gpioPortA@8
gpioPortB:
12 -> ethernet@0
sh1106 : Video.SH1106 @ i2c2 0x3C
FramesPerVirtualSecond: 10
sgp41 : Sensors.SGP41 @ i2c2 0x59
SerialNumber: 0xBBFF
VocTicks: 1024
NoxTicks: 2048
sht31 : Sensors.SHT31 @ i2c2 0x44
SerialNumber: 0xAABB
Temperature: 40
Humidity: 85
pms5003 : UART.PMS5003 @ usart2
PM2_5_atm: 10
s8lp : UART.S8LP @ usart1
Co2: 20
"""
cpu PerformanceInMips 1
logLevel 3 sysbus
logLevel 3 flash_controller
logLevel 3 rcc
logLevel 3 usart6
logLevel 3 usart1
logLevel 3 usart2
logLevel 3 gpioPortB
timer2 Frequency 64000000
timer3 Frequency 64000000
timer4 Frequency 640000000
timer5 Frequency 640000000
timer10 Frequency 640000000
timer11 Frequency 640000000
logLevel 3 timer2
logLevel 3 timer3
logLevel 3 timer4
logLevel 3 timer10
logLevel 3 timer11
showAnalyzer usart6
showAnalyzer i2c2.sh1106
spi2i2s2.ethernet MAC "02:00:04:03:07:04"
emulation CreateSwitch "switch"
connector Connect spi2i2s2.ethernet switch
emulation CreateTap $tap "tap"
connector Connect host.tap switch
rcc resetReason PowerOnReset
sysbus AddWatchpointHook 0xE000ED0C DoubleWord Write "if value == 0x5fa0004: self.NoisyLog('sw triggered reset'); self.Machine['sysbus.rcc'].SetResetReasonSoftwareReset()"
sysbus.usart2 AddLineHook "PANIC" "Antmicro.Renode.Logging.Logger.Log(LogLevel.Error, line)"
sysbus.usart2 AddLineHook "test result: ok" "Antmicro.Renode.Emulator.Exit()"
macro reset
"""
sysbus LoadELF $firmware_bin
sysbus LoadELF $bootloader_bin
sysbus.cpu VectorTableOffset 0x8000000
sysbus WriteDoubleWord 0x1FFF7A10 $id1
sysbus WriteDoubleWord 0x1FFF7A14 $id2
sysbus WriteDoubleWord 0x1FFF7A18 $id3
# Flash size KB
sysbus WriteDoubleWord 0x1FFF7A22 512
"""
runMacro $reset
# Run start in the console
# start