Skip to content

Commit 1d10654

Browse files
committed
pbio/platform/ev3/start: disable and flush caches
Add a hack to disable and flush the I and D caches at in the startup code. Previously, when we were using the U-Boot Linux loader to load our firmware, U-Boot was doing this for us. But since we switched to a different loader in commit c24798f ("bricks/_common/arm_none_eabi.mk: ev3 uImage is not Linux"), it broke the display among other things.
1 parent ddce835 commit 1d10654

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/pbio/platform/ev3/start.S

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@
5151
@ main() function.
5252
@
5353
Entry:
54+
@ HACK: The U-Boot Linux loader was doing this, but the ELF loader
55+
@ does not. Adding this here until we sort out the proper way to handle
56+
@ caching. But right now, it breaks the display driver and other things
57+
@ if we don't do this.
58+
mrc p15, #0, r0, c1, c0,#0 @ Read System Control Register
59+
bic r0, r0, #0x1000 @ Clear bit 12 to disable ICache
60+
bic r0, r0, #0x0004 @ Clear bit 2 to disable DCache
61+
mcr p15, #0, r0, c1, c0, #0 @ Write back to System Control Register
62+
mov r0, #0 @ Set r0 to 0
63+
mcr p15, #0, r0, c7, c7, #0 @ Invalidate all caches
64+
@ END HACK
65+
5466
MRC p15, 0, r0, c1, c0, 0 @ Load Coprocessor Register C1 to ARM Register r0
5567
ORR r0, r0, #0x00002000 @ Logical OR --> Set Bit 13
5668
MCR p15, 0, r0, c1, c0, 0 @ Restore Coprocessor Register C1 from ARM Register r0

0 commit comments

Comments
 (0)