Skip to content

Commit 9590757

Browse files
committed
Fix a bug in asmhello
The string length was not a multiple of 4, so the load of the 32-bit length failed :/
1 parent d7f99f6 commit 9590757

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

samples/asmhello/asmhello.S

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ app_entry:
2626
ldr r3, [r0, #8]
2727
// Set up file handle
2828
movs r0, #1
29-
// Set up data pointer
29+
// Get address of string
3030
ldr r1, =message
31-
// Set up data length
31+
// Get address of data length
3232
ldr r4, =message_len
33-
ldr r2, [r4]
33+
// Read data length (might not be aligned, as it follows the string, so only
34+
// read one byte)
35+
ldrb r2, [r4]
3436
// Call write function
3537
blx r3
3638
// Set return value
@@ -55,6 +57,6 @@ message:
5557
// Must come immediately after `message:`
5658
.type message_len,%object
5759
message_len:
58-
.long . - message
60+
.byte . - message
5961

6062
// End of file

0 commit comments

Comments
 (0)