1 / 34

A short presentation on uClinux, its applications and my experience with it.

A short presentation on uClinux, its applications and my experience with it. Designed and presented by Emile Belanger. Overview. What is uClinux Commercial application for uClinux The key differences between uClinux and Linux What the engineer should know

alyssa-duke
Download Presentation

A short presentation on uClinux, its applications and my experience with it.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A short presentation on uClinux, its applications and my experience with it. Designed and presented by Emile Belanger

  2. Overview • What is uClinux • Commercial application for uClinux • The key differences between uClinux and Linux • What the engineer should know • Porting uClinux to a μC/Processor. • My experience using uClinux • A short demonstration(?)

  3. What is uClinux? • Pronounced ‘You-See-Linux’ • A derivative of the 2.0/4/6 Linux kernel • Designed to work with microcontrollers or CPUs without an MMU, with limited storage and RAM • Full networking support • Support for many file systems. • Graphical windowing

  4. Commercial applications • Established, powerful multitasking operating system. • Royalty Free! • Large software base PDAs Data terminals Routers Security VoIP

  5. uClinux Requirement • 32 bit Microcontroller or Microprocessor • 512KB RAM min. (2MB+ recommended) • 515KB ROM min. • Hardware Timer + Interrupt • Fully functional C/C++ complier

  6. uClinux vs. Linux • The main differences revolve around the lack of MMU

  7. uClinux vs. Linux • The Memory Management Unit allows the use of Virtual Memory (VM) • Translates Virtual Address space into physical address space

  8. uClinux vs. Linux • Enables page swapping

  9. uClinux vs. Linux • Memory Protection

  10. uClinux vs. Linux • What this means to the software engineer. • No page swapping • No hardware memory protection • Only the Binary Flat Format (BFLT) executable type is supported • Use page_alloc2 as a kernel memory allocator • Non dynamic stack • Memory can not be ‘defragmented’ • fork() replaced with vfork() • XIP

  11. uClinux vs. Linux • Memory fragmentation Even though there is 32KB reported free memory, the maximum process size which can run is 12KB

  12. uClinux vs. Linux • fork() Parent (1)When fork() is called, a child process is created, and continues to run from fork() fork()(!=0) Stack/heap(0)

  13. uClinux vs. Linux • fork() Parent Child (2)When the child is created, it first shares the parents memory. The shared variables tag is incremented by 1 fork()(!=0) fork() (==0) Stack/heap(1)

  14. uClinux vs. Linux • fork() Parent Child (3)If the child tries to write to any global variables, the C.O.W is executed and a new copy of the variable is created. The tag is decremented. fork()(!=0) fork() (==0) Stack/heap(0) Stack/heap(0) If the tag = 0, then the variable is not shared

  15. uClinux vs. Linux • vfork() Parent (1)When vfork() is called, a child process is created, and continues to run from vfork(). However, the parent process if BLOCKED vfork()(!=0) Stack/heap(0)

  16. uClinux vs. Linux • vfork() Parent Child (2)When the child is created, it ALWAYS shares the memory of the parent. Changes made by the child will also be made in the parent. vfork()(!=0) vfork() (==0) _exit() Stack/heap(1)

  17. uClinux vs. Linux • How to overcome the shared memory vfork() limitation. int main(void) { pid_t pid; int value = 10; if ((pid = vfork()) == 0) { int new_value = value; new_value-=5; printf("The child process thinks value=%d\n", new_value); exit(EXIT_SUCCESS); } printf("The parent process thinks value=%d\n", value); printf("Goodbye.\n"); return EXIT_SUCCESS; } Ref: http://www.uclinux.org/pub/uClinux/archive/0772.html

  18. uClinux vs. Linux • XIP (Execute In Place) RAM ROM Process 1 Process 2 Process 3 Code Code Code Code Stack/heap Stack/heap Stack/heap Code Stack/heap Stack/heap Stack/heap

  19. Porting uClinux to a μC/Processor • Supported architectures • Motorola DragonBall, • Motorola ColdFire • ADI Blackfin • Motorola QUICC • ETRAX • ARM7TDMI • MC68EN302 • Microblaze • + Others being added all the time!

  20. Porting uClinux to a μC/Processor • If your Processor and Board are not already supported: • /linux/arch • Edit around two dozen files relating to instructions specific to the CPU core • /linux/platform • Interrupt vectors • Hardware registers • Timer initialisation • Amount of memory • External Peripherals

  21. uClinux on Microblaze My experience getting uClinux running on a custom board.

  22. uClinux on Microblaze

  23. uClinux on Microblaze • The Microblaze soft processor: • 32 bit Harvard RISC architecture • 3-stage pipeline with 32 general-purpose registers • FPU • Hardware divide and multiply • Instruction and Data Caches • Many configurable peripherals

  24. uClinux on Microblaze • Possible user implemented features: • Graphical controller (LCD) • Custom IO standards • Hardware acceleration

  25. uClinux on Microblaze

  26. uClinux on Microblaze • Primary components • XC3S400 Xilinx FPGA • 2Mb Xilinx PROM • 256Mb SDRAM • 1.2V and 2.5V DC/DC converter • 40MHZ xtal

  27. uClinux on Microblaze

  28. uClinux on Microblaze Top

  29. uClinux on Microblaze Underside

  30. uClinux on Microblaze

  31. uClinux on Microblaze

  32. uClinux on Microblaze • Outline of steps require to get uClinux functional • Implement Microblaze, SDRAM controller, UART, Timer + interrupt in FPGA. • Download latest uClinux tree via CVS • Copy autoconfig file generated by Xilinx software to uClinux tree • Run ‘make config’, ‘make dep’, ‘make all’ • Upload binary image file into SDRAM via Jtag debug cable • Reset Microblaze to run!

  33. uClinux on Microblaze Linux version 2.4.31-uc0 (root@fedora3) (gcc version 2.95.3-4 Xilinx EDK 6.3 Build EDK_Gmm.12.2) #24 Sun Oct 2 12:58:50 BST 2005On node 0 totalpages: 8192zone(0): 8192 pages.zone(1): 0 pages.zone(2): 0 pages.CPU: MICROBLAZEKernel command line: °Console: xmbserial on UARTLiteCalibrating delay loop... 1.32 BogoMIPSMemory: 32MB = 32MB totalMemory: 30916KB available (562K code, 927K data, 32K init)Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)Inode cache hash table entries: 2048 (order: 2, 16384 bytes)Mount cache hash table entries: 512 (order: 0, 4096 bytes)Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)Page-cache hash table entries: 8192 (order: 3, 32768 bytes)POSIX conformance testing by UNIFIXLinux NET4.0 for Linux 2.4Based upon Swansea University Computer Society NET3.039Microblaze UARTlite serial driver version 1.00ttyS0 at 0x40600000 (irq = 1) is a Microblaze UARTliteStarting kswapdRAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksizeuclinux[mtd]: RAM probe address=0x220bd93c size=0xb7000uclinux[mtd]: root filesystem index=0VFS: Mounted root (romfs filesystem) readonly.Freeing init memory: 32KMounting proc: Mounting var: Populating /var: Running local start scripts.Remounting / (rw): Mounting /etc/config: Populating /etc/config: flatfsd: Nonexistent or bad flatfs (-43), creating new one...flatfsd: Failed to write flatfs (-43): No such deviceflatfsd: Created 3 configuration files (346 bytes)Setting hostname: uclinux-auto login:rootPassword: # lsbin dev etc home lib mnt proc sbin tmp usr var#

  34. Thank you for listening. Are there any Question? www.uclinux.org www.ucdot.org http://www.arcturusnetworks.com/uclinux.shtml http://www-128.ibm.com/developerworks/linux/library/l-embl.html http://www.linuxjournal.com/article/7221 http://linuxdevices.com/articles/AT9541681360.html http://www.uclinux.org/pub/uClinux/archive/0772.html

More Related