cancel
Showing results for 
Search instead for 
Did you mean: 

assembly code analysis

Can anyone comment on the prologue and epilogue of following CM7 code, particularly the content of r7 when the routine returns?

 

{
   0:	b480      	push	{r7}
   2:	af00      	add	r7, sp, #0

    if ((ANADIG_MISC->MISC_DIFPROG & ANADIG_MISC_MISC_DIFPROG_CHIPID(0x10U)) != 0U)
   4:	4b0b      	ldr	r3, [pc, #44]	@ (34 <RamBased_ROM_API_Init+0x34>)
   6:	f8d3 3800 	ldr.w	r3, [r3, #2048]	@ 0x800
   a:	f003 0310 	and.w	r3, r3, #16
   e:	2b00      	cmp	r3, #0
  10:	d005      	beq.n	1e <RamBased_ROM_API_Init+0x1e>
    {
        g_bootloaderTree = ((bootloader_api_entry_t *)*(uint32_t *)0x0021001cU);
  12:	4b09      	ldr	r3, [pc, #36]	@ (38 <RamBased_ROM_API_Init+0x38>)
  14:	681b      	ldr	r3, [r3, #0]
  16:	461a      	mov	r2, r3
  18:	4b08      	ldr	r3, [pc, #32]	@ (3c <RamBased_ROM_API_Init+0x3c>)
  1a:	601a      	str	r2, [r3, #0]
    }
    else
    {
        g_bootloaderTree = ((bootloader_api_entry_t *)*(uint32_t *)0x0020001cU);
    }
}
  1c:	e004      	b.n	28 <RamBased_ROM_API_Init+0x28>
        g_bootloaderTree = ((bootloader_api_entry_t *)*(uint32_t *)0x0020001cU);
  1e:	4b08      	ldr	r3, [pc, #32]	@ (40 <RamBased_ROM_API_Init+0x40>)
  20:	681b      	ldr	r3, [r3, #0]
  22:	461a      	mov	r2, r3
  24:	4b05      	ldr	r3, [pc, #20]	@ (3c <RamBased_ROM_API_Init+0x3c>)
  26:	601a      	str	r2, [r3, #0]
}

  28:	bf00      	nop
  2a:	46bd      	mov	sp, r7
  2c:	f85d 7b04 	ldr.w	r7, [sp], #4
  30:	4770      	bx	lr
  32:	bf00      	nop

  34:	40c84000 	.word	0x40c84000
  38:	0021001c 	.word	0x0021001c
  3c:	80981070 	.word	0x80981070
  40:	0020001c 	.word	0x0020001c

 

Thanks very much!

0 REPLIES 0