I am again following up on my earlier posts - maybe it will help someone else on a future forum search. When I first began this thread, I mentioned that there were several different bootstrap versions out there. The first one I began compiling was the one that was included in the EK for my board (the actual project title is "at91bootstrap-at91sam9m10-ek-gnu"). I was able to compile this bootstrap without a problem, but for reasons unknown to me, the code for
CP15_EnableIcache() was failing - the bootstrap would get this far and then seemed to completely stop executing in this function call.
After seeing the CP15 code in the other various bootstraps, I decided to try my own patch to fix the code that was failing for me. My solution was very simple:
I commented out all of the existing code within the
CP15_EnableIcache() function. I replaced it with this code:
Code:
unsigned int cp15;
TRACE_INFO_WP("Configure CP15\n\r");
cp15 = get_cp15();
cp15 |= I_CACHE;
set_cp15(cp15);
I added the following functions to the cp15.c file:
Code:
static inline unsigned int get_cp15(void)
{
unsigned int value;
__asm__("mrc p15, 0, %0, c1, c0, 0" : "=r" (value));
return value;
}
static inline void set_cp15(unsigned int value)
{
__asm__("mcr p15, 0, %0, c1, c0, 0" : : "r" (value));
}
Finally, I added the following define to the cp15.h file:
Code:
#define I_CACHE (1<<12)
This seems to be what all of the other bootstrap projects do, so I'm not sure why the EK is different. All of the EK calls are to the at91lib files, so maybe they were just there for demonstration purposes. Whatever the reason, it isn't very reassuring that they don't seem to work, since they are part of the at91lib...
My disclaimer: I tested this out quickly, and it seems to work so far. I haven't tried removing or doing anything else with the other myriad CP15 function calls and assembly code. The whole reason I returned to this bootstrap is because it supposedly has SD card support, and v. 1.16 of the AT91 Bootstrap does not. I have no idea if this code is better than or newer than that of the 3.0+ versions of the AT91 Bootstrap...I guess time will tell.