Error when building BT mesh DFU OTA Target on Dongle 52840 (struct.error: ushort format requires 0 <= number <= 0xffff)

Dear fellow developers,

I'm working on a project were we're building a sample network containing hundreds of nRF 52840 dongles connected together using BT mesh.

The very first step is over, we managed to build the project for dongle and to verify its practical feasibility. The next steps are to build a DFU OTA Target and Distributor (both available experimentally only for nRF 52840 DK) so to have the mesh network update itself (via Distributor and Android app).

As per the case of the mesh light (ref: link), I'm trying to statically modify the partitions of the dongle since trying to build it the usual way produces an error ("section 'text' will not fit in region FLASH") and in order for it to include the bootloader on top.

So, I've modified the partitions trying to merge build_dk/partitions.yml and the partition sample I have previously done in the mesh light example. The static partitions were added to the project folder in the file pm_static_nrf52840dongle_nrf52840.yml and are the following:

nrf5_mbr:
  address: 0x0
  size: 0x1000
  placement:
    after: start
mcuboot:
  address: 0x1000
  size: 0xf000
  placement:
    after: [nrf5_mbr]
mcuboot_primary:
  address: 0x10000
  size: 0x70000
  span: [mcuboot_pad, mcuboot_primary_app]
mcuboot_pad:
  address: 0x10000
  size: 0x10000
  placement:
    after: [mcuboot]
mcuboot_primary_app:
  address: 0x20000
  size: 0x60000
  span: [app]
mcuboot_secondary:
  address: 0x80000
  size: 0x70000
  placement: 
    after: [mcuboot_primary]
settings_storage:
  address: 0xf0000
  size: 0x8000
  placement:
    after: [mcuboot_secondary]
legacy_bootloader_storage:
  address: 0xf8000
  size: 0x8000  
  placement:
    after: [settings_storage]
sram_primary:
  address: 0x20000000
  end_address: 0x20040000
  size: 0x40000
  region: sram_primary

Now, the overflowing problem seems to be solved, the partitions do work (as there is only one gap for the dynamically defined 'app' partition) and the build does compile right until the very end, where it displays this error:

I've tried repartitioning using different sizes but nothing seems to work. Any idea how to avoid this?

(secondary question: despite what's written in the documentation, is it possible to define the 'app' partition statically?)

Thank you in advance,

Alessandro

Parents
  • Apparently, the mcuboot_pad partition is not just padding, but it does contain the header. Expressionless

    Observing the call to imgtool.py the header size is 0x10000, exactly the same as the padding partition. Setting the partition to 0x8000 and the mcuboot_primary_app to 0x68000 solves the problem.

    The merged.hex file is now generated and it is possible to flash it to the dongle through the Programmer app. Once this is done, though, the dongle does not show up in unprovisioned proxy nodes in the nRF Mesh app.

    Any suggestions?

    (Still, the question about statically partition the app is open, if anyone has any idea)

  • Solved this problem as well.

    Turns out, the way i edited the partition was incorrect as the legacy_bootloader_storage partition requires more space than what was previously allocated. You can verify this buy simply blinking a light at startup for 5/10 times: it will keep blinking on and on as the chip reboots itself (probably) due to an internal ROM space error.

    The new code included in pm_static_nrf52840dongle_nrf52840.yml is:

    nrf5_mbr:
      address: 0x0
      size: 0x1000
      placement:
        after: start
    mcuboot:
      address: 0x1000
      size: 0xf000
      placement:
        after: [nrf5_mbr]
    mcuboot_primary:
      address: 0x10000
      size: 0x60000
      span: [mcuboot_pad, mcuboot_primary_app]
    mcuboot_pad:
      address: 0x10000
      size: 0x1000
      placement:
        after: [mcuboot]
    mcuboot_primary_app:
      address: 0x11000
      size: 0x5F000
      span: [app]
    mcuboot_secondary:
      address: 0x70000
      size: 0x60000
      placement:
        after: [mcuboot_primary]
    settings_storage:
      address: 0xd0000
      size: 0x18000
      placement:
        after: [mcuboot_secondary]
    legacy_bootloader_storage:
      address: 0xe8000
      size: 0x18000  
      placement:
        after: [settings_storage]
    sram_primary:
      address: 0x20000000
      end_address: 0x20040000
      size: 0x40000
      region: sram_primary

    Now the application fully loads and shows up in the nRF mesh app.

  • Sorry I wasn't able to assist in time.

    But glad to hear you was able to work it out.

    Closing the ticket. Feel free to open a new ticket if you have any questions in the future.

    Br,
    Joakim

Reply Children
  • Hei Joakim, hyggelig å møte deg.

    About the timing, yes, I'm sorry too because right now I'm actually sort of a herald trying to promote Nordic as the manufacturing company to switch to in the near future to the firm I'm working for. And they see that I'm posting here as well.

    About closing the ticket: please don't. I would like to keep this post updated so to help other people that will face the very same problems that I'm facing right now in working with the 52840 Dongle and this specific protocol (DFU over BT Mesh) and that, hopefully, might be of help for you guys too.

    God natt,

    Alessandro

  • Hi.

    Thanks for your concern. I'll close the ticket, but the information will still be available for others (and us) to see.

    It can be re-opened at a later point in time.

    Br,
    Joakim

Related