Code::Blocks

User forums => Embedded development => Topic started by: _WG_ on August 22, 2017, 02:18:47 pm

Title: Customize "Run" Button
Post by: _WG_ 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.
Title: Re: Customize "Run" Button
Post by: christobal 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).

Title: Re: Customize "Run" Button
Post by: _WG_ 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.
Title: Re: Customize "Run" Button
Post by: oBFusCATed 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.
Title: Re: Customize "Run" Button
Post by: christobal 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.
Title: Re: Customize "Run" Button
Post by: _WG_ 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"?

Title: Re: Customize "Run" Button
Post by: oBFusCATed 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.
Title: Re: Customize "Run" Button
Post by: BlueHazzard 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
Title: Re: Customize "Run" Button
Post by: oBFusCATed 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.
Title: Re: Customize "Run" Button
Post by: BlueHazzard 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
Title: Re: Customize "Run" Button
Post by: BlueHazzard 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...
Title: Re: Customize "Run" Button
Post by: oBFusCATed 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...
Title: Re: Customize "Run" Button
Post by: BlueHazzard 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 ;)
Title: Re: Customize "Run" Button
Post by: oBFusCATed on September 12, 2017, 08:36:14 pm
Yep...
Title: Re: Customize "Run" Button
Post by: _WG_ 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
Title: Re: Customize "Run" Button
Post by: Totoxa on November 16, 2017, 11:21:31 am
...
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.

I would love to be able to do that, the ability to use custom variables in the argument list (as the custom tools do) would be nice
Title: Re: Customize "Run" Button
Post by: oBFusCATed on November 16, 2017, 08:22:43 pm
It will happen, but it should have to wait for the release to happen first. So no new features in the immediate future.