Presentation is loading. Please wait.

Presentation is loading. Please wait.

P ORTING F REE RTOS TO MCB2140 BOARD Ashwini Athalye Sravya Kusam Shruti Ponkshe.

Similar presentations


Presentation on theme: "P ORTING F REE RTOS TO MCB2140 BOARD Ashwini Athalye Sravya Kusam Shruti Ponkshe."— Presentation transcript:

1 P ORTING F REE RTOS TO MCB2140 BOARD Ashwini Athalye Sravya Kusam Shruti Ponkshe

2 O VERVIEW Introduction to RTOS FreeRTOS Internals Hardware/Software Details Implementation Breakdown of work Design Tradeoffs What would we have done differently Goal: To port FreeRTOS v5.3.0 onto ARM7 MCB2140 board

3 W HAT I S A N RTOS? A multi-tasking operating system catered for real-time applications Eg Flight control, streaming media decoders, microwave etc What is the difference between a general OS and RTOS? RTOS: Deterministic “timing” OS services consume only known and expected amount of time General OS: Non-Deterministic “timing” Services can inject random delays and hence alter execution times Key kernel component Scheduler and scheduling policy

4 F REE RTOS I NTERNALS : B ASIC B LOCKS Scheduler Scheduling Policy: Pre-emptive, priority based RTOS Tick: Timer Interrupt to measure time in ticks Idle task of lowest priority(0) created by scheduler Tasks Context: Each task executes within its own context (stack) Priority: Processing time preference given to higher priority task State: Running: Currently Executing Ready: Able to execute but higher/equal priority task running Blocked: Waiting for temporal or external event (delay, semaphore) Suspended: Explicitly suspended by scheduler Queues Inter-task and interrupt-task communication Co-routines Share single stack, implemented as idle hooks (lowest priority)

5 F REE RTOS I NTERNALS : C ONTEXT S WITCHING Saving context The context can be saved by pushing processor registers onto the task stack. Push R0-LR Push CSPR Copy stack pointer in kernel Restoring context The scheduler retrieves the stack pointer for the task then POP's the context back into the correct processor registers

6 MCB2140 B OARD D ETAILS (NXP LPC2148)

7 D EVELOPMENT E NVIRONMENT Keil Development Tools uVision v4.0 IDE ARM compilation tools ARM C/C++ compiler (armcc) ARM Macro Assembler (armasm) ARM Linker (armLink) Flash Magic Developed for NXP semiconductors to program on-chip flash

8 P ORTING M ETHODOLOGY Identify source code for closely related port LPC 21xx port for MCB 2100 board Identify development environment MCB2140 manufactured by Keil Study source code organization Port-dependent Tick timer, ISR handling, Context switching Port-independent Task, queues, co-routines Make hardware related changes Config file: Processor frequency, stack direction and size, tick rate etc. Task creation Allocate appropriate stack size, priority Compile code Successful compilation = n th attempt Testing Single task Multiple tasks Co-routines Debugging Emulator, JTAG Printf : requires UART to be setup

9 A PPLICATION D EVELOPMENT Implemented Monitor(as a task) to perform IAP IAP = In Application Programming Performing erase and write operation on the on-chip flash memory from the application code IAP routine resides at 0x7FFFFFF0h, thumb code IAP commands Blank check sectors Erase sectors Prepare sectors for write Copy RAM to Flash Compare DEMO!

10 B REAKDOWN OF W ORK Common Understanding source code Understanding Interrupts, serial port configuration Sravya Task and co-routine implementation Understanding IAP vs ISP Shruti Understanding/Setting up board IAP code Ashwini Compiling code UART configuration and Monitor code

11 D ESIGN T RADEOFFS Monitor can spawn IAP as a separate task More complicated scheduling policy

12 W HAT W OULD W E D O D IFFERENTLY Debugging: Use JTAG, understand emulator Application: Design application for “Hard” real time task

13 P OINTS T O G O RTOS design and porting Simplify Code Embedding ASM in C compiler dependent syntax In-built functions may not work correctly  We wrote our own functions- isdigit(), isspace() etc Flash organization, sector layout

14 R EFERENCES www.freeRTOS.org www.wikipedia.com ARM Assembly Language Programming Guide LPC2148 Manual

15 Q UESTIONS


Download ppt "P ORTING F REE RTOS TO MCB2140 BOARD Ashwini Athalye Sravya Kusam Shruti Ponkshe."

Similar presentations


Ads by Google