apache / mynewt-newt

An OS to build, deploy and securely manage billions of devices
https://mynewt.apache.org/
Apache License 2.0
117 stars 96 forks source link

newt mfg create issue with apollo3 MCU #474

Open dbeitel opened 2 years ago

dbeitel commented 2 years ago

Hi, I’ve run into an issue building a manufacturing image and I’m not sure how to work around it. The issue is the apollo3 MCU has a boot rom starting at the beginning of flash (0x0-0xc000). When I generate the manufacturing image, the hex file has entries starting at 0x0 that overlap the boot rom. When I try to write the image to flash, the flash writer fails when writing these entries.

bsp.yml:

bsp.flash_map:
    areas:
        # System areas. Page size is 8kb
        FLASH_AREA_BOOTLOADER:
            device: 0
            offset: 0x0000c000
            size: 32kB
        FLASH_AREA_IMAGE_SCRATCH:
            device: 0
            offset: 0x00014000
            size: 16kB
        FLASH_AREA_IMAGE_0:
            device: 0
            offset: 0x00018000
            size: 384kB
        FLASH_AREA_IMAGE_1:
            device: 0
            offset: 0x00078000
            size: 384kB

        # User areas (internal).
        FLASH_AREA_BOOTROM:
            user_id: 15
            device: 0
            offset: 0x00000000
            size: 48kB

mfg.yml:

mfg.targets:
  -
    name: 'targets/boot_ama3bevb'
    area: FLASH_AREA_BOOTLOADER
    offset: 0
  -
    name: 'targets/mfg_test_ama3bevb'
    area: FLASH_AREA_IMAGE_0
    offset: 0
  -
    name: 'targets/runner_ama3bevb'
    area: FLASH_AREA_IMAGE_1
    offset: 0
  -
    name: 'targets/recovery_ama3bevb'
    area: FLASH_AREA_IMAGE_FACTORY
    offset: 0

mfg.meta:
    # The MMR is placed at the start of the scratch area.
    area: FLASH_AREA_IMAGE_SCRATCH
    offset: 0

Hex output:

:10000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
:10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
:10002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0
:10003000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
:10004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
...
:10BFD000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF71
:10BFE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF61
:10BFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF51
:10C00000F8FF051001C100006DC100006FC1000004
:10C0100071C1000073C1000075C1000077C100004C
:10C020000000000000000000000000009FC10000B0
:10C030007BC1000000000000E5C100002BC2000031
:10C0400081C1000081C1000081C1000081C10000E8
...

The problem is newt writes entries into the image between 0x0-0xc000 (apollo3 boot rom) and the flash tool fails during this write.