Hi,
Background: I have been using starterware on the AM335x as both a bare metal platform starting point for a project prototype and as a way of learning about the processor and its peripherals. StarterWare seemed a good place to start.
In my learing process I have been delving into the implementation. I'm trying to understand why some things are done in Starterware they way they are. It seems to me that much of the code that I have run across is difficult to follow, and poorly commented, which doesn't help the learning process. Here is an example (I could provide many):
In startup.c, we have the declaration for the exception vector table:
static unsigned int const vecTbl[14]=
{
0xE59FF018,
0xE59FF018,
0xE59FF018,
0xE59FF018,
0xE59FF014,
0xE24FF008,
0xE59FF010,
0xE59FF010,
(unsigned int)Entry,
(unsigned int)UndefInstHandler,
(unsigned int)SVCHandler,
(unsigned int)AbortHandler,
(unsigned int)IRQHandler,
(unsigned int)FIQHandler
};
In the start_boot function (also in startup.c) we copy this vector table to 0x4030FC00 and set the cpu to use this address. So, the questions are:
-
Why relocate the vector table to this address? Absolutely no clue in the code as to where this address comes from. Its just a seemingly arbetrary address in the onchip ram?
-
Why relocated it at all? When I leave it in DRAM, it seems to works fine.
-
Why were machine language instructions used? Yes, I can dissassemble the E59FF018 to a LDR PC instruction. But comment in the code would really help the understanding of what is going on. Should this have been done using the inline assembler or a .asm module?
I guess 1 and 2 are real questions. 3 is really a bit of a rant, sorry. But it seems that the quality of the code documentation could be improved to help with what I think the purpose of starterware is: Get new users started!
Cheers,
-Jay