Code Blocks/SDCC Tutorial
Install Software
• Download and install SDCC 2.6.0
• Download and install Code Blocks
• Run Code Blocks
Select SDCC
• Click ‘Compiler and debugger’ under the ‘Settings’ tab, choose
SDCC from the list of available compilers . You might also set it
as the default compiler.
Create a project
• Go to ‘File->New->Project’ and select ‘Empty project’. A
‘Console application’ project should also work.
Create a project (cont.)
Create a project (cont.)
• Make sure SDCC is selected as your compiler, uncheck the
‘Create “Debug” configuration box and keep the “release” box
checked. Click finish.
Create a project (Cont.)
• You might receive a few warnings; just ignore
them!
Project properties
• Right-click your project name in the ‘Management’ window
and click ‘Properties’.
Project properties (cont.)
• In the ‘Build targets’ tab, choose the ‘Console application’
type, rename the output file extension to “.hex”, uncheck the
‘Auto-generate extension’ box and click ‘Build options’.
Project properties (cont.)
• From the ‘MCS51 Options’ category, you can choose your
memory model. ‘General’ category lets you choose other
SDCC options such as “Verbose”.
Project properties (cont.)
• You can place your linker options in the ‘Other linker options’
box in the ‘Linker settings’ tab.
Create a new file
Create a new file (cont.)
• You will be asked if you want the new file to added to the
project. Click yes.
Create a new file (cont.)
Create a new file (cont.)
• You will notice that a ‘Source’ folder is automatically created
for the new file. If the you create a header (.h) file, a ‘Headers’
folder will be created instead.
Build a project
• After you build your project, you will find all the SDCC-
generated files in the project folder in your workspace.