Devices are shipped with a default policy, so you can develop and debug your application repeatedly without any knowledge about security or code signing. This is also referred to as Development LCS. In order to create a valid hex file for programming and debugging in this state, we must configure the application

  1. Create a postbuild.bat file in the root directory of the project. The primary purpose of this is to shift the application image from the C-Bus region to the S-Bus region. This is done because the ARM compiler attempts to copy the Load Region to the Execution Region, which is read-only. The bat file contains three separate lines, for example:

    C:\Keil_v5\ARM\ARMCLANG\bin\fromelf --output "Hello_World_Objects/tmp.hex" --i32combined "Hello_World_Objects/Hello_world.elf"

    [path-to-gcc]\bin\arm-none-eabi-objcopy -O ihex "Hello_world_Objects/tmp.hex" "Hello_world_Objects/Hello_world.hex" --change-addresses 0x20000000

    del "Hello_world_Objects\tmp.hex"

    Update the paths and file names to match your configuration.

    Note:

    Copying text from a PDF file may insert additional spaces and/or line breaks.

  2. Create project.ini and project2.ini files in the project root folder. These initialization files provide

    LOAD

    commands that are needed for the application.

  3. Add the following text to the project.ini file and click

    Save

    .

    LOAD $L@L.hex
  4. Add the following text to the

    project2.ini

    file and click

    Save

    .

    LOAD $L@L.elf NOCODE
    g, main

  5. Open the Options for Target dialog, select the

    User

    tab, select the

    After Build/Rebuild Run #1

    check box, and select the

    postbuild.bat

    file:



  6. Switch to the

    Output

    tab and add a ".elf" extension to the file in the

    Name of Executable

    field, and select the

    Create HEX File

    check box:



  7. Switch to the

    Utilities

    tab, select the

    project.ini

    file in the

    Init File

    field:



  8. Switch to the

    Debug

    tab. Make sure that the

    Load Application at Startup

    check box is not checked.

  9. Select the

    project2.ini

    file in the

    Initialization File

    field:



  10. Click

    OK

    to close the Options dialog.

  11. Select

    Project > Build Target

    to build the application and execute post-build commands.

  12. Configure the applicable debugger settings. See

    Miscellaneous notes

    .

  13. To program the device, select

    Flash > Download

    .

  14. To start the debugger, select

    Debug > Start/Stop Debug Session

    .