Editor-Compiler-Debugger

Whatch the related video: https://youtu.be/H_aGIalnvm8

Since 0.1.5 version there is an integrated Text Editor with some coding capabilities.
It features code highlighting, compiling, uploading to an mcu present in the circuit canvas and basic bebugging for some compilers:

- Arduino:
Files must have .ino extension.
Arduino enviroment should be installed in your system.
You must set Arduino compiler path By Right-Click in document tab.
By default Arduino will compile for "Uno" board.
You can change Board in properties left panel:
    Click inside .ino document and open properties tab.
    Select available board or "Custom" and set "Custon Board" property.

- GcBasic compiler:
Files must have .gcb extension.
GcBasic compiler should be installed in your system.
You must set GcBasic compiler path By Right-Click in document tab.

- Avra  Avr asm compiler:
Files must have .asm extension.
For Linux systems avra compiler should be installed in your system.
It is available in most Linux distibutions repositories.
For Windows systems  avra compiler comes with SimulIDE.

- Gpasm  Pic asm compiler:
Files must have .asm extension.
For Linux systems gpasm compiler should be installed in your system.
It is available in most Linux distibutions repositories. 
For Windows systems  gpasm compiler comes with SimulIDE.

 SimulIDE can auto-detect if an asm file is for Pic or Avr.

When the Editor has focus (you click on any part os the text and you see the blinking cursor) you can edit some properties in the properties tab (left panel)

- Font Size: sets the font size ( also ctrl+ and ctrl- works) ( default 9).

- Tab Size: sets the tab size ( default 4 ).

- Spaces Tab: if true tabs will be spaces, if false they will be tabs ( default false ).

- Show Spaces: if true you will diferentiate empty from actual spaces or tabs.
                         You  will see tiny dots representing spaces
                         and tiny arrows representing tabs (default false).

This is what you see with Show_Spaces = false:


And this with Show_Spaces = true:


Dots are spaces and arrows are tabs.
Note that there are some tabs you probably didn't know they were there.


If there is a compiler available for the current file type you will see an extra property to see or set the compiler path manually:




You can also set compiler path choosing a folder in a file dialog:

To set Arduino or GcBasic Path, First open an .ino or .gcb file, then Right-Click on the document tab and select "Set CompilerPath".

A file dialog will popup, you must select the root folder of Arduino or GcBasic instalation.
Don't get into the folder, just click once on it to select, then press "Choose":



Now you can work with the compilers.

The controls from left to right are:

- New File: Creates a new empty file.

- Open File: pops up a file dialog to open a file.

- Save File: save the current file.

- Save File As: pops up a file dialog to save the current file.

- Find/replace Dialog: pops up a dialog to find or replace strings in current file.

- Compile: If the file type is supported it will compile the file.
                   You will see compiler output in bottom panel.

- Upload: Uploads the firmware corresponding to the current file
                  to an Mcu present in the circuit.

- Start Debugger: Start a debugging session.


So you can open a file or create a new file and write your program.

The compiler will take the file on your disk, so when you press compile button, current file will be saved to disk and then compiled.
Note that only main file is saved, if you have code in other included files you should save them before compiling.

When you compile, all output of compiling process will be shown in bottom panel.
If the compiling fails, an ERROR message will be shown and an arrow sign will point to the line where error was found:



 Once the program compiles you can upload it to an mcu present in the circuit, then power the circuit and simulate it normally.

You can watch Mcu registers and program variables in "RamTable" tab in left panel.
Registers must be uppercase and variables lowercase.

If the register or variable is found you will see the decimal address is the most left column, just left to the name.

If the name is not found then address will read 0 and you will not see any value.



To see how to debug, please go to debugger tutorial: Editor/Debugger