2. WHAT?
● A complete system
○ HW: CPU, BUS, Memory, Peripheral
○ SW: sssimple os
● Language
○ HW: verilog
○ SW: c & assembly
3. WHY?
● Background
○ know a little about C code
○ learning embedded system-stm32f4
● Motivation
○ know about how a computer system run
○ know about CPU and OS relationship
4. Target
● Define software need -> Implement necessary hardware
● Software
○ run basic c program
○ basic function of os kernel
● Hardware
○ CPU
○ BUS
○ Memory
○ Uart(only register)
7. Demo program
A program that can run a basic function of os, include
○ boot for c code environment
○ control kernel mode and user mode
○ set up user tasks
○ context switch
○ comunicate between tasks
11. CPU
I cache D cache I/O port
Master wapper
AMBA-AHB
IM DM Peripheral
Slave wapper Slave wapper Slave wapper
Architecture
Master wapper Master wapper
25. Need to know
mul_u10:
slli $r1, $r0, #2
add $r0, $r1, $r0
slli $r0, $r0, #1
mod_u10:
addi $r1, $r0, #0
jal div_u10
jal mul_u10
sub $r0, $r1, $r0
unsigned div_u10(unsigned n){
q=(n>>1)+(n>>2);
q=q+(q>>4);
q=q+(q>>8);
q=q+(q>>16);
q=q>>3;
r=n-(((q<<2)+q)<<1);
return q+((r+6)>>4);
}
● No implement multiply and divison in CPU
● Compile with -O2 for using array
● Only use “int” type for all variable
● Volatile the variable for peripheral
● ISR need to put in boot.s
29. Final
● Need big screen for staring waveform
● Bugs everywhere
● Be care of using -O3
● Know more about CPU can help c programming
● Definition of HW & SW is different from EE & CS