Systèmes embarqués microprogrammés
EE-310

Objectifs:L'étudiant comprendra les architectures des systèmes embarqués microprogrammés, les architectures des microprocesseurs, hiérarchie de mémoire et les différents périphériques de Entrée/Sortie (E/S) inclus, utilisant comme étude de cas la plate-forme portable Nintendo DS.
Objectives:The student will get to know the architecture of microprogrammed embedded systems, including the microprocessor architecture, memory hierarchy and different input/output peripherals, using as case study the Nintendo DS portable platform.
Horaire:- Cours: Vendredi de 9h00 à 11h00 au GCC 330
- Laboratoire: Vendredi de 14h00 à 16h00 au MED 2 2524
Heures pour poser des questions:- Vendredi, 11h00 - 13h00, office ELG 130 (David Atienza)
- Mardi, 11h00 - 13h00, office ELG 121 (Stefano Albini)
- Vendredi, 12h00 - 14h00, office ELG 134 (Dimitrios Samakovlis)
- Jeudi, 14h00 - 16h00, office ELG 121 (Kai Zhu)
- Jeudi, 11h00 - 13h00, office ELG 121 (Juan Sapriza)
Support du cours: - Diapositives du cours et séries de laboratoire sur Moodle, et livres de réference à la bibliothèque indiqués pendant le cours.
- Planning of sessions and agenda for mid-term and final oral exam (File)
- Stable libnds version (Ubuntu) (File)
- Stable libnds version (MacOS) (File)
- Repository with Practical Works (URL)
- Final NDS Project Preparation Requirements and Submission Guidelines (File)
- Template for NDS project presentation (File)
- Example project presentation - Tetris (File)
- Generic Project Template (File)
- Course Summary Documentation (File)
- Announcements (Forum)
Theory session (1 hour):- Presentation of the course objectives, evaluation format, and introduction to the structure of the sessions with the Nintendo DS.
Lab. session (2 hours):- In this session, it will be explained how to test the given equipment for the laboratory, and the students can review C programming and read the basic Nintendo DS manual of operation.
Material:
- Presentation of Systèmes Embarqués Microprogrammés (File)
- PRACTICAL WORK 1: Labs equipment setup and test (File)
- Cartridge Software M3i (File)
- Cartridge Software R4 (File)
- Cartridge Software R4i-SDHC (File)
- Cartridge Software R4-SDHC-2023 (File)
- Tetris NDS Full Game (File)
- NDS Games - Previous Years (File)
- Additional Documentation (Text and media area)
- Nintendo DS Lite - Official Instruction Booklet from Nintendo (File)
- Complete Guide of GBA and NDS (URL)
Theory session (2 hours):- Microprogrammed Embedded Systems: what, why and when
- Comparisons with traditional embedded systems.
- Main application fields and design constraints.
- System-level architectures: hardware and software.
- C-based cross-development frameworks.
- Case study: Nintendo DS Lite
- Hardware and software architecture overview.
Lab. session (2 hours):- Getting familiar with the NDS cross-compilation environment: How to use the software installed in the VM (eclipse and the toolchain), create a clean environment, compile a project, run it on the simulator.
- Practical Work 2: Starting with C for the Nintendo DS.
- Practical Work 3:
- Setting up the debugger in Eclipse
- Learn how to debug C code in Eclipse
- Advanced programming exercises with C to understand the features of the architecture of the NDS and the correct memory management.
- Learn how to use different compilation options.
Material:
- Introduction to Microprogrammed Embedded Systems (File)
- VIDEO - Introduction to Microprogrammed Embedded Systems (part 1/2) (File)
- VIDEO - Introduction to Microprogrammed Embedded Systems (part 2/2) (File)
- Overview of C Language for Microprogrammed Embedded Systems and Memory Hierarchy Use in NDS (File)
- PRACTICAL WORKS - Introduction and Access Link to the NDS repository on GitLab EPFL (File)
- PRACTICAL WORK 2 – Part A: First steps with the VM (URL)
- Link to Download Page of VirtualBox (URL)
- Link to NDS Image file (URL)
- Clean workspace project of NDS - for Mac computers with Apple Silicon (File)
- DeSmuME (dev+) - NDS emulator for Mac computers with Apple hardware (File)
- PRACTICAL WORK 2 – Part B: “Hello World” (URL)
- PRACTICAL WORK 3 – Advanced C programming (URL)
- Additional Documentation (Text and media area)
- GitQuickRef (File)
Theory session (2 hours):
- Introduction to microprocessor architectures evolution and computational models for computing systems: ARM case study
- NDS memory hierarchy and boot-up process
- ARM microprocessor architectures for the NDS
- ARM instruction set (definition of the main instructions). Registers and purpose.
- How the ARM compiler works: translations from C code structures to assembly code.
- Interacting C programming with assembly.
Lab. Session (2 hours):
- Practical Work 4:
- Examples of ARM assembly for the NDS
- How to insert assembly code directly in C and how to include in C assembly code from a separate assembly file. Use of both modes in the NDS.
Material:
- ARM microprocessors and assembly programming (File)
- PRACTICAL WORK 4 – ARM Assembly on NDS (URL)
- VIDEO - ARM microprocessors and assembly programming (part 1/2) (File)
- VIDEO - ARM microprocessors and assembly programming (part 2/2) (File)
- Additional Documentation and NDS Emulators (Text and media area)
- ARM Instruction Set (File)
- ARM Thumb 16-bit Instruction Set Quick Reference Card (File)
- Advanced Use of the stack in ARM Assembly: ARM/Thumb Procedure Call Standard (File)
- The ARM-THUMB Procedure Call Standard (File)
- ARM Instruction Set Simplified Description - Electronic version (File)
- Additional Support Book - Fundamentals of System-on-Chip Design on Arm Cortex-M Microcontrollers (File)
Theory session (2 hours):- Types of I / O and peripheral management
- I / O interfaces and required management operations
- Synchronization between I / O devices and microprocessors' CPUs
- Prioritizing multiple interrupt sources: multi-level interrupts handling
- I / O management for ARM architectures
- I / O peripheral subsystem in ARM microprocessors
- Management of timers in the NDS using the libnds library
- Use of timers and screen together in the NDS: designing a clock
Lab. session (2 hours):
- Programming exercises combining interrupts using timers and the keys.
- Measure time using timers
- Implementing a chronometer using 2 timers’ interrupt
- Implementing a chronometer using 1 timer
- Refreshing the screen properly using graphic interrupts
- Changing the color of the clock periodically
- Printing lap time with the keys
- Our first simple game with interrupts: The Time Challenge game
Material:
- I/O and Peripheral Devices Management (File)
- PRACTICAL WORK 5 – Timers (URL)
- PRACTICAL WORK 5 (Additional optional) – Time Challenge game (URL)
- SOLUTIONS - Release of solutions for PW3 and PW4 (URL)
- VIDEO - I/O and Peripheral Devices Management (part 1/2) (File)
- VIDEO - I/O and Peripheral Devices Management (part 2/2) (File)
Theory session (2 hours): GRAPHICS I - Fundamental graphics- Colors in the Nintendo DS
- Review of the (V)RAM structure
- Framebuffer mode
Lab. session (2 hours): - Implementation of fundamental graphic functions to draw lines and rectangles or fill shapes using framebuffer mode.
- Drawing basic shapes in the screen (rectangles, lines, triangles) with different colours, degrading the screen and cleaning the screen.
- Additional effects in framebuffer mode: Gray-scale, color inversion, etc.
Material:
- Graphics in the NDS (Part 1) - The Framebuffer Mode (File)
- Git for NDS practical works (File)
- PRACTICAL WORK 6 – Graphics I (Framebuffer mode) (URL)
- PRACTICAL WORK 6 (Additional optional) – Tetris (URL)
- PRACTICAL WORK 6 (Additional optional) – Color degradation, shifting, grayscale (URL)
- SOLUTIONS - Release of solutions for PW5 (URL)
- VIDEO - Graphics in the NDS (Part 1) - The Framebuffer (part 1/2) (File)
- VIDEO - Graphics in the NDS (Part 1) - The Framebuffer (part 2/2) (File)
Theory session (2 hours):- Specific aspects of C coding for embedded systems: arrays/matrices, pointers and memory management
- Presentation about fixed-point arithmetic in microprogrammed embedded systems
- Questions about previous exams and exercises
Lab. session (2 hours):
- Catchup to complete previous practical work sessions
- Suggestion: revisit exercises about C after fixed-point arithmetic lecture this week.
Material:
- Overview of Fixed Point Arithmetic for Embedded Systems (File)
- Fractal animation (File)
- Additional Exercises - Fixed-point (URL)
- SOLUTIONS - Release of solutions for PW6 (URL)
- Additional Documentation (Text and media area)
- "Introduction to C language" Book (French) (File)
- Basic on-line guide to C programming (URL)
- Creating Debug Configuration for NDS (File)
Theory session (2 hours): - GRAPHICS II - Extended rotoscale mode - Video modes for rotoscale
- Palettes and backgrounds
- Data storage in VRAM structure
- Data transfer functions
- Transformation matrix
- Drawing graphics in extended rotoscale mode with the NDS
- Examples transformation matrix
- Converting images for NDS: grit
Lab. session (2 hours):
- Video modes for rotoscale
- Palettes and backgrounds
- Data storage in VRAM structure
- Data transfer functions
- Transformation matrix
- Drawing graphics in extended rotoscale mode with the NDS
- Examples transformation matrix
- Converting images for NDS: grit
Material:
- Graphics in the NDS (Part 2) - The Extended Rotoscale Mode (File)
- PRACTICAL WORK 7 - Extended Rotoscale (URL)
- OPTIONAL EXERCISES - Color gradient (URL)
- ADDITIONAL OPTIONAL EXERCISES - Helicopter animation (URL)
- VIDEO - Graphics in the NDS (Part 2) - The Extended Rotoscale Mode (part 1/2) (File)
- VIDEO - Graphics in the NDS (Part 2) - The Extended Rotoscale Mode (part 2/2) (File)
- Additional Documentation (Text and media area)
- Advanced Affine Matrix Manipulation (File)
Theory session (2 hours): GRAPHICS III - Tiled/text mode
- NDS video modes for tiled mode
- Concepts: tiles and their effects
- Multi-palettes with tiles
- Background representations with tiles
- Review of the (V)RAM structure
- Copying large data sets: direct memory address (DMA)
Lab session (2 hours):- Drawing graphics in tiled/text mode (Part 1)
- Example of custom background definition in tiled mode
- Converting images to tiles: revisit the grit tool
- Implementation of effects using multiple backgrounds in the NDS
- Additional exercises with advanced graphics: change background priorities, large backgrounds, overlapping backgrounds, and use of sprites on backgrounds.
Material:
- Graphics in the NDS (Part 3) - The Tiled Mode (including advanced used of multiple backgrounds and sprites) (File)
- VIDEO - Graphics in the NDS (Part 3) - The Tiled Mode (part 1/2) (File)
- VIDEO - Graphics in the NDS (Part 3) - The Tiled Mode (part 2/2) (File)
- PRACTICAL WORK 8 - Tiled mode (URL)
- OPTIONAL EXERCISES - Sprites (PW8B) (URL)
- OPTIONAL EXERCISES - Chrono display (PW8C) (URL)
- Additional Material (Text and media area)
- Example changing background priorities (File)
- Example using big backgrounds-Moving in Background as racing track (File)
- Example using overlapping backgrounds - Moving clouds (File)
- Example using simple sprite on background - Ball moving on a football field (File)
- Example Project using Multiple Sprites (File)
- Example random Number Generation (File)
Theory session (2 hours): Controls in NDS: keys and touchscreen- Detection of events in controls and I/O handling modes
- Polling for keys and touchscreen: libnds
- Efficient keys management: interrupts triggers and identification
- Tracking complex shapes using the touchscreen
Lab. session (2 hours):- Using controls and graphics in the NDS
- Developing a basic Paint tool
- Try to be the fastest with colors: Simon game
- Adding keypad and touchscreen control to the Tetris
Material:
- Keys and touchscreen in the NDS (File)
- VIDEO - Keys and touchscreen devices (Part 1/2) (File)
- VIDEO - Keys and touchscreen devices (Part 2/2) (File)
- Project source code to complete for example of Multiple Backgrounds and Timer (midterm 2021-2022) (File)
- Background image for example of Multiple Backgrounds and Timer (midterm 2021-2022) (File)
- PRACTICAL WORK 9 - Controls (URL)
- OPTIONAL EXERCISES - Tetris (PW9B) (URL)
- OPTIONAL EXERCISES - Simon game (PW9C) (URL)
- SOLUTIONS FOR PW8 (URL)
- Simple paint example (File)
Theory session (2 hours): Review of solution of midterm 2014-2015 and Q&A session
- An example of mid-term exam (year 2014-2015) will be solved in the classroom all together
- Mid-term practice doing the mid-term exams of the academic years 2017-2018 and 2022-2023 (the solution is available in the Moodle page)
- Sound system management on the NDS
- Adding background music and sounds to the Simon game
- Adding preexisting background music and effects to the Tetris
- Creating a piano keyboard for the NDS
Lab. session ( 2 hours):
- Practice doing the mid-term exam of one of the previous academic years
- Sound system management on the NDS
- Adding background music and sounds to the Simon game
- Adding preexisting background music and effects to the Tetris
- Creating a piano keyboard for the NDS
Material:
- SOLUTIONS OF PW9 (URL)
- Midterm 2014-2015 (copy) (Text and media area)
- Mid-term Exam Questions (2014-2015) (File)
- midterm_code (2014-2015) (File)
- bottom.png (File)
- Midterm Review (2014-2015) (File)
- VIDEO - Midterm Review (2014-2015) (File)
- Comparisons of types of Graphic Modes and Examples of Multiple Backgrounds and Timer (File)
- Sound in the NDS (copy) (Text and media area)
- Sound in the NDS (File)
- PRACTICAL WORK 10 - Sound (URL)
- OPTIONAL EXERCISES - Tetris (PW10B) (URL)
- OPTIONAL EXERCISES - Piano (PW10C) (URL)
- Additional documentation (Text and media area)
- Useful Web for Music (URL)
- Useful wav sound effects (URL)
- Mid-term 2017-2018 (Text and media area)
- Mid-Term Exam Questions (2017-2018) (File)
- midterm_code (2017-2018) (File)
- plate.png (File)
- Mid-Term Review (2017-2018) (File)
Theory session (2 hours): Questions about Midterm, and advanced sound system management- Q&A session about Midterm
- Advanced sound system management on the NDS
- Creating streaming flow with IPC flow between ARM7 and ARM9
- Using the NDS microphone
- Creating a piano keyboard for the NDS: advanced sound effects on WAV format
Lab. session ( 2 hours): Mid-Term Individual Exam (open book, the submission of the different exercises after correction of the teachers should be done using the links below)
- The mid-term exam will take place on Friday, December 1, from 14:15 to 16:00 in the laboratory room MED 2 2524 and MED 2 2419, during the usual laboratory session of the course. Please make sure to come a few minutes before 14:15 to be ready to start on time. Also, do not forget to upload each exercise on the corresponding link on Moodle after the correction of the exercise during the exam by the teachers.
Material:
- Use of Git for the NDS final project (Text and media area)
- Git and GitLab Repositories - Introduction to source code management of NDS projects (File)
- VIDEO: Git Tutorial (URL)
- Midterm_Exam_2024_2025_Instructions (File)
- Midterm_2024_2025_source_code (File)
Theory session (2 hours): Midterm review and secondary storage management in NDS
- Revision of midterm and explanation of solutions
- Secondary storage on the NDS
- Comparisons between memories and secondary storage units
- Components of a file system: files and directories
- Implementations of a file system: contiguous and indirect allocation
- libFAT library methods for files and directories in the NDS
Lab. session ( 2 hours): Secondary management in Nintendo DS
- Secondary Storage on the NDS (2 hours):
- Listing the root directory of the NDS into a file
- Listing all files of an NDS unit into a file
- Adding score counters and managing score records (store and retrieval) in the Tetris Game
- Adding storage and playing saved melodies in a Piano keyboard player
Material:
- Mid-term Review (Academic Year 2024-2025) (File)
- Secondary Storage in the NDS (Text and media area)
- Secondary storage management in the NDS (File)
- PRACTICAL WORK 11 - Secondary storage (URL)
- SOLUTIONS - PRACTICAL WORK 11 (URL)
- OPTIONAL EXERCISES - Tetris (PW11B) (URL)
- OPTIONAL EXERCISES - Piano (PW11C) (URL)
- VIDEO - Secondary storage management in the NDS (File)
Theory session (2 hours): Understanding the use of WiFI in the NDS and Q&A for the final projectsWireless communication in the NDS- General network topology structure
- Internet protocol concepts
- Wireless communication devices in the NDS: Wi-Fi and Bluetooth
- Description of DSWifi library methods for Wi-Fi
- Use of high-level Mini-Wifi library methods for NDS
- Basic Wi-Fi functionality: Send/receive data between two NDS
- Presentation of template slides for the final projects delivery (in groups of two students)
- Questions about the oral exam, and requirements of final project code and presentations
Lab. session (2 hours):- Wifi interface on the NDS:
- Use of high-level Mini-Wifi library methods for NDS
- Basic Wi-Fi functionality: Send/receive data between two NDS
- Work on the Final Project
Material:
- Wireless communication in the NDS (File)
- VIDEO - Wireless communication in the NDS (File)
- Example project presentation - Tetris (File)
- PRACTICAL WORK 12 - WiFi (URL)
- Wireless communication in the NDS (Text and media area)
Theory session (2 hours): Revision Session
- Q&A about theory and projects preparation
Lab. session (2 hours):- Work in the final project.
Material
NOT USED THIS YEAR
Theory (1h):
- Presentation about fixed-point arithmetic in microprogrammed embedded systems.
Work on Team Project (1h):
- Questions about the use of NDS for the projects.
The project here is an example of generating random numbers on the NDS using the real-time-clock.
However, it always return the same number on the emulator, as the emulator does not have a real-time clock.