SlideShare una empresa de Scribd logo
1 de 28
Uclinux on the Pluto 6
Project Origin
Pluto 6 Fruit machine controller board
made by Heber:
● Drivers written from scratch by Heber
● Fast, well understood
● Drivers compiled to Library object files
provided to customers
● Problem
– Future boards may use more complex
peripheral buses
– Requires 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
– No virtual address spaces, applications must
be linked to absolute addresses
– No memory protection
– Drivers altered to operate through local bus
instead of ISA/PCI, with bigger interrupt
vector ranges
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)
● 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 desired 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
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

Más contenido relacionado

La actualidad más candente

Threading Successes 06 Allegorithmic
Threading Successes 06   AllegorithmicThreading Successes 06   Allegorithmic
Threading Successes 06 Allegorithmic
guest40fc7cd
 
Term Project Presentation (4)
Term Project Presentation (4)Term Project Presentation (4)
Term Project Presentation (4)
Louis Loizides PE
 

La actualidad más candente (20)

Memory Bandwidth QoS
Memory Bandwidth QoSMemory Bandwidth QoS
Memory Bandwidth QoS
 
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...
 
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
 
z/VM Performance Analysis
z/VM Performance Analysisz/VM Performance Analysis
z/VM Performance Analysis
 
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
 
Linux rt in financial markets
Linux rt in financial marketsLinux rt in financial markets
Linux rt in financial markets
 
Task migration using CRIU
Task migration using CRIUTask migration using CRIU
Task migration using CRIU
 
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
 
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
 
Linux kernel memory allocators
Linux kernel memory allocatorsLinux kernel memory allocators
Linux kernel memory allocators
 
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 ...
 
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
 
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)
 
Memory management
Memory managementMemory management
Memory management
 
Threading Successes 06 Allegorithmic
Threading Successes 06   AllegorithmicThreading Successes 06   Allegorithmic
Threading Successes 06 Allegorithmic
 
Getting Started with Performance Co-Pilot
Getting Started with Performance Co-PilotGetting Started with Performance Co-Pilot
Getting Started with Performance Co-Pilot
 
Term Project Presentation (4)
Term Project Presentation (4)Term Project Presentation (4)
Term Project Presentation (4)
 
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portlandAsymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
 
Xen Debugging
Xen DebuggingXen Debugging
Xen Debugging
 

Similar a µCLinux on Pluto 6 Project presentation

Kvm performance optimization for ubuntu
Kvm performance optimization for ubuntuKvm performance optimization for ubuntu
Kvm performance optimization for ubuntu
Sim Janghoon
 
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
AMD Developer Central
 
Graphics processing uni computer archiecture
Graphics processing uni computer archiectureGraphics processing uni computer archiecture
Graphics processing uni computer archiecture
Haris456
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
 

Similar a µCLinux on Pluto 6 Project presentation (20)

module4.ppt
module4.pptmodule4.ppt
module4.ppt
 
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
 
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
 
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
 
lecture11_GPUArchCUDA01.pptx
lecture11_GPUArchCUDA01.pptxlecture11_GPUArchCUDA01.pptx
lecture11_GPUArchCUDA01.pptx
 
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
 
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
 
Linux based Stubdomains
Linux based StubdomainsLinux based Stubdomains
Linux based Stubdomains
 
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
“Show Me the Garbage!”, Garbage Collection a Friend or a Foe
 
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo..."Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
 
Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack
 
Graphics processing uni computer archiecture
Graphics processing uni computer archiectureGraphics processing uni computer archiecture
Graphics processing uni computer archiecture
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
 
Bsdtw17: ruslan bukin: free bsd/risc-v and device drivers
Bsdtw17: ruslan bukin: free bsd/risc-v and device driversBsdtw17: ruslan bukin: free bsd/risc-v and device drivers
Bsdtw17: ruslan bukin: free bsd/risc-v and device drivers
 
"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...
 
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
 

Último

Último (20)

Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 

µCLinux on Pluto 6 Project presentation

  • 1. Uclinux on the Pluto 6
  • 2. Project Origin Pluto 6 Fruit machine controller board made by Heber:
  • 3. ● Drivers written from scratch by Heber ● Fast, well understood ● Drivers compiled to Library object files provided to customers ● Problem – Future boards may use more complex peripheral buses – Requires more complex software – E.G. TCP/IP stack, USB hosting Project Origin
  • 4. ● A version of the Linux kernel for microcontrollers without a MMU ● First port in January 1998 by Rt-Control ● Differences to Linux – No virtual address spaces, applications must be linked to absolute addresses – No memory protection – Drivers altered to operate through local bus instead of ISA/PCI, with bigger interrupt vector ranges uClinux
  • 5. ● 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
  • 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
  • 7. – 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...
  • 8. ● 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)
  • 9. ● 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
  • 10. ● 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
  • 11. ● 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
  • 12. ● 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
  • 13. ● 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
  • 14. Multiplexed lamp driver /> echo 0123456776543210 > /dev/lamps10 /> echo 0707070707070707 > /dev/lamps15
  • 15. Frame buffer driver ● Graphics were a desired 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 Calypso 32 Graphics card
  • 16. 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
  • 17. Frame buffer driver ● Lots of code mistakes before finally:
  • 18. Frame buffer driver ● Endian issue, added byte swaps to macros in fb_con.h:
  • 19. Frame buffer driver ● Forgot to allocate memory to 16 entry console pseudo palette:
  • 20. Frame buffer driver ● Had a try with 8 bit indirect colour mode ● Created a new par instance
  • 21. Frame buffer driver ● Set bit field lengths in fb_var_screeninfo to 8:
  • 22. Frame buffer driver ● Set layer width in Cremson correctly:
  • 23. Frame buffer driver ● Finally, set the palette tables in video memory in cremson_setcolreg():
  • 24. Nano X ● A pain to compile
  • 25. 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
  • 26. 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 }
  • 27. ● 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