You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Christopher Collins <ch...@runtime.io> on 2017/09/18 20:46:38 UTC

Re: How to use a single image setup?

Hi Alfred,

On Mon, Sep 18, 2017 at 06:26:32PM +0200, Alfred Schilken wrote:
> The mynewt documentaion says it supports also a single image setup without a bootloader.
> 
> I would like to use more flash in apps on calliope or microbit but without the complication of split images.
> 
> How can I do that?
> 
> Can I still use a flash-map like this:
> 
> bsp.flash_map:
>     areas:
>         # User areas.
>         FLASH_AREA_NFFS:
>             user_id: 0
>             device: 0
>             offset: 0x00037000
>             size: 32kB
>         FLASH_AREA_FCB_CONF:
>             user_id: 1
>             device: 0
>             offset: 0x0003f000
>             size: 2kB
>         FLASH_AREA_FCB_LOG:
>             user_id: 3
>             device: 0
>             offset: 0x0003f800
>             size: 2kB

Yes, that portion of the flash map looks good.  Unfortunately, I don't
believe there is any documentation for the single-image setup, so here
are some (untested) thoughts on how you should proceed:

1. Remove the `FLASH_AREA_BOOTLOADER`, `FLASH_AREA_IMAGE_1`, and
`FLASH_AREA_IMAGE_SCRATCH` areas from your BSP's flash map.

2. Adjust the offset of the `FLASH_AREA_IMAGE_0` area to 0, and increase
its size such that it fills the gaps you just created in step 1.

3. Fix up the BSP linker script.  Copy the normal linker script and
modify its `FLASH` memory region so that it matches the
`FLASH_AREA_IMAGE_0` flash area (set `ORIGIN` to 0; set `LENGTH` to the
size of the flash area).

That should be it.  You might run into issues if some of your target's
dependencies expect all these flash areas to exist.  For example, you
will have to ensure you aren't pulling in `mgmt/imgmgr`.

Chris

Re: How to use a single image setup?

Posted by Alfred Schilken <al...@schilken.de>.
Hi Chris,

thank you for your quick answer.

It didn’t quite work with your proposed changes
but you sent me at the right direction.
And I was not sure whether I have to change any vectors or such stuff.

I fake the app as a boot loader with the following changes,
and that works fine for me.
Now I have plenty of flash and can try out the NFFS :-)

Thanks  a lot
Regards
Alfred


==== hw/bsp/calliope_mini_single_image/bsp.yml ===> I moved FLASH_AREA_IMAGE_0 and _1  behind the flash limit to avoid missing defines
…
...
bsp.flash_map:
    areas:
        # System areas.
        FLASH_AREA_BOOTLOADER:
            device: 0
            offset: 0x00000000
            size: 220kB

        # User areas.
        FLASH_AREA_NFFS:
            user_id: 0
            device: 0
            offset: 0x00037000
            size: 32kB
        FLASH_AREA_REBOOT_LOG:
            user_id: 1
            device: 0
            offset: 0x0003f000
            size: 1kB
        FLASH_AREA_FCB_CONF:
            user_id: 2
            device: 0
            offset: 0x0003f400
            size: 1kB
        FLASH_AREA_FCB_LOG:
            user_id: 3
            device: 0
            offset: 0x0003f800
            size: 2kB

        FLASH_AREA_IMAGE_0:
            device: 0
            offset: 0x00040000
            size: 2kB
        FLASH_AREA_IMAGE_1:
            device: 0
            offset: 0x00040800
            size: 2kB



==== nrf51xxac.ld ======->  no header 

MEMORY
{
  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x37000
  RAM (rwx)  : ORIGIN = 0x20000000, LENGTH = 0x4000
}

/* This linker script is used for images and thus contains an image header */
_imghdr_size = 0x00;



In the syscfg.yml of the target I fake this is a boot loader,
so I can use the newt load <target> to install it on a device.  

=== targets/mydrivertest_single_image/syscfg.yml ===

syscfg.defs:
    BOOT_LOADER:
        description: 'Set to indicate that this app is a bootloader.'
        value: 1



> Am 18.09.2017 um 22:46 schrieb Christopher Collins <ch...@runtime.io>:
> 
> Hi Alfred,
> 
> On Mon, Sep 18, 2017 at 06:26:32PM +0200, Alfred Schilken wrote:
>> The mynewt documentaion says it supports also a single image setup without a bootloader.
>> 
>> I would like to use more flash in apps on calliope or microbit but without the complication of split images.
>> 
>> How can I do that?
>> 
>> Can I still use a flash-map like this:
>> 
>> bsp.flash_map:
>>    areas:
>>        # User areas.
>>        FLASH_AREA_NFFS:
>>            user_id: 0
>>            device: 0
>>            offset: 0x00037000
>>            size: 32kB
>>        FLASH_AREA_FCB_CONF:
>>            user_id: 1
>>            device: 0
>>            offset: 0x0003f000
>>            size: 2kB
>>        FLASH_AREA_FCB_LOG:
>>            user_id: 3
>>            device: 0
>>            offset: 0x0003f800
>>            size: 2kB
> 
> Yes, that portion of the flash map looks good.  Unfortunately, I don't
> believe there is any documentation for the single-image setup, so here
> are some (untested) thoughts on how you should proceed:
> 
> 1. Remove the `FLASH_AREA_BOOTLOADER`, `FLASH_AREA_IMAGE_1`, and
> `FLASH_AREA_IMAGE_SCRATCH` areas from your BSP's flash map.
> 
> 2. Adjust the offset of the `FLASH_AREA_IMAGE_0` area to 0, and increase
> its size such that it fills the gaps you just created in step 1.
> 
> 3. Fix up the BSP linker script.  Copy the normal linker script and
> modify its `FLASH` memory region so that it matches the
> `FLASH_AREA_IMAGE_0` flash area (set `ORIGIN` to 0; set `LENGTH` to the
> size of the flash area).
> 
> That should be it.  You might run into issues if some of your target's
> dependencies expect all these flash areas to exist.  For example, you
> will have to ensure you aren't pulling in `mgmt/imgmgr`.
> 
> Chris