4 ms·
For folks not into embedded development, semihosting is sort of like remote debugging. The application runs on the microcontroller, and the output is displayed
by slau 3y ago
For folks not into embedded development, semihosting is sort of like remote debugging.
The application runs on the microcontroller, and the output is displayed in your IDE/terminal. Depending on the capabilities of the microcontroller and its development environment, value interpolation might not be fully operational, and step by step debugging can go from fully supported to barely able to support breakpoints.
- MrBuddyCasino 3y agoSemihosting is afaik an ARM specific term. The advantage over UART & JTAG is performance I think, printing text is usually blocking & slow, while semihosting is using a ring-buffer I think?
- zwirbl 3y agoThe advantage is ease of use, semihosting is rather slow and has a big impact on system behaviour, as it uses a breakpoint and r0 to transfer a datapoint. It is definitely slower than SWO or RTT, which transfers data over SWD. You can find a detailed description here https://interrupt.memfault.com/blog/arm-semihosting https://interrupt.memfault.com/blog/arm-semihosting
- MrBuddyCasino 3y agoThanks for the correction, I might have confused it with the Instrumentation Trace Macrocell.
- pjerem 3y agoThat’s what I guessed from the article, especially when I read that it only works with breakpoints but in this case is there a reason to not call this "debug mode" ? Because it sounds confusing. Or maybe there are other usages than just debugging ?
- rcxdude 3y agoIt is basically a debugging feature: giving you printf support through the JTAG connection instead of needing a dedicated UART or something like that. You can also do some stuff like read/write files on the host as well, but again this is basically only useful for debugging.
- pm215 3y ago"Semihosting" is a very old term for this ABI (it dates back to at least the late 1990s in a bit of Arm documentation I found, and might well be earlier). It's mostly I think a name coined when looking at it from the point of view of "what is the C library this guest program linked with using to do stuff": * hosted == we're running on a real OS, and printf etc become system calls to that OS * freestanding == this is a bare metal program (perhaps it is itself an OS kernel) and much of the C library facilities are simply unavailable * semihosted == an in-between position, similar to freestanding but with printf and some other facilities talking over a debug protocol to a connected development system, so you get more of the conveniences of a hosted C library during the development process (the first two are C standard terminology.) The use of the bkpt insn is also fairly new, being specific to M-profile (which is the device the blog post author happens to be using). The original 32-bit Arm version uses SVC (the system call instruction). Either way, use of the instruction is caught (by a debug ROM on the guest, or by a JTAG debugger, or by an emulator/software model) to perform the necessary operations, in a flow that is separate from use of bkpt as a true breakpoint). More recently some other architectures have borrowed the "semihosting" term to refer to the equivalent ABI they provide.
- pjerem 3y agoThank you !