summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorzhkag <[email protected]>2023-06-10 12:32:34 +0800
committerGitHub <[email protected]>2023-06-10 12:32:34 +0800
commit0f998f6b05e044d2c2a0c99f24f4cd97f263f478 (patch)
tree8211353b2dfe888d9a1c8f5355cc415bdad5c37c /components
parentd0c6d6f4a48b67fde477c743bec1a68198e882f3 (diff)
[simulator] 模拟器可以使用 utest 测试框架 (#7644)
Co-authored-by: Man, Jianting (Meco) <[email protected]>
Diffstat (limited to 'components')
-rw-r--r--components/utilities/utest/utest.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/components/utilities/utest/utest.c b/components/utilities/utest/utest.c
index 3c91fa8166..6b480dd1e1 100644
--- a/components/utilities/utest/utest.c
+++ b/components/utilities/utest/utest.c
@@ -88,19 +88,19 @@ int utest_init(void)
#elif defined (__ICCARM__) || defined(__ICCRX__) /* for IAR Compiler */
tc_table = (utest_tc_export_t)__section_begin("UtestTcTab");
tc_num = (utest_tc_export_t)__section_end("UtestTcTab") - tc_table;
-#elif defined (__GNUC__) /* for GCC Compiler */
+#else
+ unsigned int *ptr_begin, *ptr_end;
+#if defined(__GNUC__)
extern const int __rt_utest_tc_tab_start;
extern const int __rt_utest_tc_tab_end;
- tc_table = (utest_tc_export_t)&__rt_utest_tc_tab_start;
- tc_num = (utest_tc_export_t) &__rt_utest_tc_tab_end - tc_table;
+ ptr_begin = (unsigned int *)&__rt_utest_tc_tab_start;
+ ptr_end = (unsigned int *)&__rt_utest_tc_tab_end;
#elif defined(_MSC_VER)
- unsigned int* ptr_begin, * ptr_end;
-
- ptr_begin = (unsigned int*)&__tc_export_begin;
+ ptr_begin = (unsigned int *)&__tc_export_begin;
+ ptr_end = (unsigned int *)&__tc_export_end;
ptr_begin += (sizeof(struct utest_tc_export) / sizeof(unsigned int));
+#endif
while (*ptr_begin == 0) ptr_begin++;
-
- ptr_end = (unsigned int*)&__tc_export_end;
ptr_end--;
while (*ptr_end == 0) ptr_end--;
/* copy tc_table from rodata section to ram */