Fix semihosting_putc (#530)

Per the Arm semihosting protocol documentation[1], the SYS_WRITEC command
expects *a pointer to* the character to be printed in r1, not the
character itself.

[1] https://developer.arm.com/documentation/dui0471/g/Semihosting/SYS-WRITEC--0x03-?lang=en
This commit is contained in:
Brian Starkey 2021-10-04 19:24:50 +01:00 committed by GitHub
parent eb42ecfaa5
commit a119b5bd9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,7 @@
// );
//}
static void __attribute__((naked)) semihosting_putc(char c) {
static void __attribute__((naked)) semihosting_putc(const char *c) {
__asm (
"mov r1, r0\n"
@ -31,7 +31,7 @@ static void __attribute__((naked)) semihosting_putc(char c) {
static void stdio_semihosting_out_chars(const char *buf, int length) {
for (uint i = 0; i <length; i++) {
semihosting_putc(buf[i]);
semihosting_putc(&buf[i]);
}
}