Is ENTRY(_Reset) necessary in this case?

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I read a code somewhere:

startup.s:

.section INTERRUPT_VECTOR, "x"
.global _Reset
_Reset:
    B Reset_Handler /* Reset */
    B.
    ...
    
Reset_Handler:
    LDR sp, =stack_top
    ...

test.ld:

ENTRY(_Reset)
SECTIONS
{
    . = 0x0;
    .text: {
    startup.o (INTERRUPT_VECTOR)
    *(.text)
    }
    ...
}

 

I understand that ENTRY(_Reset) set the program entry point to _Reset.

Q1. What if .text does not start from 0x0? Will the first instruction to be executed still be "B Reset_Handler"?

ENTRY(_Reset)
SECTIONS
{
    . = 0x20; /* Let's say this is not 0x0 */
    .text: {
    startup.o (INTERRUPT_VECTOR)
    *(.text)
    }
    ...
}

Q2. In the original test.ld, is ENTRY(_Reset) still necessary, or is it redundant? Since we already set startup.o (INTERRUPT_VECTOR) to start from 0x0 already.