Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Add external linkage to start entry point function #4

Closed
wants to merge 1 commit into from

Conversation

gustavonihei
Copy link

This PR intends to extern the symbol for start entry point function, which is necessary for restoring the ESP32-C3 build for MCUboot bootloader (feature = mcu-boot).

Patches here are similar to those previously applied on esp-rs/esp-hal#49 for ESP32-C3 target.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
@bjoernQ
Copy link
Collaborator

bjoernQ commented Mar 1, 2023

I think the function should be at least a naked function since otherwise the compiler will generate the function prologue and epilogue

Maybe I miss something but I also think it's not really necessary - will comment on that esp-hal PR

@gustavonihei
Copy link
Author

I think the function should be at least a naked function since otherwise the compiler will generate the function prologue and epilogue

The compiler won't generate the epilogue for a function that does not return. I checked the assembly and the prologue is also elided, maybe due to compiler inter-procedural optimizations.

Disassembly of section .rwtext:

40380000 <_start>:
40380000:       4081                    li      ra,0
40380002:       4101                    li      sp,0
40380004:       4181                    li      gp,0
40380006:       4201                    li      tp,0
40380008:       4281                    li      t0,0
...

@gustavonihei
Copy link
Author

Closing PR in favor of a simpler alternative solution suggested by @bjoernQ in esp-rs/esp-hal#417 (comment).

@gustavonihei gustavonihei deleted the bugfix/extern_start branch March 1, 2023 10:26
@bjoernQ
Copy link
Collaborator

bjoernQ commented Mar 1, 2023

I think the function should be at least a naked function since otherwise the compiler will generate the function prologue and epilogue

The compiler won't generate the epilogue for a function that does not return. I checked the assembly and the prologue is also elided, maybe due to compiler inter-procedural optimizations.

Disassembly of section .rwtext:

40380000 <_start>:
40380000:       4081                    li      ra,0
40380002:       4101                    li      sp,0
40380004:       4181                    li      gp,0
40380006:       4201                    li      tp,0
40380008:       4281                    li      t0,0
...

Oh, that's interesting!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants