Skip to content

S32K Startup: stack pointer is initialized twice #371

@jan-bruckner-esr

Description

@jan-bruckner-esr

The stack pointer is initialized twice:

  1. In line 325
  2. In line 352

Additionally, the instruction in line 326 is not necessary. It loads the address of Reset_Handler into r0 but that is not used afterwards.
Seems like an artifact of jumping to Reset_Handler from there.

/* ISR reloction */
ISB
DSB
DMB
ldr r0, =_NVIC_VTOR
ldr r1, =__isr_vector
str r1, [r0]
ldr r0, [r1]
mov sp, r0
ldr r0, [r1, #4]
ISB
DSB
DMB
/* enable fpu */
ldr r0, = _CPACR
ldr r1, [r0]
orr r1, r1, #0x00F00000
str r1, [r0]
/* Init the rest of the registers */
ldr r1,=0
ldr r2,=0
ldr r3,=0
ldr r4,=0
ldr r5,=0
ldr r6,=0
ldr r7,=0
mov r8,r7
mov r9,r7
mov r10,r7
mov r11,r7
mov r12,r7
/* Initialize the stack pointer */
ldr r0,=__StackTop
mov r13,r0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions