Download presentation
Presentation is loading. Please wait.
Published byGavin Wood Modified over 9 years ago
1
1 3-Software Design Basics in Embedded Systems
2
2 Development Environment Development processor The processor on which we write and debug our programs Usually a PC Target processor The processor that the program will run on in our embedded system Often different from the development processor Development processorTarget processor
3
3 Development Environment Compiler Linker C File Asm. File Binary File Exec. File Assemble r Library Implementation Phase Debugger Profiler Verification Phase Compilers Cross compiler Runs on one processor, but generates code for another Assemblers Linkers Debuggers Profilers
4
4 Running a Program If development processor is different than target, how can we run our compiled code? Two options: Download to target processor Simulate Simulation One method: Hardware description language But slow, not always available Another method: Instruction set simulator (ISS) Runs on development processor, but executes instructions of target processor
5
5 Instruction Set Simulator For A Simple Processor # include typedef struct { unsigned char first_byte, second_byte; } instruction; instruction program[1024]; //instruction memory unsigned char memory[256]; //data memory void run_program(int num_bytes) { int pc = -1; unsigned char reg[16], fb, sb; while( ++pc < (num_bytes / 2) ) { fb = program[pc].first_byte; sb = program[pc].second_byte; switch( fb >> 4 ) { case 0: reg[fb & 0x0f] = memory[sb]; break; case 1: memory[sb] = reg[fb & 0x0f]; break; case 2: memory[reg[fb & 0x0f]] = reg[sb >> 4]; break; case 3: reg[fb & 0x0f] = sb; break; case 4: reg[fb & 0x0f] += reg[sb >> 4]; break; case 5: reg[fb & 0x0f] -= reg[sb >> 4]; break; case 6: pc += sb; break; default: return –1; } return 0; } int main(int argc, char *argv[]) { FILE* ifs; If( argc != 2 || (ifs = fopen(argv[1], “rb”) == NULL ) { return –1; } if (run_program(fread(program, sizeof(program) == 0) { print_memory_contents(); return(0); } else return(-1); }
6
6 Testing and Debugging Implementation Phase Verification Phase Verification Phase Emulator Debugger / ISS Programmer Development processor (a) (b) External tools ISS Gives us control over time – set breakpoints, look at register values, set values, step-by-step execution,... But, doesn’t interact with real environment Download to board Use device programmer Runs in real environment, but not controllable Compromise: emulator Runs in real environment, at speed or near Supports some controllability from the PC
7
7 Quartus II Development Tool
8
8 Example of File Menu
9
9 New Project Wizard
10
10 Creation of new project
11
11 Adding files to project
12
12 Choose device family and specific device
13
13 Electronic Design Automation Tools
14
14 Summary of project settings
15
15 Quartus II display of created project
16
16 Processing>Start Compilation
17
17 Assignment > Pins For example, SW0,SW1 are connected on FPGA Pins N25,N26. LEDG0 is pin AE22.
18
18 Available pins
19
19 Programming the FPGA: Tools>Programmer Check the Program/Configure box, then click Start. Wait till the progress bar show 100% (done).
20
20 Chapter Summary General-purpose processors Good performance, low NRE, flexible Controller, data-path, and memory Structured languages prevail But some assembly level programming still necessary Many tools available Including instruction-set simulators, and in-circuit emulators ASIPs Microcontrollers, DSPs, network processors, more customized ASIPs Choosing among processors is an important step Designing a general-purpose processor is conceptually the same as designing a single-purpose processor
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.