How to add own output file (makefile target) to a project?

e2studio 7.3.0 + SSP 1.6.0, S5D5/D9

Our project creates .srec flash output standard way. I'd like to add a command which processes .srec and creates new output based on it (SBM mastering tool creating .ssrec + .upk files). Is it possible somewhat?

Post-build step isn't a way because it is called before creating flash. Currently I just extended flash build command like this:

${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} & $(SBMROOT)\evaluation\bin\mastering first "${ProjName}.txt" v1 65535

but it isn't the right way as there is no make dependency and no cleaning. Actually, make doesn't even know .ssrec and .upk files exist. Currently the make looks like:

Application.srec: Application.elf
    @echo 'Invoking: GNU ARM Cross Create Flash Image'
    arm-none-eabi-objcopy -O srec "Application.elf"  "Application.srec" & $(SBMROOT)\evaluation\bin\mastering first "Application.txt" v1 65535
    @echo 'Finished building: $@'
    @echo ' '

and I'd like to have:

Application.srec: Application.elf
    @echo 'Invoking: GNU ARM Cross Create Flash Image'
    arm-none-eabi-objcopy -O srec "Application.elf"  "Application.srec"
    @echo 'Finished building: $@'
    @echo ' '

 Application.ssrec: Application.srec
    @echo 'Mastering'
    $(SBMROOT)\evaluation\bin\mastering first "Application.txt" v1 65535
    @echo 'Finished building: $@'
    @echo ' '

  • Hello, Michal.


    If you would like to use your own makefile, just turn off automatic generation.
    Open project property dialog and click on "C/C++ Build" category in the left paine.
    Then turn off "Generate Makefiles automatically" checkbox in the right paine.
    You can edit makefile as you wish.

  • In reply to Okra:

    Hi Okra,

    I'm afraid it is an overkill in this case. I'm not only one working on this project and it could create complications for coworkers. This part is mentioned to make their life easier, not harder :)

    But looking at makefile I noticed it includes some non-existent files:

    -include ../makefile.init
    -include ../makefile.targets

    Maybe I could utilized it somewhat?

    Michal
  • In reply to Michal:

    You could add a custom builder to the project in e2studio. In the properties of the project select builders :-

    and add a new builder. The builders will be called in the order they are listed.

  • In reply to Jeremy:

    Well, it also seems too "heavy". All I need is one build target/step and for single build configuration only. Anyway, it is interesting idea and can be useful in the future. Thanks for it.

    Michal
  • In reply to Michal:

    > But looking at makefile I noticed it includes some non-existent files:
    >
    > -include ../makefile.init
    > -include ../makefile.targets
    The "-include" doesn't warn even files are not found while "include" warns it.

    See https://www.gnu.org/software/make/manual/html_node/Include.html