Is it possible to print the value of variables in STM8s Discovery?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-02 11:53 PM
Hi there!
I am new to STM8s Discovery, could someone suggests me how to print the values of variables in the program? it is more convenient if i can do this but I have no idea how to make it. Thank you very much !
Morris
Solved! Go to Solution.
- Labels:
-
DEBUG
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-06 09:40 AM
Looking at your question again, maybe you didn't mean on-target debugging, but just plain old output from your program. If you want to do that: Set up an UART for serial output, provide a putchar protoype that uses it, then just use printf() like you would on any other C implementation.
For an example, see e.g. http://www.colecovision.eu/stm8/STM8S-DISCOVERY%20Serial.shtml (the example uses SDCC, but should work without changes for IAR, too, and only require minor changes for Cosmic and Raisonance).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-06 09:33 AM
The STM8S supports on-target debugging, so this should just work. AFAIK it is supported by all the usual development environments, be it STVD, or one from IAR, Cosmic or Raisonance.
If you use SDCC, you would do it by compile with --debug --out-fmt-elf to generate ELF/DWARF output that can then be used with OpenOCD and GDB for on-target debugging.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-06 09:40 AM
Looking at your question again, maybe you didn't mean on-target debugging, but just plain old output from your program. If you want to do that: Set up an UART for serial output, provide a putchar protoype that uses it, then just use printf() like you would on any other C implementation.
For an example, see e.g. http://www.colecovision.eu/stm8/STM8S-DISCOVERY%20Serial.shtml (the example uses SDCC, but should work without changes for IAR, too, and only require minor changes for Cosmic and Raisonance).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-08 09:16 AM
Hi Philipp,
Thanks for your reply!!!!
I have tried your suggestion and i am able to use printf() now!!!!!
Thanks a lot!!!!