SlideShare a Scribd company logo
1 of 30
Uclinux on the Pluto 6
From this....
To this...
Edwin Langley : Heber
edwin@heber.co.uk
Craig Duffy : University of the West of
England
Craig.Duffy@uwe.ac.uk
Project Origin
Pluto 6 Fruit machine controller board
made by Heber:
● Heber have developed their own in-
house monitor/executive
– It has drivers written from scratch by
Heber
– It is fast, and well understood
– We provide to customers drivers compiled
to Library object files
● However there is a problem...
– Future boards may use more complex
peripheral buses
– We will require more complex software
● E.G. TCP/IP stack, USB hosting
Project Origin
● A version of the Linux kernel for
microcontrollers without a MMU
● First port in January 1998 by Rt-Control
● Differences to Linux - uClinux has:
– No virtual address spaces; applications must
be linked to absolute addresses
– No memory protection
– To have drivers altered to operate through
local bus instead of ISA/PCI, with bigger
interrupt vector ranges
Background to uClinux
● Create development environment
– Obtain tool chain
– m68k-elf-gdb
● Create new board configuration
● Edit entry assembly in crt0_ram.S
– Set variables _rambase, _ramstart, _ramend,
_ramvec.
● Edit linker script in ram.ld
– Link to DRAM at 0x60000000
Porting uClinux to the Pluto 6
● Crashed in kernel during boot:
– Assembly variables were wrong
● #define MEM_SIZE 0x0016fefc
– PAGE_OFFSET was wrong
– Stack corruption
● Set SP to end of external SRAM
– MBAR wrongly set to address of SRAM
● #define MCF_MBAR 0x10000000
Porting uClinux to the Pluto 6
– Romfs too big
● _ramstart
calculated >
_ramend
Porting uClinux to the Pluto 6
RAM
.text
.data
.romfs
0x60000000 _stext
_sdata
_sbss
_ebss
Dynamic
memory
0x6016FEFC
A0
A1
A0 + ROMFS size
A1 + ROMFS size
Copy data
from end
forwards
– VBR set to start of RAM, overwriting kernel
– Set _ramvec to ColdFire internal SRAM
● Finally a working kernel!
– But...
● 2Mb of DRAM doesn't give even uClinux
much room to do anything
– After 3 commands, memory is too
fragmented to load programs:
Porting uClinux to the Pluto 6
– Romfs contents restricted
– Tools are required to test drivers
/bin> vi
__alloc_pages: 0-order allocation failed (gfp=0x1d2/0)
__alloc_pages: 4-order allocation failed (gfp=0x1f0/0)
Allocation of length 65000 from process 20 failed
Free pages: 136kB ( 0kB HighMem)
Zone:DMA freepages: 0kB
Zone:Normal freepages: 136kB
Zone:HighMem freepages: 0kB
( Active: 5, inactive: 27, free: 34 )
= 0kB)
6*4kB 2*8kB 2*16kB 0*32kB 1*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB = 136kB)
= 0kB)
Running the kernel from VRAM
● Problem: program counter incrementing incorrectly
● Possibly cache related
● Initial solution to use video card RAM
● Solution found and borrowed from Heber:
Getting more memory
● Finally a working USABLE kernel!
FPGA for DRAM
to local bus
decoding
DRAM
Battery
16Mb local
bus interface
DRAM card
● Vacuum Fluorescent Display
– Simple character device
– Clock ASCII characters in through 2 line serial
port
Time to write some drivers!
/> echo hello world! > /dev/vfd0
● FPGA controls 256 lamps as 16 strobes of
32, each has 8 brightness levels
● Every 1ms, software must:
– fill 8 32 bit data registers, each bit
corresponds to one lamp
– Write the strobe number to illuminate to the
MPX control register in the FPGA
● The FPGA splits the 1ms period into 8
segments, using 1 data register for each
● Each bit of each data register = 1/8ms
Multiplexed lamp driver
● Problem:
– Kernel timer used to rewrite lamp registers
every millisecond
– Interrupt set for next jiffy, which is
incremented by timer interrupt
– Timer interrupt frequency determined by HZ
– HZ default is 100 (every 10ms)
– Lamps flash (on for 1ms, off for 9ms)
– Increased HZ to 1000
Multiplexed lamp driver
● Choosing interface to user space
– Write a char for brightness of each lamp
● 1 file for all 256 lamps
– Big overhead to change 1 lamp
● 1 file for each lamp
– 256*3*2=1536 context switches
● Best compromise
– 1 file for each lamp strobe
Multiplexed lamp driver
Multiplexed lamp driver
/> echo 0123456776543210 > /dev/lamps10
/> echo 0707070707070707 > /dev/lamps15
Frame buffer driver
● Graphics were a key part of project
● Two options
– Port a Denx Coral P X server on a PPC board
accessed through PCI running full Linux
– Write a frame buffer driver from scratch
Cremson video
controller
DRAM
Fujitsu Calypso 32 Graphics card
Frame buffer driver
● Not a lot of design
required
● But understanding
of sub system is
required
● Values written to
Cremson stored in
a par structure
– Initial par instance
with set values
used for testing
● 1024x768x16
fb_info
fb_var_screeninfo
fb_fix_screeninfo
fb_monospecs
fb_ops * fb_ops
fbgen_get_fix()
fbgen_get_var()
fbgen_set_var()
fbgen_get_cmap()
fbgen_set_cmap()
fbgen_pan_display()fb_cmap
display * display
Par *
cremsonfb_info
fb_info_gen
fbgen_hwswitch * cremsonfb_switch
cremson_detect()
cremson_encode_fix()
cremson_decode_var()
cremson_encode_var()
cremson_get_par()
cremson_set_par()
cremson_get_getcolreg()
cremson_set_getcolreg()
cremson_pan_display()
cremson_blank()
cremson_set_disp()
uint32_t fbcon_cmap[256]
void *screen_base_phys
void *screen_base_virt
uint32_t vid_mem_len
par
Cremson register
copies
unsigned int parsize
Frame buffer driver
● Lots of code mistakes before finally:
Frame buffer driver
● Endian issue, added byte swaps to macros
in fb_con.h:
Frame buffer driver
● Forgot to allocate memory to 16 entry
console pseudo palette:
Frame buffer driver
● Had a try with 8 bit indirect colour mode
● Created a new par instance
Frame buffer driver
● Set bit field lengths in fb_var_screeninfo to 8:
Frame buffer driver
● Set layer width in Cremson correctly:
Frame buffer driver
● Finally, set the palette tables in video
memory in cremson_setcolreg():
Nano X
● A pain to compile
IDE
● Used a generic driver provided by uClinux
● FPGA outputs same interrupt level for
CompactFlash and Cremson
● Lots of trouble with Cremson Vsync interrupt
while unmasking in ColdFire for the IDE
– Mask Vsync on Cremson
– Unmask interrupt vector on ColdFire
● Copied romfs to CompactFlash card
● Altered kernel command line to mount as
root FS
eXecute In Place
● Tried XIP with romfs
– Romfs scrambled when copying .data and .init
from ROM area to RAM area
– No need for romfs with a working disk present
● Added initial vector table to crt0_rom.S
● Split DRAM card into 2 Mb "ROM" and the
rest as RAM area
● Could finally boot straight into uClinux at
power on
MEMORY {
flash : ORIGIN = 0x00000000, LENGTH = 0x00200000
ram : ORIGIN = 0x00200000, LENGTH = 0x00E00000
}
● Project was successful
● Verdict
– Board is rather slow
– Accumulated knowledge for future Heber
boards
● Lessons learned
– Understand code before starting
● learned lesson porting
● used lesson on frame buffer
– Learned lots about kernel programming
Conclusion
Questions

More Related Content

What's hot

eBPF in the view of a storage developer
eBPF in the view of a storage developereBPF in the view of a storage developer
eBPF in the view of a storage developerRichárd Kovács
 
Current and Future of Non-Volatile Memory on Linux
Current and Future of Non-Volatile Memory on LinuxCurrent and Future of Non-Volatile Memory on Linux
Current and Future of Non-Volatile Memory on Linuxmountpoint.io
 
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...ScyllaDB
 
Task migration using CRIU
Task migration using CRIUTask migration using CRIU
Task migration using CRIURohit Jnagal
 
Linux rt in financial markets
Linux rt in financial marketsLinux rt in financial markets
Linux rt in financial marketsAdrien Mahieux
 
Kernel Recipes 2016 - kernelci.org: 1.5 million kernel boots (and counting)
Kernel Recipes 2016 - kernelci.org: 1.5 million kernel boots (and counting)Kernel Recipes 2016 - kernelci.org: 1.5 million kernel boots (and counting)
Kernel Recipes 2016 - kernelci.org: 1.5 million kernel boots (and counting)Anne Nicolas
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmAnne Nicolas
 
Kernel Recipes 2017 - What's new in the world of storage for Linux - Jens Axboe
Kernel Recipes 2017 - What's new in the world of storage for Linux - Jens AxboeKernel Recipes 2017 - What's new in the world of storage for Linux - Jens Axboe
Kernel Recipes 2017 - What's new in the world of storage for Linux - Jens AxboeAnne Nicolas
 
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...Bruno Castelucci
 
Getting Started with Performance Co-Pilot
Getting Started with Performance Co-PilotGetting Started with Performance Co-Pilot
Getting Started with Performance Co-PilotPaul V. Novarese
 
Linux kernel memory allocators
Linux kernel memory allocatorsLinux kernel memory allocators
Linux kernel memory allocatorsHao-Ran Liu
 
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan BaljevicUnix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan BaljevicCircling Cycle
 
BKK16-317 How to generate power models for EAS and IPA
BKK16-317 How to generate power models for EAS and IPABKK16-317 How to generate power models for EAS and IPA
BKK16-317 How to generate power models for EAS and IPALinaro
 
Threading Successes 06 Allegorithmic
Threading Successes 06   AllegorithmicThreading Successes 06   Allegorithmic
Threading Successes 06 Allegorithmicguest40fc7cd
 
Term Project Presentation (4)
Term Project Presentation (4)Term Project Presentation (4)
Term Project Presentation (4)Louis Loizides PE
 
BKK16-208 EAS
BKK16-208 EASBKK16-208 EAS
BKK16-208 EASLinaro
 
DB Latency Using DRAM + PMem in App Direct & Memory Modes
DB Latency Using DRAM + PMem in App Direct & Memory ModesDB Latency Using DRAM + PMem in App Direct & Memory Modes
DB Latency Using DRAM + PMem in App Direct & Memory ModesScyllaDB
 

What's hot (20)

eBPF in the view of a storage developer
eBPF in the view of a storage developereBPF in the view of a storage developer
eBPF in the view of a storage developer
 
Current and Future of Non-Volatile Memory on Linux
Current and Future of Non-Volatile Memory on LinuxCurrent and Future of Non-Volatile Memory on Linux
Current and Future of Non-Volatile Memory on Linux
 
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
 
Task migration using CRIU
Task migration using CRIUTask migration using CRIU
Task migration using CRIU
 
Linux rt in financial markets
Linux rt in financial marketsLinux rt in financial markets
Linux rt in financial markets
 
Kernel Recipes 2016 - kernelci.org: 1.5 million kernel boots (and counting)
Kernel Recipes 2016 - kernelci.org: 1.5 million kernel boots (and counting)Kernel Recipes 2016 - kernelci.org: 1.5 million kernel boots (and counting)
Kernel Recipes 2016 - kernelci.org: 1.5 million kernel boots (and counting)
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farmKernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
 
Memory management
Memory managementMemory management
Memory management
 
Kernel Recipes 2017 - What's new in the world of storage for Linux - Jens Axboe
Kernel Recipes 2017 - What's new in the world of storage for Linux - Jens AxboeKernel Recipes 2017 - What's new in the world of storage for Linux - Jens Axboe
Kernel Recipes 2017 - What's new in the world of storage for Linux - Jens Axboe
 
Lect18
Lect18Lect18
Lect18
 
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
Revisão: Forwarding Metamorphosis: Fast Programmable Match-Action Processing ...
 
Getting Started with Performance Co-Pilot
Getting Started with Performance Co-PilotGetting Started with Performance Co-Pilot
Getting Started with Performance Co-Pilot
 
Linux kernel memory allocators
Linux kernel memory allocatorsLinux kernel memory allocators
Linux kernel memory allocators
 
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan BaljevicUnix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
 
BKK16-317 How to generate power models for EAS and IPA
BKK16-317 How to generate power models for EAS and IPABKK16-317 How to generate power models for EAS and IPA
BKK16-317 How to generate power models for EAS and IPA
 
Threading Successes 06 Allegorithmic
Threading Successes 06   AllegorithmicThreading Successes 06   Allegorithmic
Threading Successes 06 Allegorithmic
 
Term Project Presentation (4)
Term Project Presentation (4)Term Project Presentation (4)
Term Project Presentation (4)
 
Xen Debugging
Xen DebuggingXen Debugging
Xen Debugging
 
BKK16-208 EAS
BKK16-208 EASBKK16-208 EAS
BKK16-208 EAS
 
DB Latency Using DRAM + PMem in App Direct & Memory Modes
DB Latency Using DRAM + PMem in App Direct & Memory ModesDB Latency Using DRAM + PMem in App Direct & Memory Modes
DB Latency Using DRAM + PMem in App Direct & Memory Modes
 

Similar to UKUUG presentation about µCLinux on Pluto 6

Rendering Battlefield 4 with Mantle by Johan Andersson - AMD at GDC14
Rendering Battlefield 4 with Mantle by Johan Andersson - AMD at GDC14Rendering Battlefield 4 with Mantle by Johan Andersson - AMD at GDC14
Rendering Battlefield 4 with Mantle by Johan Andersson - AMD at GDC14AMD Developer Central
 
Kvm performance optimization for ubuntu
Kvm performance optimization for ubuntuKvm performance optimization for ubuntu
Kvm performance optimization for ubuntuSim Janghoon
 
SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016Koan-Sin Tan
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and InsightsGlobalLogic Ukraine
 
High Performance Computer Architecture
High Performance Computer ArchitectureHigh Performance Computer Architecture
High Performance Computer ArchitectureSubhasis Dash
 
Presentation sun stor edge 9990 system technical
Presentation   sun stor edge 9990 system technicalPresentation   sun stor edge 9990 system technical
Presentation sun stor edge 9990 system technicalxKinAnx
 
AMP Kynetics - ELC 2018 Portland
AMP  Kynetics - ELC 2018 PortlandAMP  Kynetics - ELC 2018 Portland
AMP Kynetics - ELC 2018 PortlandKynetics
 
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portlandAsymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portlandNicola La Gloria
 
Advanced performance troubleshooting using esxtop
Advanced performance troubleshooting using esxtopAdvanced performance troubleshooting using esxtop
Advanced performance troubleshooting using esxtopAlan Renouf
 
Rendering Battlefield 4 with Mantle by Yuriy ODonnell
Rendering Battlefield 4 with Mantle by Yuriy ODonnellRendering Battlefield 4 with Mantle by Yuriy ODonnell
Rendering Battlefield 4 with Mantle by Yuriy ODonnellAMD Developer Central
 
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]RootedCON
 
DB2 for z/OS - Starter's guide to memory monitoring and control
DB2 for z/OS - Starter's guide to memory monitoring and controlDB2 for z/OS - Starter's guide to memory monitoring and control
DB2 for z/OS - Starter's guide to memory monitoring and controlFlorence Dubois
 
lecture11_GPUArchCUDA01.pptx
lecture11_GPUArchCUDA01.pptxlecture11_GPUArchCUDA01.pptx
lecture11_GPUArchCUDA01.pptxssuser413a98
 
Optimizing Servers for High-Throughput and Low-Latency at Dropbox
Optimizing Servers for High-Throughput and Low-Latency at DropboxOptimizing Servers for High-Throughput and Low-Latency at Dropbox
Optimizing Servers for High-Throughput and Low-Latency at DropboxScyllaDB
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyLinaro
 
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese..."Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...Edge AI and Vision Alliance
 

Similar to UKUUG presentation about µCLinux on Pluto 6 (20)

module4.ppt
module4.pptmodule4.ppt
module4.ppt
 
Rendering Battlefield 4 with Mantle by Johan Andersson - AMD at GDC14
Rendering Battlefield 4 with Mantle by Johan Andersson - AMD at GDC14Rendering Battlefield 4 with Mantle by Johan Andersson - AMD at GDC14
Rendering Battlefield 4 with Mantle by Johan Andersson - AMD at GDC14
 
Rendering Battlefield 4 with Mantle
Rendering Battlefield 4 with MantleRendering Battlefield 4 with Mantle
Rendering Battlefield 4 with Mantle
 
Kvm performance optimization for ubuntu
Kvm performance optimization for ubuntuKvm performance optimization for ubuntu
Kvm performance optimization for ubuntu
 
SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016SoC Idling for unconf COSCUP 2016
SoC Idling for unconf COSCUP 2016
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and Insights
 
High Performance Computer Architecture
High Performance Computer ArchitectureHigh Performance Computer Architecture
High Performance Computer Architecture
 
Presentation sun stor edge 9990 system technical
Presentation   sun stor edge 9990 system technicalPresentation   sun stor edge 9990 system technical
Presentation sun stor edge 9990 system technical
 
AMP Kynetics - ELC 2018 Portland
AMP  Kynetics - ELC 2018 PortlandAMP  Kynetics - ELC 2018 Portland
AMP Kynetics - ELC 2018 Portland
 
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portlandAsymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
 
Advanced performance troubleshooting using esxtop
Advanced performance troubleshooting using esxtopAdvanced performance troubleshooting using esxtop
Advanced performance troubleshooting using esxtop
 
Rendering Battlefield 4 with Mantle by Yuriy ODonnell
Rendering Battlefield 4 with Mantle by Yuriy ODonnellRendering Battlefield 4 with Mantle by Yuriy ODonnell
Rendering Battlefield 4 with Mantle by Yuriy ODonnell
 
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
Jaime Peñalba - Kernel exploitation. ¿El octavo arte? [rooted2019]
 
DB2 for z/OS - Starter's guide to memory monitoring and control
DB2 for z/OS - Starter's guide to memory monitoring and controlDB2 for z/OS - Starter's guide to memory monitoring and control
DB2 for z/OS - Starter's guide to memory monitoring and control
 
Linux based Stubdomains
Linux based StubdomainsLinux based Stubdomains
Linux based Stubdomains
 
100Gbps OpenStack For Providing High-Performance NFV
100Gbps OpenStack For Providing High-Performance NFV100Gbps OpenStack For Providing High-Performance NFV
100Gbps OpenStack For Providing High-Performance NFV
 
lecture11_GPUArchCUDA01.pptx
lecture11_GPUArchCUDA01.pptxlecture11_GPUArchCUDA01.pptx
lecture11_GPUArchCUDA01.pptx
 
Optimizing Servers for High-Throughput and Low-Latency at Dropbox
Optimizing Servers for High-Throughput and Low-Latency at DropboxOptimizing Servers for High-Throughput and Low-Latency at Dropbox
Optimizing Servers for High-Throughput and Low-Latency at Dropbox
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case study
 
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese..."Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
 

Recently uploaded

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Recently uploaded (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

UKUUG presentation about µCLinux on Pluto 6

  • 1. Uclinux on the Pluto 6 From this.... To this...
  • 2. Edwin Langley : Heber edwin@heber.co.uk Craig Duffy : University of the West of England Craig.Duffy@uwe.ac.uk
  • 3. Project Origin Pluto 6 Fruit machine controller board made by Heber:
  • 4. ● Heber have developed their own in- house monitor/executive – It has drivers written from scratch by Heber – It is fast, and well understood – We provide to customers drivers compiled to Library object files ● However there is a problem... – Future boards may use more complex peripheral buses – We will require more complex software ● E.G. TCP/IP stack, USB hosting Project Origin
  • 5. ● A version of the Linux kernel for microcontrollers without a MMU ● First port in January 1998 by Rt-Control ● Differences to Linux - uClinux has: – No virtual address spaces; applications must be linked to absolute addresses – No memory protection – To have drivers altered to operate through local bus instead of ISA/PCI, with bigger interrupt vector ranges Background to uClinux
  • 6. ● Create development environment – Obtain tool chain – m68k-elf-gdb ● Create new board configuration ● Edit entry assembly in crt0_ram.S – Set variables _rambase, _ramstart, _ramend, _ramvec. ● Edit linker script in ram.ld – Link to DRAM at 0x60000000 Porting uClinux to the Pluto 6
  • 7. ● Crashed in kernel during boot: – Assembly variables were wrong ● #define MEM_SIZE 0x0016fefc – PAGE_OFFSET was wrong – Stack corruption ● Set SP to end of external SRAM – MBAR wrongly set to address of SRAM ● #define MCF_MBAR 0x10000000 Porting uClinux to the Pluto 6
  • 8. – Romfs too big ● _ramstart calculated > _ramend Porting uClinux to the Pluto 6 RAM .text .data .romfs 0x60000000 _stext _sdata _sbss _ebss Dynamic memory 0x6016FEFC A0 A1 A0 + ROMFS size A1 + ROMFS size Copy data from end forwards – VBR set to start of RAM, overwriting kernel – Set _ramvec to ColdFire internal SRAM ● Finally a working kernel! – But...
  • 9. ● 2Mb of DRAM doesn't give even uClinux much room to do anything – After 3 commands, memory is too fragmented to load programs: Porting uClinux to the Pluto 6 – Romfs contents restricted – Tools are required to test drivers /bin> vi __alloc_pages: 0-order allocation failed (gfp=0x1d2/0) __alloc_pages: 4-order allocation failed (gfp=0x1f0/0) Allocation of length 65000 from process 20 failed Free pages: 136kB ( 0kB HighMem) Zone:DMA freepages: 0kB Zone:Normal freepages: 136kB Zone:HighMem freepages: 0kB ( Active: 5, inactive: 27, free: 34 ) = 0kB) 6*4kB 2*8kB 2*16kB 0*32kB 1*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB = 136kB) = 0kB)
  • 10. Running the kernel from VRAM ● Problem: program counter incrementing incorrectly ● Possibly cache related
  • 11. ● Initial solution to use video card RAM ● Solution found and borrowed from Heber: Getting more memory ● Finally a working USABLE kernel! FPGA for DRAM to local bus decoding DRAM Battery 16Mb local bus interface DRAM card
  • 12. ● Vacuum Fluorescent Display – Simple character device – Clock ASCII characters in through 2 line serial port Time to write some drivers! /> echo hello world! > /dev/vfd0
  • 13. ● FPGA controls 256 lamps as 16 strobes of 32, each has 8 brightness levels ● Every 1ms, software must: – fill 8 32 bit data registers, each bit corresponds to one lamp – Write the strobe number to illuminate to the MPX control register in the FPGA ● The FPGA splits the 1ms period into 8 segments, using 1 data register for each ● Each bit of each data register = 1/8ms Multiplexed lamp driver
  • 14. ● Problem: – Kernel timer used to rewrite lamp registers every millisecond – Interrupt set for next jiffy, which is incremented by timer interrupt – Timer interrupt frequency determined by HZ – HZ default is 100 (every 10ms) – Lamps flash (on for 1ms, off for 9ms) – Increased HZ to 1000 Multiplexed lamp driver
  • 15. ● Choosing interface to user space – Write a char for brightness of each lamp ● 1 file for all 256 lamps – Big overhead to change 1 lamp ● 1 file for each lamp – 256*3*2=1536 context switches ● Best compromise – 1 file for each lamp strobe Multiplexed lamp driver
  • 16. Multiplexed lamp driver /> echo 0123456776543210 > /dev/lamps10 /> echo 0707070707070707 > /dev/lamps15
  • 17. Frame buffer driver ● Graphics were a key part of project ● Two options – Port a Denx Coral P X server on a PPC board accessed through PCI running full Linux – Write a frame buffer driver from scratch Cremson video controller DRAM Fujitsu Calypso 32 Graphics card
  • 18. Frame buffer driver ● Not a lot of design required ● But understanding of sub system is required ● Values written to Cremson stored in a par structure – Initial par instance with set values used for testing ● 1024x768x16 fb_info fb_var_screeninfo fb_fix_screeninfo fb_monospecs fb_ops * fb_ops fbgen_get_fix() fbgen_get_var() fbgen_set_var() fbgen_get_cmap() fbgen_set_cmap() fbgen_pan_display()fb_cmap display * display Par * cremsonfb_info fb_info_gen fbgen_hwswitch * cremsonfb_switch cremson_detect() cremson_encode_fix() cremson_decode_var() cremson_encode_var() cremson_get_par() cremson_set_par() cremson_get_getcolreg() cremson_set_getcolreg() cremson_pan_display() cremson_blank() cremson_set_disp() uint32_t fbcon_cmap[256] void *screen_base_phys void *screen_base_virt uint32_t vid_mem_len par Cremson register copies unsigned int parsize
  • 19. Frame buffer driver ● Lots of code mistakes before finally:
  • 20. Frame buffer driver ● Endian issue, added byte swaps to macros in fb_con.h:
  • 21. Frame buffer driver ● Forgot to allocate memory to 16 entry console pseudo palette:
  • 22. Frame buffer driver ● Had a try with 8 bit indirect colour mode ● Created a new par instance
  • 23. Frame buffer driver ● Set bit field lengths in fb_var_screeninfo to 8:
  • 24. Frame buffer driver ● Set layer width in Cremson correctly:
  • 25. Frame buffer driver ● Finally, set the palette tables in video memory in cremson_setcolreg():
  • 26. Nano X ● A pain to compile
  • 27. IDE ● Used a generic driver provided by uClinux ● FPGA outputs same interrupt level for CompactFlash and Cremson ● Lots of trouble with Cremson Vsync interrupt while unmasking in ColdFire for the IDE – Mask Vsync on Cremson – Unmask interrupt vector on ColdFire ● Copied romfs to CompactFlash card ● Altered kernel command line to mount as root FS
  • 28. eXecute In Place ● Tried XIP with romfs – Romfs scrambled when copying .data and .init from ROM area to RAM area – No need for romfs with a working disk present ● Added initial vector table to crt0_rom.S ● Split DRAM card into 2 Mb "ROM" and the rest as RAM area ● Could finally boot straight into uClinux at power on MEMORY { flash : ORIGIN = 0x00000000, LENGTH = 0x00200000 ram : ORIGIN = 0x00200000, LENGTH = 0x00E00000 }
  • 29. ● Project was successful ● Verdict – Board is rather slow – Accumulated knowledge for future Heber boards ● Lessons learned – Understand code before starting ● learned lesson porting ● used lesson on frame buffer – Learned lots about kernel programming Conclusion