Author Topic: Customize "Run" Button  (Read 889 times)

Offline _WG_

  • Single posting newcomer
  • *
  • Posts: 4
Customize "Run" Button
« on: August 22, 2017, 02:18:47 pm »
Hello to everyone!

I use Code::Blocks a lot for embedded programming (STM32 and AVR). But up to now i did not found a solution to use the "Run" button or "Build and Run" Button to flash the controller.
At the moment i use Tool-Buttons in the menu, but now i do have 8 different buttons for the different controllers.

It would be helpful, if the customized "Run" Button use project dependent settings and not global settings.

Is there any solution you you can add this to the Development Todo-List?

Thx.

Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Customize "Run" Button
« Reply #1 on: August 22, 2017, 02:28:24 pm »
You can use the "Tools" menu with C::B Makros.
I use it to start the debugger and pass ${TARGET_OUTPUT_FILE} as parameter, which refers to the build target output file (.elf in my case).


Offline _WG_

  • Single posting newcomer
  • *
  • Posts: 4
Re: Customize "Run" Button
« Reply #2 on: August 22, 2017, 07:13:26 pm »
I know this and thats the way i do the last years. But this is not project dependent and to use "Run" or "Build+Run" would be very nice.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10277
Re: Customize "Run" Button
« Reply #3 on: August 28, 2017, 12:15:00 am »
You can use post build steps to flash the controller. This is the only way to do it at the moment.
Probably you can experiment with commands only target and see if running it could be used to flash controllers.
I've never done it, so if this works I'll be happy to learn how.
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline christobal

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Customize "Run" Button
« Reply #4 on: August 28, 2017, 06:58:31 am »
I know this and thats the way i do the last years. But this is not project dependent and to use "Run" or "Build+Run" would be very nice.

You can use "Custom Variables" to define the controller type (i guess that's whats project dependent in your case). You can use these Variables just like the "normal" macros in the "tools" menu.

Offline _WG_

  • Single posting newcomer
  • *
  • Posts: 4
Re: Customize "Run" Button
« Reply #5 on: September 11, 2017, 07:54:24 am »
Hi christibal,
thx for the answer. This could improve the usability. I will try it.
But any chance to use the play button for flashing? Maybe with custom variable "hacks"?


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10277
Re: Customize "Run" Button
« Reply #6 on: September 11, 2017, 09:37:36 pm »
I'll see what could be done about this, but it won't happen soon.
If you feel like it you could add a feature request in our tracker at the project page on sf.net.
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1519
Re: Customize "Run" Button
« Reply #7 on: September 11, 2017, 10:58:44 pm »
What are you using to flash the controller?
it would be possible to use the debug button to flash the controller, if you have a gdb supported debugger

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10277
Re: Customize "Run" Button
« Reply #8 on: September 11, 2017, 11:19:13 pm »
He is probably using avrdude...
How could a debugger help for flashing?
Using the jtag or similar interface?

I'm thinking that we could extend the host app field in a way to allow the execution of more commands than just the host app.
Unfortunately the host app is not executed for executable targets and for commands only target.
I guess we could extend this with a checkbox which controls if the host app is used or not, so the user could override it.
« Last Edit: September 11, 2017, 11:40:27 pm by oBFusCATed »
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1519
Re: Customize "Run" Button
« Reply #9 on: September 11, 2017, 11:58:12 pm »
With a debugger (hardware) you usually can also flash your device. Most gdb server for embedded debugging incorporate a load command that can be executed with gdb
for example you can add this lines in the Project->Properties->Debugger->Additional GDB commands->After connection
for Segger gdb server or OpenOCD gdb server:
Code: [Select]
monitor reset
load

This will load the firmware file into the flash

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1519
Re: Customize "Run" Button
« Reply #10 on: September 12, 2017, 12:00:55 am »
Quote
I'm thinking that we could extend the host app field in a way to allow the execution of more commands than just the host app.
Unfortunately the host app is not executed for executable targets and for commands only target.
I guess we could extend this with a checkbox which controls if the host app is used or not, so the user could override it.
It would simply be great to execute squirrel scripts... this would make it flexible for all i can think of...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10277
Re: Customize "Run" Button
« Reply #11 on: September 12, 2017, 12:43:37 am »
I didn't mention squirrel :); it could be done, but I'd prefer if they are just shell scripts...
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1519
Re: Customize "Run" Button
« Reply #12 on: September 12, 2017, 09:59:05 am »
you probably will use the glorious Manager::Get()->GetMacrosManager()->ReplaceMacros() function for the macros and i am satisfied ;)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10277
Re: Customize "Run" Button
« Reply #13 on: September 12, 2017, 08:36:14 pm »
Yep...
<debugger plugin maintainer>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline _WG_

  • Single posting newcomer
  • *
  • Posts: 4
Re: Customize "Run" Button
« Reply #14 on: September 30, 2017, 11:19:14 am »
I just tried to use a custom variable in the Project property outputfile with the hope, that this will be executed. But due to this the output file was not created :-)

I use openocd and avrdude. But for debugging i still have to start the openocd server before that i just want to do in case of debugging.

It should be a project dependent configuration in future, so that just the project file is necessary to do the job. No application configuration should be done.

thx