Skip to content

Comment on Raspberry Pi Pico: What is this code doing in its boot ROM, line 442?parent

Comments

Normally you'd save more than just PC as AAPCS (https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aap...) mandates stack to be aligned to 8 bytes for "public interface" functions. But this is is not a "public" function so it's fine to only save lr here.

"bx lr" is only used on it's own when the function doesn't call another function (altering lr), and doesn't need to save any registers.

If you see pop {lr}; bx lr then that's code that's being compiled to explicitly support Armv4 (e.g. Arm7TDMI)

EDIT: https://gcc.godbolt.org/z/TadnqescT

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.