1*** Variables *** 2${AGT_ELF} https://dl.antmicro.com/projects/renode/renesas_ek_ra8m1--agt.elf-s_391008-c0a91e7f3d279b86269ca83ac0aabb9936f94838 3${SCI_UART_ELF} https://dl.antmicro.com/projects/renode/renesas_ek_ra8m1--sci_uart.elf-s_535224-63f8b0f8a025f09554a015f4b896f73b2cbeee43 4${SCI_SPI_ELF} https://dl.antmicro.com/projects/renode/renesas_ek_ra8m1--sci_spi.elf-s_436396-52fced761b153c037fab56f23d65971e752af799 5${SCI_I2C_ELF} https://dl.antmicro.com/projects/renode/renesas_ek_ra8m1--sci_i2c.elf-s_427784-2814fc53a441712e50d182c6e73770344b7f6ba4 6 7*** Keywords *** 8Prepare Machine 9 [Arguments] ${elf} 10 Execute Command using sysbus 11 Execute Command mach create "ra8m1" 12 13 Execute Command machine LoadPlatformDescription @platforms/boards/renesas-ek_ra8m1.repl 14 15 Execute Command set bin @${elf} 16 Execute Command macro reset "sysbus LoadELF $bin" 17 Execute Command runMacro $reset 18 19Prepare Segger RTT 20 [Arguments] ${pauseEmulation}=true 21 Execute Command machine CreateVirtualConsole "segger_rtt" 22 Execute Command include @scripts/single-node/segger-rtt.py 23 Execute Command setup_segger_rtt sysbus.segger_rtt 24 Create Terminal Tester sysbus.segger_rtt defaultPauseEmulation=${pauseEmulation} 25 26Prepare LED Tester 27 Create Led Tester sysbus.port6.led_blue 28 29Create Echo I2C Peripheral 30 [Arguments] ${master} ${slave_address} 31 Execute Command machine LoadPlatformDescriptionFromString "dummy: Mocks.DummyI2CSlave @ ${master} ${slave_address}" 32 33 ${python_script}= Catenate SEPARATOR=\n 34 ... python 35 ... """ 36 ... class EchoI2CPeripheral: 37 ... ${SPACE*4}def __init__(self, dummy): 38 ... ${SPACE*8}self.dummy = dummy 39 ... 40 ... ${SPACE*4}def write(self, data): 41 ... ${SPACE*8}self.dummy.EnqueueResponseBytes(data) 42 ... 43 ... def mc_setup_echo_i2c_peripheral(path): 44 ... ${SPACE*4}dummy = monitor.Machine[path] 45 ... ${SPACE*4}dummy.DataReceived += EchoI2CPeripheral(dummy).write 46 ... """ 47 48 Execute Command ${python_script} 49 Execute Command setup_echo_i2c_peripheral "sysbus.${master}.dummy" 50 51*** Test Cases *** 52Should Run Periodically Blink LED 53 Prepare Machine ${AGT_ELF} 54 Prepare LED Tester 55 Prepare Segger RTT 56 57 Execute Command agt0 IRQ AddStateChangedHook "Antmicro.Renode.Logging.Logger.Log(LogLevel.Error, 'AGT0 ' + str(state))" 58 # Timeout is only used for checking whether the IRQ has been handled 59 Create Log Tester 0.001 defaultPauseEmulation=true 60 61 # Configuration is roughly in ms 62 Wait For Prompt On Uart One-shot mode: 63 Write Line To Uart 10 waitForEcho=false 64 Wait For Line On Uart Time period for one-shot mode timer: 10 65 66 Wait For Prompt On Uart Periodic mode: 67 Write Line To Uart 5 waitForEcho=false 68 Wait For Line On Uart Time period for periodic mode timer: 5 69 70 Wait For Prompt On Uart Enter any key to start or stop the timers 71 Write Line To Uart waitForEcho=false 72 73 # Timeout is extended by an additional 1ms to account for rounding errors 74 Wait For Log Entry AGT0 True level=Error timeout=0.011 75 Wait For Log Entry AGT0 False level=Error 76 # move to the beginning of a True state 77 Assert Led State True timeout=0.01 pauseEmulation=true 78 # Run test for 5 cycles 79 Assert Led Is Blinking testDuration=0.05 onDuration=0.005 offDuration=0.005 tolerance=0.2 pauseEmulation=true 80 Assert Led State True timeout=0.005 pauseEmulation=true 81 82 # Stop timers, clear log tester history and check whether the periodic timer stops 83 Write Line To Uart waitForEcho=false 84 Wait For Line On Uart Periodic timer stopped. Enter any key to start timers. 85 Assert And Hold Led State True 0.0 0.05 86 87Should Read And Write On UART 88 Prepare Machine ${SCI_UART_ELF} 89 Execute Command cpu AddHook `sysbus GetSymbolAddress "bsp_clock_init"` "cpu.PC = cpu.LR" 90 91 Create Terminal Tester sysbus.sci2 92 93 Wait For Line On Uart Starting UART demo 94 95 Write Line To Uart 56 waitForEcho=false 96 Wait For Line On Uart Setting intensity to: 56 97 Wait For Line On Uart Set next value 98 99 Write Line To Uart 1 waitForEcho=false 100 Wait For Line On Uart Setting intensity to: 1 101 Wait For Line On Uart Set next value 102 103 Write Line To Uart 100 waitForEcho=false 104 Wait For Line On Uart Setting intensity to: 100 105 Wait For Line On Uart Set next value 106 107 Write Line To Uart 371 waitForEcho=false 108 Wait For Line On Uart Invalid input. Input range is from 1 - 100 109 110 Write Line To Uart 74 waitForEcho=false 111 Wait For Line On Uart Setting intensity to: 74 112 Wait For Line On Uart Set next value 113 114Should Read Temperature From SPI 115 Prepare Machine ${SCI_SPI_ELF} 116 Execute Command cpu AddHook `sysbus GetSymbolAddress "bsp_clock_init"` "cpu.PC = cpu.LR" 117 Prepare Segger RTT 118 119 # Sample expects the MAX31723PMB1 temperature sensor which there is no model for in Renode 120 Execute Command machine LoadPlatformDescriptionFromString "sensor: Sensors.GenericSPISensor @ sci2" 121 122 # Sensor initialization values 123 Execute Command sci2.sensor FeedSample 0x80 124 Execute Command sci2.sensor FeedSample 0x6 125 Execute Command sci2.sensor FeedSample 0x0 126 127 # Temperature of 15 °C 128 Execute Command sci2.sensor FeedSample 0x0 129 Execute Command sci2.sensor FeedSample 0xF 130 Execute Command sci2.sensor FeedSample 0x0 131 132 # Temperature of 10 °C 133 Execute Command sci2.sensor FeedSample 0x0 134 Execute Command sci2.sensor FeedSample 0xA 135 Execute Command sci2.sensor FeedSample 0x0 136 137 # Temperature of 2 °C 138 Execute Command sci2.sensor FeedSample 0x0 139 Execute Command sci2.sensor FeedSample 0x2 140 Execute Command sci2.sensor FeedSample 0x0 141 142 Wait For Line On Uart Temperature:${SPACE*2}15.000000 *C 143 Wait For Line On Uart Temperature:${SPACE*2}10.000000 *C 144 Wait For Line On Uart Temperature:${SPACE*2}2.000000 *C 145 Wait For Line On Uart Temperature:${SPACE*2}0.000000 *C 146 147Should Pass Communication Test On SCI With Sample I2C Echo Slave 148 Prepare Machine ${SCI_I2C_ELF} 149 Prepare Segger RTT 150 Execute Command cpu AddHook `sysbus GetSymbolAddress "bsp_clock_init"` "cpu.PC = cpu.LR" 151 152 Create Echo I2C Peripheral sci1 0x4A 153 154 Wait For Line On Uart ** SCI_I2C Master Write operation is successful ** 155 Wait For Line On Uart ** SCI_I2C Master Read operation is successful ** 156 Wait For Line On Uart ** Read and Write buffers are equal ** 157