Download presentation
Presentation is loading. Please wait.
Published byScot Hopkins Modified over 8 years ago
1
Exercise 5: Developing an Embedded Application Write a software application to run on the system that we built in the previous exercise Compile the code using Altera Monitor Program Run the program and examine some debugging features of the Altera Monitor Program 1
2
Application Code (/exercise5/fpga_gpio.c) 2 Read switches and display on LEDs and 7-Segs int main(void)( volatile int * LEDs = (int *) 0xFF200000; volatile int * HEX3_HEX0= (int *) 0xFF200020; volatile int * SW_switch= (int *) 0xFF200040; int hex_conversions[16]= {0x3F,..., 0x71}; while(1) { int value= *SW_switch; *LEDs= value; int first_digit= value & 0xF; int second_digit= (value >> 4) & 0xF; int third_digit= (value >> 8) & 0xF; int hex_value= hex_conversions[first_digit]; hex_value|= hex_conversions[second_digit] << 8; hex_value|= hex_conversions[third_digit] << 16; *HEX3_HEX0= hex_value; }
3
Application Code (/exercise5/fpga_gpio.c) 3 Read switches and display on LEDs and 7-Segs int main(void)( volatile int * LEDs = (int *) 0xFF200000; volatile int * HEX3_HEX0= (int *) 0xFF200020; volatile int * SW_switch= (int *) 0xFF200040; int hex_conversions[16]= {0x3F,..., 0x71}; while(1) { int value= *SW_switch; *LEDs= value; int first_digit= value & 0xF; int second_digit= (value >> 4) & 0xF; int third_digit= (value >> 8) & 0xF; int hex_value= hex_conversions[first_digit]; hex_value|= hex_conversions[second_digit] << 8; hex_value|= hex_conversions[third_digit] << 16; *HEX3_HEX0= hex_value; }
4
Application Code (/exercise5/fpga_gpio.c) 4 Read switches and display on LEDs and 7-Segs int main(void)( volatile int * LEDs = (int *) 0xFF200000; volatile int * HEX3_HEX0= (int *) 0xFF200020; volatile int * SW_switch= (int *) 0xFF200040; int hex_conversions[16]= {0x3F,..., 0x71}; while(1) { int value= *SW_switch; *LEDs= value; int first_digit= value & 0xF; int second_digit= (value >> 4) & 0xF; int third_digit= (value >> 8) & 0xF; int hex_value= hex_conversions[first_digit]; hex_value|= hex_conversions[second_digit] << 8; hex_value|= hex_conversions[third_digit] << 16; *HEX3_HEX0= hex_value; }
5
Program Behaviour 5
6
6
7
Step 1: Start Altera Monitor Program 7
8
Step 2: Create a New Project 8 Sets up the Altera Monitor Program Select files to work with Specify target system
9
Step 2.1: Specify name, directory and architecture 9
10
Step 2.2: Select a Custom System 10
11
Step 2.3: Select Program Type 11
12
Step 2.4: Add Source File 12
13
Step 2.5: Set Board Connection and Select Processor 13
14
Step 2.6: Leave Default Memory Settings 14
15
Step 3: Program the FPGA with the Custom System 15
16
Step 4: Compile and Load 16 Compile your C language program Load the compiled code into the memory on the DE1-SoC board
17
Step 5: Examine the Window Contents 17
18
Step 5: Examine the Window Contents 18 Disassembly
19
Step 5: Examine the Window Contents 19 Registers
20
Step 5: Examine the Window Contents 20 Info & Error Msgs
21
Step 5: Examine the Window Contents 21 Terminal
22
Step 6: Run the Program and Toggle Switches on Board 22
23
Step 7: Pause the Processor 23
24
Step 8: Go to 0xff200000 in Memory Window 24 1 2 3
25
Step 9: Read PIO Registers (Right Click) 25
26
Step 9: Examine Values 26
27
Step 10: Alter the Red LED PIO Register (Double Click) 27
28
Step 11: Test Other Features 28 Single Step
29
Step 11: Test Other Features 29 Breakpoints
30
Step 11: Test Other Features 30 Restart Program
31
Step 12: Disconnect 31
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.