[DemoCode下载] 半主机测试

[复制链接]
732|4
 楼主| xinpian101 发表于 2017-8-21 20:23 | 显示全部楼层 |阅读模式
TE, se, ge, AC
  1. /****************************************************************************
  2. * [url=home.php?mod=space&uid=288409]@file[/url]     main.c
  3. * [url=home.php?mod=space&uid=895143]@version[/url]  V3.00
  4. * $Revision: 7 $
  5. * $Date: 15/11/02 10:00a $
  6. * [url=home.php?mod=space&uid=247401]@brief[/url]    A sample code to show how to debug with semihost message print.
  7. * @note
  8. * Copyright (C) 2014~2015 Nuvoton Technology Corp. All rights reserved.
  9. *
  10. ******************************************************************************/

  11. #include <stdio.h>
  12. #include "NUC123.h"


  13. /*---------------------------------------------------------------------------------------------------------*/
  14. /* Main Function                                                                                            */
  15. /*---------------------------------------------------------------------------------------------------------*/

  16. int32_t main()
  17. {
  18.     int8_t item;

  19.     /*
  20.         To enable semihost, user must define "DEBUG_ENABLE_SEMIHOST" constant when buildind sample code.
  21.         This sample code is used to show how to print message/getchar on IDE debug environment.
  22.         It will echo all input character back on UART #1 of KEIL IDE.

  23.         In KEIL MDK, user need to open "View->Serial Window->UART #1" windows in debug mode.
  24.         In IAR Workbench, user need to open "View->Terminal I/O" in debug mode.

  25.         NOTE1: HardFault_Handler handler is implemented in retarget.c.
  26.         NOTE2: Semihost only works with Nuvoton NuLink ICE Dongle in debug mode.
  27.         NOTE3: It does not print any message if Nuvoton NuLink ICE Dongle is not connected.
  28.     */

  29.     printf("\n Start SEMIHOST test: \n");

  30.     while(1)
  31.     {
  32.         /* Get input character */
  33.         item = getchar();

  34.         /* Print input character back */
  35.         printf("%c\n", item);
  36.     }
  37. }

  38. /*** (C) COPYRIGHT 2014~2015 Nuvoton Technology Corp. ***/




 楼主| xinpian101 发表于 2017-8-21 20:23 | 显示全部楼层
新唐的BSP里面总有这个东西,干啥用的,今天查了百度才略有所懂。
天灵灵地灵灵 发表于 2017-8-21 22:14 | 显示全部楼层
就是可以直接用这个输入输出的系统函数呗
捉虫天师 发表于 2017-8-21 22:35 | 显示全部楼层
就是在单片机上用标准输入输出函数。
wanduzi 发表于 2017-8-26 19:19 | 显示全部楼层
看样子什么都不用配置,直接可以用啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

130

主题

1651

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部