2020-10-07 23:19:23 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import ttfw_idf
|
|
|
|
from tiny_test_fw import Utility
|
|
|
|
|
2021-01-27 16:03:07 -05:00
|
|
|
MEM_TEST_S2 = [
|
2020-10-07 23:19:23 -04:00
|
|
|
['IRAM0_SRAM', 'WRX'],
|
|
|
|
['IRAM0_RTCFAST', 'WRX'],
|
|
|
|
['DRAM0_SRAM', 'WR'],
|
|
|
|
['DRAM0_RTCFAST', 'WR'],
|
|
|
|
['PERI1_RTCSLOW', 'WR'],
|
|
|
|
['PERI2_RTCSLOW_0', 'WRX'],
|
|
|
|
['PERI2_RTCSLOW_1', 'WRX']
|
|
|
|
]
|
|
|
|
|
2021-01-27 16:03:07 -05:00
|
|
|
MEM_TEST_C3 = [
|
|
|
|
['IRAM0_SRAM', 'WRX'],
|
2021-09-06 04:22:40 -04:00
|
|
|
['DRAM0_SRAM', 'WR'],
|
|
|
|
['IRAM0_RTCFAST', 'WRX'],
|
2021-01-27 16:03:07 -05:00
|
|
|
]
|
|
|
|
|
2020-10-07 23:19:23 -04:00
|
|
|
|
2021-01-27 16:03:07 -05:00
|
|
|
@ttfw_idf.idf_custom_test(env_tag='Example_GENERIC', target=['esp32c3', 'esp32s2'], group='test-apps')
|
2020-10-07 23:19:23 -04:00
|
|
|
def test_memprot(env, extra_data):
|
|
|
|
|
2021-01-25 21:49:01 -05:00
|
|
|
dut = env.get_dut('memprot', 'tools/test_apps/system/memprot')
|
2020-10-07 23:19:23 -04:00
|
|
|
dut.start_app()
|
|
|
|
|
2021-01-27 16:03:07 -05:00
|
|
|
mem_test_cfg = []
|
|
|
|
current_target = dut.app.get_sdkconfig()['CONFIG_IDF_TARGET'].replace('"','').lower()
|
|
|
|
|
|
|
|
if current_target == 'esp32c3':
|
|
|
|
mem_test_cfg = MEM_TEST_C3
|
|
|
|
elif current_target == 'esp32s2':
|
|
|
|
mem_test_cfg = MEM_TEST_S2
|
|
|
|
|
|
|
|
Utility.console_log('Test cfg: ' + current_target)
|
|
|
|
|
|
|
|
for i in mem_test_cfg:
|
2020-10-07 23:19:23 -04:00
|
|
|
if 'R' in i[1]:
|
2021-01-25 21:49:01 -05:00
|
|
|
dut.expect(i[0] + ' read low: OK')
|
|
|
|
dut.expect(i[0] + ' read high: OK')
|
2020-10-07 23:19:23 -04:00
|
|
|
if 'W' in i[1]:
|
2021-01-25 21:49:01 -05:00
|
|
|
dut.expect(i[0] + ' write low: OK')
|
|
|
|
dut.expect(i[0] + ' write high: OK')
|
2020-10-07 23:19:23 -04:00
|
|
|
if 'X' in i[1]:
|
2021-01-25 21:49:01 -05:00
|
|
|
dut.expect(i[0] + ' exec low: OK')
|
|
|
|
dut.expect(i[0] + ' exec high: OK')
|
2020-10-07 23:19:23 -04:00
|
|
|
|
2021-01-25 21:49:01 -05:00
|
|
|
Utility.console_log('Memprot test done')
|
2020-10-07 23:19:23 -04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test_memprot()
|