I have a preference for using Geany as my GCB IDE rather than SynWrite. I've previously used the GCB "tools" for compiling my programs. This has the downside of not showing the full compilation information in Geany once the compilation has completed. It also means that where an error is found during compilation the G+STools window stays open which means it has to be closed to return control to the Geany window, and a re-compilation can't take place until this window has been closed. Worse still, my preferences are often overwritten when updating, something that makes me reluctant to upgrade. Hopefully this will prevent those preferences from being lost.
Being spurred on by another thread, I've managed to create a "command line" that calls the GCB compiler directly, and invoking the programmer with the correct .hex file name to program the target device. I'm using the NSDSP programmer (nsprog.exe). If you are using another programmer the portion of the line which invokes the programmer and sets the parameters for the programmer would need changing. Hopefully it will give some hints as to the calls used to extract the (.hex) filename and the device name, the documentation for the compiler output is something I have not seen listed and it took me some time to figure them out.
I've been able to add these to my build menu in Geany so can call them directly with a keystroke within Geany.
I should add that in Geany the final five characters %d/%f are replaced by Geany with the current full directory (%d) a directory "slash" / and the current filename (%f).
The GCBasic compiler replaces %chipmodel% with the chip model name as defined in the program by the #Chip directive, and the phrase that took me forever to work out, %Fn_NoExt% returns a fully qualified (I.E. including the full path) current file name with no extension.
'Command line required to compile a source program to a .hex file''and program it into the target device.''The GCB compiler is set to verbose output (/V)''include the full program text in the .asm file (/K:A)''create a report in text (/R:txt)''and to automatically program using the NSDSP programmer (/P)''This uses the NSDSP programmer in HVP (-h)''without erasing the EeProm (-e) in verbose mode (-v)'C:\GCB\GCB@Syn\GreatCowBasic\gcbasic64.exe/NP/A:GCASM/K:AR:txt/V/P:"C:\GCB_NSDSP\NSDSP\nsprog.exe p -h -e -v -d "PIC"%chipmodel% -i %Fn_NoExt%.hex"%d/%f'The command required for a "compile" only (syntax check) is:'C:\GCB\GCB@Syn\GreatCowBasic\gcbasic64.exe/NP/A:GCASM/K:AR:txt/V%d/%f
I have also set the error regular expression on my Geany build menu to:
(?P<file>[^(]+) \((?P<line>\d+)
This allows any compilation errors to be highlighted and navigated to automatically by clicking on the error message in the Geany compiler tab.
Here is an image of Geany having just performed a successful compile of a small program to show how it looks.
Using Geany is relevant if using linux gcb.
It's enough bother to get freebasic to work and build gcb.
The windows version is SO much simpler and the win ide is fine.
This using geany is worth archiving for the info as command line parameters are no fun.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It all about the implementation. Geany needs a lot of sorting before it gets anywhere near SynWrite. Things I spotted this morning in my first five mins to create the video.
Helpers for Great Cow BASIC/language not to use FreeBASIC helpers/language
Integration into CHM Help directly.
Ability to enter filename directly into the file/open dialog
Window control
Code/comment toggle
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For a while now there has been a need for an IDE that was not restricted to windows.
I have not personally tried Geany but I will certainty give it a go.
Here is what Google Thinks :
Size: 14 MB (Windows)
Initial release: October 19, 2005; 16 years ago
Developer(s): Geany authors
License: GPL-2.0-or-later
Operating system: Linux; macOS; Windows
Stable release: 1.38.0 / 9 October 2021
As we have users on all three platforms and the backend has been brought up to that latest standards (AS) whilst maintaining portability between Operating Systems as well as Target Processors it may be time that the IDE did the same.
A common IDE on all target platforms will certainly ease support and enhance tutorials.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Linux is a minority and gcb is a "minority" user group.
I like win gcb on avr. I can just get on with coding. I bet there's other arduino users that
can't use the Arduino ide but can use gcb for avr. I always thought this was brill... gcb avr.
Someone posted "Why isn't there a linux gcb file?"... apt-get install I guess. Why not?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the video. I can see the advantages of using the Preference Editor in your use with a large number of (competing) devices and programmers. In my work and at home I deal with a very limited range of PIC only devices and find the "direct" command line is more appropriate for me.
I have edited the "FreeBasic"command reference using the file @Trev posted some years back. I'm sure I posted a copy of that same file, edited and formatted to suit Geany which then performs syntax highlighting in Geany for GCB files.
I have also entered a "help" entry on my Geany build menu, this calls the GCB help file with the current word on the cursor used as the search command. This uses the "CallCHM" tool at the moment. On the Mac I used SumatraPDF to open the .chm help file and perform the search, having switched back to Windows I struggled to make this work so reverted back to Frank's tool.
c:\gcb\gcb@syn\G+Stools\CallCHM.exe/%s
The "/%s" section is replaced with the current word at the cursor.
It is also possible to re-map the keys in Geany so I have mapped F1 to call the help (using the above command) F5 to perform a syntax check (compile to .asm only). This more closely matched Borland's Delphi that I was so used to.
It is possible to comment selected code and/or remove comments in Geany using a keystroke, I've set this to "Alt+C". The command can be seen by selecting some text, right clicking, then on the context sensitive menu select Format>Toggle commentation.
A filename can be entered in the "file/open" dialog box, click the little "pencil and pad" icon near the top left corner of the dialog box and you'll get the search box as can be seen in the picture.
I think the need is for a gcb user to use any text editor. Notepad++ is an example but getting it to flash the hex file is the problem.. imho... nice if everyone could write scripts.
I'll try using gcb on rpi and geany and see. I'll spend more time getting it to work than the code I'm working on :( .... but cheers for the info.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any editor that can launch an application via some form of customisation can use the one command script to make a hex and program. There is no more writing scripts that all ended a few years ago.
All folks need to do is look how to customise an editor, add the customisation, test and use.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
piece of.. not really.. not like win gcb works out the box... well a bit of setting programmer and ports but no big deal.
Why can't my debian linux gcb just be a file that others can use? May seem a daft question, sorry. Linux is fun... not!
My problems would be averdude interface using another gcb ide... don't do pics much.
Last edit: stan cartwright 2022-01-31
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
using gcb rpi400 not a clue.
This is posted from a rpi.
First getting freebasic to build itself from a partial build then building gcb is not fun.
Second it's not like windows gcb.
linux is just dos with graphics..... unless you got an app-get install file.
But it's free. GCB on rpi was just a challenge but represents gcb on linux problems for a beginner. It's a long experience and then using geany... yawn.
If I got gcb to compile an avr file, I bet it would go bits up when flashing via usb to say nano328, just a feeling.
GCB was made for win I think. Works great on win but using another ide like geany or notebook++ all seems lots of stuff I can't do on linux.
Where is the software in the video for linux please?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Adapted for use on Linux from flashAVR.bat and flashPIC.bat. Not to be used on Windows.
WARNING: Not tested!
You can adapt this file to your needs including removing the .sh extension for convenience.
In this script, "$1" gets replaced with whatever you enter for <hexfile> on the command line. $2 gets replaced with the value entered for <chipmodel>.</chipmodel></hexfile>
Be sure to uncomment/edit the appropriate flash command line for your programmer.
Changes @ August 2015
Changed AVRDude calls. The first call prevents errors when trying to flash AVRs in delivery status (1MHz).
The second gives the maximum speed.
Both does not affect the speed of the firmware in most cheapy china programmers. But those with the actual
USBASP firmware (2011-05-28) benefit from. Actually most of the chinese USBASPs can be updated (needs two programmers).
basename=${0##*/}
export LC_ALL=C
if [ $# -ne 2 ]; then
echo "Usage: $basename <hexfile> <chipmodel>"
echo "Example: $basename myfile.hex tiny44"
echo
echo "Note: If calling this script from the gcbasic command line"
echo "using the %FILENAME% and %CHIPMODEL% placeholders,"
echo "the appropriate values will be populated automatically."
exit
fi</chipmodel></hexfile>
--- Your code here: ---------------------------------------
For AVR
Call AVRdude for USBASP programmer - moderate speed (187.5 kHz) for 1 MHz devices:
Brill Anobiwan, I'll try. Be nice GCB on RPI. Just cos you can idea.It works fine for me on win but never got GCB to work on linux and rpi twisteros is debian based so it's linux.
I could use ubuntu mate but tried that on a pc.
Twisteros on rpi is nice. Loads of useful stuff installs with it, like Cura for 3D printers. Geany, AVR-IDE,ScreenShot. It's nice. Boots off usb3 120Gb ssd ,Using retropie on usb3 240Gb ssd and N64 games are amazing. I found some games I wrote in the 80's.
PS converting your setup to linux file system ...
Last edit: stan cartwright 2022-02-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a preference for using Geany as my GCB IDE rather than SynWrite. I've previously used the GCB "tools" for compiling my programs. This has the downside of not showing the full compilation information in Geany once the compilation has completed. It also means that where an error is found during compilation the G+STools window stays open which means it has to be closed to return control to the Geany window, and a re-compilation can't take place until this window has been closed. Worse still, my preferences are often overwritten when updating, something that makes me reluctant to upgrade. Hopefully this will prevent those preferences from being lost.
Being spurred on by another thread, I've managed to create a "command line" that calls the GCB compiler directly, and invoking the programmer with the correct .hex file name to program the target device. I'm using the NSDSP programmer (nsprog.exe). If you are using another programmer the portion of the line which invokes the programmer and sets the parameters for the programmer would need changing. Hopefully it will give some hints as to the calls used to extract the (.hex) filename and the device name, the documentation for the compiler output is something I have not seen listed and it took me some time to figure them out.
I've been able to add these to my build menu in Geany so can call them directly with a keystroke within Geany.
I should add that in Geany the final five characters %d/%f are replaced by Geany with the current full directory (%d) a directory "slash" / and the current filename (%f).
The GCBasic compiler replaces %chipmodel% with the chip model name as defined in the program by the #Chip directive, and the phrase that took me forever to work out, %Fn_NoExt% returns a fully qualified (I.E. including the full path) current file name with no extension.
I have also set the error regular expression on my Geany build menu to:
This allows any compilation errors to be highlighted and navigated to automatically by clicking on the error message in the Geany compiler tab.
Here is an image of Geany having just performed a successful compile of a small program to show how it looks.
Last edit: mkstevo 2022-01-29
Great insights. I have created a version of this advice in the Hints and Tips for v0.99.01 thread.
I installed Geany, then, I made this video. Just to explain that config of Geany is very easy. And, the level of integration is great.
https://1drv.ms/v/s!Ase-PX_n_4cvhKk7wQt5tuZXT1pjFg?e=OL0EU5
Last edit: Anobium 2022-01-31
Using Geany is relevant if using linux gcb.
It's enough bother to get freebasic to work and build gcb.
The windows version is SO much simpler and the win ide is fine.
This using geany is worth archiving for the info as command line parameters are no fun.
It all about the implementation. Geany needs a lot of sorting before it gets anywhere near SynWrite. Things I spotted this morning in my first five mins to create the video.
Geany is not only relevant if using Linux.
For a while now there has been a need for an IDE that was not restricted to windows.
I have not personally tried Geany but I will certainty give it a go.
Here is what Google Thinks :
Size: 14 MB (Windows)
Initial release: October 19, 2005; 16 years ago
Developer(s): Geany authors
License: GPL-2.0-or-later
Operating system: Linux; macOS; Windows
Stable release: 1.38.0 / 9 October 2021
As we have users on all three platforms and the backend has been brought up to that latest standards (AS) whilst maintaining portability between Operating Systems as well as Target Processors it may be time that the IDE did the same.
A common IDE on all target platforms will certainly ease support and enhance tutorials.
Linux is a minority and gcb is a "minority" user group.
I like win gcb on avr. I can just get on with coding. I bet there's other arduino users that
can't use the Arduino ide but can use gcb for avr. I always thought this was brill... gcb avr.
Someone posted "Why isn't there a linux gcb file?"... apt-get install I guess. Why not?
Thanks for the video. I can see the advantages of using the Preference Editor in your use with a large number of (competing) devices and programmers. In my work and at home I deal with a very limited range of PIC only devices and find the "direct" command line is more appropriate for me.
I have edited the "FreeBasic"command reference using the file @Trev posted some years back. I'm sure I posted a copy of that same file, edited and formatted to suit Geany which then performs syntax highlighting in Geany for GCB files.
I have also entered a "help" entry on my Geany build menu, this calls the GCB help file with the current word on the cursor used as the search command. This uses the "CallCHM" tool at the moment. On the Mac I used SumatraPDF to open the .chm help file and perform the search, having switched back to Windows I struggled to make this work so reverted back to Frank's tool.
The "/%s" section is replaced with the current word at the cursor.
It is also possible to re-map the keys in Geany so I have mapped F1 to call the help (using the above command) F5 to perform a syntax check (compile to .asm only). This more closely matched Borland's Delphi that I was so used to.
It is possible to comment selected code and/or remove comments in Geany using a keystroke, I've set this to "Alt+C". The command can be seen by selecting some text, right clicking, then on the context sensitive menu select Format>Toggle commentation.
A filename can be entered in the "file/open" dialog box, click the little "pencil and pad" icon near the top left corner of the dialog box and you'll get the search box as can be seen in the picture.
Last edit: mkstevo 2022-01-31
Good info. My point is that using the correct entry points into Great Cow BASIC is easy, and does not reduce any capabilities.
A consistent Geany config would be great. That uses the proper entry point would be the approach as you cannot assume the programmer is use.
Last edit: Anobium 2022-01-31
I think the need is for a gcb user to use any text editor. Notepad++ is an example but getting it to flash the hex file is the problem.. imho... nice if everyone could write scripts.
I'll try using gcb on rpi and geany and see. I'll spend more time getting it to work than the code I'm working on :( .... but cheers for the info.
Any editor that can launch an application via some form of customisation can use the one command script to make a hex and program. There is no more writing scripts that all ended a few years ago.
All folks need to do is look how to customise an editor, add the customisation, test and use.
Just dowloaded NotePad++. You can add two RUN commands, one to create HEX&PROG and another to open Prefs Editor.
Works ok - most of the same issues as Geany. Not integration, no Helper etc etc. But, it works.
See attachment.
Last edit: Anobium 2022-01-31
Far out. I just thought it was a good editor.
piece of.. not really.. not like win gcb works out the box... well a bit of setting programmer and ports but no big deal.
Why can't my debian linux gcb just be a file that others can use? May seem a daft question, sorry. Linux is fun... not!
My problems would be averdude interface using another gcb ide... don't do pics much.
Last edit: stan cartwright 2022-01-31
using gcb rpi400 not a clue.
This is posted from a rpi.
First getting freebasic to build itself from a partial build then building gcb is not fun.
Second it's not like windows gcb.
Last edit: stan cartwright 2022-01-31
I do compilers and stuff. For Linux you need patience... I have Windows.
linux is just dos with graphics..... unless you got an app-get install file.
But it's free. GCB on rpi was just a challenge but represents gcb on linux problems for a beginner. It's a long experience and then using geany... yawn.
If I got gcb to compile an avr file, I bet it would go bits up when flashing via usb to say nano328, just a feeling.
GCB was made for win I think. Works great on win but using another ide like geany or notebook++ all seems lots of stuff I can't do on linux.
Where is the software in the video for linux please?
linux gcb looks hard
!/bin/bash
Version 0.95.001
Adapted for use on Linux from flashAVR.bat and flashPIC.bat. Not to be used on Windows.
WARNING: Not tested!
You can adapt this file to your needs including removing the .sh extension for convenience.
In this script, "$1" gets replaced with whatever you enter for <hexfile> on the command line. $2 gets replaced with the value entered for <chipmodel>.</chipmodel></hexfile>
Be sure to uncomment/edit the appropriate flash command line for your programmer.
Changes @ August 2015
Changed AVRDude calls. The first call prevents errors when trying to flash AVRs in delivery status (1MHz).
The second gives the maximum speed.
Both does not affect the speed of the firmware in most cheapy china programmers. But those with the actual
USBASP firmware (2011-05-28) benefit from. Actually most of the chinese USBASPs can be updated (needs two programmers).
basename=${0##*/}
export LC_ALL=C
if [ $# -ne 2 ]; then
echo "Usage: $basename <hexfile> <chipmodel>"
echo "Example: $basename myfile.hex tiny44"
echo
echo "Note: If calling this script from the gcbasic command line"
echo "using the %FILENAME% and %CHIPMODEL% placeholders,"
echo "the appropriate values will be populated automatically."
exit
fi</chipmodel></hexfile>
--- Your code here: ---------------------------------------
For AVR
Call AVRdude for USBASP programmer - moderate speed (187.5 kHz) for 1 MHz devices:
avrdude -B 5 -c usbasp -P /dev/cuaa0 -p $2 -U flash:w:"$1":i
Call AVRdude for USBASP programmer - fastest mode (1500 kHz):
# avrdude -B 0.5 -c usbasp -P /dev/cuaa0 -p $2 -U flash:w:"$1":i
Call AVRdude for STK500v2 programmer:
# avrdude -c stk500v2 -P com4 -p $2 -U flash:w:"$1":i
Call AVRdude for DASA3 programmer:
# avrdude -i 1 -c dasa3 -P com1 -p $2 -U flash:w:"$1":i
Call AVRdude for Arduino_Uno bootloader:
avrdude -c arduino -P /dev/ttyUSB0 -b 115200 -p $2 -U flash:w:"$1":i
Call AVRdude for Arduino_Pro_Mini bootloader:
# avrdude -c arduino -P com6 -b 57600 -p $2 -U flash:w:"$1":i
Call AVRdude for Arduino_Mega2560 bootloader:
# avrdude -c wiring -P com7 -b 115200 -p $2 -U flash:w:"$1":i
Call for Digispark bootloader:
Replace the command name appropriately, and
remove the '#' from the next three lines
# Echo "ReInsert Digispark USB now"
# "micronucleus.exe" -run "$1"
# timeout 5 > nul
## For PIC
! Not tested. Be sure to edit the commands appropriately. You may need to add or remove double-quotes around the $ variables.
Call uploader for TinyBootLoader+ bootloader:
# TinyMultiBootloader+ "$1" exit
Call PICpgm-programming software:
# picpgm -p "$1"
# picpgm -delay 1 -if "5PiP" -port COM1 -pic PIC$2 -p "$1"
# picpgm -delay 1 -if "JDM Programmer" -port COM1 -pic PIC$2 -p "$1"
# picpgm -delay 1 -if "FT232Board-Programmer" -port USB -pic PIC$2 -p "$1"
# picpgm -delay 1 -if "FT232Adapter-Programmer" -port USB -pic PIC$2 -p "$1"
Call PicKit2 command-line programming Software leaving power on the chip
and always exit with MCLR on. Optionally #ove -r for MCLR off
#pk2cmd -bPicKit2 -pPIC$2 -f"$1" -m -j -t -r
Call PicKit2 command-line programming Software without leaving the power on the chip
and always exit with MCLR on. Optionally #ove -r for MCLR off
# pk2cmd -bPicKit2 -pPIC$2 -f"$1" -m -r
Call PicKit3 command-line programming software:
note, that the Java Runtime Environment (jre) has to be installed!
# java -jar ipecmd.jar -TPPK3 -P$2 -M -F"$1"
Use PicKit3 Integrated Programming Environment GUI (IPE):
note, that IPE must run and a programmer and a PIC is connected!
# IPE-Pusher "$1" 0
Call uploader for diolan bootloader:
# picboot -r "$1"
Call MicroBrn K150 programming software:
# microbrn "$1" $2 /f /Q 1
--- End of your code. ------------------------------------
if [ $? -ne 0 ]; then
echo "ERROR $? running: $0 with parameters $*"
fi
using rpi400
This where avrdude is I think.
next image is gcb
Last edit: stan cartwright 2022-02-03
sorry multiple images can't do.
this is arduino avrdude I think
Last edit: stan cartwright 2022-02-03
so how do I use Geany to run a file in Geany to GCB and use avrdude whatever?
Here are my settings. This will enable standard compile/programming and the Prefs Editor
Build parameters are
I do know how to the other stuff. I could not follow the instructions and it was all out of date - we have new Reversed Words and Helpers.
Last edit: Anobium 2022-02-03
To make this work well. We need a proper Language definition, Helpers (that are maintained) etc etc
Brill Anobiwan, I'll try. Be nice GCB on RPI. Just cos you can idea.It works fine for me on win but never got GCB to work on linux and rpi twisteros is debian based so it's linux.
I could use ubuntu mate but tried that on a pc.
Twisteros on rpi is nice. Loads of useful stuff installs with it, like Cura for 3D printers. Geany, AVR-IDE,ScreenShot. It's nice. Boots off usb3 120Gb ssd ,Using retropie on usb3 240Gb ssd and N64 games are amazing. I found some games I wrote in the 80's.
PS converting your setup to linux file system ...
Last edit: stan cartwright 2022-02-03