[quote author=dsbros link=msg=3727590 date=1526015656
Is it possible to edit source code of arduino IDE such that after verify button is pressed and hex file is generated, the .bat file execute at the end of compilation.
[/quote]
Yes. Here are the build instructions for the Arduino IDE source code:
It might actually make more sense to do the modification on the arduino-builder tool the Arduino IDE uses to run the verify process (the IDE code is intended to be only for the GUI):
But that's all a bit of a hack. The Arduino IDE actually provides a way to do what you want to do without modifying the source code and building executables. I will proceed to explain:
The first thing you need to understand is that each Tools > Board selection has a hardware package that contains, among other things, compilation and upload recipes the Arduino IDE uses to determine exactly which actions should be taken during verify or upload. This system of hardware packages is what allows 3rd parties to easily add support for other hardware without needing to supply a customized IDE.
This technique involves adding an extra recipe to the hardware package, thus you would need to do so for every hardware package of a board you want the modification to apply to. It may be that you are only using one hardware package. Many Arduino users only use the Arduino AVR Boards of the Uno, Nano, Leonardo, Mega boards.
The easiest way to find the active hardware package location is as follows:
- Select a board from the hardware package from the Tools > Board menu
- File > Examples > SPI > BarometricPressureSensor
- Sketch > Show Sketch Folder
- Move up folder levels until you reach the one that contains platform.txt
platform.txt contains the compilation recipes but Arduino has provided a method by which you can add additional compilation recipes without messing around in platform.txt by instead defining them in a file you create named platform.local.txt in the same folder. This makes it easier to apply your modification to multiple packages or when you update to a new package (or IDE in the case of Arduino AVR Boards) version.
A number of hook recipes may be defined. These hooks are run at various points through the verification process: