Semihosting as an additional debug mechanism Estimated reading time: Less than a minute Sections in this page SYS_WRITE0References QEMU implements some semihosted operations which can be triggered from the app. For instance, messages can be printed to stderr with the following code: SYS_WRITE0 void debug_write(char *buf) { asm volatile ( "movs r0, #0x04\n" "movs r1, %0\n" "svc 0xab\n" :: "r"(buf) : "r0", "r1" ); } The operation number must be passed in r0 (here SYS_WRITE0 operation is defined to 0x04) and arguments are in r1, r2 and r3. Usage: debug_write("magic!\n"); References ARM semihosting Semihosting for AArch32 and AArch64 - Release 2.0 qemu/target/arm/arm-semi.c Did you find this page helpful? How would you improve this page for developers? I am a developer. Contributors will be chosen randomly to receive rewards. Check this box to send your email and participate. Ledger collects your email address to send you rewards for your contribution to improve the Developer Portal documentation. Learn more about how we manage your data and your rights. By providing your email address, you consent that Ledger may contact you for rewards delivery purposes. If you are part of the randomly selected contributors, we will send you an email to ask for your physical address and if necessary, ask you for additional information on the suggestion you made. Your information will only be available to Ledger and will be retained for no longer than 90 days. It may be transferred to non-European countries that ensure an adequate level of protection or under the standard contractual clauses adopted by the EU Commission. Please note that you may withdraw your consent at any time, access your data and request their rectification or deletion. You may also request the limitation of the processing of your data. To exercise your rights or for any question on the processing of your data, please contact LEDGER’s Data Protection Officer here. If nevertheless you believe LEDGER did not adequately address your concerns and mishandled your data, you may lodge a complaint with the personal data protection authority of your country. Automation: press buttons automatically ← Previous