Generate Combined Hex File for PSoC 6 MCU Basic Device Firmware Update - KBA227138

Version 3

    Author: WangS_81           Version: **

     

    Question:

    How can I generate a combined hex file merging both app0 and app1 for a basic device firmware update for PSoC® 6 MCU in PSoC Creator™ 4.2?

     

    Answer:

    Follow below steps to generate a combined hex file for a basic device firmware update (take UART as DFU communication method):

     

    1. Copy the post_build_core1.bat file attached with this knowledge base article to CE213903\PSoC6DfuBasicApp0Uart\Shared Files. This bat file is used to copy the generated ELF file of app0 to a more accessible location for later merging.

     

    2. In the Build Settings dialog, add the post-build command line post_build_core1.bat creator ${OutputDir} ${ProjectShortName} for app0 under CM4 ARM GCC 5.4-2016-q2-update à User Commands à Post Build.

    3. Add the following command snippet to the end of the file PSoC6DfuBasicApp1\Shared Files\ post_building_core1.bat. This command line merges the ELF file copied from app0 folder into the hex file generated by app1.

    @rem Merges App0 and App1 into a single hex file for easier programming

    %CY_MCU_ELF_TOOL% -M %OUTPUT_DIR%\%PRJ_NAME%%ELF_EXT% ..\App0%ELF_EXT% --output %OUTPUT_DIR%\%PRJ_NAME%_merged%ELF_EXT% --hex %OUTPUT_DIR%\%PRJ_NAME%.hex

    4. Build  app0 and then app1 in the same sequence to generate the combined hex file.

     

    5. Program the combined hex files generated in step 4 to the CY8CKIT-062-BLE DVK board. After the programming is complete, confirm that the red LED on the kit blinks twice per second, indicating that app1 is running.