app_test.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/usr/bin/env python
  2. import ttfw_idf
  3. from tiny_test_fw import Utility
  4. MEM_TEST_S2 = [
  5. ['IRAM0_SRAM', 'WRX'],
  6. ['IRAM0_RTCFAST', 'WRX'],
  7. ['DRAM0_SRAM', 'WR'],
  8. ['DRAM0_RTCFAST', 'WR'],
  9. ['PERI1_RTCSLOW', 'WR'],
  10. ['PERI2_RTCSLOW_0', 'WRX'],
  11. ['PERI2_RTCSLOW_1', 'WRX']
  12. ]
  13. MEM_TEST_C3 = [
  14. ['IRAM0_SRAM', 'WRX'],
  15. ['DRAM0_SRAM', 'WR'],
  16. ['IRAM0_RTCFAST', 'WRX']
  17. ]
  18. MEM_TEST_S3_MULTI = [
  19. # instruction execute test temporarily disabled
  20. # ['IRAM0_SRAM (core 0)', 'WRX'],
  21. ['IRAM0_SRAM (core 0)', 'WR'],
  22. ['DRAM0_SRAM (core 0)', 'WR'],
  23. # instruction execute test temporarily disabled
  24. # ['IRAM0_SRAM (core 1)', 'WRX'],
  25. ['IRAM0_SRAM (core 1)', 'WR'],
  26. ['DRAM0_SRAM (core 1)', 'WR']
  27. # temporarily disabled unless IDF-5208 gets merged
  28. # ['IRAM0_RTCFAST', 'WR'],
  29. ]
  30. MEM_TEST_S3_UNI = [
  31. ['IRAM0_SRAM (core 0)', 'WRX'],
  32. ['DRAM0_SRAM (core 0)', 'WR']
  33. # temporarily disabled unless IDF-5208 gets merged
  34. # ['IRAM0_RTCFAST', 'WR'],
  35. ]
  36. @ttfw_idf.idf_custom_test(env_tag='Example_GENERIC', target=['esp32c3', 'esp32s2', 'esp32s3'], group='test-apps')
  37. def test_memprot(env, extra_data):
  38. dut = env.get_dut('memprot', 'tools/test_apps/system/memprot')
  39. dut.start_app()
  40. mem_test_cfg = []
  41. current_target = dut.app.get_sdkconfig()['CONFIG_IDF_TARGET'].replace('"','').lower()
  42. try:
  43. unicore = dut.app.get_sdkconfig()['CONFIG_FREERTOS_UNICORE']
  44. except KeyError:
  45. unicore = 'n'
  46. if current_target == 'esp32c3':
  47. mem_test_cfg = MEM_TEST_C3
  48. elif current_target == 'esp32s2':
  49. mem_test_cfg = MEM_TEST_S2
  50. elif current_target == 'esp32s3':
  51. mem_test_cfg = MEM_TEST_S3_UNI if unicore == 'y' else MEM_TEST_S3_MULTI
  52. Utility.console_log('Test cfg: ' + current_target)
  53. for i in mem_test_cfg:
  54. if 'R' in i[1]:
  55. dut.expect(i[0] + ' read low: OK')
  56. dut.expect(i[0] + ' read high: OK')
  57. if 'W' in i[1]:
  58. dut.expect(i[0] + ' write low: OK')
  59. dut.expect(i[0] + ' write high: OK')
  60. if 'X' in i[1]:
  61. dut.expect(i[0] + ' exec low: OK')
  62. dut.expect(i[0] + ' exec high: OK')
  63. Utility.console_log('Memprot test done')
  64. if __name__ == '__main__':
  65. test_memprot()