How do I configure an ARM application to be loaded by a bootloader?

Here is a summary of the steps for modifying an existing working standard (vectors at start of Flash, default linker script, etc.) Ride/GCC/ARM application for use with a bootloader (basically, that means leaving a blank space at the beginning of Flash).

1. Build the application 'normally', in Flash mode using the default linker script.
    Check that several (4 or 5) .ld files are created _in_the_application's_folder_ and identify them using the file dates (and read them, they include comments to explain things).

2. Change the options for using the generated default script to using a "custom linker script":
2.1. Change the "LD Linker" / "Scripts" / "Use Default Script File" option to "No".
2.2. Change the "LD Linker" / "Scripts" / "Script File" option to point to the secondary/main linker script file (typically, "STM32F103_64K_20K_FLASH.ld") generated in your application's folder during step 1.
2.3. Rebuild the application, check that it still works as before. The result of the link by step 2.2. should be identical to the result of step 1 (each and every byte of it).

3. Change the Flash region definition:
3.1. Modify the memory space definitions sub-script (typically, "STM32F103_64K_20K_DEF.ld") generated in your application's folder during step 1.
        For example, to reserve 0x2000 bytes for the bootloader, modify the definition of the Flash region like this:
        FLASH (rx) : ORIGIN = 0x08000000+0x2000, LENGTH = 0x10000-0x2000
        DO NOT modify the files in <Ride>\lib\ARM
        DO NOT modify the files in <Ride>\scripts
        DO NOT add files in <Ride>\scripts
3.2. Build the application.
3.3. Load it using your bootloader and observe it executing. At this point you cannot use it without the bootloader.
3.4. If you need to debug it, or just to program and run it from Ride, you will have to include the hex or elf file of the bootloader as if it was a source file of the application, as shown in the example projects for debugging CircleOS applications.


For more information about linker script management by Ride+RKit_ARM (default, custom, etc.) refer to the GettingStartedARM document.

For more information about linker script syntax and how to modify them, refer to the LD linker documentation.