Forum: ARM programming with GCC/GNU tools Is ENTRY(_Reset) redundant here?

von Splee S. (Company: ss) (splee)

Rate this post
0 useful
not useful
I read a code somewhere:

.section INTERRUPT_VECTOR, "x"
.global _Reset
    B Reset_Handler /* Reset */

    LDR sp, =stack_top

    . = 0x0;
    .text: {
    startup.o (INTERRUPT_VECTOR)

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"?

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.

von Markus F. (mfro)

Rate this post
0 useful
not useful
Splee S. wrote:
> I understand that ENTRY(_Reset) set the program entry point to _Reset.

Basically the only thing ENTRY(...) does is to place the information 
about this entry point into the header of your executable, provided such 
thing (header) is available and can hold such information (which is the 
case for ELF, for example).

This will only have any effect if you have a loader (i.e., an ELF 
loader, in our case) that will use this information at runtime. In 
embedded coding, more often than not you won't have such luxury, i.e. 
there isn't any header since you basically convert your ELF file into a 
flat binary during the flash process.

Bottom line: in most use cases, the ENTRY() statement is basically 
useless for embedded development.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.