Author Topic: How can I create (when building) hex files in two folders at the same time?  (Read 242 times)

Offline selevo

  • Single posting newcomer
  • *
  • Posts: 3
My programming program takes a hex file from the folder C: \ proghex
And my projects are in different places and hex files are created inside their folders.
Can I create hex files in two places at once?
In the folder C: \ proghex and as usual in the project folder.
-
Thank's

Offline hongwenjun

  • Multiple posting newcomer
  • *
  • Posts: 15
Code: [Select]
#include <stdio.h>

int main(int argc, char* argv[])
{
    printf("%s\n",argv[1]);
    return 0;
}

Use the source code above, then set the command line parameters as shown below


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2756
Do you really need the hex file in both folder? Or is it enough in one?

If really both are needed, then you have to copy the files. You can do this with two ways:
1) Squirrel scripting
2) Operating system native copy function

Both have to go in the post build step

Project->Build options->Pre/post build steps->Post build
Then you can
1)
Code: [Select]
[[IO.CopyFile(_("$(TARGET_OUTPUT_FILE)"), _("C:\hexprog"), true );]]2)
Code: [Select]
cmd /c xcopy /D /Y PATH\TO\OUTPUT\FILE PATH/TO/NEW/FILE
If you do not need have the hex file in both:
Project->Properties->Build targets->select both targets from the left side->Output file

If you want to use codeblocks to start your programmer and feed the output file directly to the programmer you can use the tools+ plugin to start it directly from codeblocks and feed the outptu file directly

Offline selevo

  • Single posting newcomer
  • *
  • Posts: 3
Thank's
I will test your idea
------
Yes, I need in two places that the files would be automatically created and updated in two folders after build projects without  other action hands  .
I have a dumb program for updating firmware, it contains one button and there is nothing more in it, it can only take a hex file from one place and program the controller.
« Last Edit: June 01, 2020, 09:01:33 am by selevo »