From da6d526e9c2583e96058a4ed607b2f05f65ac48f Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Wed, 24 Aug 2022 18:28:18 +0800 Subject: [PATCH] arch/sim: fix visual studio Linker Tools Error LNK2019 nuttx_all.lib(up_initialstate.obj) : error LNK2019: unresolved external symbol '___builtin_frame_addres' referenced in function '_up_getsp' Return stack pointer from esp Signed-off-by: chao.an --- arch/sim/include/irq.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/sim/include/irq.h b/arch/sim/include/irq.h index 03c90b0c06..8c177a9c08 100644 --- a/arch/sim/include/irq.h +++ b/arch/sim/include/irq.h @@ -77,7 +77,13 @@ extern "C" static inline uintptr_t up_getsp(void) { +#ifdef _MSC_VER + uintptr_t regval; + __asm mov regval, esp; + return regval; +#else return (uintptr_t)__builtin_frame_address(0); +#endif } /****************************************************************************