This blog for Sylixos ARM BSP wrote the third article, the main introduction of BSPINIT.C file specific implementation.
BSPINIT.C initializes part of the code for the BSP operating system, usually by startup. S is called after the basic processor parameters are initialized , the following is an example of the S3C2440A processor, which introduces the bspinit.c code block by piece.
Sylixos ARM BSP The second article mentions startup. The completion of S initialization will call the Bspinit () function, which initializes the operating system and begins the multitasking schedule.
int bspinit (void) { static __section (. noinit) CHAR Ckernelheap[6 * lw_cfg_mb_size]; static __section (. Noinit) CHAR cSystemHeap[6 * LW_CFG_MB_SIZE]; Halmodeinit (); debugchannelinit (0); api_ Kernelstartparam ("Ncpus=1 kdlog=no kderror=yes kfpu=no heapchk=yes"); api_kernelstart (usrstartup, ckernelheap,sizeof (ckernelheap), csystemheap,sizeof ( CSYSTEMHEAP)); return ( -1);}
< Span style= "Padding:0px;margin:0px;color:rgb (85,85,85); Line-height:28px;background-color:rgb (255,255,255);" The &NBSP;CKERNELHEAP and csystemheap defined in the code are the Sylixos kernel heap and the system heap memory location ( Ckernelheap and cSystemHeap array does not need to be zeroed ), which is opened by means of a static char number, __section (. noinit) wherein __section () is a macro, and the prototype is defined in Sys/compiler.h:
#ifdef BSD /* bsd system use __attribute__ ((__section__ (S))) not #S, so Compiler bsd source must defined bsd */# define __section (S) __attribute__ ((__section__ (s))) #else # define __section (s) __attribute__ (__section__ (#S)) #endif
< Span style= "Padding:0px;margin:0px;color:rgb (85,85,85); Line-height:28px;background-color:rgb (255,255,255);" >__section (. noinit) Represents cSystemHeap Array placed in .noinit segment (if not specified, By default in the. BSS section), similar to the section () operation in the Assembly.
< Span style= "Padding:0px;margin:0px;color:rgb (85,85,85); Line-height:28px;background-color:rgb (255,255,255);" >.noinit segment does not need to be in startup. S does not have the same zeroing as the. BSS segment, so this method can speed up the system startup time.
< Span style= "Padding:0px;margin:0px;color:rgb (85,85,85); Line-height:28px;background-color:rgb (255,255,255);" >halModeInit () is the target machine mode initialization function, currently an empty function, if necessary users can join their own code, this code will be called before the operating system initialization.
debugChannelInit () Internal operating system uses &NBSP;BSPDEBUGMSG () as the internal debugging information printing interface, debugchannelinit () is the initialization of this print interface,
< Span style= "Padding:0px;margin:0px;color:rgb (85,85,85); Line-height:28px;background-color:rgb (255,255,255);" >API_KernelStartParam () is the system kernel function, is responsible for setting the operating system startup parameters, the startup parameter is a string, the format "parameter name = parameter value" between multiple parameters separated by a space, Sylixos currently supports the startup parameters are:
| Name of parameter |
Default value |
Description |
| Ncpus |
1 |
Number of CPUs, such as single-core processor Ncpus=1 multi-core processor Ncpus=cpu quantity, note: Ncpus must not be greater than lw_cfg_max_processors |
| Dlog |
No
|
Whether the operating system is allowed to print debug information through the Bspdebugmsg () function, Dlog=yes is allowed, DLOG=NO representative does not allow |
| Derror |
Yes |
Allows the operating system to print error messages through the Bspdebugmsg () function with the same parameters as Dlog |
| Kfpu |
No |
Whether to allow the operating system kernel to use a hard floating point operator, it is strongly recommended that this parameter be no |
| Heapchk |
Yes |
Whether the operating system allows memory access across all memory heap operations to cross-check, the recommended parameter is Yes |
| Varea |
0xC0000000 |
Represents the system virtual memory space starting point, and the virtual space configuration will be explained in detail later in BspMap.h blog post. |
| Vsize |
0x40000000 |
|
| Hz |
100 |
|
| Hhz |
100 |
|
| Irate |
5 |
|
| Hpsec |
1
|
|
(not finished, to be continued)
Sylixos ARM BSP Third "bspinit.c"