This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

StarterWare code documentation

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:

  1. 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?
  2. Why relocated it at all?  When I leave it in DRAM, it seems to works fine.
  3. 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

  • 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).

    Cheers,

    Sujith.