You are on page 1of 19

Code Blocks/SDCC Tutorial

10/13/2013

Linden McClure, Ph.D.

Process Flow
Download and install SDCC 2.6.0
Download and install Code Blocks 12.11
Run Code Blocks and configure project

10/13/2013

Linden McClure, Ph.D.

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

10/13/2013

Linden McClure, Ph.D.

Create a project (cont.)

Fill in the project name and location and click Next

Enter the project name


Enter location of the project

Click Next

10/13/2013

Linden McClure, Ph.D.

Create a project (cont.)

Ensure Create Debug configuration is deselected to avoid warnings

Deselect Debug

10/13/2013

Linden McClure, Ph.D.

Create
a
project
(cont.)
Select Large memory model

Select Large Memory Model

10/13/2013

Linden McClure, Ph.D.

Project properties
Right-click your project name in the Management pane and click
Properties.

10/13/2013

Linden McClure, Ph.D.

Project properties (cont.)


Select Build targets and then select Build options.
Select Build targets

Select Build options

10/13/2013

Linden McClure, Ph.D.

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.

10/13/2013

Linden McClure, Ph.D.

Project properties (cont.)

10/13/2013

Linden McClure, Ph.D.

10

Project properties (cont.)


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

10/13/2013

Linden McClure, Ph.D.

11

Project properties (cont.)

Go to the Linker settings tab.


Select Policy as Use Target options only, include the linker options, then select OK.

10/13/2013

Linden McClure, Ph.D.

12

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.

10/13/2013

Linden McClure, Ph.D.

13

Build a Project
Check Build messages and Build log tabs for errors.

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

10/13/2013

Linden McClure, Ph.D.

14

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

10/13/2013

Linden McClure, Ph.D.

15

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

10/13/2013

Linden McClure, Ph.D.

16

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

10/13/2013

Linden McClure, Ph.D.

17

Compiler Settings
To set compiler settings go to Settings->Compiler

10/13/2013

Linden McClure, Ph.D.

18

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.

10/13/2013

Linden McClure, Ph.D.

19

You might also like