IAR debugging STM8S encountered the problem of wrong function return value

Publisher:SunshineHopeLatest update time:2022-05-09 Source: eefocusKeywords:IAR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The problem occurred when debugging EEPROM operation on stm8s003. I captured IIC communication data from the logic analyzer and saw that both reading and writing were normal. Under normal circumstances, a successful operation would directly return 0x00; but this time it always returned 0x37. Single-step tracing showed that the return was indeed 0, but after assigning the return value to a variable, it became 0x37. This driver has been used before without any problems, but I don't know why it's broken this time.


The IIC driver is in an independent C file, and the call is in another file, which is referenced through the extern declaration in the header file. After cross-comparison with the previous program, it was found that the function declaration in IIC.h was commented out, which is equivalent to calling it directly without declaration. Finally, after removing the comment, it returned to normal.


Keywords:IAR Reference address:IAR debugging STM8S encountered the problem of wrong function return value

Previous article:The problem of inaccurate time when using the STM8S timer for the first time
Next article:The same STM8 project generates inconsistent HEX checksums after changing the directory location

Popular Resources
Popular amplifiers
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号