Computer System Laboratory

Slides:



Advertisements
Similar presentations
An Overview Of Virtual Machine Architectures Ross Rosemark.
Advertisements

9.0 EMBEDDED SOFTWARE DEVELOPMENT TOOLS 9.1 Introduction Application programs are typically developed, compiled, and run on host system Embedded programs.
Lab 4 Department of Computer Science and Information Engineering National Taiwan University Lab4 - Bootloader 2014/10/14/ 13 1.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
Intel Do-It-Yourself Challenge Lab 1: Intel Galileo’s Arduino side Nicolas Vailliet
Embedded Systems Programming Introduction to the course.
COMPUTER SYSTEM LABORATORY Lab4 - Bootloader. Lab 4 Experimental Goal Learn how to build U-Boot bootloader for PXA /10/8/ 142.
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 - Cross Tools 2014/10/7/ 20 1.
COMPUTER SYSTEM LABORATORY Lab10 - Sensor II. Lab 10 Experimental Goal Learn how to write programs on the PTK development board (STM32F207). 2013/11/19/
The PC The PC is a standard computing platform, built around a EISA bus (1988) –IBM compatible –“Intel Architecture” from Intel or AMD or other companies.
Lab 11 Department of Computer Science and Information Engineering National Taiwan University Lab11 - Porting 2014/12/9/ 26 1.
Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.
Lab 10 Department of Computer Science and Information Engineering National Taiwan University Lab10 – Debugging II 2014/12/2 1 /16.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Operating System What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. An operating.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
Implementation of Embedded OS Lab4 Cortex-M3 Programming.
Implementation of Embedded OS Lab3 Porting μC/OS-II.
Getting ready. Why C? Design Features – Efficiency (C programs tend to be compact and to run quickly.) – Portability (C programs written on one system.
Lab 9 Department of Computer Science and Information Engineering National Taiwan University Lab9 - Debugging I 2014/11/4/ 28 1.
Virtual Machines Mr. Monil Adhikari. Agenda Introduction Classes of Virtual Machines System Virtual Machines Process Virtual Machines.
Implementation of Embedded OS
By Ganesan Alagu Ganesh Feb 26, 2008
cFS Platforms OSAL and PSP
The Post Windows Operating System
Building Raspberry Pi Controllers with Python
Computer System Laboratory
Operating System Overview
Topic 2: Hardware and Software
Android Mobile Application Development
Virtualization.
Computer System Laboratory
#FOSDEM Februari 4, 2017 brabo
Implementation of Embedded OS
Computer System Laboratory
Computer System Laboratory
Memory Protection: Kernel and User Address Spaces
Credits: 3 CIE: 50 Marks SEE:100 Marks Lab: Embedded and IOT Lab
Course on Embedded Systems Introduction
Computer System Laboratory
Implementation of Embedded OS
Implementation of Embedded OS
Operating System Structure
Computer System Laboratory
Microprocessor and Assembly Language
Implementation of Embedded OS
CS4101 Introduction to Embedded Systems Design and Implementation
Implementation of Embedded OS
CSCI/CMPE 3334 Systems Programming
Memory Protection: Kernel and User Address Spaces
Programming Languages
Computer System Laboratory
Computer Science I CSC 135.
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Booting Up 15-Nov-18 boot.ppt.
COMPUTER SOFT WARE Software is a set of electronic instructions that tells the computer how to do certain tasks. A set of instructions is often called.
9.0 EMBEDDED SOFTWARE DEVELOPMENT TOOLS
BIC 10503: COMPUTER ARCHITECTURE
Introduction to Computer Systems
Implementation of Embedded OS
Computer System Laboratory
Workshop GPIO I2C SPI Panic1 woensdag 10 april 2019.
Computer System Laboratory
Computer System Laboratory
Computer System Laboratory
Computer System Laboratory
Memory Protection: Kernel and User Address Spaces
Presentation transcript:

Computer System Laboratory Lab12 - Porting / 16

Experimental Goal Understand the basic process of porting. Port FreeRTOS to RPi 2. Understand some FreeRTOS implementations. / 16

Environment Host Machine Target Machine Build Machine OS: Windows Raspberry Pi 2 Build Machine A computer with a SD card slot OS: Ubuntu 15.10 (or above) 64-bit / 16

Software Required Host Machine Target Machine Build Machine PL2303 Driver PuTTY Target Machine Raspberry Pi Firmware Raspberry Pi Older Firmware Build Machine GCC Cross-Compiler Targeting arm-none-eabi FreeRTOS port for Raspberry Pi You may find all software on the CSL Course Software. / 16

Hardware Checklist Raspberry Pi 2 Power supply Micro SD card and card reader USB-TTL cable / 16

Introduction to Porting In software engineering, porting is the process of adapting software so that an executable program can be created for a computing environment that is different from the one for which it was originally designed (e.g. different CPU, operating system, or third party library). Software is portable when the cost of porting it to a new platform is less than the cost of writing it from scratch. The lower the cost of porting software, relative to its implementation cost, the more portable it is said to be. / 16

Popular Embedded OS Architecture OS porting only needs to modify OS Port layer for the target platform. Modify the hardware dependent codes, such as GPIO, memory mapping, or interrupt control. / 16

Introduction to FreeRTOS Yet another real-time operating system Why choose FreeRTOS? Official introduction Unlike uCOSII which requires royalty payments for commercial use, FreeRTOS is distributed under a modified GPL. Source code is available here. Source code structure FreeRTOS suggests that the two directories FreeRTOS/Source/portable/your_compiler/your_architecture/ and FreeRTOS/Demo/your_platform/ form the port layer. / 16

FreeRTOS Port for Raspberry Pi FreeRTOS has been officially ported to many platforms. Raspberry Pi series is not included, however. Lucky, there is a contributed port from third party. This port runs on Raspberry Pi 1 (BCM2835). We are going to modify it and make it run on Raspberry Pi 2 (BCM2836). Download and extract the source code of this port. Compare the code structure of this port and the official FreeRTOS ports. FreeRTOS/Source/portable/GCC/RaspberryPi/ and Demo/ form the port layer. Build script Makefile and linker script raspberrypi.ld are at the root of the archive. / 16

Control Flow According to the linker script, the program entry point is _start in Demo/startup.s. After doing some processor specific initializations, the control flow jumps to main() in Demo/main.c. In main(), a FreeRTOS kernel API xTaskCreate() is called twice to register two user-defined tasks task1() and task2(). Another FreeRTOS kernel API vTaskStartScheduler() is then called to start the two tasks. task1() and task2() perform their works periodically. Their periods are specified by a FreeRTOS kernel API vTaskDelay(). FreeRTOS kernel API reference can be found here. Their implementations can be found in the source code. / 16

Build Instructions Fix compiler version issue. Run % make directly. The linker needs libgcc.a and libc.a to generate the final executable. Find their path and replace “/usr/lib/gcc/arm-none-eabi/4.7.4” and “/usr/arm- none-eabi/lib” in Makefile with their path. Run % make directly. kernel.img is the FreeRTOS image bootable by RPi firmware. Currently, this image is not able to run on RPi 2, since we have not modified the code. / 16

Porting to Raspberry Pi 2 Modify the source code. Reference this article. You may also want to add UART support for debugging purpose. Modify the build script. Specify target CPU for compiler and assembler. In dbuild.config.mk, replace “-march=armv6z” with “-mcpu=cortex-a7”, and add a line “ASFLAGS += - mcpu=cortex-a7”. If you add additional .c or .s files, specify corresponding .o files in objects.mk. / 16

Firmware Issue Raspberry Pi Foundation only provides pre-compiled RPi firmware. In other words, RPi firmware is not open-source, and what its code does is actually not standardize. So, RPi firmware may not be compatible among all versions. If an OS is able to run with RPi firmware of a certain version, it is not guaranteed to be able to run with RPi firmware of another version. This FreeRTOS Raspberry Pi port only runs with RPi firmware of some older versions. It can not run with firmware-1.20160315, the firmware we have used so far. So, let’s use firmware-1.20150820 instead. Backup your config.txt and FreeRTOS image. Format the boot partition. Put firmware-1.20150820/boot/* into boot partition. Restore your config.txt and FreeRTOS image. / 16

Boot Successfully Note: In my task1() and task2(), I replace “SetGpio(16, 1)” and “SetGpio(16, 0)” with printing “task 1” and “task 2” respectively. / 16

Lab Requirement Show that your FreeRTOS is able to run on RPi 2. E.g. Let the two tasks print something. Explain how task1() and task2() are called. Hint: Look into vTaskStartScheduler() to see how it starts all tasks. / 16

Reference FreeRTOS GitHub - jameswalmsley/RaspberryPi-FreeRTOS GitHub - mopplayer/uCOSII_RPi BCM2835 - Raspberry Pi Documentation BCM2836 - Raspberry Pi Documentation uCOSII porting on RPi A+/B+/2B / 16