FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


manage:debugger_tips

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manage:debugger_tips [2019/11/08 14:29]
jfduval
manage:debugger_tips [2020/04/09 16:55] (current)
tmayadagli [USB connection and rights]
Line 12: Line 12:
   * Reset: personal preference   * Reset: personal preference
   * Build before launch: best way to make sure you are debugging what you are looking at.   * Build before launch: best way to make sure you are debugging what you are looking at.
 +
 +===== CLion Build/​Execution/​Deployment settings =====
 +  * Make sure you're pointing to the correct debugger executable (arm-none-eabi-gdb.exe) ​
 +{{ :​manage:​clion_debugger_exe_settings.png?​600 |}}
  
 ===== USB connection and rights ===== ===== USB connection and rights =====
  
   * The STLink does not always work well with hubs. We recommend connecting it directly to a USB 2.0 port.   * The STLink does not always work well with hubs. We recommend connecting it directly to a USB 2.0 port.
-  * Sometimes having ST-LINK Utility open will cause issues. Most of the time it's OK.+  * Sometimes having ST-LINK Utility open will cause issues. Most of the time it's OK. We recommend terminating ST-LINK Utility during debugging session to avoid connection problems.  
 + 
 +===== Optimizations ===== 
 +  * Make sure the compiler isn't optimizing too much such that you can't hit your breakpoints. Do this by adding a -g to your compiler flags in the CMakeLists.txt file. 
 +{{ :​manage:​optimization_compiler_flags.png?​600 |}}
  
 ===== Resets ===== ===== Resets =====
Line 26: Line 34:
 bootNotification();​ bootNotification();​
 </​code>​ </​code>​
 +===== Settings =====
 +Using ST-LINK Utility, double-check that your settings are OK, particularly the connection settings.
 +{{ :​manage:​STLink_settings.png?​400 |}}
  
 ===== Option Bytes ===== ===== Option Bytes =====
Line 32: Line 43:
  
 **Good:** **Good:**
-{{ :manage:goodcbytes.png?400 |}}+{{ :manage:STLink_optionbytes.png?400 |}}
  
 **Problematic:​** **Problematic:​**
Line 39: Line 50:
 Not shown on this screenshot is another problematic situation: having certain sectors protected. Not shown on this screenshot is another problematic situation: having certain sectors protected.
  
 +===== Printing Floats =====
 +
 +Printing floats is not enabled on most embedded systems by default, including STM32. ​
 +
 +To enable printing floats, you must add "-u _printf_float"​ to the linker flags in cmake/​chip/<​chip_name>​_definitions.cmake
 +
 +For example:
 +<code c>
 +set(MANAGE_LINK_FLAGS "-u _printf_float -specs=rdimon.specs"​)
 +</​code>​
 +
 +In general we want to have this feature turned off for code size reasons, but it is essential for debugging complex code involving floats.
 +
 +There also seems to be a bug in the provided cmake/​obko/​stm32_linker.cmake
 +By default the _estack variable is set as follows:
 +<code c>
 +_estack = ${STM32_RAM_ORIGIN} + ${STM32_RAM_SIZE} - 1
 +</​code>​
 +It should be set as follows, or else float prints will not work:
 +<code c>
 +_estack = ${STM32_RAM_ORIGIN} + ${STM32_RAM_SIZE}
 +</​code>​
manage/debugger_tips.1573223386.txt.gz · Last modified: 2019/11/08 14:29 by jfduval