How to remap bootloader and application flash area in overlay file

Board :52840dk_52840

SDK: NCS1.7.1

IDE :Visual Studio Code

I remap my bootloader partition in my application .overlay file

as

        &boot_partition{
            reg = <0x000000000 0x00010000>;
        };


        &slot0_partition {
            reg = <0x00010000 0x00063000>;
        };

but I get the this result in zephyr.dts, the beginning of slot0 did NOT change to 0x10000

                    boot_partition: partition@0 {
                        label = "mcuboot";
                        reg = < 0x0 0x10000 >;
                    };
                    slot0_partition: partition@c000 {
                        label = "image-0";
                        reg = < 0x10000 0x63000 >;
                    };

and my mcuboot build result is as following, the bootloader area size was still 48KB


Memory region         Used Size  Region Size  %age Used
           FLASH:       30984 B        48 KB     63.04%
            SRAM:       17760 B       256 KB      6.77%
        IDT_LIST:          0 GB         2 KB      0.00%

It seems like that my bootloader remap is a failure .

my quesion is

1# can I remap bootloader and application flash area in .overlay file

2# how to remap bootloader and application flash area in .overlay file

Parents
  • I use these settings in .conf  filefor my mcuboot building

    CONFIG_LOG=y
    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000

    # The build won't fit on the partition allocated for it without size
    # optimizations.
    CONFIG_SIZE_OPTIMIZATIONS=y

    # Serial
    CONFIG_SERIAL=y
    CONFIG_UART_LINE_CTRL=y

    # MCUBoot serial
    CONFIG_MCUBOOT_SERIAL=y
    CONFIG_BOOT_SERIAL_CDC_ACM=y

    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_BACKEND_RTT=n

    and I got my partitions.yml as following

    app:
    address: 0x10200
    end_address: 0x88000
    region: flash_primary
    size: 0x77e00
    mcuboot:
    address: 0x0
    end_address: 0x10000
    placement:
    before:
    - mcuboot_primary
    region: flash_primary
    size: 0x10000
    mcuboot_pad:
    address: 0x10000
    end_address: 0x10200
    placement:
    align:
    start: 0x1000
    before:
    - mcuboot_primary_app
    region: flash_primary
    size: 0x200
    mcuboot_primary:
    address: 0x10000
    end_address: 0x88000
    orig_span: &id001
    - mcuboot_pad
    - app
    region: flash_primary
    sharers: 0x1
    size: 0x78000
    span: *id001
    mcuboot_primary_app:
    address: 0x10200
    end_address: 0x88000
    orig_span: &id002
    - app
    region: flash_primary
    size: 0x77e00
    span: *id002
    mcuboot_secondary:
    address: 0x88000
    end_address: 0x100000
    placement:
    after:
    - mcuboot_primary
    align:
    start: 0x1000
    region: flash_primary
    share_size:
    - mcuboot_primary
    size: 0x78000
    sram_primary:
    address: 0x20000000
    end_address: 0x20040000
    region: sram_primary
    size: 0x40000

    this is my build result

    [204/204] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       63340 B        64 KB     96.65%
                SRAM:       33440 B       256 KB     12.76%
            IDT_LIST:          0 GB         2 KB      0.00%
    [149/164] Linking C executable zephyr\zephyr_prebuilt.elf

    [156/164] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       20124 B     491008 B      4.10%
                SRAM:        7424 B       256 KB      2.83%
            IDT_LIST:          0 GB         2 KB      0.00%
    [160/164] Generating ../../zephyr/dfu_application.zip
    [162/164] No install step for 'mcuboot_subimage'
    [163/164] Completed 'mcuboot_subimage'
    [164/164] Generating zephyr/merged.hex

    I think I have remap my bootloader flash area successfully

    but when I flash my board with merged.hex and reset my board

    I got these error log :

    [14:33:11.346]收←◆*** Booting Zephyr OS build v2.6.99-ncs1-1-15-g0710acdc35e7  ***
    I: Starting bootloader
    W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?
    W: Cannot upgrade: not a compatible amount of sectors
    E: Unable to find bootable image

    what's the reason fail to boot into application ??

  • Hi,

     

    I'm not able to reproduce this behavior on my end.

    I have a similar partition layout:

    ninja partition_manager_report 
    [1/1] cd /opt/ncs/zephyr/samples/2...amples/281606/build/partitions.yml
      flash_primary (0x100000 - 1024kB): 
    +--------------------------------------------------+
    | 0x0: mcuboot (0x10000 - 64kB)                    |
    +---0x10000: mcuboot_primary (0x78000 - 480kB)-----+
    | 0x10000: mcuboot_pad (0x200 - 512B)              |
    +---0x10200: mcuboot_primary_app (0x77e00 - 479kB)-+
    | 0x10200: app (0x77e00 - 479kB)                   |
    +--------------------------------------------------+
    | 0x88000: mcuboot_secondary (0x78000 - 480kB)     |
    +--------------------------------------------------+
    
      sram_primary (0x40000 - 256kB): 
    +--------------------------------------------+
    | 0x20000000: sram_primary (0x40000 - 256kB) |
    +--------------------------------------------+
    

     

    Here's the sample:

    281606.zip

     

    Could you try this and see if the behavior is still equal on your end?

     

    PS: I see that your zephyr boot banner indicates that you are on a non-tagged version. Could you repeat testing on ncs v1.7.x or ncs v1.8.0?

     

    Kind regards,

    Håkon

  • Hi Håkon

    I still have the same issue using your sample.

    And I am using NCS 1.7.1

    Best regards

    Sky Lu

Reply Children
Related