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
This commit is contained in:
Solomon Peachy 2020-04-04 16:17:57 -04:00
parent 00c0d2012f
commit 5bd86eb4b4

View file

@ -277,8 +277,12 @@ static void init_cache(void)
/* Ensure all cache lines are valid for the next flush. Since this
* can run from cached RAM, rewriting of cache status words may not
* be safe and the cache is filled instead by reading. */
/* Note: Don't start at 0x0, as the compiler thinks it's a
null pointer dereference and will helpfully blow up the code. */
register volatile char *p;
for (p = (volatile char *)0; p < (volatile char *)0x2000; p += 0x10)
for (p = (volatile char *)0x1000; p < (volatile char *)0x3000; p += 0x10)
(void)*p;
}
#endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE */