<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>STM32 &#8211; Antonio</title>
	<atom:link href="/category/%E7%AC%94%E8%AE%B0/stm32/feed/" rel="self" type="application/rss+xml" />
	<link>https://nstar.ltd</link>
	<description></description>
	<lastBuildDate>Fri, 20 Jun 2025 17:37:19 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>STM32CubeIDE使用</title>
		<link>/stm32cubeide%e4%bd%bf%e7%94%a8/</link>
					<comments>/stm32cubeide%e4%bd%bf%e7%94%a8/#respond</comments>
		
		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Fri, 20 Jun 2025 17:27:15 +0000</pubDate>
				<category><![CDATA[STM32]]></category>
		<guid isPermaLink="false">http://antonioz.asia/?p=239</guid>

					<description><![CDATA[新建工程： debug配置： 配置使用DAP作为调试器： 通过arm-eabi工具链以及openocd实现：包 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">新建工程：</h2>



<h3 class="wp-block-heading">debug配置：</h3>



<ul class="wp-block-list">
<li>System Wake-Up 勾选，用于低功耗时PA0实现唤醒</li>



<li>Timebase Source 默认选用SysTick，使用RTOS时，建议使用更加精确的 <strong>TIM</strong> 作为时钟源</li>
</ul>



<h3 class="wp-block-heading">配置使用DAP作为调试器：</h3>



<p>通过arm-eabi工具链以及openocd实现：<br>包括了&nbsp;<strong><a href="https://gnutoolchains.com/arm-eabi/">Windows Toolchain for ARM</a></strong>&nbsp;和&nbsp;<strong><a href="https://gnutoolchains.com/arm-eabi/openocd/">OpenOCD</a></strong>&nbsp;两个工具库</p>



<p>首先，需要调用&nbsp;<code>openocd.exe</code>&nbsp;开启一个连接到 DAP-Link 与目标微控制器的&nbsp;<a href="https://zhida.zhihu.com/search?content_id=218942787&amp;content_type=Article&amp;match_order=1&amp;q=GDB&amp;zd_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ6aGlkYV9zZXJ2ZXIiLCJleHAiOjE3NTA2MTI2NTksInEiOiJHREIiLCJ6aGlkYV9zb3VyY2UiOiJlbnRpdHkiLCJjb250ZW50X2lkIjoyMTg5NDI3ODcsImNvbnRlbnRfdHlwZSI6IkFydGljbGUiLCJtYXRjaF9vcmRlciI6MSwiemRfdG9rZW4iOm51bGx9.bVCu_8c0cDmqfIvQBsRCAyg_sVicztGfPWLQ_SYJjAo&amp;zhida_source=entity" target="_blank" rel="noreferrer noopener">GDB</a>&nbsp;调试服务；</p>



<p>然后，<strong>STM32CubeIDE</strong>&nbsp;就可以通过&nbsp;<code>arm-none-eabi-gdb.exe</code>&nbsp;访问这个 GDB 服务；</p>



<p>下载并且解压两个工具库之后，分别将它们的&nbsp;<code>bin</code>&nbsp;目录添加到操作系统的环境变量</p>



<h3 class="wp-block-heading" id="h_588638750_1">以命令行方式进行调用</h3>



<h3 class="wp-block-heading" id="h_588638750_2">配置 OpenOCD</h3>



<p>OpenOCD 命令的调用格式如下面的代码所示，其中的&nbsp;<code>-f</code>&nbsp;参数表示当前使用的是配置文件：</p>



<pre class="wp-block-code"><code>openocd.exe -f interface\调试器接口配置文件 -f target\目标微控制器配置文件</code></pre>



<p>调试器接口配置文件在&nbsp;<code>OpenOCD\share\openocd\scripts\interface</code>&nbsp;目录下，由于这里使用的是&nbsp;<strong>DAP-Link</strong>&nbsp;作为调试器，所以通常都是以&nbsp;<code>cmsis-dap.cfg</code>&nbsp;作为参数</p>



<p>目标微控制器配置文件在 <code>OpenOCD\share\openocd\scripts\target</code>&nbsp;目录下</p>



<p>以此为例：</p>



<pre class="wp-block-code"><code>openocd.exe -f interface\cmsis-dap.cfg -f target\stm32l0.cfg
openocd.exe -f interface\cmsis-dap.cfg -f target\stm32f1x.cfg
openocd.exe -f interface\cmsis-dap.cfg -f target\stm32f4x.cfg</code></pre>



<p>然后打开STM32cubeIDE调试配置，“虫子”图标</p>



<p>修改GDB配置为arm-none-eabi-gdb.exe</p>



<p>修改端口号为localhost:3333</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>/stm32cubeide%e4%bd%bf%e7%94%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
