在使用SWD使用Atmel-ICE调试器在Atmel Studio 7中设置软件断点时,我遇到了各种问题。我想知道是否有人能更详细地解释(或指出文档的方向),让我更好地理解为什么我会遇到以下问题:
下面的代码是我编写的一个测试程序,它使用ASF的延迟例程和端口驱动程序来演示这一点:
#include <asf.h>
#define LED PIN_PA01
int main (void)
{
system_init();
delay_init();
struct port_config config_port_pin;
config_port_pin.direction = PORT_PIN_DIR_OUTPUT;
port_pin_set_config(LED, &config_port_pin);
while(1)
{
port_pin_toggle_output_level(LED);
delay_ms(100);
}
}据我所知,代码运行良好。当我在没有调试的情况下运行时,LED每100毫秒切换一次,只是软件断点我不太明白,很抱歉我的无知。
发布于 2018-04-26 04:33:51
我知道你回答了你的问题,但这是一个很好的教程,有人写了关于编译器优化的文章。
https://www.avrfreaks.net/forum/tutcoptimization-and-importance-volatile-gcc
https://stackoverflow.com/questions/38176321
复制相似问题