RE: Custom boot loader

2018-11-20 Thread Jeff Belz
Chris:

After further investigation into the mynewt bootloader, it actually has what I 
need.   I'm trying to test swapping images, but ran into an issue.  I can't 
seem to load an image into slot 2.   Here is what I want to do

1) Make an image and load it into slot 1(this would have the pending bit set)
2) Change my code (in my case the color of an LED) and make a new image
3) Load new image into slot 2
4) Verify images swap

Jeff
-Original Message-
From: Christopher Collins  
Sent: Tuesday, November 20, 2018 11:53 AM
To: dev@mynewt.apache.org
Subject: Re: Custom boot loader

Hi Jeff,

On Tue, Nov 20, 2018 at 04:12:54PM +, Jeff Belz wrote:
> All:
> 
> I have to use a custom boot loader for my application.  Has anyone 
> done this before and if so, what are the tricks to doing this?
> 
> I'm running a stm32f412.  I've got the application running on 0x802
>    and the mynewt loader is at 0x800.  Looking to bypass the
> mynewt loader, and use mine instead. My bootloader works for my
> other non-mynewt application, so I'm looking for possibility why it's
> not working now.I'm thinking it's the naming of the entry points,
> but not sure of the newt OS needs something special it look for in 
> order to run the application.

If I understand, you want to replace the Mynewt boot loader with a custom one 
(as opposed to using two boot loaders).  Is that right?

That should be fairly straightforward.  The interface between boot loader and 
application is very simple.  In particular, both components just have to agree 
on the application starting address.  When the boot loader is done doing 
whatever it is meant to do, it simply jumps to the application starting 
address.  Entry point names don't matter; these are discarded during the build 
process.

The specific address to jump to is:
slot-0-offset + image-header-size + start-word

Using the default stm32f412 BSP definition, this would be:
0x802 + 32 + 4 = 0x8020024

(It probably doesn't make sense to use the 32-byte Mynewt image header at all 
with your custom boot loader, but that is a separate issue.)

Chris


Re: Custom boot loader

2018-11-20 Thread Christopher Collins
Hi Jeff,

On Tue, Nov 20, 2018 at 04:12:54PM +, Jeff Belz wrote:
> All:
> 
> I have to use a custom boot loader for my application.  Has anyone
> done this before and if so, what are the tricks to doing this?
> 
> I'm running a stm32f412.  I've got the application running on 0x802
>    and the mynewt loader is at 0x800.  Looking to bypass the
> mynewt loader, and use mine instead. My bootloader works for my
> other non-mynewt application, so I'm looking for possibility why it's
> not working now.I'm thinking it's the naming of the entry points,
> but not sure of the newt OS needs something special it look for in
> order to run the application.

If I understand, you want to replace the Mynewt boot loader with a
custom one (as opposed to using two boot loaders).  Is that right?

That should be fairly straightforward.  The interface between boot
loader and application is very simple.  In particular, both components
just have to agree on the application starting address.  When the boot
loader is done doing whatever it is meant to do, it simply jumps to the
application starting address.  Entry point names don't matter; these are
discarded during the build process.

The specific address to jump to is:
slot-0-offset + image-header-size + start-word

Using the default stm32f412 BSP definition, this would be:
0x802 + 32 + 4 = 0x8020024

(It probably doesn't make sense to use the 32-byte Mynewt image header
at all with your custom boot loader, but that is a separate issue.)

Chris