1*** Variables *** 2${UART} sysbus.uart0 3${URI} @https://dl.antmicro.com/projects/renode 4 5${STANDARD}= SEPARATOR= 6... """ ${\n} 7... using "platforms/cpus/nrf52840.repl" ${\n} 8... """ 9 10${NO_DMA}= SEPARATOR= 11... """ ${\n} 12... using "platforms/cpus/nrf52840.repl" ${\n} 13... uart0: ${\n} 14... ${SPACE*4}easyDMA: false ${\n} 15... uart1: ${\n} 16... ${SPACE*4}easyDMA: false ${\n} 17... """ 18 19${DMA}= SEPARATOR= 20... """ ${\n} 21... using "platforms/cpus/nrf52840.repl" ${\n} 22... uart0: ${\n} 23... ${SPACE*4}easyDMA: true ${\n} 24... uart1: ${\n} 25... ${SPACE*4}easyDMA: true ${\n} 26... """ 27 28${ADXL_SPI}= SEPARATOR= 29... """ ${\n} 30... using "platforms/cpus/nrf52840.repl" ${\n} 31... ${\n} 32... adxl372: Sensors.ADXL372 @ spi2 ${\n} 33... ${\n} 34... gpio0: ${\n} 35... ${SPACE*4}22 -> adxl372@0 // CS ${\n} 36... """ 37 38${ADXL_I2C}= SEPARATOR= 39... """ ${\n} 40... using "platforms/cpus/nrf52840.repl" ${\n} 41... ${\n} 42... adxl372: Sensors.ADXL372 @ twi1 0x11 ${\n} 43... """ 44 45${BUTTON_LED}= SEPARATOR= 46... """ ${\n} 47... using "platforms/cpus/nrf52840.repl" ${\n} 48... ${\n} 49... gpio0: ${\n} 50... ${SPACE*4}13 -> led@0 ${\n} 51... ${\n} 52... button: Miscellaneous.Button @ gpio0 11 ${\n} 53... ${SPACE*4}invert: true ${\n} 54... ${SPACE*4}-> gpio0@11 ${\n} 55... ${\n} 56... led: Miscellaneous.LED @ gpio0 13 ${\n} 57... """ 58 59*** Keywords *** 60Create Machine 61 [Arguments] ${platform} ${elf} 62 63 Execute Command mach create 64 Execute Command machine LoadPlatformDescriptionFromString ${platform} 65 66 Execute Command sysbus LoadELF ${URI}/${elf} 67 68Run ZephyrRTOS Shell 69 [Arguments] ${platform} ${elf} 70 71 Create Machine ${platform} ${elf} 72 Create Terminal Tester ${UART} 73 74 Execute Command showAnalyzer ${UART} 75 76 Start Emulation 77 Wait For Prompt On Uart uart:~$ 78 Write Line To Uart demo ping 79 Wait For Line On Uart pong 80 81*** Test Cases *** 82Should Run ZephyrRTOS Shell On UART 83 Run ZephyrRTOS Shell ${NO_DMA} zephyr_shell_nrf52840.elf-s_1110556-9653ab7fffe1427c50fa6b837e55edab38925681 84 85Should Run ZephyrRTOS Shell On UARTE 86 [Tags] skipped 87 Run ZephyrRTOS Shell ${DMA} renode-nrf52840-zephyr_shell_module.elf-gf8d05cf-s_1310072-c00fbffd6b65c6238877c4fe52e8228c2a38bf1f 88 89 90Should Run Alarm Sample 91 Create Machine ${NO_DMA} zephyr_alarm_nRF52840.elf-s_489392-49a2ec3fda2f0337fe72521f08e51ecb0fd8d616 92 Create Terminal Tester ${UART} defaultPauseEmulation=True 93 94 Execute Command showAnalyzer ${UART} 95 96 Wait For Line On Uart !!! Alarm !!! 97 ${timeInfo}= Execute Command emulation GetTimeSourceInfo 98 Should Contain ${timeInfo} Elapsed Virtual Time: 00:00:02 99 100 Wait For Line On Uart !!! Alarm !!! 101 ${timeInfo}= Execute Command emulation GetTimeSourceInfo 102 Should Contain ${timeInfo} Elapsed Virtual Time: 00:00:06 103 104Should Handle LED and Button 105 Create Machine ${BUTTON_LED} nrf52840--zephyr_button.elf-s_660440-50c3b674193c8105624dae389420904e2036f9c0 106 Create Terminal Tester ${UART} 107 108 Create LED Tester sysbus.gpio0.led defaultTimeout=0 109 110 Start Emulation 111 Wait For Line On Uart Booting Zephyr OS 112 Wait For Line On Uart Press the button 113 114 Assert LED State true 115 Execute Command sysbus.gpio0.button Press 116 Sleep 1s 117 Assert LED State false 118 Execute Command sysbus.gpio0.button Release 119 Sleep 1s 120 # TODO: those sleeps shouldn't be necessary! 121 Assert LED State true 122 123Should Handle SPI 124 Create Machine ${ADXL_SPI} nrf52840--zephyr_adxl372_spi.elf-s_993780-1dedb945dae92c07f1b4d955719bfb1f1e604173 125 Create Terminal Tester ${UART} 126 127 Execute Command sysbus.spi2.adxl372 AccelerationX 0 128 Execute Command sysbus.spi2.adxl372 AccelerationY 0 129 Execute Command sysbus.spi2.adxl372 AccelerationZ 0 130 131 Start Emulation 132 Wait For Line On Uart Booting Zephyr OS 133 Wait For Line On Uart 0.00 g 134 135 Execute Command sysbus.spi2.adxl372 AccelerationX 1 136 Execute Command sysbus.spi2.adxl372 AccelerationY 0 137 Execute Command sysbus.spi2.adxl372 AccelerationZ 0 138 139 Wait For Line On Uart 1.00 g 140 141 Execute Command sysbus.spi2.adxl372 AccelerationX 2 142 Execute Command sysbus.spi2.adxl372 AccelerationY 2 143 Execute Command sysbus.spi2.adxl372 AccelerationZ 0 144 145 Wait For Line On Uart 2.83 g 146 147 Execute Command sysbus.spi2.adxl372 AccelerationX 3 148 Execute Command sysbus.spi2.adxl372 AccelerationY 3 149 Execute Command sysbus.spi2.adxl372 AccelerationZ 3 150 151 Wait For Line On Uart 5.20 g 152 153Should Handle I2C 154 Create Machine ${ADXL_I2C} nrf52840--zephyr_adxl372_i2c.elf-s_944004-aacf7d772ebcc5a26c156f78ebdef2e03f803cc3 155 Create Terminal Tester ${UART} 156 157 Execute Command sysbus.twi1.adxl372 AccelerationX 0 158 Execute Command sysbus.twi1.adxl372 AccelerationY 0 159 Execute Command sysbus.twi1.adxl372 AccelerationZ 0 160 161 Start Emulation 162 Wait For Line On Uart Booting Zephyr OS 163 Wait For Line On Uart 0.00 g 164 165 Execute Command sysbus.twi1.adxl372 AccelerationX 1 166 Execute Command sysbus.twi1.adxl372 AccelerationY 0 167 Execute Command sysbus.twi1.adxl372 AccelerationZ 0 168 169 Wait For Line On Uart 1.00 g 170 171 Execute Command sysbus.twi1.adxl372 AccelerationX 2 172 Execute Command sysbus.twi1.adxl372 AccelerationY 2 173 Execute Command sysbus.twi1.adxl372 AccelerationZ 0 174 175 Wait For Line On Uart 2.83 g 176 177 Execute Command sysbus.twi1.adxl372 AccelerationX 3 178 Execute Command sysbus.twi1.adxl372 AccelerationY 3 179 Execute Command sysbus.twi1.adxl372 AccelerationZ 3 180 181 Wait For Line On Uart 5.20 g 182 183Should Echo I2S Audio 184 Create Machine ${STANDARD} nrf52840--nordic_snippets_i2s_master.elf-s_181224-98d5e53081cf7d76d30a183978a03b3e00beaf53 185 186 ${input_file}= Allocate Temporary File 187 ${output_file}= Allocate Temporary File 188 Create Binary File ${input_file} \x00\x00\x00\x00\x5a\x82\x5a\x82\x7f\xff\x7f\xff\x5a\x82\x5a\x82\x00\x00\x00\x00\xa5\x7e\xa5\x7e\x80\x00\x80\x00\xa5\x7e\xa5\x7e 189 190 Execute Command sysbus.i2s InputFile @${input_file} 191 Execute Command sysbus.i2s OutputFile @${output_file} 192 193 Execute Command emulation RunFor "0.01" 194 Execute Command Clear 195 196 ${input_file_size}= Get File Size ${input_file} 197 ${output_file_size}= Get File Size ${output_file} 198 199 Should Be Equal ${input_file_size} ${output_file_size} 200 201 ${input_file_content}= Get Binary File ${input_file} 202 ${output_file_content}= Get Binary File ${output_file} 203 204 Should Be Equal ${input_file_content} ${output_file_content} 205 206Should Detect Yes Pattern 207 [Tags] non_critical 208 Create Machine ${STANDARD} nrf52840--tflite-micro_speech.elf-s_7172308-9ab5781883d7af2582d7fea09b14352628da9839 209 210 Execute Command sysbus.pdm SetInputFile ${URI}/audio_yes_1s.s16le.pcm-s_32000-b69f5518615516f80ae0082fe9b5a5d29ffebce8 211 212 Create Terminal Tester ${UART} 213 Start Emulation 214 215 Wait For Line On Uart Heard yes 216 217Should Run Zephyr's kernel.interrupt Test 218 [Tags] zephyr 219 Create Machine ${STANDARD} nrf52840-zephyr-c320bb0-kernel-interrupt-test.elf-s_737512-7802727d11c415c1859c00842063ebec6c0a6fdc 220 Create Terminal Tester ${UART} 221 222 Start Emulation 223 Wait For Line On Uart PROJECT EXECUTION SUCCESSFUL 224 225Should Run Zephyr's cmsis_dps.transform.rq15 Test 226 [Documentation] Tests if QADD16, QSUB16, QASX and QSAX intructions are working properly 227 [Tags] zephyr 228 Create Machine ${STANDARD} nrf52840--zephyr-cmsis_transform_rq15.elf-s_1115276-3e1fb95c3d1283d1fe22acf4b8ef887d05455fdf 229 Create Terminal Tester ${UART} 230 231 Start Emulation 232 Wait for Line On Uart PROJECT EXECUTION SUCCESSFUL 233 234Should Restart After Watchdog Timeout 235 [Tags] zephyr 236 Create Machine ${STANDARD} nrf52840--zephyr-watchdog.elf-s_889852-75a696a301c8439400645e646a322039963d74c8 237 Create Terminal Tester ${UART} 238 Execute Command sysbus.cpu PerformanceInMips 1 239 # Zephyr is busy-waiting for watchdog timeout to trigger, which causes 240 # virtual-time to flow _very slowly_ with higher PerformanceInMips. 241 # This workarounds this issue by changing PerformanceInMips to lower value 242 243 Start Emulation 244 Wait for Line On Uart Watchdog sample application 245 Wait for Line On Uart Watchdog sample application 246 247Should Run Task Watchdog Subsystem 248 [Tags] zephyr 249 Create Machine ${STANDARD} nrf52840--zephyr-task_wdt.elf-s_904904-91eadd958664ba0a009403a1a64f429dce3603a3 250 Create Terminal Tester ${UART} 251 252 Start Emulation 253 # Following set of lines should be continuosly repeated on uart. 254 Wait for Line On Uart Task watchdog sample application. 255 Wait for Line On Uart Main thread still alive... 256 Wait for Line On Uart Control thread started. 257 Wait for Line On Uart Main thread still alive... 258 Wait for Line On Uart Main thread still alive... 259 Wait for Line On Uart Main thread still alive... 260 Wait for Line On Uart Control thread getting stuck... 261 Wait for Line On Uart Main thread still alive... 262 Wait for Line On Uart Task watchdog channel 1 callback, thread: control 263 Wait for Line On Uart Resetting device... 264 265 Wait for Line On Uart Task watchdog sample application. 266 Wait for Line On Uart Main thread still alive... 267 Wait for Line On Uart Control thread started. 268 Wait for Line On Uart Main thread still alive... 269 Wait for Line On Uart Main thread still alive... 270 Wait for Line On Uart Main thread still alive... 271 Wait for Line On Uart Control thread getting stuck... 272 Wait for Line On Uart Main thread still alive... 273 Wait for Line On Uart Task watchdog channel 1 callback, thread: control 274 Wait for Line On Uart Resetting device... 275 276Should Run Bluetooth sample 277 Execute Command emulation CreateIEEE802_15_4Medium "wireless" 278 279 Execute Command mach add "central" 280 Execute Command machine LoadPlatformDescription @platforms/cpus/nrf52840.repl 281 Execute Command sysbus LoadELF ${URI}/nrf52840--zephyr-bluetooth_central_hr.elf-s_3380332-316e27f81dcda3c2b0e7f2c3516001e7b27ad051 282 Execute Command connector Connect sysbus.radio wireless 283 284 Execute Command showAnalyzer ${UART} 285 ${cen_uart}= Create Terminal Tester ${UART} machine=central 286 287 Execute Command mach add "peripheral" 288 Execute Command mach set "peripheral" 289 Execute Command machine LoadPlatformDescription @platforms/cpus/nrf52840.repl 290 Execute Command sysbus LoadELF ${URI}/nrf52840--zephyr-bluetooth_peripheral_hr.elf-s_3217940-7b59adc9629f8be90067b131e663a13d2d4bb711 291 Execute Command connector Connect sysbus.radio wireless 292 293 Execute Command showAnalyzer ${UART} 294 ${per_uart}= Create Terminal Tester ${UART} machine=peripheral 295 296 Execute Command emulation SetGlobalQuantum "0.00001" 297 298 Start Emulation 299 300 Wait For Line On Uart Booting Zephyr testerId=${cen_uart} 301 Wait For Line On Uart Booting Zephyr testerId=${per_uart} 302 303 Wait For Line On Uart Bluetooth initialized testerId=${cen_uart} 304 Wait For Line On Uart Bluetooth initialized testerId=${per_uart} 305 306 Wait For Line On Uart Scanning successfully started testerId=${cen_uart} 307 Wait For Line On Uart Advertising successfully started testerId=${per_uart} 308 309 Wait For Line On Uart Connected: C0:00:AA:BB:CC:DD testerId=${cen_uart} 310 Wait For Line On Uart Connected testerId=${per_uart} 311 312 Wait For Line On Uart HRS notifications enabled testerId=${per_uart} 313 314 Wait For Line On Uart [SUBSCRIBED] testerId=${cen_uart} 315 Wait For Line On Uart [NOTIFICATION] testerId=${cen_uart} 316 317Should Run Bluetooth Hci Uart Sample 318 Execute Command include @scripts/multi-node/nrf52840-ble-hci-uart-zephyr.resc 319 320 ${cen_uart}= Create Terminal Tester ${UART} machine=central_host 321 ${per_uart}= Create Terminal Tester ${UART} machine=peripheral_host 322 323 Wait For Line On Uart *** Booting Zephyr OS build v3.6.0 *** testerId=${cen_uart} 324 Wait For Line On Uart *** Booting Zephyr OS build v3.6.0 *** testerId=${per_uart} 325 326 Wait For Line On Uart Bluetooth initialized testerId=${cen_uart} 327 Wait For Line On Uart Bluetooth initialized testerId=${per_uart} 328 329 Wait For Line On Uart Scanning successfully started testerId=${cen_uart} 330 Wait For Line On Uart Advertising successfully started testerId=${per_uart} 331 332 Wait For Line On Uart Connected: testerId=${cen_uart} 333 Wait For Line On Uart Connected testerId=${per_uart} 334 335 Wait For Line On Uart HRS notifications enabled testerId=${per_uart} 336 337 Wait For Line On Uart [SUBSCRIBED] testerId=${cen_uart} 338 Wait For Line On Uart [NOTIFICATION] testerId=${cen_uart} 339