mcuboot on nRF9160 custom board

I have written simple hello world code on nRF9160 custom board and enables the MCUBoot as bootloader using CONFIG_BOOTLOADER_MCUBOOT=y in prj.conf file.

Also, made some bootloader related configuration at mcuboot.conf file.

I have kept the break point on loader.c file but my program execution is not halting there.

my question is that. How to debug the mcuboot a bootloader code on nRF9160 custom board?

I am using Segger Embedded Studio IDE.

Parents
  • Hi,

    In my hello world application i have added the below prj.conf

    # Bootloader
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_SECURE_BOOT=y
    #CONFIG_BUILD_S1_VARIANT=y
    CONFIG_IMG_MANAGER=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    
    # External Falsh for secondary storage
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    
    CONFIG_PM_EXTERNAL_FLASH=y
    CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="MX25R64"
    CONFIG_PM_EXTERNAL_FLASH_BASE=0x0
    CONFIG_PM_EXTERNAL_FLASH_SIZE=0x800000
    

    mcuboot.conf as below

    # 
    CONFIG_SPI=y
    #CONFIG_SPI_1=y
    CONFIG_SPI_NOR=y
    CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    #CONFIG_SPI_NOR_STACK_WRITE_BUFFER_SIZE=16
    
    CONFIG_MULTITHREADING=y
    CONFIG_BOOT_MAX_IMG_SECTORS=512 
    
    # Enable these for serial recovery
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_LOG_OVERRIDE_LEVEL=4
    CONFIG_PM_EXTERNAL_FLASH=y
    CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="MX25R64"
    CONFIG_PM_EXTERNAL_FLASH_BASE=0x0
    CONFIG_PM_EXTERNAL_FLASH_SIZE=0x800000
    CONFIG_PM_EXTERNAL_FLASH_SUPPORT_LEGACY=y
    
    #secondary image
    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY=0xf0000
    
    #OVERWRITE mode
    CONFIG_BOOT_UPGRADE_ONLY=y
    
    #shared memory area
    #CONFIG_MEASURED_BOOT=y
    
    CONFIG_MAIN_STACK_SIZE=10240
    
    CONFIG_GPIO=y
    
    # Enable regulators
    CONFIG_REGULATOR=y
    
     

    pm_static.yml as below

    mcuboot:
      address: 0x0
      end_address: 0xc000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    EMPTY_0:
      address: 0xC000
      end_address: 0x10000
      placement:
        before:
        - mcuboot_pad
      region: flash_primary
      size: 0x4000
    mcuboot_primary:
      address: 0x10000
      end_address: 0x100000
      orig_span: &id001
      - mcuboot_pad
      - spm
      - app
      region: flash_primary
      sharers: 0x1
      size: 0xF0000
      span: *id001
    mcuboot_primary_app:
      address: 0x10200
      end_address: 0x100000
      orig_span: &id002
      - app
      - spm
      region: flash_primary
      size: 0xEFE00
      span: *id002
    mcuboot_pad:
      address: 0x10000
      end_address: 0x10200
      placement:
        align:
          start: 0x8000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    spm:
      address: 0x10200
      end_address: 0x20200
      inside:
      - mcuboot_primary_app
      placement:
        before:
        - app
      region: flash_primary
      size: 0x10000
    app:
      address: 0x20200
      inside:
      - mcuboot_primary_app
      region: flash_primary
      size: 0xDFE00
    mcuboot_secondary:
      address: 0x0
      device: MX25R64
      end_address: 0xf0000
      placement:
        align:
          start: 0x000
      region: external_flash
      size: 0xf0000
    storage:
      address: 0xf0000
      end_address: 0x800000
      device: MX25R64
      region: external_flash
      size: 0x710000
      

    Thank You,

    MayurKumar

  • Hey Mayur!

    Yes, this is possible. This is what you need to do:

    - Program the sample to the chip

    - Start an Ozone-session, and when you choose an elf file, then choose <sample>/<build folder>/mcuboot/zephyr/zephyr.elf.

    - Then you drag the file /bootloader/mcuboot/boot/bootutil/src/loader.c into the Ozone window.

    - Then choose debug --> start debug session --> Attach to running program

    - Then set a breakpoint in loader.c and press Debug --> reset

    This should work.

    Best regards,

    Elfving

Reply
  • Hey Mayur!

    Yes, this is possible. This is what you need to do:

    - Program the sample to the chip

    - Start an Ozone-session, and when you choose an elf file, then choose <sample>/<build folder>/mcuboot/zephyr/zephyr.elf.

    - Then you drag the file /bootloader/mcuboot/boot/bootutil/src/loader.c into the Ozone window.

    - Then choose debug --> start debug session --> Attach to running program

    - Then set a breakpoint in loader.c and press Debug --> reset

    This should work.

    Best regards,

    Elfving

Children
No Data
Related