- Silicon Labs Community
- Welcome and Announcements
- Silicon Labs Knowledge Base
- 8-bit MCU
- 32-bit MCU
- Bluetooth / Wi-Fi
- Other Products Category
- Optical/RH/Temp Sensor
- Other Products
- Hardware and Software Tools
- Simplicity Studio and Software
- General Discussions and Suggestions
- Chinese Forum
- Software Libraries
- Development Kits
- Reference Designs
- Third Party Tools
- White Papers
- Official Blog of Silicon Labs
- Chinese Blog
09-08-2017 11:10 AM
I have a problem where I cannot get my code to break on a breakpoint in the C code.
I am using:
Simplicity Studio V4
BlueGecko module wireless starter kit (PCB4003 revA3)
Debug adaptor (BRD8010A revA01)
Custom board with BGM121
I can compile my project in debug mode with no errors.
I can program my custom board with said compiled code with the Debug button.
I can pause execution while in debug, BUTI only see the paused line of code in the Disassembly window. There is no indication in the C code where the program is paused.
I can set a breakpoint in the C code (right-click -> Add breakpoint... -> Class: C/C++ Line Breakpoint, Type = Regular, Enabled = True) BUT the program never pauses on that breakpoint. I have tried several (many) different locations for the breakpoint - locations which I know are being traversed, but still it never pauses. The "Disable Breakpoints" option is not enabled.
I can set an in-line breakpoint by typing "__BKPT(0);" which DOES pause execution, but again, only visible in the Disassembly window and not the C code file. Once paused in this fashion, I do not have access to the variables (in the C code) to see what values they hold.
I have turned off optimizations (they were already set to off) in Project -> Properties -> C/C++ Build -> Settings -> IAR C/C++ Compiler for ARM -> Optimizations -> Optimization level = None.
Can someone offer suggestions which would allow me to pause execution while debugging via a breakpoint on a line in my C code which allows me to view the variables and the values they hold?
Solved! Go to Solution.
09-08-2017 11:53 AM
Which operating system is the PC running?
When you say the "Disable Breakpoints" option is not enabled do you mean the "Skip all Breakpoints" option? (CTRL-ALT-B). If you build an example project for the BRD4003 and debug that application on that board do the breakpoints work correctly on the example? Just trying to narrow done the issue, because what you are doing should be working.
09-08-2017 01:06 PM
Thank you for your reply.
My operating system is Windows 10. And I was indeed referring to the "Skip all breakpoints (Ctrl + Alt + B)" option. That button is not selected.
I should say I had a typo in my original post - The wireless starter kit is PBC4001 RevA03, not PCB4003. Sorry about that.
I tried your suggestion. I plugged a BGM121 demo board into the wireless starter kit, switched the debug mode of my Simplicity Debugger from "OUT" to "MCU," then built and ran the "SOC - Thermometer" example.
I am seeing the same behavior. When I create a breakpoint in Main then run in debug mode, the program does not pause execution at the line of code with the breakpoint. But if I type "__BKPT(0);" just below the line with that break point, then rerun in debug mode, the program halts execution on the in-line breakpoint, but only shows the context in the Disassembly window, not in the C code.
I'm glad to hear you say it should work. I began to doubt I would be able to debug properly. Do you have any other thoughts as to what could be causing this particular issue? Is there some configuration option that I have inadvertently set which only debugs in disassembly? Maybe I am not creating the breakpoints correctly?
09-08-2017 01:32 PM
Maybe you could zip up the program folder for the SOC Thermometer example and attach that to this forum thread so we can try and see what is going on. I don't see an option to set a breakpoint if I right click on a line in the 'C' file. I normally set a breakpoint by double clicking at the beginning of the line (far left margin). But in the disassembly window the 'C' code is interspersed with the assembly code, there is a small "Show Source" icon at the top of the dissembly window (looks like a sheet of paper with some code on it and a small yellow arrow pointing to the right, I've highlighted it in red in this screenshot:
But the fact that the breakpoints don't seem to be working correctly makes me think that probably isn't the issue. There is a project property setting for the Linker in the Output section "Include debug information in output", but if that isn't checked there is a warning when launching the debugger, so I doubt that is the issue. In the debug configuration (right click on the project folder and select [Debug As] > [Debug Configurations...] is the executable the ".out" file? (IAR ARM - Debug/soc-thermometer.out).
09-08-2017 02:04 PM
I have attached the zipped project to this post. Hopefully this will help troubleshoot this issue.
When I said I right-click the line, I was right-clicking the line number to create the breakpoint. I repeated the test creating a breakpoint by double-clicking as you do and the results were the same.
My disassembly window is not interspersed with C code. Here is an image of the window after stopping on an in-line breakpoint:
Note the "Show Source" icon is selected.
I double-checked that the "Include debug information in output" checkbox was checked in the Linker output settings page. It was already checked.
I also verified that the executable is indeed the .out file. It is listed as "IAR ARM - Debug/soc-thermometer.out" in the Debug Configuration for that project.
Thank you for looking into this.
09-08-2017 04:14 PM
It looks like you are using version 8.1.1 of the IAR compiler and Simplicity Studio only works with versions up to 7.80.x. There is a known issue trying to debug projects built with the 8.1.x version of the IAR compiler with Simplicity Studio. All of the libraries that Silicon Labs provides (for example stack.a, binstack.o) are also built with version 7.80 of the compiler. IAR lets you install different versions in parallel, so the 7.80 version can be installed and used with Simplicity Studio. I don't have a time table on when Silicon Labs will add support for IAR version 8.1.1. The other option would be to use the efr32.ewp file in the project to launch the IAR Workbench and build and debug the project from the IAR Workbench.
09-08-2017 08:22 PM
Bingo! That was indeed the problem. I installed IAR license 7.80 instead of 8.11 and the debugging is now working as expected.
Terrific sleuthing, jpitt. Thank you for your help.