Skip to content

Commit f6e974e

Browse files
committed
Initial version of the Embedded Systems labs
Initial version of the Embedded Systems laboratory exercises
1 parent af0c422 commit f6e974e

File tree

654 files changed

+30140
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

654 files changed

+30140
-2
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Releases directory
2+
release/
3+
4+
# iv Files
5+
*.swp
6+

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 fpgacademy
3+
Copyright (c) 2021 FPGAcademy.org
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
# LabExercisesEmbeddedSystems
1+
# Embedded Systems Laboratory Exercises
2+
3+
These laboratory exercises cover such topics as: introduction to ARM processors and FPGA systems, introduction to
4+
embedded Linux and code development in an embedded environment, memory-mapped I/O with virtual memory in user and
5+
kernel space, kernel modules (device drivers), interrupts, and I/O devices such as buttons, switches, lights,
6+
timers, accelerometers, audio, video, A/D, USB peripherals, and developing custom hardware systems in the FPGA.

common/docs/copyright.tex

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
%%% FPGAcademy Copyright Information %%%
3+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4+
5+
%Always put the copyright on a new page (clear page), with some vertical space from top
6+
\clearpage
7+
\vspace{1in}
8+
9+
\noindent
10+
11+
Copyright {\copyright} FPGAcademy.org. All rights reserved. FPGAcademy and the
12+
FPGAcademy logo are trademarks of FPGAcademy.org. This document is provided
13+
"as is", without warranty of any kind, express or implied, including but not
14+
limited to the warranties of merchantability, fitness for a particular purpose
15+
and noninfringement. In no event shall the authors or copyright holders be
16+
liable for any claim, damages or other liability, whether in an action of
17+
contract, tort or otherwise, arising from, out of or in connection with the
18+
document or the use or other dealings in the document.
19+
~\\
20+
~\\
21+
**Other names and brands may be claimed as the property of others.
22+

common/docs/defaulttext.tex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
\newcommand{\UPDatePublished}{Oct 2021}
2+
\newcommand{\versnum}{21.1} %version number quartus/AMP
3+
\newcommand{\quartusname}{Quartus\textsuperscript{\textregistered} Prime}
4+
\newcommand{\UPTextBar}{For \quartusname{} \versnum{}}
5+
\newcommand{\thisyear}{2021 } %for copyright
6+
\newcommand{\company}{FPGAcademy.org}
7+
\newcommand{\longteamname}{FPGAcademy.org}
8+
\newcommand{\teamname}{FPGAcademy}
9+
\newcommand{\website}{FPGAcademy.org}
10+
11+
\newcommand{\productAcronym}{AMP}
12+
\newcommand{\productNameShort}{Monitor Program}
13+
14+
\newcommand{\productNameMedTM}{A Monitor Program}
15+
\newcommand{\productNameMed}{A Monitor Program}
16+
17+
%\newcommand{\headerLogoFilePath}[1]{#1/FPGAcademy.png}

common/docs/listingsstyles.tex

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
% listings is a package that supports encapsulating source code in LaTeX conveniently
2+
\usepackage{listings}
3+
4+
\def\expandparam\lstinputlisting[#1]#2{\edef\tmp{\noexpand\lstinputlisting[#1]{#2}}\tmp}
5+
6+
%%%%%%%%%%%%%%%%%%%% Source Code Formatting %%%%%%%%%%%%%%%%%%%%
7+
\definecolor{globalCommentColour}{rgb}{0.588,0.588,0.588}
8+
9+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10+
% Defining language style
11+
% NiosII ASM
12+
\lstdefinelanguage[NiosII]{Assembler} {
13+
morekeywords={add, addi, and, andhi, andi, beq, bge, bgeu, bgt, bgtu, ble, bleu, blt, bltu, bne, br, break,
14+
bret, call, callr, cmpeq, cmpeqi, cmpge, cmpgei, cmpgeu, cmpgeui, cmpgt, cmpgti, cmpgtu, cmpgtui, cmple,
15+
cmplei, cmpleu, cmpleui, cmplt, cmplti, cmpltu, cmpltui, cmpne, cmpnei, custom, div, divu, eret, flushd,
16+
flushda, flushi, flushp, initd, initda, initi, jmp, jmpi, ldb, ldbio, ldbu, ldbuio, ldh, ldhio, ldhu, ldhuio,
17+
ldw, ldwio, mov, movhi, movi, movia, movui, mul, muli, mulxss, mulxsu, mulxuu, nextpc, nop, nor, or, orhi, ori,
18+
rdctl, rdprs, ret, rol, roli, ror, sll, slli, sra, srai, srl, srli, stb, stbio, sth, sthio, stw, stwio,
19+
sub, subi, sync, trap, wrctl, wrtcl, wrprs, xor, xori, xorhi, xori},
20+
morekeywords=[2]{.abort, .ABORT, .align, .app-file, .ascii, .asciz, .balign, .byte, .comm, .data, .def,
21+
.desc, .dim, .double, .eject, .else, .end, .endef, .endif, .equ, .equiv, .err, .extern, .file, .fill, .float,
22+
.global, .globl, .hword, .ident, .if, .include, .int, .irp, .irpc, .lcomm, .lflags, .line, .linkonce, .ln,
23+
.list, .long, .macro, .mri, .nolist, .octa, .org, .p2align, .psize, .quad, .rept, .sbttl, .scl, .section,
24+
.set, .short, .single, .size, .sleb128, .skip, .space, .stadb, .stabn, .stabs, .string, .symver, .tag,
25+
.text, .title, .type, .val, .uleb128, .word},
26+
morekeywords=[3]{et, bt, gp, sp, fp, ea, sstatus, ra, pc, status, estatus, bstatus, ienable, ipending, cpuid,
27+
exception, pteaddr, tlbacc, tlbmisc, eccinj, badaddr, config, mpubase, mpuacc},
28+
sensitive=t,
29+
alsoletter=.,
30+
morestring=[b]",
31+
morecomment=[s]{/*}{*/},
32+
morecomment=[l]\#,
33+
}[keywords,comments,strings]
34+
35+
%% NOTE: morekeywords=[2] are GNU directives.
36+
37+
\definecolor{niosInstructionColour}{rgb}{0.000,0.608,0.000}
38+
\definecolor{niosDirectiveColour}{rgb}{0.000,0.000,0.902}
39+
\definecolor{niosSpecialRegColour}{rgb}{0.000,0.000,0.000}
40+
\definecolor{niosStringColour}{rgb}{0.808,0.482,0.000}
41+
42+
%% NOTE: To make bold use: =\bfseries\color{<colour>}
43+
\lstdefinestyle{defaultNiosStyle} {
44+
language=[NiosII]{Assembler},
45+
stringstyle=\color{niosStringColour},
46+
keywordstyle=\color{niosInstructionColour},
47+
keywordstyle=[2]\color{niosDirectiveColour},
48+
keywordstyle=[3]\itshape\color{niosSpecialRegColour}
49+
}
50+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51+
52+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53+
% Defining language style
54+
% ArmA9 ASM
55+
\lstdefinelanguage[ArmA9]{Assembler} {
56+
morekeywords={ADC, ADD, ADDS, AND, ANDS, B, BAL, BEQ, BGE, BGT, BL, BLT, BIC, BKPT, BLX, BNE, BX, CDP, CLZ, CMN, CMP, EOR,
57+
EORS, LDC, LDM, LDR, LDRB, LDRBT, LDRH, LDRSB, LDRSH, LDRT, LSL, MCR, MLA, MOV, MOVW, MOVT, MRC, MRS, MSR, MUL, MVN, ORR, PLD,
58+
ROR, RSB, RSC, SBC, SMLAL, SMULL, STC, STM, STR, STRB, STRBT, STRH, STRT, SUB, SUBS, SWI, SWP, SWPB, TEQ, UMLAL,
59+
PUSH, POP, MOVS, RORS, LSR},
60+
morekeywords=[2]{.abort, .ABORT, .align, .app-file, .ascii, .asciz, .balign, .byte, .comm, .data, .def,
61+
.desc, .dim, .double, .eject, .else, .end, .endef, .endif, .equ, .equiv, .err, .extern, .file, .fill, .float,
62+
.global, .globl, .hword, .ident, .if, .include, .int, .irp, .irpc, .lcomm, .lflags, .line, .linkonce, .ln,
63+
.list, .long, .macro, .mri, .nolist, .octa, .org, .p2align, .psize, .quad, .rept, .sbttl, .scl, .section,
64+
.set, .short, .single, .size, .sleb128, .skip, .space, .stadb, .stabn, .stabs, .string, .symver, .tag,
65+
.text, .title, .type, .val, .vectors, .uleb128, .word},
66+
morekeywords=[3]{SP, PC, MIDR, CTR, TCMTR, TLBTR, MPIDR, ID_PFR0, ID_PFR1, ID_DFR0, ID_MMFR0, ID_MMFR1, ID_MMFR2,
67+
ID_MMFR3, ID_ISAR0, ID_ISAR1, ID_ISAR2, ID_ISAR3, ID_ISAR4, CCSIDR, CLIDR, AIDR, CSSELR, TTBR0, TTRB1, TTBR2, DACR,
68+
DFSR, IFSR, ADFSR, AIFSR, DFAAR, IFAR, ICIALLUIS, BPIALLIS, PAR, ICIALLU, ICIMVAU, BPIALL, DCIMVAC, DCISW, V2PCWPR,
69+
DCCVAC, DCCSW, DDIMVAC, DCISW, TLBALLIS, TLBIMVAIS, TLBIASIDIS, TLBIMVAAIS, TLBIALL, TLBIMVA, TLBIASID, TLBIMVAA,
70+
PMCR, PMCNTENSET, PMCNTENCLR, PMOVSR, PMSWINC, PMSELR, PMXEVTYPER, PMXEVCNTR, PMUSERENR, PMINTENSET, PMINTENCLR,
71+
PRRR, NRRR, PLEIDR, PLEASR, PLEFSR, PLEUAR, PLEPCR, VBAR, MVBAR, ISR, FCSEIDR, CONTEXTIDR, TPIDRURW, TPIDRURO, TPIDRPRW},
72+
sensitive=f,
73+
alsoletter=.,
74+
morestring=[b]",
75+
morecomment=[s]{/*}{*/},
76+
morecomment=[l]{//},
77+
}[keywords,comments,strings]
78+
79+
%% NOTE: morekeywords=[2] are GNU directives.
80+
81+
\definecolor{armInstructionColour}{rgb}{0.000,0.608,0.000}
82+
\definecolor{armDirectiveColour}{rgb}{0.000,0.000,0.902}
83+
\definecolor{armSpecialRegColour}{rgb}{0.000,0.000,0.000}
84+
\definecolor{armStringColour}{rgb}{0.808,0.482,0.000}
85+
86+
\lstdefinestyle{defaultArmStyle} {
87+
language=[ArmA9]{Assembler},
88+
stringstyle=\color{armStringColour},
89+
keywordstyle=\color{armInstructionColour},
90+
keywordstyle=[2]\color{armDirectiveColour},
91+
keywordstyle=[3]\itshape\color{armSpecialRegColour}
92+
}
93+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94+
95+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96+
% Defining language style
97+
% FPGAcademy ASM
98+
\lstdefinelanguage{ASM}{
99+
morekeywords = [1]{mv, mvt, mvne, mvcc, add, sub, st, ld, and, b, bne, beq, bcc, bcs},
100+
morekeywords = [2]{word, define},
101+
keywordstyle = [1]\color{ForestGreen},
102+
keywordstyle = [2]\color{blue},
103+
sensitive = true,
104+
morecomment = [l]{//},
105+
}
106+
107+
\lstset{
108+
language = ASM,
109+
basicstyle=\small\color{black}\ttfamily,
110+
commentstyle=\small\color{Brown}\itshape\ttfamily,
111+
showstringspaces=false,
112+
frame=none, %lines % boxed listings
113+
breaklines=true,
114+
breakatwhitespace=true,
115+
tabsize=3
116+
}
117+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118+
119+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120+
% Defining language style
121+
% Java
122+
\definecolor{javaStringColour}{rgb}{0.808,0.482,0}
123+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124+
125+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126+
% Defining language style
127+
% C
128+
\definecolor{CStringColour}{rgb}{0.808,0.482,0}
129+
130+
\lstset{
131+
language = C,
132+
basicstyle=\small\color{black}\ttfamily,
133+
commentstyle=\small\color{PineGreen}\itshape\ttfamily,
134+
keywordstyle=\small\color{blue}\bfseries\ttfamily,
135+
showstringspaces=false,
136+
frame=none, %lines % boxed listings
137+
breaklines=true,
138+
breakatwhitespace=true,
139+
tabsize=3
140+
}
141+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142+
143+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
144+
% Defining language style
145+
% Verilog
146+
\definecolor{verilogCommentColour}{rgb}{0.000,0.502,0.000}
147+
148+
\lstdefinestyle{defaultVerilogStyle} {
149+
language={Verilog},
150+
keywordstyle=\color{blue},
151+
commentstyle=\color{verilogCommentColour}
152+
}
153+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
154+
155+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156+
% Defining language style
157+
% VHDL
158+
\lstdefinestyle{defaultVHDLStyle} {
159+
language={VHDL},
160+
keywordstyle=\color{blue},
161+
commentstyle=\color{verilogCommentColour}
162+
}
163+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
164+
165+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166+
% Defining language style
167+
% LaTeX
168+
\lstdefinelanguage[LocalLaTeX]{TeX}[LaTeX]{TeX}{moretexcs={bf, it, sf, lstset},}
169+
170+
\lstdefinestyle{defaultLocalLatexStyle} {
171+
language=[LocalLatex]{TeX},
172+
keywordstyle=\color{blue}\bfseries,
173+
keywordstyle=[2]\color{blue},
174+
keywordstyle=[3]\color{blue}\bfseries
175+
}
176+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
177+
178+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
179+
% Defining language style
180+
% Default
181+
\lstset{
182+
basicstyle=\small\color{black}\ttfamily,
183+
commentstyle=\small\color{globalCommentColour}\itshape\ttfamily,
184+
keywordstyle=\small\color{blue}\bfseries\ttfamily,
185+
showstringspaces=false,
186+
frame=none, %lines % boxed listings
187+
breaklines=true,
188+
breakatwhitespace=true,
189+
tabsize=3
190+
}
191+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

common/docs/preamble.tex

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
\addtolength{\textwidth}{1.5in}
2+
\addtolength{\oddsidemargin}{-0.75in}
3+
\addtolength{\topmargin}{-0.75in}
4+
\addtolength{\textheight}{1.5in}
5+
\addtolength{\evensidemargin}{0.75in}
6+
\setlength\parindent{0pt}
7+
\raggedbottom
8+
9+
\usepackage{ae,aecompl}
10+
\usepackage{epsfig,float,times}
11+
\usepackage[hypcap]{caption}
12+
\usepackage[pdftex, colorlinks]{hyperref}
13+
\usepackage{graphicx}
14+
\usepackage[usenames, dvipsnames]{color}
15+
\usepackage{rotating}
16+
\usepackage{tikz}
17+
\usetikzlibrary{automata,positioning}
18+
\usepackage{placeins}
19+
20+
\widowpenalty 10000
21+
\clubpenalty 10000
22+
23+
\newcommand{\red}[1]{{\color{red}\sf{#1}}}
24+
\newcommand{\green}[1]{{\color{green}\sf{#1}}}
25+
\newcommand{\blue}[1]{{\color{blue}\sf{#1}}}
26+
\definecolor{PineGreen}{rgb}{0.0, 0.47, 0.44}
27+
\definecolor{ForestGreen}{rgb}{0.13, 0.55, 0.13}
28+
\definecolor{Brown}{rgb}{0.59, 0.29, 0.0}
29+
30+
\input{\CommonDocsPath/defaulttext.tex}
31+
\input{\CommonDocsPath/listingsstyles.tex}
32+
33+
\hypersetup{
34+
pdftitle={Embedded Systems Lab Exercise \LabNum},
35+
linkcolor=blue,
36+
hyperindex=true,
37+
pdfauthor={FPGAcademy.org},
38+
pdfkeywords={FPGAcademy.org, FPGAcademy, Lab, Exercise, Embedded Systems},
39+
bookmarks,
40+
bookmarksopen=false,
41+
filecolor=blue,
42+
pdfstartview={FitH},
43+
urlcolor=blue,
44+
plainpages=false,
45+
pdfpagelabels=true,
46+
linkbordercolor={1 1 1} %no color for link border
47+
}
48+

lab1/design_files/DE1-SoC/README.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The file part2 is an ARM executable program. It is a sample solution to Part II. This sample
2+
solution exits after 12 seconds.
3+
4+
The file part3.ko is a kernel module. It is a sample solution using the HEX0 display for Part III.
5+
6+
The file part3_ASCII.ko is a kernel module. It is a sample solution using the Terminal window
7+
for Part III.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* Memory */
2+
#define DDR_BASE 0x00000000
3+
#define DDR_SPAN 0x3FFFFFFF
4+
#define A9_ONCHIP_BASE 0xFFFF0000
5+
#define A9_ONCHIP_SPAN 0x0000FFFF
6+
#define SDRAM_BASE 0xC0000000
7+
#define SDRAM_SPAN 0x03FFFFFF
8+
#define FPGA_ONCHIP_BASE 0xC8000000
9+
#define FPGA_ONCHIP_SPAN 0x0003FFFF
10+
#define FPGA_CHAR_BASE 0xC9000000
11+
#define FPGA_CHAR_SPAN 0x00001FFF
12+
13+
/* Cyclone V FPGA devices */
14+
#define LW_BRIDGE_BASE 0xFF200000
15+
16+
#define LEDR_BASE 0x00000000
17+
#define HEX3_HEX0_BASE 0x00000020
18+
#define HEX5_HEX4_BASE 0x00000030
19+
#define SW_BASE 0x00000040
20+
#define KEY_BASE 0x00000050
21+
#define JP1_BASE 0x00000060
22+
#define JP2_BASE 0x00000070
23+
#define PS2_BASE 0x00000100
24+
#define PS2_DUAL_BASE 0x00000108
25+
#define JTAG_UART_BASE 0x00001000
26+
#define JTAG_UART_2_BASE 0x00001008
27+
#define IrDA_BASE 0x00001020
28+
#define TIMER0_BASE 0x00002000
29+
#define TIMER1_BASE 0x00002020
30+
#define AV_CONFIG_BASE 0x00003000
31+
#define PIXEL_BUF_CTRL_BASE 0x00003020
32+
#define CHAR_BUF_CTRL_BASE 0x00003030
33+
#define AUDIO_BASE 0x00003040
34+
#define VIDEO_IN_BASE 0x00003060
35+
#define ADC_BASE 0x00004000
36+
37+
#define LW_BRIDGE_SPAN 0x00005000
38+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* FPGA interrupts (there are 64 in total; only a few are defined below) */
2+
#define TIMER0_IRQ 72
3+
#define KEY_IRQ 73
4+
#define TIMER1_IRQ 74
5+
#define FPGA_IRQ3 75
6+
#define FPGA_IRQ4 76
7+
#define FPGA_IRQ5 77
8+
#define AUDIO_IRQ 78
9+
#define PS2_IRQ 79
10+
#define JTAG_IRQ 80
11+
#define IrDA_IRQ 81
12+
#define FPGA_IRQ10 82
13+
#define JP1_IRQ 83
14+
#define JP2_IRQ 84
15+
#define FPGA_IRQ13 85
16+
#define FPGA_IRQ14 86
17+
#define FPGA_IRQ15 87
18+
#define FPGA_IRQ16 88
19+
#define PS2_DUAL_IRQ 89
20+
#define FPGA_IRQ18 90
21+
#define FPGA_IRQ19 91

0 commit comments

Comments
 (0)