Thanks Lwazi and Peter. By examining the data in the NuttX binary I have tentatively concluded that the binary, as stored as an MCUboot signed bootable image:

 * Has the 32 byte MCUboot header. This contains the address in RAM
   that the entire image in the flash slot, minus the 32 byte header,
   should be copied to
 * A further 32 bytes, that are perhaps a NuttX or gnu header or
   something, but I can't track done what is is specifically. Don't
   like loose ends, but hey ho
 * 4 byte reset handler address
 * 4 byte stack pointer value as appropriate for the reset handler
 * The address that I saw, 24 bytes in (i.e. 8 bytes after the reset
   handler address) is the address that the reset handler will finally
   jump to, after whatever it needs to do, I think? My debugger says
   this is the "Entry point"?
 * The NuttX Binary itself (i.e. pre MCUboot header stuff) does not
   include the "load address" so my debugger must get this from the
   loader script or map file etc.

For my binary:

 * MCUboot load address is 0x20008000. This matches the gcc loader script.
 * Reset handler address is 0x200080e0
 * Stack value is 0x20008240
 * The "entry point" is 0x20008040

I can get my NuttX binary to run by either:

 * setting the stack value to 0 and running from 0x20008000 - but not
   0x20008040. Or
 * setting the stack value to 0x200082e0 and running from 0x200080c0

I still admit to being confused and hate not 100% "knowing" what is going on.

If anyone can aid my learning here it would be great, but I'll go with:

 * Copying the image to the address in the MCUboot header
 * Setting stack value and reset address to the first two bytes after
   the 32 bytes of unknown NuttX/gnu binary header.

FYI, I have also been in dialogue with Microchip tech support who are helpful and willing, but I've not got the definitive from them as yet. I will update them with my current thinking and see what they say!

On 11/02/2025 23:58, Peter Barada wrote:
Tim,

Common across bulk of ARM processors, the vector table starting at address 0x0 contains the 32-bit value of the stack pointer, address 0x4 contains the reset vector (i.e. where to start execution in supervisor state) and then the exception and IRQ vectors.

On 12/02/2025 03:50, Lwazi Dube wrote:
On Tue, 11 Feb 2025 at 18:59, Peter Barada<peter.bar...@gmail.com> wrote:

Tim,

Common across bulk of ARM processors, the vector table starting at
address 0x0 contains the 32-bit value of the stack pointer, address 0x4
contains the reset vector (i.e. where to start execution in supervisor
state) and then the exception and IRQ vectors.

Only for cortex-m. Not true for armv7a and older.

Reply via email to