From c45a0e66af124ae03906fe5aaa82fe3b3edff2ea Mon Sep 17 00:00:00 2001 From: dataisland Date: Tue, 14 Dec 2021 17:32:56 +0800 Subject: [PATCH] Add stm32f407 CRC examples --- examples/rootfs | 2 +- tests/test_mcu.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/examples/rootfs b/examples/rootfs index ceca1d03..24a74337 160000 --- a/examples/rootfs +++ b/examples/rootfs @@ -1 +1 @@ -Subproject commit ceca1d03e03032e533a5f3ae7db7cea972211d75 +Subproject commit 24a743372c8115000231e4da0d5a939e84d30129 diff --git a/tests/test_mcu.py b/tests/test_mcu.py index c3d2f3c8..01e7bec0 100644 --- a/tests/test_mcu.py +++ b/tests/test_mcu.py @@ -319,6 +319,34 @@ class MCUTest(unittest.TestCase): del ql + def test_mcu_crc_stm32f407(self): + ql = Qiling(["../examples/rootfs/mcu/stm32f407/ai-sine-test.elf"], + archtype="cortex_m", env=stm32f407, verbose=QL_VERBOSE.DEFAULT) + + ql.hw.create('rcc') + ql.hw.create('pwr') + ql.hw.create('flash interface') + ql.hw.create('gpioa') + ql.hw.create('gpiob') + ql.hw.create('gpiod') + ql.hw.create('spi1') + ql.hw.create('crc') + + flag = False + def indicator(ql): + nonlocal flag + ql.log.info('PA7 set') + flag = True + + ql.hw.gpioa.hook_set(7, indicator, ql) + ql.hw.systick.ratio = 1000 + + ql.run(count=600000) + self.assertTrue(flag) + + del ql + + if __name__ == "__main__": unittest.main()