Top Banner
Code Blocks/SDCC Tutorial 1 © Linden McClure, Ph.D. 10/13/2013
19

Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Feb 07, 2018

Download

Documents

truongliem
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Code Blocks/SDCC Tutorial

1 © Linden McClure, Ph.D. 10/13/2013

Page 2: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Process Flow

• Download and install SDCC 2.6.0

• Download and install Code Blocks 12.11

• Run Code Blocks and configure project

2 © Linden McClure, Ph.D. 10/13/2013

Page 3: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Create a project • Go to ‘File->New->Project’, select ‘MCS51 Project’, and click ‘Go’.

3 © Linden McClure, Ph.D. 10/13/2013

Page 4: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Create a project (cont.)

Enter the project name Enter location of the project

Click Next

• Fill in the project name and location and click ‘Next’

4 © Linden McClure, Ph.D. 10/13/2013

Page 5: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Create a project (cont.) • Ensure “Create Debug configuration” is deselected to avoid warnings

Deselect Debug

5 © Linden McClure, Ph.D. 10/13/2013

Page 6: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Create a project (cont.) • Select Large memory model

Select Large Memory Model

6 © Linden McClure, Ph.D. 10/13/2013

Page 7: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Project properties • Right-click your project name in the ‘Management’ pane and click

‘Properties’.

7 © Linden McClure, Ph.D. 10/13/2013

Page 8: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Project properties (cont.) • Select “Build targets” and then select “Build options…”.

Select ‘Build targets’

Select ‘Build options…’

8 © Linden McClure, Ph.D. 10/13/2013

Page 9: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Project properties (cont.) • In the build options, on the Compiler settings tab, select the Policy: Use target options only. • Ensure “Verbose”, “Intel MCS51”, “MCS51 large model” and “Output Intel Hex” are selected.

9 © Linden McClure, Ph.D. 10/13/2013

Page 10: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Project properties (cont.)

10 © Linden McClure, Ph.D. 10/13/2013

Page 11: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Project properties (cont.)

11 © Linden McClure, Ph.D. 10/13/2013

• Add any other desired compiler flags to the ‘Other options’ tab.

Page 12: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Project properties (cont.) • Go to the Linker settings tab. • Select Policy as Use Target options only, include the linker options, then select OK.

12 © Linden McClure, Ph.D. 10/13/2013

Page 13: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Build a project • To build the project right click on the Project name and select Build, or use

the “ “ icon at the top of the Code::Blocks screen.

13 © Linden McClure, Ph.D. 10/13/2013

Page 14: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Build a Project

• Check Build messages and Build log tabs for errors.

14 © Linden McClure, Ph.D. 10/13/2013

When compiling a real source file, this output file will be multiple KB in size.

Page 15: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Custom Settings • For changing syntax color go to Settings->Editor->Syntax highlighting

15 © Linden McClure, Ph.D. 10/13/2013

Page 16: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Custom Settings(cont.) • Spell checker can produce an unnecessary effect for words not in the

dictionary

• To remove the effect go to Settings->Editor->SpellChecker and disable spell checker

16 © Linden McClure, Ph.D. 10/13/2013

Page 17: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Compiler Path Settings

• Note:- The workstations in the ECEE 2B37 lab have the correct path settings for the SDCC compiler

• Note:- When using your own personal computer

system, you may need to set the correct path variable for the SDCC compiler as shown in the following slides

17 © Linden McClure, Ph.D. 10/13/2013

Page 18: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Compiler Settings

• To set compiler settings go to Settings->Compiler

18 © Linden McClure, Ph.D. 10/13/2013

Page 19: Code Blocks/SDCC Tutorial - University of Colorado Boulderecee.colorado.edu/~mcclurel/CodeBlocks-SDCC_Tutorial_10-13-2013… · Compiler Path Settings • Note:- The workstations

Compiler Settings • Go to Toolchain executables and enter the path.

You can also use Auto-detect to let Code::Blocks find the SDCC compiler in the system.

19 © Linden McClure, Ph.D. 10/13/2013