3

I'm trying to understand this assembly from a bare-metal project I've cloned from GitHub.

.section .text._start

_start:
    // Infinitely wait for events (aka "park the core").
.L_parking_loop:
    wfe
    b   .L_parking_loop

.size   _start, . - _start
.type   _start, function
.global _start

I'm stuck on the first line. None of the documentation I've found, so far, explains the presence of the _start label at the end of the .section directive. e.g. .section. And most examples I've found just have .section .text. What is the function of the 'extra' ._start?

4
  • 6
    .text._start is the section name. Often linker scripts will place something like this in a specific place like the beginning of an output section so that this code is output first before anything else. I would check if there is a linker script file with the project. By convention linker scripts usually have an .ld extension (but not required). I would bet you'll find reference to this section in there. Commented Jan 12 at 18:41
  • 1
    @MichaelPetch you are right. I'm going through file-by-file and thought the boot loader assembly was the logical place to start so I hadn't done the .ld file yet. It contains KEEP(*(.text._start)) in a .text section. If you want to submit it as an answer, I'll mark it so, Commented Jan 13 at 18:51
  • The 'wart' on the section name allows special treatment in full text cases, but will allow wild card match (such as .text*) in other cases. For instance, marking the section as 'allocated' and 'read-only' might use the wild card. Others might be .text.irq and .data.mmu, etc. They are 'text' or 'data', but require special positioning. I think purpose is better than .ld as a wart. Commented Jan 13 at 19:01
  • 1
    Please feel free to answer your own question! Commented Jan 13 at 19:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.