![]() " in the right-click menu (or F2) to manually change specific variables - this can be useful for forcing tricky conditional behaviours to execute!ĭepending on how your code was compiled, be aware that this might have unintended consequences! You can be naughty and overwrite the value of a variable with " Set Value. You can navigate the call-stack on the left hand side of the debugger tab to see what conditions higher level code was in when you hit the breakpoint. This is useful for keeping a structure member visible with repeated breakpoints. You can pin a specific variable to be displayed in this window by right-clicking on a variable and selecting " Add watch" or by typing the name of the variable into the expressions box. Relevant data for the current line's scope is shown in the Variables tab in the debug window at the bottom of the screen. It's common to set or remove breakpoints while you're in a breakpoint!ĬLion displays function arguments and variables alongside their use in the code view, and you can hover over a variable or pointer to display any relevant information.Use the blue arrow buttons along the top of the Debugger window to step line-by-line, into/out of a conditional, or to wherever your cursor is sitting.The Green arrow button ▶ resumes code execution until the next breakpoint,.When you hit a breakpoint the microcontroller's execution is halted - take a breath, relax, and lets look at some of the basics When the microcontroller hits that line, the debugger will halt the core and allow you to view some internal information, step through code line-by-line, and allow you to resume operation as needed. Make sure your code is compiled in Debug mode without optimisations for this next step - once the compiler starts getting clever the debugging can be a bit trickier! BreakpointsĬlick in the left margin next to the line number where you want the debugger to halt. With the ability to pause code execution at key moments, you'll be able to watch how your variables change and how the microcontroller is executing logic at a speed comfortable for humans.īonus features are included because your debug probe has an incredibly deep and invasive access to the microcontroller, allowing you to halt at a specific place or time and then inspect (and even change) variables and memory! Printing to a terminal or log file can only go so far. If you've been around the block before and know how debugging works, maybe check out how Electric UI's features can help with higher-level real-time system monitoring. The binary should be flashed, and code execution should start automatically. launch one of the JLink tools from the CLI and it should stick when invoked from CLion,.If the prompt appears every time you flash the target after clicking the " Do not show " checkbox: If you use one of the EDU JLink probes, then a non-commercial use prompt may be shown prior to flashing. Your project should build and attempt to flash. If you're like me and prefer a one-click debug workflow - you probably want to ensure 'Build' is added to the "Before launch" box at the bottom to force a rebuild before flashing.Ĭlick OK, select the configuration in the top bar, and attempt to flash your target by clicking the green bug icon (" Debug") or use Shift F9. Linux: /opt/segger/jlink-V770e/JLinkGDBServer macOS: /Applications/SEGGER/JLink_V770e/JLinkGDBServerCLExe Windows: C:\Program Files\SEGGER\JLink\JLinkGDBServerCL.exe Example settings in the table and screenshot below (remember to set the appropriate device name as listed in Segger's device table): Specify the path and arguments to use to launch JLinkGDBServer. Select the correct GDB toolchain for your platform - I have one configured for arm-none-eabi-gdb in my toolchain configurations. ![]() Give it a useful name, I've chosen " Build and JLink", and select your target binary to be flashed. ![]() Open the the "Run/Debug Configurations" window, and click the " " in the top left corner to add a new "Embedded GDB Server" configuration. Configuring CLionīecause CLion has had in-built Embedded GDB support since 2019.2, configuration is pretty easy. On Windows, the installer either puts it in user PATH automatically, or provides the option to do so during install. On macOS and Linux, you may decide to manually add this location to your path if you use the other J-Link tools on the CLI - I generally don't as it allows quick changes between multiple versions if needed. J-Link installer puts the tools in your Applications folder, /Applications/SEGGER/JLink_V770e/.ĭefault install location is C:\Program Files\SEGGER\JLink\ ![]() I expanded the J-Link tarball into /opt/segger/jlink-V770e/
0 Comments
Leave a Reply. |