CON
_clkfreq = 10_000_000
DOWNLOAD_BAUD = 921_600
DEBUG_BAUD = 921_600
PUB go() | i
repeat i from 0 to 9
debug(udec(i))
However, if I leave out the DOWNLOAD_BAUD and repower the board (RetroBlade2 and CP2102) and relaunch pnut35k, the very first compile/run (Ctrl-F10) there is no debug message displayed. A second compile/run (Ctrl-F10) works correctly, and from then on.
Then I tried P2-EVAL...
This code never shows the data in the debug screen after relaunching pnut35k
CON
_clkfreq = 10_000_000
' DOWNLOAD_BAUD = 921_600
DEBUG_BAUD = 921_600
PUB go() | i
repeat i from 0 to 9
debug(udec(i))
even with multiple Ctrl-F10's.
But this does work first and subsequent times
CON
_clkfreq = 10_000_000
DOWNLOAD_BAUD = 921_600
DEBUG_BAUD = 921_600
PUB go() | i
repeat i from 0 to 9
debug(udec(i))
So, from launch, the very first time DEBUG_BAUD is used without DOWNLOAD_BAUD, the debug terminal screen is blank. ie there is a problem setting the speed on the port with W10 and pnut somewhere.
Chip,
How does Pnut extract command line parameters? I've just tried using it under Wine but nothing is picked up. Not even the filename. Pnut just opens a blank edit window.
PS: When I've used pnut previously, I've always relied on drag'n'drop. It worked from day dot and there wasn't any command line entry for a long while anyway. Once silicon was cast I migrated to fastspin/flexspin because I preferred another text editor and also got a liking for some of fastspin's and loadp2's extra features. Only just now thought about trying out the pnut command options.
Maybe you can tweak the extended settings for the CP2102?
Go to windows device manager, double click the COM-port, connection settings, extended settings ... hope my translation from my german windows system is close enough for you to find it.
@evanh said:
Chip,
How does Pnut extract command line parameters? I've just tried using it under Wine but nothing is picked up. Not even the filename. Pnut just opens a blank edit window.
PNut does not want any extension on the file name. So to compile "foo.spin2" you do
wine /path/to/PNut.exe foo -c
Unfortunately no error messages get printed, so it's not as useful as it could be (you have to check afterwards to see if "foo.bin" actually got produced and/or updated).
To open the editor with a file, just leave off the -c:
wine /path/to/PNut.exe foo
@cgracey : this issue has come up a few times... any chance that PNut could accept an optional file extension? Even something as simple as checking to see if the file name ends in ".spin2" and if so skipping the extension adding would be useful.
Lol, thanks Eric. Oh, I see what you mean with no errors - That might just put a nail in the coffin of actually using Pnut with another editor ... Which I was thinking about doing.
@cgracey said:
The ERROR.TXT file is written with "okay" if no error or
Z:\home\evanh\hoard\coding\prop2\testing\video1.spin2:65:error:Expected "," or end of line
And line 65 is #ifdef revA
Yep, it works rather well. I have the directory open on the desktop beside the console, so the error.txt appears at the top of the file list when written to.
If we had a console program that deleted ERROR.TXT, then conveyed arguments to PNut, and then waited for the ERROR.TXT file to appear, conveying it out on StdErr, we would have this working.
@cgracey said:
If we had a console program that deleted ERROR.TXT, then conveyed arguments to PNut, and then waited for the ERROR.TXT file to appear, conveying it out on StdErr, we would have this working.
Nah, that'd be extremely jank. Just make the command line compiker its own executable
pnut is not part of PropTool, but a copy of it with some necessary changes AFAIK.
So, while you can edit and save with PropTool, and can use pnut to then compile this code, they are unrelated programs and operations. PropTool’s inbuilt compiler is a (modified???) copy of pnut from some perhaps/often prior version on pnut.
A new PNut_v35L.exe is posted at the top of this thread.
I really beefed up the command-line interface of PNut.exe. It turns out that when you run a GUI app from a batch file, it waits for the app to close before going to the next line of the batch file, unlike the console, which immediately returns a prompt. So, PNut.exe writes the error status to a one-line text file and then the batch file passes it out to STDOUT, STDERR, and ERRORLEVEL. This should enable everyone to shell out from their favorite editor, in case they can't handle not having a scroll bar. Von Sarvas figured out all the cryptic batch file commands to make this happen. I had no idea.
Comments
Thanks Chip. Will not get time to try it out today - surprise 70th party for the wife
Luckily she doesn’t read these forums!
Chip,
SUCCESS
This works first time
However, if I leave out the DOWNLOAD_BAUD and repower the board (RetroBlade2 and CP2102) and relaunch pnut35k, the very first compile/run (Ctrl-F10) there is no debug message displayed. A second compile/run (Ctrl-F10) works correctly, and from then on.
Then I tried P2-EVAL...
This code never shows the data in the debug screen after relaunching pnut35k
even with multiple Ctrl-F10's.
But this does work first and subsequent times
So, from launch, the very first time DEBUG_BAUD is used without DOWNLOAD_BAUD, the debug terminal screen is blank. ie there is a problem setting the speed on the port with W10 and pnut somewhere.
Cluso, add "CON debug_delay = 100" and see if that helps.
I wait 100ms before changing the baud rate for debug, so that the download can complete at the download baud. You may need to add DEBUG_DELAY.
Chip,
How does Pnut extract command line parameters? I've just tried using it under Wine but nothing is picked up. Not even the filename. Pnut just opens a blank edit window.
PS: When I've used pnut previously, I've always relied on drag'n'drop. It worked from day dot and there wasn't any command line entry for a long while anyway. Once silicon was cast I migrated to fastspin/flexspin because I preferred another text editor and also got a liking for some of fastspin's and loadp2's extra features. Only just now thought about trying out the pnut command options.
Maybe you can tweak the extended settings for the CP2102?
Go to windows device manager, double click the COM-port, connection settings, extended settings ... hope my translation from my german windows system is close enough for you to find it.
You might want to quote who you are replying to.
Ups ... there were some more pages I think I should go and get some sleep.
I was actually replied to the entries around #1201 ... where the CP2102 seemed to be working for small junks of data.
PNut does not want any extension on the file name. So to compile "foo.spin2" you do
Unfortunately no error messages get printed, so it's not as useful as it could be (you have to check afterwards to see if "foo.bin" actually got produced and/or updated).
To open the editor with a file, just leave off the -c:
@cgracey : this issue has come up a few times... any chance that PNut could accept an optional file extension? Even something as simple as checking to see if the file name ends in ".spin2" and if so skipping the extension adding would be useful.
Lol, thanks Eric. Oh, I see what you mean with no errors - That might just put a nail in the coffin of actually using Pnut with another editor ... Which I was thinking about doing.
I have been searching for how to output to StdErr from Delphi GUI's and it's not simple. Nothing clear, yet.
I can change the file-extension sensitivity, no problem. I could also write a one-line file with the error information in it.
stdout is fine, especially since there's nothing else emitted anyway.
Here is a test version of PNut which does some new things:
1) It writes an ERROR.TXT file after command-line compilation.
2) It accepts filenames with or without the .spin2 extension applied.
The ERROR.TXT file is written with "okay" if no error or
<file_path>:<line_number>:error:<error_message>
https://drive.google.com/file/d/1mHAS5A30PavFRemdX7NpSBkQgdL6PgWm/view?usp=sharing
If I can figure out how to get this error message out to StdErr, it should work with Stephen Moraco's VSC setup.
Maybe
writeln(stderr,'An error has occurred');
That works in a Delphi console app, but not from a GUI.
Z:\home\evanh\hoard\coding\prop2\testing\video1.spin2:65:error:Expected "," or end of line
And line 65 is
#ifdef revA
Yep, it works rather well. I have the directory open on the desktop beside the console, so the error.txt appears at the top of the file list when written to.
Is this any help? https://www.freepascal.org/docs-html/current/fcl/process/tprocess.stderr.html
You'd have to make it a console app, anyways, because GUI apps don't make the shell wait for their completion.
Sorry Chip, haven’t had time for P2 to test it. Hope I may get time this afternoon to try it.
If we had a console program that deleted ERROR.TXT, then conveyed arguments to PNut, and then waited for the ERROR.TXT file to appear, conveying it out on StdErr, we would have this working.
Nah, that'd be extremely jank. Just make the command line compiker its own executable
Hello,
simple question:
Yes, this is my understanding. If you run PNut you're working with the latest-released compiler. Not the case @cgracey?
Ken Gracey
pnut is not part of PropTool, but a copy of it with some necessary changes AFAIK.
So, while you can edit and save with PropTool, and can use pnut to then compile this code, they are unrelated programs and operations. PropTool’s inbuilt compiler is a (modified???) copy of pnut from some perhaps/often prior version on pnut.
This fixed the first download problem on both P2-EVAL and RetroBlade2/CP2102. Thanks Chip.
A new PNut_v35L.exe is posted at the top of this thread.
I really beefed up the command-line interface of PNut.exe. It turns out that when you run a GUI app from a batch file, it waits for the app to close before going to the next line of the batch file, unlike the console, which immediately returns a prompt. So, PNut.exe writes the error status to a one-line text file and then the batch file passes it out to STDOUT, STDERR, and ERRORLEVEL. This should enable everyone to shell out from their favorite editor, in case they can't handle not having a scroll bar. Von Sarvas figured out all the cryptic batch file commands to make this happen. I had no idea.
Bash shell prompt doesn't return until Pnut exits on Wine.
Thanks so much for debug FIX. I can now see the debug screen with Retroblade2.
While playing with debug I found something that is not working as I expected: (no loop is executed)
(Edit: no issue actually here, reset command has missing 0 -> HUBSET ##$1000_0000 )
Also, I cannot have the SD card plugged in on the Retroblade while I use PNUT or Propeller tool.
I do NOT have this problem with Flexprop. Flexprop allows me to compile and upload even if the SD card is plugged in.