Is it possible to use HEW to generate multiple .mot files when select Build->Build All


In one of our product, we use R8C23 MCU. Renesas High-Performace Embedded Workshop and M16C Series, R8C Family C Compiler V.5.45 is used as the development tool. The executable file generated is .mot file.

Now we plan to use one base line of code to support multiple versions of hardware. Since the hardware differences are minor, I want to find a way to generate multiple .mot files (executable files), one for each version of hardware, when select Build->Build All using HEW development environment. Is it possible? If yes, how should I set "Renesas M16C Standard Toolchain"?

Basically, I can add some macro at the code, like:

#ifdef HARDWARE_1

  /* do hardware_1 specific actions */


#ifdef HARDWARE_2

/* do hardware_2 specific actions */


#ifdef HARDWARE_3

/* do hardware_3 specific actions */


But I don't know how can I set up the HEW build environment to be able to build three executable files (e.g. hw_1.mot, hw_2.mot, hw_3.mot) upon above macros.

  • Hi Karen,

    The way I have seen it done:

    Create 3 build configurations (such as HW_1, HW_2 and HW_3). 

    Each configuration sets the appropriate define you mentioned above (HW_1 sets HARDWARE_1, etc.) in the BUILD "defines" window.

    Each one should have a different output file name (hw_1.mot, hw_2.mot, hw_3.mot) in the Linker window.

    During Debug, the user can select the configuration they are testing and build manually to debug.

    To just build all 3 automatically, use a batch file with 6 commands







    When you want to build all three, run the Batch file from the command window instead of clicking the build button (by the way if a long build you can go for a coffee at this point).

    You can add other command like a CLEAN if you want to force an entire rebuild from scratch, BUILD_ALL instead of BUILD, etc..

    Been a while since I did/saw this, but still should work.  Hopfully I didn't miss anything in the description.

    Hope this helps.



  • Just to add to kevinpkings reply. It's as he said :

    • Create multiple build configurations based on the one you want.
    • Go to "Renesas M16C Standard Toolchain" and for each build configuration add the specific definition(s) (HW_1, HW_2, HW_3) to 'C' tab -> Show Entries For : Defines
    • Use Build->Build All or Build -> Build Multiple to build the required build configurations.
    • You can also define a custom placeholder, say ${MOTFILEDIR} via Setup->Customise->Place Holder and then for each build configuration go to the 'LMC'  tab -> Output file name and change the base path to the new custom place holder. All generated .mot files will then be placed in this folder with the specified name.

    One complication of this is that you then have to manually maintain all build configuration settings if any need changing. See