Add ARM semihosting SYS_WRITE (0x05) operation support#184
Open
millerjef wants to merge 1 commit intorenode:masterfrom
Open
Add ARM semihosting SYS_WRITE (0x05) operation support#184millerjef wants to merge 1 commit intorenode:masterfrom
millerjef wants to merge 1 commit intorenode:masterfrom
Conversation
Implements SYS_WRITE semihosting operation to enable printf() output from ARM firmware using newlib's rdimon.specs semihosting support. Changes: - Added case 5 (SYS_WRITE) handler in DoSemihosting() - Uses TryTranslateAddress with proper error handling for robustness - Reads parameter block: file handle, data pointer, byte count - Transfers data from memory to SemihostingUart - Returns 0 (success) to firmware - Also improves error handling for existing SYS_WRITEC/SYS_WRITE0 cases This completes the semihosting operations needed for firmware testing, complementing existing SYS_READC, SYS_WRITEC, and SYS_WRITE0. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Jeff Miller seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the missing SYS_WRITE (0x05) semihosting operation to complete ARM semihosting support in Renode.
This enables
printf()and other standard I/O functions to work correctly for ARM firmware compiled with newlib'srdimon.specssemihosting support.Background
ARM semihosting allows embedded firmware to perform I/O operations by making supervisor calls that the debugger/emulator handles. Renode already has partial semihosting support with
SemihostingUart, implementing:However, when firmware uses standard newlib functions like
printf(), the C library's_write()implementation calls SYS_WRITE (0x05) instead of the simpler operations above. Without this operation, printf-based output doesn't work.Changes
File:
src/Emulator/Cores/Arm/Arm.csAdded case 5 (SYS_WRITE) handler in the
DoSemihosting()method:TryTranslateAddress()with proper error handling for robustnessSemihostingUartTesting
Tested with STM32 firmware using FreeRTOS and semihosting-based console output. Printf statements now appear correctly in Renode's UART output.
Related Issues
ARM Semihosting Specification
Per ARM Semihosting Documentation, SYS_WRITE (0x05) writes to a file descriptor or stream, with register r1 pointing to a parameter block containing file handle, data pointer, and length.
🤖 Generated with Claude Code