120 likes | 162 Views
Power on board. Execute start code. Initialize board. Operating sys init. Application Initialize. Start Scheduler. Startup and Initialization. Development Basics. Start (crt0) - executes at power up Board initialization Operating System Initialization Application Program Initialization
E N D
Power on board Execute start code Initialize board Operating sys init Application Initialize Start Scheduler Startup and Initialization Development Basics • Start (crt0) - executes at power up • Board initialization • Operating System Initialization • Application Program Initialization • Start Scheduler
Obtain Semaphore Program Execution Shared Resource Release Semaphore Task Synchronization Binary Semaphores Generally used to control access to a “shared resource”
Disable Interrupts Critical Section Enable Interrupts Critical Sections / Reentrancy Interrupt
Creation and Deletion of Objects • Control Block - required for every object; you define location anywhere in memory • Memory Requirements - data needed for components (e.g., task stack, queue space, etc.)
Source File Structure Component Source Code • XX_DEFS.H - component constants and data structures • XX_EXTR.H - external interfaces (function prototypes) • XX_D.C - static and global data structure definitions • XX_I.C - initialization functions for component • XX_F.C - status functions for component • XX_C.C - core functions for component • XX_CE.C - error checking shell functions of core functions • XX_S.C - supplemental functions for component • XX_SE.C - error checking shell functions for supplemental functions
System Startup • Startup Vector • INT_Initialize() • INC_Initialize() • Nucleus Services Init • Application_Initialize() • TCT_Schedule()
.code .data (initialized data) .bss (uninitialized data) application memory System Startup Application Memory first_available_memory_address
System Startup Code • INT_Initialize - contains target processor dependent initialization routines and data. • Setup necessary processor/system control registers • Setup system stack • Setup timer interrupt • Calculate timer HISR stack and priority • Calculate first available memory address • Transfer control to INC_Initialize()
System Startup Code • INC_Initialize( ) • Nucleus PLUS Component Initialization • Initialization of Error Handling, History, Thread Control, Mailbox, Queue, Pipe, Semaphore, Event Group, Partition Memory, Dynamic Memory, Timer, and I/O Driver Components • Application_Initialize() • TCT_Schedule()
System Startup Code • Application_Initialize( ) • Create dynamic memory pool • NU_Create_Memory_Pool( ) • Create Tasks • NU_Allocate_Memory( ) • NU_Create_Task( ) • Create other system objects (optional) • NU_Allocate_Memory( ) • NU_Create_Queue( ) • NU_Create_Semaphore( ) • … • NOTE - Interrupts disabled during Application_Initialize( )
.code .data (initialized data) .bss (uninitialized data) System stack application memory Timer HISR stack System Startup Application Memory first_available_memory_address
NU_Protect NU_Unprotect Critical Sections / Reentrancy Protection • Protection - “monitor” surrounding Nucleus PLUS service calls • prevents disabling of interrupts • prevents priority inversion