Bootloader tutorial not working with certain targets

Hi Zoltan,

Thanks for the suggestion. I ran the command for mbed-os-blinky_application.bin built with the “application starter” with GCC Command Prompt and it printed the result below. Notably, VMA and LMA of Idx 0 are both 08000000 which would result target.restrict_size of 0.

Idx Name          Size      VMA       LMA       File off  Algn
  0 ER_IROM1      00009a5c  08000000  08000000  00000034  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 RW_IRAM1      00000100  20000198  20000198  00009a90  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 RW_IRAM1      00001fd0  20000298  20000298  00009b90  2**3
                  ALLOC
  3 ARM_LIB_STACK 00000400  20017c00  20017c00  00009b90  2**2
                  ALLOC
  4 .debug_abbrev 0001608d  00000000  00000000  00009b90  2**0
                  CONTENTS, READONLY, DEBUGGING
  5 .debug_frame  0000a848  00000000  00000000  0001fc1d  2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_info   0016568f  00000000  00000000  0002a465  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_line   0005303c  00000000  00000000  0018faf4  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_loc    000384d6  00000000  00000000  001e2b30  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_str    000ea090  00000000  00000000  0021b006  2**0
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_ranges 00008c78  00000000  00000000  00305096  2**0
                  CONTENTS, READONLY, DEBUGGING
 11 .note         00000020  00000000  00000000  003209f4  2**2
                  CONTENTS, READONLY
 12 .comment      00003ea8  00000000  00000000  00320a14  2**0
                  CONTENTS, READONLY

Furthermore, the ROM regions at the beginning of build of the mbed-os-blinky seem to depend on the code in the main.cpp, not the restriction set in mbed_app.json. I don’t know if this is right. The ROM regions printed when building the code you provided are:

Using ROM regions bootloader, application in this build.
Region bootloader: size 0xc000, offset 0x8000000
Region application: size 0x74000, offset 0x800c000

whereas with the main.cpp with the example code they are:

Using ROM regions bootloader, application in this build.
Region bootloader: size 0x20000, offset 0x8000000
Region application: size 0x60000, offset 0x8020000

Have a nice weekend,

Samuli