After creating an application, make a few changes before attempting to build it:

  1. Edit the

    Makefile

    located in the project folder as follows:

    APPNAME=Hello_World 
    # Use the same App_Name used to create the project

    TOOLCHAIN=IAR

  2. Open a modus-shell terminal from the ModusToolbox™ install directory, navigate to the IAR project directory, and run this command:

    make build -j8

  3. Copy the post-build command from the log. For example:

    ../mtb_shared/core-make/release-v3.6.1/make/scripts/python.bash C:/examples/psoc64-iar/Hello_World/bsps/TARGET_APP_CY8CPROTO-064S1-SB/psoc64_postbuild.py --core CM4 --secure-boot-stage single --policy policy_single_CM0_CM4 --target cyb06xx7 --toolchain-path C:/Users/follettcj/Infineon/Tools/mtb-gcc-arm-eabi/11.3.1/gcc --toolchain IAR --build-dir C:/examples/psoc64-iar/Hello_World/build/APP_CY8CPROTO-064S1-SB/Debug --app-name Hello_World --cm0-app-path ../mtb_shared/cat1cm0p/release-v1.8.0/COMPONENT_CAT1A/COMPONENT_CM0P_SECURE --cm0-app-name psoc6_01_cm0p_secure

  4. Paste the command into an appropriate editor, and make the following edits:

    • Update the path to python

    • Add path to the policy file, for example:

      --policy-path ./policy

    • Change

      --build-dir

      to

      Debug/Exe

    • Change

      --app-name

      to your project in IAR name, if needed

    Example of command after edit:

    [path to python.exe] C:/examples/psoc64-iar/Hello_World/bsps/TARGET_APP_CY8CPROTO-064S1-SB/psoc64_postbuild.py --core CM4 --secure-boot-stage single --policy-path ./policy --policy policy_single_CM0_CM4 --target cyb06xx7 --toolchain-path C:/Users/follettcj/Infineon/Tools/mtb-gcc-arm-eabi/11.3.1/gcc --toolchain IAR --build-dir Debug/Exe --app-name Hello_World --cm0-app-path ../mtb_shared/cat1cm0p/release-v1.8.0/COMPONENT_CAT1A/COMPONENT_CM0P_SECURE --cm0-app-name psoc6_01_cm0p_secure

  5. Copy the edited command.

  6. In IAR embedded Workbench, open the Options dialog, go to

    Build Actions

    , and click

    New

    :


    ../figures/image16.png

  7. On the New Build Action dialog, paste the edited command in the

    Command line

    field, select "Run after linking" in the

    Build order

    field, and click

    OK

    :


    ../figures/image17.png

  8. Click

    OK

    to close the dialog.


    ../figures/image18.png

  9. Switch to

    Linker > Output

    and change the file extension from ".out" to ".elf" in

    Output filename

    field:


    ../figures/image15.png

  10. Click

    OK

    to close the dialog.

  11. On the IAR main menu, select

    Project > Make

    to build the application.