User`s guide
2 Overview of a BSP
2.5 Avoiding Common Problems
51
2
For example, the routine sysPhysMemTop( ) indicates the highest addressable
memory present on the system. If autosizing is not used, such as during early parts
of BSP development, this routine can be written to return a constant value. This
value should be relative to
LOCAL_MEM_LOCAL_ADRS, for example:
char * sysPhysMemTop()
{
return ((char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE));
}
Most BSP developers do not change the value of LOCAL_MEM_LOCAL_ADRS, so
this problem tends to be copied and replicated throughout development projects.
Too Much Device Initialization in romInit.s
Many BSP writers add too much device initialization code to romInit.s. Treat the
initialization in romInit.s as a preliminary step only. All real device initialization
should be handled in sysHwInit( ) in sysLib.c.
Many embedded devices have a requirement for a very fast boot time. Developers
working on such projects must ensure that the system boots quickly. This is usually
achieved by removing initialization routines entirely, or by delaying the
initialization until later in the boot process. Typically, efforts to minimize boot time
do not require changes to romInit.s. However, if romInit.s includes too much
initialization code, modification may be necessary.
Not Enough Initialization in sysALib.s
Many BSP writers assume that any initialization done in romInit.s need only be
done once. However, all initialization done by romInit.s should be repeated in the
routine sysInit( ) in sysALib.s. If the initialization is not repeated, the BSP user
must rebuild boot ROMs for simple configuration changes in their VxWorks
image.
There are some kinds of initialization that do not need to be performed in
sysALib.s, though these exceptions are limited. In most cases, the exceptions are
limited to one of two situations. One kind of initialization that does not need to be
done in sysALib.s is configuration of processor or board registers that can only be
written once after initial power-on and that retain their original value regardless of
subsequent attempts to change them. The other situation involves initialization
that must be done in order for the code in sysALib.s to execute; for example,
certain parts of memory controller initialization must be performed first.