JTAG调试时如何引入IAR内置库(C运行时等)的源代码?
Hey there! As someone who’s worked with IAR and STM32F4 boards, I can walk you through how to get the C runtime initialization source code showing up during debugging. Here’s what you need to do:
Check if you have the runtime source code installed
IAR doesn’t install the CRT (C Runtime) source files by default in all setups. Open IAR and go toTools > Options > General > Product Informationto verify if "Runtime Source Code" or a similar component is listed. If it’s missing, re-run the IAR installer, choose "Modify" installation, and make sure to check the box for ARM Runtime Library Source (or the equivalent for your version).Add the source path to your project’s debug configuration
Once the source files are installed, configure your project to find them:- Open your STM32F4 project, then go to
Project > Options > Debugger > Source. - In the Source lookup paths section, click
Add. Navigate to your IAR installation directory—typically something likeC:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\src\lib. This folder contains subdirectories likecstartup,libc, andlibmwhich hold the CRT source code. - Check the Search subdirectories box so the debugger can find nested source files automatically.
- Open your STM32F4 project, then go to
Ensure debug information is enabled
If you still can’t see the source, double-check that your project is generating debug info:
Go toProject > Options > Build > Compiler > Outputand confirm thatGenerate debug informationis checked. This ensures the debugger has the links between compiled code and source files.Bonus: Handle STM32 startup assembly code
For the low-level STM32 startup code (not just IAR’s CRT), you can get thecstartup_stm32f4xx.sfile from STM32CubeMX. Export a project with your STM32F4 model, copy the startup file into your IAR project, and add it to the build. This lets you step through the board-specific initialization too.
内容的提问来源于stack exchange,提问作者ritu

