diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-04-04 16:17:57 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-04-04 23:07:04 +0200 |
commit | 5bd86eb4b4ce1b98a5f8b369d218fd1de41b4822 (patch) | |
tree | 986ae5fd5227ff977e6f50bd48edc8b3481641c2 /firmware/target/arm/pp/system-pp502x.c | |
parent | 00c0d2012f2e8d977bad5487ab6f3b8ca46c8572 (diff) | |
download | rockbox-5bd86eb4b4ce1b98a5f8b369d218fd1de41b4822.tar.gz rockbox-5bd86eb4b4ce1b98a5f8b369d218fd1de41b4822.zip |
pp502x: Don't fill the cache starting from address 0x0
The pp502x cache init code tries to flush the cache by reading
a block of DRAM. Change the starting point from 0x0 to 0x1000
so the compiler doesn't helpfully insert an undefined instruction
to deliberately crash the target.
(This behavior is intentional on the part of GCC, and was triggered
by using -Os with my experimental 4.9.4 toolchain)
Change-Id: I2d2719615a1164a035f3dac8a56dd3737bbab1d5
Diffstat (limited to 'firmware/target/arm/pp/system-pp502x.c')
-rw-r--r-- | firmware/target/arm/pp/system-pp502x.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/firmware/target/arm/pp/system-pp502x.c b/firmware/target/arm/pp/system-pp502x.c index 102cfd8fea..ad0577c38f 100644 --- a/firmware/target/arm/pp/system-pp502x.c +++ b/firmware/target/arm/pp/system-pp502x.c | |||
@@ -277,8 +277,12 @@ static void init_cache(void) | |||
277 | /* Ensure all cache lines are valid for the next flush. Since this | 277 | /* Ensure all cache lines are valid for the next flush. Since this |
278 | * can run from cached RAM, rewriting of cache status words may not | 278 | * can run from cached RAM, rewriting of cache status words may not |
279 | * be safe and the cache is filled instead by reading. */ | 279 | * be safe and the cache is filled instead by reading. */ |
280 | |||
281 | /* Note: Don't start at 0x0, as the compiler thinks it's a | ||
282 | null pointer dereference and will helpfully blow up the code. */ | ||
283 | |||
280 | register volatile char *p; | 284 | register volatile char *p; |
281 | for (p = (volatile char *)0; p < (volatile char *)0x2000; p += 0x10) | 285 | for (p = (volatile char *)0x1000; p < (volatile char *)0x3000; p += 0x10) |
282 | (void)*p; | 286 | (void)*p; |
283 | } | 287 | } |
284 | #endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE */ | 288 | #endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE */ |