I've seen a question like this but it didn't have an answer.
All I want to do is make a change to the code and then compile and run on the target without the debugger, ideally with a simple keyboard shortcut.
Simple example using the ST NUCLEO-F030R8 board and a Keil project auto-generated using ST's STM32CubeMX tool.while (1) { HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin); HAL_Delay(200);}
while (1)
{
HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
HAL_Delay(200);
}
Let's say I edit the delay and want to quickly experiment with values without running the debugger. I just want to compile, load and run in one step every time I make a change.
I tried setting this option:
Options for Target > Debug > ST-Link Debugger Settings > Flash Download > Reset and Run
An odd thing happens. When I hit F8 to load, it loads and then it looks like it holds the processor in reset; in other words, it never runs.
The odd part is that if I don't touch anything and return to that dialog, the instant I click on the "Settings" button for the ST-Link Debugger the target start running. This is very weird and I wonder if it is a bug.
Here's a video. Tell me if I am doing anything wrong.
https://youtu.be/pB0Rgmr-5A4
Is there a way to compile-load-reset-run without the debugger all in one step?
Thanks.
martincho said:it looks like it holds the processor in reset; in other words, it never runs.
it looks like it holds the processor in reset; in other words, it never runs.
Can't you just press the reset button on the Nucleo board?
However, if you really are just experimenting with different timer values, why not do that in the debugger?
that would be a whole lot simpler that having to rebuild & download just for a value change - surely?
Well, I am using this nucleo board just to illustrate the issue. The actual application board I am working on does not have a reset button. I suppose I could wire one in for development but that would mean working with a board that isn't the actual qualified article. Think in terms of something like an engine control computer...no reason to have a rest button, in fact, it could be a liability.
OK, but that still leaves the question of why you would want to do a complete rebuild & download just to tweak a parameter - why not just do that in the debugger?
I am guilty of constructing a simplified example to be able to ask the question using an example rather than a wall of text. I can't post real code. This isn't about just using the debugger to change a single variable. I am trying to get to a simple answer to the --at least in my view-- simple question of: Is there a way to compile > load > reset > run all in one step? I know I can use the debugger for simple cases, yet that's not what I am asking here. Sorry that my question wasn't more clearly worded. Thanks for taking the time to respond.
Aside from that, if you look at my video, it seems there's real bug in Keil...it resets the board when you enter the settings dialog.
You should try to open your project with command line "UV4" with option "-b" for building, and then a new command line "UV4" with "-f" option it will flash your code.
You also have to activate the option "Reset and run" when flashing, in Keil IDE go to "Target option -> Debug ->Settings -> Flash Download -> Reset and run"
If you try to Flash with this option you should see something like "Apllication running..." in the Build Output Window.