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:
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
Hi Jay,
Check this thread it was answered there:
http://e2e.ti.com/support/embedded/starterware/f/790/p/179868/647892.aspx#647892
Regards,
Valentin
Hi Jay/Valentin,
Many thanks for your interest in StarterWare and for the valuable review comments !
As Jay pointed out, it will make a difference if we give proper comments, as at some places its not clear why the code is written that way.
Regarding the vector table relocation; Yes, we can have the vector table in DDR as well, defining them in a .asm file as well. But current StarterWare code places in OCMC RAM because by default, the vector table will be in OCMC RAM, and in StarterWare, we preferred the default place, but moved to the end of OCMC RAM.
Secondly, in some other platforms, say ARM9 based, the vector table cannot be placed anywhere other than 0xFFFF0000 and 0x00000000. In such case, we will have to relocate the vector table since we are supporting bootloader which will .bin file. To make it consistent, we kept it similar for AM335x also. (May be it can now be made depending on the platform).
Sujith.