Difference between revisions of "Compiling a Flowchart to a Chip"
(25 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
Chips can only execute code that is in hexadecimal (hex.) format. Flowcode needs to process your flowcharts (for example TEST.FCF) into a format that a chip can execute Flowcode takes a number of steps: | Chips can only execute code that is in hexadecimal (hex.) format. Flowcode needs to process your flowcharts (for example TEST.FCF) into a format that a chip can execute Flowcode takes a number of steps: | ||
− | 1 Compile Flowchart into C code | + | 1) Compile Flowchart into C code |
− | 2 Compile C code into Assembler | + | 2) Compile C code into Assembler |
− | 3 Assemble the Assembler into Hex | + | 3) Assemble the Assembler into Hex |
− | 4 Send the Hex code to the chip | + | 4) Send the Hex code to the chip |
Line 19: | Line 17: | ||
− | Before compiling your flowchart into a program that can be sent to a chip you will need to ensure you have followed the instructions in the section entitled Selecting a | + | Before compiling your flowchart into a program that can be sent to a chip you will need to ensure you have followed the instructions in the section entitled [[Selecting a Target Chip]]. |
− | + | ==Compile to C== | |
Compiles the Flowchart to C code. | Compiles the Flowchart to C code. | ||
Line 29: | Line 27: | ||
− | Select the Compile to C option from the | + | Select the 'Compile to C' option from the 'Build' menu (Build > Compile to C...). |
Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case. | Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case. | ||
− | You can also use the Compile to C icon on the toolbar. | + | You can also use the 'Compile to C' [[File:CompileToC.png|border]] icon on the toolbar. |
− | + | ==Compile to Hex== | |
Compiles the Flowchart to C code and then compiles the C code to Assembly and Machine code. | Compiles the Flowchart to C code and then compiles the C code to Assembly and Machine code. | ||
− | The resulting ASM file is saved in the program directory, with a .asm extension, and can be viewed or used by external programs. | + | The resulting ASM file is saved in the program directory, with a .asm or .s extension, and can be viewed or used by external programs. |
− | The resulting machine code file is also saved in the program directory with a .hex or .bin extension. | + | The resulting machine code file is also saved in the program directory with a .hex, .s19 or .bin extension. |
− | Select the Compile to | + | Select the 'Compile to HEX' option from the 'Build' menu (Build > Compile to HEX...). |
Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case. | Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case. | ||
− | You can also use the Compile to | + | You can also use the 'Compile to HEX' [[File:CompileToHex.png|border]] icon on the toolbar. |
+ | If the program has already been compiled and the flowchart has not been edited then you can force a re-compilation by holding down the left shift button while clicking the 'Compile to HEX' icon on the toolbar. | ||
− | |||
− | Unlike the | + | ==Compiling to Chip== |
+ | |||
+ | Unlike the previous two methods Compile to chip actually programs the chip after compiling the machine code file. | ||
Compile to chip compiles the Flowchart to C code, then ASM code, then assembles the ASM to Machine code and launches the Programmer application to download the program into the chip. | Compile to chip compiles the Flowchart to C code, then ASM code, then assembles the ASM to Machine code and launches the Programmer application to download the program into the chip. | ||
− | Select the Compile to | + | Select the 'Compile to Chip' option from the 'Build' menu (Build > Compile to Chip...) to transfer the flowchart to the target microcontroller. |
Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case. | Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case. | ||
− | You can also use the Compile to | + | You can also use the 'Compile to Chip' [[File:CompileToChip.png|border]] icon on the toolbar. |
Line 69: | Line 69: | ||
− | + | ====Compiler errors==== | |
+ | |||
+ | If the compiler detects any errors during compilation, these errors will be displayed within the [[Using the Icon Lists Pane|Icon Lists]] panel. | ||
+ | |||
+ | |||
+ | If the program has already been successfully compiled and the flowchart has not been edited then clicking the 'Compile to Chip' [[File:Btn_Compile_Chip.png|border]] icon on the toolbar will skip the compilation stage and go directly to programming the device allowing multiple devices to be programmed. | ||
− | + | You can force a re-compilation by holding down the left '''Shift''' button while clicking the 'Compile to Chip' [[File:Btn_Compile_Chip.png|border]] icon on the toolbar. | |
− | + | ====Compiling with non standard applications==== | |
− | Flowcode is optimized for use with the | + | Flowcode is optimized for use with the Microchip XC8 (PIC8), Microchip XC16 (PIC16), Microchip XC32 (PIC32) and GCC compilers (AVR, ARM). The C code generated may not be appropriate for other compilers. |
Latest revision as of 08:24, 2 July 2019
Chips can only execute code that is in hexadecimal (hex.) format. Flowcode needs to process your flowcharts (for example TEST.FCF) into a format that a chip can execute Flowcode takes a number of steps:
1) Compile Flowchart into C code
2) Compile C code into Assembler
3) Assemble the Assembler into Hex
4) Send the Hex code to the chip
Whilst this seems a bit long-winded it has the advantage that it allows you to embed third party C code or Assembly code into your programs without actually getting too bogged down in creating the code - or understanding it.
The various options available allow users to halt the process at various stages so that they can view the resulting code, or check for errors at that code level.
Before compiling your flowchart into a program that can be sent to a chip you will need to ensure you have followed the instructions in the section entitled Selecting a Target Chip.
Contents
Compile to C
Compiles the Flowchart to C code.
The resulting C file is saved in the program directory, with a .c extension, and can be viewed or used by external programs.
Select the 'Compile to C' option from the 'Build' menu (Build > Compile to C...).
Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case.
You can also use the 'Compile to C' icon on the toolbar.
Compile to Hex
Compiles the Flowchart to C code and then compiles the C code to Assembly and Machine code.
The resulting ASM file is saved in the program directory, with a .asm or .s extension, and can be viewed or used by external programs.
The resulting machine code file is also saved in the program directory with a .hex, .s19 or .bin extension.
Select the 'Compile to HEX' option from the 'Build' menu (Build > Compile to HEX...).
Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case.
You can also use the 'Compile to HEX' icon on the toolbar.
If the program has already been compiled and the flowchart has not been edited then you can force a re-compilation by holding down the left shift button while clicking the 'Compile to HEX' icon on the toolbar.
Compiling to Chip
Unlike the previous two methods Compile to chip actually programs the chip after compiling the machine code file.
Compile to chip compiles the Flowchart to C code, then ASM code, then assembles the ASM to Machine code and launches the Programmer application to download the program into the chip.
Select the 'Compile to Chip' option from the 'Build' menu (Build > Compile to Chip...) to transfer the flowchart to the target microcontroller.
Flowcharts must be saved before they can be transferred and Flowcode will prompt you if this is the case.
You can also use the 'Compile to Chip' icon on the toolbar.
Please check your Configuration information before downloading, or if you are having problems: Many perceived errors are as a result of the incorrect set up.
Compiler errors
If the compiler detects any errors during compilation, these errors will be displayed within the Icon Lists panel.
If the program has already been successfully compiled and the flowchart has not been edited then clicking the 'Compile to Chip' icon on the toolbar will skip the compilation stage and go directly to programming the device allowing multiple devices to be programmed.
You can force a re-compilation by holding down the left Shift button while clicking the 'Compile to Chip' icon on the toolbar.
Compiling with non standard applications
Flowcode is optimized for use with the Microchip XC8 (PIC8), Microchip XC16 (PIC16), Microchip XC32 (PIC32) and GCC compilers (AVR, ARM). The C code generated may not be appropriate for other compilers.