semihost
是arm的一种机制,把运行设备的输入输出请求传递给运行调试器的主机,利用这种机制,可以使用主机的屏幕和键盘,而不用在嵌入式目标系统上使用屏幕和键盘。可以使用此机制启用C库中的函数,例如printf()和scanf()
下面的例子是printf打印到调试窗口,工具为DAVEv4
,其他版本的可能不一样些
/*
* main.c
*
* Created on: 2018 Aug 16 09:51:30
* Author: ink
*/
#include
#include
/**
* @brief main() - Application entry point
*
* Details of function
* This routine is the application entry point. It is invoked by the device startup code.
*/
extern void initialise_monitor_handles(void);
int main(void)
{
initialise_monitor_handles();
/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
printf("semihost:output to console
");
}
}
https://www.infineonforums.com/threads/3489-DAVE-TIP-of-the-day-Semihosting-in-DAVEv4?tdsourcetag=s_pctim_aiomsg
https://blog.csdn.net/x356982611/article/details/81713760