Skip to content

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

Comments

[deleted, thought it was possibly some pre-compiled code related to the trampoline but I don't think so]

EDIT: I spoke too quickly, looking at the disassembly in the sibling comment.

EDIT 2: That disassembly looks like data, TBH.

What does trampoline mean in this context?

Usually just a piece of code to jump to another piece of code with certain necessary register modifications, ie: https://gcc.gnu.org/onlinedocs/gccint/Trampolines.html

A trampoline is a useful pattern in software https://en.m.wikipedia.org/wiki/Trampoline_(computing)

A trampoline in code is something you jump off of - essentially, a redirection snippet. You jump into it and it bounces you somewhere else.

In this case, the use is documented where it's implemented: https://github.com/raspberrypi/pico-bootrom/blob/master/boot... . It's a custom wrapper to call ROM functions. When the ROM function returns, the trampoline executes a debugger breakpoint. This is done so that the debugger can call into ROM easily without needing to set a hardware breakpoint.

if u go up it looks like there is a `debug_trampoline` function. so they are saying the `debug_trampoline_end` is a precompiled version of the `debug_trampoline` one. not sure if this is true or not

It is not. debug_trampoline_end is just a label in this context.

AboutSource Built by g1lg1l

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