当前位置: 首页 > news >正文

记录个IAR程序下载后硬件复位不运行,必须断电复位才运行的问题

【问题测试】

有个F407的跑马灯的例子,是MDK和IAR两个版本,MDK版本的例子下载并复位后可以正常看到LED闪烁,而IAR的例子下进去后,不会闪烁。

使用TOOL的上位机内核寄存器监测工具测试发现,硬件复位后竟然还在调试状态,邪门了

1.1

1.2

1.3

必须断电复位,断电复位后正常了:

1.4

或者LUA命令控制退出调试状态

1.5


【问题解决】

起初以为是启动代码里面封装的函数__iar_program_start造成,将其注释掉,直接跳转到mian也不行

2.1

最后测试发现是半主模式配置问题,之前测试的8.50版本是半主模式配置 + fputc重新写,实际测试不会再执行半主操作了

2.2

进入IAR9,X后,这种配置不行了,必执行半主操作,导致运行起来了,还处于调试模式状态。使用9.X要关闭半主,并且重新定向串口

2.3

/********************* Copyright 1998-2017 IAR Systems AB.** This is a template implementation of the "__write" function used by* the standard library.  Replace it with a system-specific* implementation.** The "__write" function should output "size" number of bytes from* "buffer" in some application-specific way.  It should return the* number of characters written, or _LLIO_ERROR on failure.** If "buffer" is zero then __write should perform flushing of* internal buffers, if any.  In this case "handle" can be -1 to* indicate that all handles should be flushed.** The template implementation below assumes that the application* provides the function "MyLowLevelPutchar".  It should return the* character written, or -1 on failure.*********************/#include <LowLevelIOInterface.h>#pragma module_name = "?__write"int MyLowLevelPutchar(int x)
{comSendChar(COM1, x);return x;}/** If the __write implementation uses internal buffering, uncomment* the following line to ensure that we are called with "buffer" as 0* (i.e. flush) when the application terminates.*/size_t __write(int handle, const unsigned char * buffer, size_t size)
{/* Remove the #if #endif pair to enable the implementation */
#if 1size_t nChars = 0;if (buffer == 0){/** This means that we should flush internal buffers.  Since we* don't we just return.  (Remember, "handle" == -1 means that all* handles should be flushed.)*/return 0;}/* This template only writes to "standard out" and "standard err",* for all other file handles it returns failure. */if (handle != _LLIO_STDOUT && handle != _LLIO_STDERR){return _LLIO_ERROR;}for (/* Empty */; size != 0; --size){if (MyLowLevelPutchar(*buffer++) < 0){return _LLIO_ERROR;}++nChars;}return nChars;#else/* Always return error code when implementation is disabled. */return _LLIO_ERROR;#endif}

 

http://www.wuyegushi.com/news/570.html

相关文章:

  • 操作系统 - 浪矢
  • Qt布局管理
  • 最小树形图:朱刘算法
  • 基于YOLOv8的边坡排水沟堵塞检测与识别项目|完整源码数据集+PyQt5界面+完整训练流程+开箱即用!
  • POLIR-Laws-民法典: 第三编 合同 : 第二分编 典型合同: 20.技术合同 : 1)一般规定、2)技术开发、3)技术转让 和 技术许可、4)技术咨询 和 技术服务
  • hybrid口
  • 利用Transformer模型提升产品检索效果
  • 第二十天
  • 《恶意代码实战分析》笔记
  • POLIR-Laws-民法典: 第三编 合同 : 第二分编 典型合同: 19.运输合同 : 1)一般规定、2)客运合同、3)货运合同、4)多式联运合同
  • 《大道至简》读后感
  • @GetMapping、@PostMapping、@PutMapping、@DeleteMapping
  • 建模神器草图大师!SketchUp 2025 安装激活全流程,新手也能玩转!
  • 【最新专业评测】PDF Reducer专业版:85%超高压缩率的PDF压缩神器|Windows最佳PDF压缩工具推荐
  • @RequestMapping
  • DMP学习路径之入门
  • 第一篇随笔
  • 旋转链表 - 商商
  • 匀速二阶贝塞尔曲线
  • Redis原理
  • HTTP POST请求:初学者指南与示范
  • @Autowired 自动依赖注入
  • 基于接口划分vlan
  • 【AirSim】图像API的使用
  • CSS页面布局
  • switch 语句
  • 优秀书籍随记
  • Golang 文本模板,你指定没用过
  • @RestController
  • Django实时通信实战:WebSocket与ASGI全解析(下)