Skip to content

Commit 664e9de

Browse files
committed
fix memset runtime error under some compilers
Switching compilers from arm-none-eabi-gcc on macOS (arm m1 host) to arm-none-eabi-gcc on linux (x86 host virtual machine via rosetta) caused failures in this new frame buffer memset code. The system booted properly if I kept a subset of memsets, but if too many were included it looked like the arm9 firmware was never able to run. This memset replacement, in the form of memclr8, does resolve the issue at least for my compilers (it works for both configurations). I'm sure there is some other issue, here are the things I tried: * added explicit data synchronization barriers after writes to SYNC_ADDR in the arm11 * moving the multi-core startup code to after the framebuffer initialization * this code seems to also use the SYNC_ADDR * checked the cache policy for SYNC_ADDR on the arm9 side * it seemed like cache was disabled for that address which is what we'd want
1 parent 8892992 commit 664e9de

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

arm11/source/start.S

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ _start:
8080
mov r1, #0 @ value to set
8181
ldr r2, =FB_TOP_SIZE @ number of bytes
8282
ldr r0, =FB_TOP_LEFT1 @ address of buffer
83-
bl memset
83+
bl memclr8
8484
ldr r0, =FB_TOP_LEFT2
85-
bl memset
85+
bl memclr8
8686
ldr r0, =FB_TOP_RIGHT1
87-
bl memset
87+
bl memclr8
8888
ldr r0, =FB_TOP_RIGHT2
89-
bl memset
89+
bl memclr8
9090
ldr r2, =FB_BOT_SIZE
9191
ldr r0, =FB_BOT_1
92-
bl memset
92+
bl memclr8
9393
ldr r0, =FB_BOT_2
94-
bl memset
94+
bl memclr8
9595

9696
@@@ Top screen @@@
9797
ldr r0, =LCD_FB_PDC0
@@ -151,6 +151,18 @@ wait_arm9:
151151
@ Jump to the kernel!
152152
bx lr
153153

154+
memclr8:
155+
push {lr}
156+
cmp r2, #0
157+
beq .done
158+
.loop:
159+
strb r1, [r0], #1
160+
subs r2, r2, #1
161+
bne .loop
162+
.done:
163+
pop {lr}
164+
bx lr
165+
154166
smp_start:
155167
@ Get the CPUID
156168
mrc p15, 0, r0, c0, c0, 5

0 commit comments

Comments
 (0)