[simulator] 模拟器可以使用 utest 测试框架 (#7644)
Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
This commit is contained in:
parent
d0c6d6f4a4
commit
0f998f6b05
|
@ -77,7 +77,7 @@ CONFIG_RT_USING_DEVICE=y
|
|||
# CONFIG_RT_USING_DM is not set
|
||||
# CONFIG_RT_USING_INTERRUPT_INFO is not set
|
||||
CONFIG_RT_USING_CONSOLE=y
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=128
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=256
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="console"
|
||||
CONFIG_RT_VER_NUM=0x50001
|
||||
# CONFIG_RT_USING_STDC_ATOMIC is not set
|
||||
|
|
|
@ -66,6 +66,12 @@ SECTIONS
|
|||
|
||||
/* setction information for finsh shell begin */
|
||||
. = ALIGN(8);
|
||||
UtestTcTab : {
|
||||
__rt_utest_tc_tab_start = .;
|
||||
KEEP(*(UtestTcTab))
|
||||
__rt_utest_tc_tab_end = .;
|
||||
}
|
||||
. = ALIGN(8);
|
||||
FSymTab : {
|
||||
__fsymtab_start = .;
|
||||
KEEP(*(FSymTab))
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
#define RT_CONSOLEBUF_SIZE 256
|
||||
#define RT_CONSOLE_DEVICE_NAME "console"
|
||||
#define RT_VER_NUM 0x50001
|
||||
|
||||
|
|
|
@ -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 += (sizeof(struct utest_tc_export) / sizeof(unsigned int));
|
||||
while (*ptr_begin == 0) ptr_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--;
|
||||
while (*ptr_end == 0) ptr_end--;
|
||||
/* copy tc_table from rodata section to ram */
|
||||
|
|
|
@ -1574,8 +1574,13 @@ rt_inline void _heap_unlock(rt_base_t level)
|
|||
|
||||
#ifdef RT_USING_UTESTCASES
|
||||
/* export to utest to observe the inner statements */
|
||||
#ifdef _MSC_VER
|
||||
#define rt_heap_lock() _heap_lock()
|
||||
#define rt_heap_unlock() _heap_unlock()
|
||||
#else
|
||||
rt_base_t rt_heap_lock(void) __attribute__((alias("_heap_lock")));
|
||||
void rt_heap_unlock(rt_base_t level) __attribute__((alias("_heap_unlock")));
|
||||
#endif /* _MSC_VER */
|
||||
#endif
|
||||
|
||||
#if defined(RT_USING_SMALL_MEM_AS_HEAP)
|
||||
|
|
Loading…
Reference in New Issue