About the Command Line Parameters
GCBASIC [/O:output.asm] [/A:assembler] [/P:programmer] [/K:{C|A}] [/H:[Y/1 | N/0]] [/V] [/L] [/NP] [/M:[Y/1 | N/0]] filename GCBASIC [/O:output.asm] [/A:assembler] [/P:programmer] [/K:{C|A}] [/H:[Y/1 | N/0]] [/V] [/L] [/WX] [/M:[Y/1 | N/0]] [/NP] filename GCBASIC [/O:output.asm] [/A:assembler] [/P:programmer] [/K:{C|A}] [/H:[Y/1 | N/0]] [/V] [/L] [/WX] [/M:[Y/1 | N/0]] [/S:Use.ini] [/NP] filename GCBASIC [/O:output.asm] [/A:assembler] [/P:programmer] [/K:{C|A}] [/H:[Y/1 | N/0]] [/V] [/L] [/WX] [/M:[Y/1 | N/0]] [/S:Use.ini] [/F[O]] [/NP] filename GCBASIC /version
Switch | Description | Default |
---|---|---|
|
Sets the name of the assembly file generated to |
Same name as the input file, but with a |
|
Batch file used to call assembler(1). If |
The program will not be assembled |
|
Exports the config bits automatically selected by the compiler to an output file called |
None |
|
Set the production, or not, of the hex output file. /H:1 is the default. To prevent production of the hex output file - use /H:0 |
The default is to produce the hex output file |
|
Mute the banner messages, or not. /M:1 is the default. To prevent banner messages - use /M:0 |
The default is to output banner messages |
|
Batch file used to call programmer(1). This parameter is ignored if the program is not assembled. |
The program will not be downloaded. |
|
Keep original code in assembly output. |
No original code left in output. |
|
Verbose mode - compiler gives more detailed information about its activities. /Vx will overide any configuration in the user ini file. |
- |
|
Show license and exit. |
- |
|
Do not pause on errors. Use with IDEs. |
Pause when an error occurs, and wait for the user to press a key. |
|
Force compiler to ensure all include files are valid. |
|
|
Shown build date and version of the compiler. |
|
|
Load the settings from a specified file, rather than use the defaults. |
/S:use.ini |
|
Used to bypass compilation when not needed, compiler will verify that config settings in the already compiled file match those required for the programmer. If not, a recompilation will be forced. Skip compilation if the hex file is up to date and has correct config. /F:x ( F or 0) to force a fresh compile regardless of what ini specifies. |
|
|
Used to bypass compilation and program only. Compiler will verify that config settings in the already compiled file match those required for the programmer. If not, a recompilation will be forced. |
|
|
The file to compile. |
- |
(1) For the /A:
and /P:
switches, there are special options available. If
%FILENAME%
is present, it will be replaced by the name of the .asm
file.
%FN_NOEXT%
will be replaced by the name of the .asm
file but without an
extension, and %CHIPMODEL%
will be replaced with the name of the chip.
The name of the chip will be the same as that on the chip data file.
A batch file to load the ASM
from GCBASIC into MPASM
. Command line should be like this:
C:\progra~1\microc~1\mpasms~1\MPASMWIN /c- /o- /q+ /l- /x- /w1 %code%.asm
A batch file to compile in GCBASIC then load the ASM
from GCBASIC into GPASM
. Command line should be like this:
gcbasic.exe %1 /NP /K:A /A:"..\gputils\bin\gpasm.exe %~d1%~p1%~n1.asm"
To instruct MAKEHEX.BAT to use GPASM
. You have GPUTILS installed. The batch file should be edited as follows:
REM Create the ASM gcbasic.exe /NP /K:A %1 REM Use GPASM piping to the GCB error log gpasm.exe "%~d1%~p1%~n1.asm" -k -i -w1 >> errors.txt
To summarise, you can use any of the following:
gcbasic.exe filetocompile.gcb /A:GCASM /P:"icprog -L%FILENAME%" /V /O:compiled.asm
GCBASIC will compile the file, then assemble the program, and run this command:
`icprog -Lcompiled.hex`
You can also create/edit the gcbasic.ini file :
'Assembler settings Assembler = C:\Program Files\Microchip\MPASM Suite\mpasmwin AssemblerParams = /c- /o- /q+ /l+ /x- /w1 "%FileName%" 'Programmer settings Programmer = C:\Program Files\WinPic\Winpic.exe ProgrammerParams = /device=PIC%ChipModel% /p "%FileName%"
This example will use MPASM to assemble the program. It will run the program specified in the assembler = line, and give it these parameters:
`/c- /o- /q+ /l+ /x- /w1 "compiled.asm"`
Then, it will run the programmer, and give it these parameters when it calls it:
`/device=PIC16F88 /p "compiled.hex"`
%ChipModel%
will get replaced with the chip you are using, so this the chip GCBASIC will pass to WinPIC.
Errors.txt
The compiler only produces the file errors.txt if there is an error. The creation of the errors.txt file makes it easier for IDEs to detect if the program compiled successfully - if the file was not produced then the IDE would be unalbe to present the error message to the user.
The file error.txt is always produced in the same folder as the compiler. Typically: C:\GCStudio\GCBASIC\Errors.txt