@proplem - sorry about that, I just came across the problem you mentioned. It was a simple auto load utility that is normally commented out but I had moved them around and it tried to load. All fixed and tested now.
I downloaded your sanitized folder (thanks for this) to give iot5500 the next attempt:
- with defensive settings (115200 baud, 10 ms line delay excepted COMPACT.FTH and EASYNET.FTH)
- kernel ok
- extend ok
- easyfile ok - but ls not working (while v3 is)
*No Card inserted!* *Card Error* *Card Error*
- nevertheless I patched good old P8.FTH for V4 (ignoring missed PCB and PCB$)
TACHYON V4
FORGET +P8.fth
pub +P8.fth ." P1432 +P8 HARDWARE DEFINITIONS 141118.0000 " ;
--- P1432 +P8 PCB + P1455 IoT5500 ---
( P8X32A PINOUTS )
#P1 |< == &WNDO '' MISO from WIZNET
#P17 |< == &WNCS '' WIZNET CS
#P18 |< == &WNCK '' WIZNET SPI CLOCK
#P19 |< == &WNDI '' MOSI to WIZNET
#P23 |< == &SFCS '' Serial flash CS (WINBOND W25Q80 8Mbit Flash)
#P27 |< == &SDCS '' SDCARD CS
#P24 |< == &SDDO '' Data out from SDCARD
#P25 |< == &SDCK '' SDCARD clocks (Shared with SCL)
#P26 |< == &SDDI '' Data to SDCARD (Shared with SDA)
#P16 |< == &WINT
&SDCS >| #24 SHL &SDDO >| 16 SHL OR &SDDI >| 8 SHL OR &SDCK >| OR == SDC
&SFCS >| #24 SHL &SDDO >| 16 SHL OR &SDDI >| 8 SHL OR &SDCK >| OR == SDD
pub LANLED #P21 SWAP IF LOW ELSE FLOAT THEN ;
pub SDBSYLED #P22 SWAP IF LOW ELSE FLOAT THEN ;
pub WRESET ( on/off -- ) #P0 SWAP IF LOW ELSE HIGH THEN ;
pub WPWRDN ( on/off -- ) DROP ;
( PCB DEFINITIONS )
\ Do what we need to do to init the hardware on this pcb
pub !PCB
&WNCS OUTSET
&SFCS OUTSET
&SDCS OUTSET
;
\ " P1432 +P8" PCB$ $!
\ #1432 TO PCB
END
- pasting COMPACT.FTH with 50 ms line delay ok
- pasting EASYNET with up to 100 ms line delay but no success
- see attached build.log
- and a snippet from the makefile
I think we/you are not so far away although this costs hours and hours but I couldn't give up.
BTW I have symbolic links on your original files so the names are different.
Things are going better now. The build runs without errors but there are still problems:
- sdcard access isn't working
( 1409 $5510 ok ) ls
*No Card inserted!* *Card Error* *Card Error*
( 1410 $5510 ok )
- EASYNET needs SDCARD access and goes wild
( 0001 $5510 ok ) EASYNET
MODULES LOADED:
48F2: EASYNET.fth WIZNET NETWORK SERVERS 161216.1900
4046: W5500.fth WIZNET W5500 driver 170417.0000
AUTORUN
Loading cog 3 E506 F32
*** ROMS ***
0,848 VGA32x15
0,388 HSUART
1,900 F32
0,196 MONO16
1,900 F32
CODE:$5510 =21264 bytes NAME:$6678 =3464 bytes DATA:$7A14 =1028 bytes =4456 by)
*Card Error*
*** Tachyon Forth EASYNET Network Servers and EASYFILE File Server ***
... ready!
NETWORK STATUS:
LINK DOWN
HARDWARE: WIZnet W5500 V0
SRC IP 000.000.000.000
MASK 000.000.000.000
GATEWAY 000.000.000.000
MAC 00.00.00.00.00.00.
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
* WEB, FTP, and TELNET servers running *
( 0002 $5510 ok )
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
- attention: this ^^^^ is not yet ethernet connected just a quick test
- sdcard worked yesterday on V3, hmmm
@proplem - These files are setup so that they don't need a hardware header file, so in the case of the P8 you can setup the pins with a predefined constant SD8. So once you enter SD8 SDPINS that will lock the hardware setup in EEPROM, that's all you have to do. Since these predefined constants do not take up any code space they are convenient as they can be removed during a RECLAIM if so desired.
In V4 I decided to steer away from hardware headers that needed to be setup before loading the other modules as I want to be able to have generic binary images if necessary combined with the flexibility of configuring hardware at runtime. I see though that I haven't fully setup EASYNET in the same manner but I will fix that up shortly. Expect to be able to enter:
@proplem - These files are setup so that they don't need a hardware header file, so in the case of the P8 you can setup the pins with a predefined constant SD8. So once you enter SD8 SDPINS that will lock the hardware setup in EEPROM, that's all you have to do. Since these predefined constants do not take up any code space they are convenient as they can be removed during a RECLAIM if so desired.
In V4 I decided to steer away from hardware headers that needed to be setup before loading the other modules as I want to be able to have generic binary images if necessary combined with the flexibility of configuring hardware at runtime. I see though that I haven't fully setup EASYNET in the same manner but I will fix that up shortly. Expect to be able to enter:
&13.12.15.14 WIZPINS ( &ce.miso.mosi.sck )
to configure as necessary.
@Peter - sorry for responding delayed with bad news. IoT5500 is still rejecting cooperation:
I build it like this:
- 115200 baud, 10 ms line delay
- bstc kernel
- EXTEND.FTH
- EASYFILE.FTH
- COMPACT.FTH (50 ms line delay)
- execute: COMPACT
- execute: BACKUP
- EASYNET.FTH (50 ms line delay)
- execute: SD8 SDPINS
The build as itself is successful (no errors reported) but still I'cant access the SD card via "ls". Also WIZPINS is not yet implemented as you already mentioned but I tried to be sure.
@proplem - Just make sure which pins are used for the interface and code them in decimal bytes (IP notation) in the same manner as it is for +P8 module -
&27.24.26.25
So these port numbers are in the order of left to right as CE, MISO, MOSI, and CLK as I'm guessing that perhaps your hardware is different. But normally the card and file system is mounted before use anyway with MOUNT but you could also just try !SD and look at the result which should be non-zero. If it is zero then it failed to even initialize the card so check with another card or board etc.
CE is the chip enable (without a pullup)
MISO is the "master in, slave out" so that means the read data from the card
MOSI is the data and commands to the card
CLK of course is the clock pin.
You're right, I haven't done WIZPINS yet, but that should be straightforward. There was a very small bug in the 4.3 kernel that was causing a problem in EASYNET so just make sure you use the latest updates too, not that this would cause any of the problems you are describing though.
@proplem - These files are setup so that they don't need a hardware header file, so in the case of the P8 you can setup the pins with a predefined constant SD8.
.
.
.
In V4 I decided to steer away from hardware headers that needed to be setup before loading the other modules as I want to be able to have generic binary images if necessary combined with the flexibility of configuring hardware at runtime.
That was very easy to change EASYNET to handle pin configuration at runtime. The format is the same as it is with SDPINS, just use the IP notation prefix & with your fields separated by a decimal point.
I have my standard default set at compile time but otherwise just use WIZPINS (in uppercase) to lock this into EEPROM.
&13.12.15.14 WIZPINS
btw, with wordcode it is easy to revector any word so if for instance you want LEDs to indicate SD card activity then there are dummy words in EASYFILE that you can revector to your LED word. In some cases your word may simply drive an I/O high or low but in other cases for instance I have LEDs connected over a shift register or I2C so they are easily accommodated. If your "vector" has the lsb set then it ends up performing a jump instead of a call which would be useful in revectoring code such as CARD? but optional if you revector SDBUSY for instance as that one is just a dummy word.
To revector the card detect routine to perform a jump to the vector with 1+ to set the lsb. Default is to sense the card's pullup on CE without any external pullup.
peter@peter-workstation ~ $ telnet 192.168.0.99 10001
Trying 192.168.0.99...
Connected to 192.168.0.99.
Escape character is '^]'.
WELCOME TO THE IoT5500 TELNET SESSION
Use Forth commands, for help type WORDS
Try ls or DIR for directory
Session time is unlimited but all other network ports
will be blocked until Telnet is disconnected
( 0005 $5520 ok ) .S
Data Stack (0)
( 0006 $5520 ok ) ??
Propeller .:.:--TACHYON--:.:. Forth V4.3 DAWN 430170415.0000
MODULES LOADED:
4902: EASYNET.fth WIZNET NETWORK SERVERS 161216.1900
4046: W5500.fth WIZNET W5500 driver 170421.0000
AUTORUN
FREQ = 80,000,000 CODE:$5520 =21280 bytes NAME:$6688 =3448 bytes DATA:$7A14 =1028 bytes =4456 bytes free Data Stack (0)
( 0007 $5520 ok ) BYE
Connection closed by foreign host.
peter@peter-workstation ~ $
btw, there are more modules than that loaded but the names are in the EEPROM dictionary after a compact so I need to update the reporting to include these too.
Hi Mike, good to hear from you. I have PropellerIDE installed on my Linux system so I opened 4.3 and compiled it and got a successful build:
Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
Compiled for i386 Linux at 08:17:46 on 2009/07/20
Loading Object Tachyon V4.3
Program size is 32348 longs
Compiled 3515 Lines of Code in 0.109 Seconds
However I changed my preferences from BST to OpenSpin and it failed:
Compiling /mnt/OS/Dropbox/Tachyon/V4/Tachyon V4.3.spin
/mnt/OS/Dropbox/Tachyon/V4/Tachyon V4.3.spin(2233:36) : error : Address is out of range
Line:
_PLREP mov R1,pblksz ' reload buffer cnt
Offending Item: pblksz
I see the problem, the org statement is missing for this section of code and pblksz ends up effectively out of range at $1F9.
With the correction (thanks!) it compiles, but won't load (under MacOS 10.12.5 with the Apple FTDI driver). I have a Linux netbook as well and will try with that. Small programs will load and run successfully with the Mac and PropellerIDE.
FYI: I can load V4r3 with PropellerIDE on the Linux netbook to my Propeller (one of Bean's Dongles at 5MHz). It did take 2 or 3 tries to be successful. I can load EXTEND with the Mac using CoolTerm at 19200 Baud with 3ms character delay and 80ms line delay. It wouldn't work with no character delay and 50ms line delay.
FYI: I can load V4r3 with PropellerIDE on the Linux netbook to my Propeller (one of Bean's Dongles at 5MHz). It did take 2 or 3 tries to be successful. I can load EXTEND with the Mac using CoolTerm at 19200 Baud with 3ms character delay and 80ms line delay. It wouldn't work with no character delay and 50ms line delay.
Sounds like totally buggy serial coms software to me since I never have any problems at 921600 baud with zero character delay and only 5ms line delay. This is with a standard FT232R chip and minicom in Linux. The same goes for Teraterm running in an old XP on VirtualBox. In fact when you said it takes 2 or 3 tries to be successful from PropellerIDE I would start to suspect hardware problems, perhaps even a ground loop problem. Can you try powering the board from the same laptop just to check if that is any better?
@Peter - it's going forward. It seems that I had a problem with my SD card. I now killed the next one :-) I will reformat them later
There is another issue: How to set IP configuration?
AFAICS:
&192.168.2.1 == myGW
&192.168.2.124 == myIP
&255.255.255.0 == mySN
WCOLD could do - but doesn't.
ifconfig returns:
LINK DOWN
HARDWARE: WIZnet W5500 V0
SRC IP 000.000.000.000
MASK 000.000.000.000
GATEWAY 000.000.000.000
MAC 00.00.00.00.00.00.
BTW is there a word to print dotted decimals a la &123.321.1.2 ?
@Peter - it's going forward. It seems that I had a problem with my SD card. I now killed the next one :-) I will reformat them later
There is another issue: How to set IP configuration?
AFAICS:
&192.168.2.1 == myGW
&192.168.2.124 == myIP
&255.255.255.0 == mySN
WCOLD could do - but doesn't.
ifconfig returns:
LINK DOWN
HARDWARE: WIZnet W5500 V0
SRC IP 000.000.000.000
MASK 000.000.000.000
GATEWAY 000.000.000.000
MAC 00.00.00.00.00.00.
BTW is there a word to print dotted decimals a la &123.321.1.2 ?
@Proplem
as quoted often: "just check the source" ;-)
if you can print it with ifconfig then there is the answer ...
pub ifconfig
0 sktbuf $40 @COMMON LREAD \ read in common registers
BOLD
CR PRINT" NETWORK STATUS:" PLAIN
CR PRINT" LINK " 1 $2E @SKTBUF SET? IF PRINT" *UP*" ELSE PRINT" DOWN" THEN
CR PRINT" HARDWARE: " PCB$ PRINT$ PRINT" using WIZnet W5500 V" $39 @SKTBUF C@ .
CR PRINT" SRC IP " $0F .IP
CR PRINT" MASK " 5 .IP
CR PRINT" GATEWAY" 1 .IP
CR PRINT" MAC " 9 @SKTBUF 6 ADO I C@ .BYTE PRINT" ." LOOP
pub .SOCKETS
.SKTHD 8 0 DO I .SKT LOOP CR
;
BOLD does not work inside [ code] ...
so it is .IP
EDIT: was too fast again ;-( .IP does not print the & ...
so if you remove the last line it should do what you want ...
EDIT: maybe not exactly ;-(
try this q&d hack
pub .& '&' EMIT 4 FOR 8 ROL DUP >B . IX 1 > IF '.' EMIT THEN NEXT DROP ;
propably Peter has a shorter solution ...
@MJB - thanks to your reply. Of course you are right with "check the source". Definitely yes. I want to explain that I'm permanently short in time and therefore I'm very thankful If someone helps me with something I could investigate myself which I'd have to spend a lot more time. I also agree that I would learn better/faster if I would more often read the source. Nevertheless I can not spend more time on tachyon as I'm currently doing. Often I do have pauses of a few weeks in which I forget again half what I learned in the sessions between. So please help me with a short hint if you can but don't spend much time to figure out things that I can do myself. In these cases I appreciate also the advice "check the source" which is sometimes also helpful.
so if you remove the last line it should do what you want ...
EDIT: maybe not exactly ;-(
try this q&d hack
pub .& '&' EMIT 4 FOR 8 ROL DUP >B . IX 1 > IF '.' EMIT THEN NEXT DROP ;
propably Peter has a shorter solution ...
@MJB - thanks to your reply. Of course you are right with "check the source". Definitely yes. I want to explain that I'm permanently short in time and therefore I'm very thankful If someone helps me with something I could investigate myself which I'd have to spend a lot more time. I also agree that I would learn better/faster if I would more often read the source. Nevertheless I can not spend more time on tachyon as I'm currently doing. Often I do have pauses of a few weeks in which I forget again half what I learned in the sessions between. So please help me with a short hint if you can but don't spend much time to figure out things that I can do myself. In these cases I appreciate also the advice "check the source" which is sometimes also helpful.
Best regards,
proplem
actually I also have far too little time for Tachyon ... and everything else ;-)
but sometimes I get curious and want to know myself.
I have a hard time after I knew Tachyon V1 and V2 quite well to keep up with Peter's fast pace in changing and advancing Tachyon.
With V4 I have to relearn much of the kernels internals again ...
@Peter Jakacki,
- AFAICS there is no .& in kernel or EXTEND. Maybe you could add MJB's version three posts before?
- second: there seems no UMOUNT or EJECT to be existing. Wouldn't this be necessary? I'm always unsure changing an sd card during operation and I think it's no good idea to do.
@Peter Jakacki,
- AFAICS there is no .& in kernel or EXTEND. Maybe you could add MJB's version three posts before?
- second: there seems no UMOUNT or EJECT to be existing. Wouldn't this be necessary? I'm always unsure changing an sd card during operation and I think it's no good idea to do.
if you FLUSH and close the open files then it is safe to eject the SD card.
Since Peter makes normally no use of the FAT itself, just writing sectors,
after FLUSH of the actual buffer taking the SD out is safe.
And the APPEND word scans a file for an empty sector / EOF ($00)
so there is no need for writing the actual file size all the time.
If you understand how it works internally, and you use tit right, then you gain some 'peace of mind' ;-) - and can just pull the SD card out any time.
No, STRING has not been implemented properly yet but that's easily fixed. You may have noticed that I don't use the STRING construct in my V4 Forth code as it was easy enough to just allocate memory but the real reason is that I'm not happy about having two types of strings with no way of telling if one has a preceding max count or not. Now if the string always had a end stop with the 8th bit set then the null terminator could be anywhere in between. But for that to work properly all strings would have to be the same. So I find it easier I think if I make STRING not worry about maximum size, so therefore there is no need for ERASE$ which would wipe the whole string buffer but needed to know the size.
But STRING is very good for creating a string constant at compile time as these strings can be passed as message etc. So the V4 version may just skip the maximum count internally although we would still specify it so memory can be allocated. We just know it's maximum size from the source, It's a bit like the Propeller chip, it doesn't have something built-in that says it only has 32k RAM, we just know it does from the datasheet.
@proplem - I've updated EXTEND with the STRING word that now works just like the old one except it only uses the max count for allocating string space, it doesn't bother saving this parameter before the start of the string like the old one.
( 0001 $3002 ok ) " HELLO" 0 STRING A$
( 0002 $300A ok ) A$ PRINT$
HELLO
( 0003 $300A ok )
( 0004 $300A ok ) " SECRET" 32 STRING PASS$
( 0005 $302E ok ) PASS$ PRINT$
SECRET
( 0006 $302E ok ) " DOUBLESECRET" PASS$ $! PASS$ PRINT$
DOUBLESECRET
( 0007 $302E ok ) " 007" PASS$ APPEND$ PASS$ PRINT$
DOUBLESECRET007
( 0008 $302E ok ) PASS$ 3 RIGHT$ PRINT$
007
( 0009 $302E ok )
pub STRING ( str max -- ) IMMEDIATE
[C] CREATE
HERE DUP DUP @NAMES NFA>BFA W! ALLOCATED
CALL ( here str max )
SWAP LEN$ MAX
OVER + 3 + 2 ALIGN uhere W!
' VAR SWAP W!
;
I mentioned before how wordcode allows us to revector any wordcode definition very easily as all we need to do is write the new vector to the first word of the wordcode. Here is an example of this in action for when we have EASYFILE loaded and we would like an LED connected to indicate that the card is busy. EASYFILE has a dummy function called SDBUSY that normally drops the ON/OFF flag passed to it. Here in this example we define a function to handle the LED being sourced from P0 and then write the address/vector of that to SDBUSY.
pri BSYLED 0 PIN! ;
' BSYLED ' SDBUSY W!
Now whenever you access the SD card the LED on P0 will flash. If you wanted the LED connected to VDD instead of ground then a simple NOT is all that you require in BSYLED before 0 PIN!
In the case of SDBUSY the default definition was simple and it didn't matter if the new function returned:
pub SDBUSY DROP ;
However for most functions or even all functions you can change the vector to a jump instead of a call simply by setting its lsb which is easily done if you add 1.
' BSYLED 1+ ' SDBUSY W!
Here is how a jump is done (before and after)
( 0087 $421A ok ) SEE SDBUSY
30E8 BSYLED
30EA EXIT
' BSYLED 1+ ' SDBUSY W!
( 0088 $421A ok ) SEE SDBUSY
30E8 GOTO BSYLED
30EA EXIT
A more complex example where LEDs are connected over I2C can be found in the SDLEDS.FTH file in the V4 folder. EDIT: I have now defined REVECTOR in EXTEND as a standard word with a from/to syntax just like ALIAS etc.
Normally the AUTORUN vector on reset points to BOOT in EXTEND but after loading other modules we have redirect AUTORUN to our own boot routine which then needs to call BOOT. Rather than doing this I have introduced +INIT so that modules may add their INIT vector to the list which is handled by BOOT as the last thing it does. This means that small routines that may need to setup hardware can be included and also the main application autostart can now just be added as a +INIT also. This list does not depend upon the dictionary although a check will be made to make sure that the code pointer HERE is greater than the INIT vector, just in case we run a FORGET and the init vector points to this section.
So !PCB has been done away with and up to 16 vectors may be added to the list in code memory so it can be backed up.
@proplem - I've updated EXTEND with the STRING word that now works just like the old one except it only uses the max count for allocating string space, it doesn't bother saving this parameter before the start of the string like the old one.
( 0001 $3002 ok ) " HELLO" 0 STRING A$
( 0002 $300A ok ) A$ PRINT$
HELLO
( 0003 $300A ok )
( 0004 $300A ok ) " SECRET" 32 STRING PASS$
( 0005 $302E ok ) PASS$ PRINT$
SECRET
( 0006 $302E ok ) " DOUBLESECRET" PASS$ $! PASS$ PRINT$
DOUBLESECRET
( 0007 $302E ok ) " 007" PASS$ APPEND$ PASS$ PRINT$
DOUBLESECRET007
( 0008 $302E ok ) PASS$ 3 RIGHT$ PRINT$
007
( 0009 $302E ok )
pub STRING ( str max -- ) IMMEDIATE
[C] CREATE
HERE DUP DUP @NAMES NFA>BFA W! ALLOCATED
CALL ( here str max )
SWAP LEN$ MAX
OVER + 3 + 2 ALIGN uhere W!
' VAR SWAP W!
;
I want to define a fixed length string buffer say 100 bytes. Hmm. Reading sources ...
Ok:
@proplem - I've updated EXTEND with the STRING word that now works just like the old one except it only uses the max count for allocating string space, it doesn't bother saving this parameter before the start of the string like the old one.
( 0001 $3002 ok ) " HELLO" 0 STRING A$
( 0002 $300A ok ) A$ PRINT$
HELLO
( 0003 $300A ok )
( 0004 $300A ok ) " SECRET" 32 STRING PASS$
( 0005 $302E ok ) PASS$ PRINT$
SECRET
( 0006 $302E ok ) " DOUBLESECRET" PASS$ $! PASS$ PRINT$
DOUBLESECRET
( 0007 $302E ok ) " 007" PASS$ APPEND$ PASS$ PRINT$
DOUBLESECRET007
( 0008 $302E ok ) PASS$ 3 RIGHT$ PRINT$
007
( 0009 $302E ok )
pub STRING ( str max -- ) IMMEDIATE
[C] CREATE
HERE DUP DUP @NAMES NFA>BFA W! ALLOCATED
CALL ( here str max )
SWAP LEN$ MAX
OVER + 3 + 2 ALIGN uhere W!
' VAR SWAP W!
;
I want to define a fixed length string buffer say 100 bytes. Hmm. Reading sources ...
Ok:
isn't working because NUM>STR is gone with the wind.
Peter I can't believe that in V4 we have to write our own number to text conversion don't we ;-))
you can easily define a string-output-stream by revectoring EMIT to
BYTE bufptr
$FF BYTES mystr
pub EMIT2$ ( char .. ) mystr bufptr + C! bufptr C++ ;
pub to$ ' EMIT2$ uemit W! ;
/// then
to$
/// now you can use any print routines redirected to your string ...
CON /// resets to normal EMIT
I did a generalized version of this for T2, but would need to search for it ...
but this should do
Thanks for persisting with this proplem, I know that you have many other things on your plate. However as MJB pointed out there are requirements where the nice and easy to use "automatic targeting" systems won't cut the mustard. If that's all that the "don't mess with it yourself, let me do it all for you" compiler will do then you're stuck with it. But like Luke we can use the "Forth", although he had to be reminded that it was there. When he did it saved his bacon.
Try the code that MJB posted and since you have the Forth you can even enhance your X-wing fighter as a proper string output device to recognize new lines etc.
I think I need to have a Tachyon blog running where I can make announcements etc...
Anyway, as I haven't been so sidetracked lately I've been updating various sections of Tachyon which should be a cause, not for dismay, but for joy joy, really.
Virtual file memory
A while back I updated EASYFILE to handle virtual file memory as opposed to virtual SD memory. As you know a 32-bit pointer will only read 4GB and many SD cards are larger than that and a problem occurs if a file is on a sector that >4GB, and then the FILE@ and XC@ operators etc cannot work properly. This was fixed in Tachyon for the P2 and only recently I updated EASYFILE with virtual file memory. So even though the old FILE@ and XC@ type words are still there, they are being deprecated in favor of filesystem words such as FSC@ to read a byte from a file etc. Rather than FILE@ I am using FSECT@ to return with the starting sector of the file, since in EASYFILE it assumes (and never fails) to find all file sectors consecutive.
Immediate words
Standard Forth also uses a : to start a new definition which from the start I augmented with pub and pri which later did differentiate a definition so that private headers could be automatically removed with RECLAIM. But there were also pub or : words that could have their IMMEDIATE attribute set as these needed to be executed as they were encountered rather than be compiled. Such words as IF ELSE THEN BEGIN AGAIN WHILE REPEAT etc are all such immediate words. But I find IMMEDIATE distracting and unnecessary when we could just as easily substitute the pub or colon for another word which says this should be public and immediate. I've chosen "pre" in keeping with the three letter p words and short for preemptive. So instead of saying:
pub REVECTOR IMMEDIATE
We can now say
pre REVECTOR
Some other points have already been mentioned in other posts. I may "blog" these notes into a Tachyon document at least with a table of contents but as always having some help from all you Tachyon users is only of help if you actively edit and add content rather than maybe just commenting on formatting etc. This may mean you will need to sign in to Google to edit a document, but don't be afraid to do so. Remember though that this is more of an on-line document and not really intended to be printed and pretty, just make it functional first. If you have a suggestion then I may not have time to read and fully understand or implement what you are suggesting, so just add it in and like me you will also find that while it serves as a basis for the present, you will find better ways of presenting that information.
btw - On comp.lang.forth which I infrequently read due to its focus on PCs and the language itself rather than what it is most useful for (getting things done), there was a post about a "Forth Pet" but I think they meant mascot. However I quite like the rebel fighter as a Forth icon with the "Use the Forth" caption. What do you think?
I like the way that the init list runs at startup, it is much more versatile than a single AUTORUN vector.
Tachyon has always displayed system information at startup. Now I am just adding and filling in some more details such as
initializations, Modules, ROMS, I2C devices, Clock frequency, Forth stats etc.
V4 also uses single keystroke commands which are most useful for those odd control characters too. There's a summary at the end of this post.
edit: .& to print in IP notation has been added to EXTEND (different from EASYNET's version as the digits are in big endian order in the Wiznet).
System before COMPACT which moves dictionary to EEPROM after which almost 12kB is free even with filesystem and buffers etc.
Comments
ah proplems proplems :-))
I downloaded your sanitized folder (thanks for this) to give iot5500 the next attempt:
- with defensive settings (115200 baud, 10 ms line delay excepted COMPACT.FTH and EASYNET.FTH)
- kernel ok
- extend ok
- easyfile ok - but ls not working (while v3 is) - nevertheless I patched good old P8.FTH for V4 (ignoring missed PCB and PCB$) - pasting COMPACT.FTH with 50 ms line delay ok
- pasting EASYNET with up to 100 ms line delay but no success
- see attached build.log
- and a snippet from the makefile
I think we/you are not so far away although this costs hours and hours but I couldn't give up.
BTW I have symbolic links on your original files so the names are different.
Thanks a lot,
proplem
- sdcard access isn't working - EASYNET needs SDCARD access and goes wild
- attention: this ^^^^ is not yet ethernet connected just a quick test
- sdcard worked yesterday on V3, hmmm
Have to go to bed - good night,
proplem
In V4 I decided to steer away from hardware headers that needed to be setup before loading the other modules as I want to be able to have generic binary images if necessary combined with the flexibility of configuring hardware at runtime. I see though that I haven't fully setup EASYNET in the same manner but I will fix that up shortly. Expect to be able to enter: to configure as necessary.
@Peter - sorry for responding delayed with bad news. IoT5500 is still rejecting cooperation:
I build it like this:
The build as itself is successful (no errors reported) but still I'cant access the SD card via "ls". Also WIZPINS is not yet implemented as you already mentioned but I tried to be sure.
&27.24.26.25
So these port numbers are in the order of left to right as CE, MISO, MOSI, and CLK as I'm guessing that perhaps your hardware is different. But normally the card and file system is mounted before use anyway with MOUNT but you could also just try !SD and look at the result which should be non-zero. If it is zero then it failed to even initialize the card so check with another card or board etc.
CE is the chip enable (without a pullup)
MISO is the "master in, slave out" so that means the read data from the card
MOSI is the data and commands to the card
CLK of course is the clock pin.
You're right, I haven't done WIZPINS yet, but that should be straightforward. There was a very small bug in the 4.3 kernel that was causing a problem in EASYNET so just make sure you use the latest updates too, not that this would cause any of the problems you are describing though.
This is a nice touch.
I have my standard default set at compile time but otherwise just use WIZPINS (in uppercase) to lock this into EEPROM.
btw, with wordcode it is easy to revector any word so if for instance you want LEDs to indicate SD card activity then there are dummy words in EASYFILE that you can revector to your LED word. In some cases your word may simply drive an I/O high or low but in other cases for instance I have LEDs connected over a shift register or I2C so they are easily accommodated. If your "vector" has the lsb set then it ends up performing a jump instead of a call which would be useful in revectoring code such as CARD? but optional if you revector SDBUSY for instance as that one is just a dummy word.
To revector the card detect routine to perform a jump to the vector with 1+ to set the lsb. Default is to sense the card's pullup on CE without any external pullup.
Startup
Testing a telnet connection btw, there are more modules than that loaded but the names are in the EEPROM dictionary after a compact so I need to update the reporting to include these too.
An open-source compiler for Propeller Spin
Copyright © 2012-2015 Parallax, Inc.
Compiling /Users/mgreen/Desktop/V4_21-Apr-2017/Tachyon V4.3.spin
/Users/mgreen/Desktop/V4_21-Apr-2017/Tachyon V4.3.spin(2233:36) : error : Address is out of range
Line:
_PLREP mov R1,pblksz ' reload buffer cnt
Offending Item: pblksz
Any suggestions?
However I changed my preferences from BST to OpenSpin and it failed:
I see the problem, the org statement is missing for this section of code and pblksz ends up effectively out of range at $1F9. Just insert " org _RUNMOD" before the _PLAY label where it should be. Obviously I haven't used that for a while
(File is updated on Dropbox)
Sounds like totally buggy serial coms software to me since I never have any problems at 921600 baud with zero character delay and only 5ms line delay. This is with a standard FT232R chip and minicom in Linux. The same goes for Teraterm running in an old XP on VirtualBox. In fact when you said it takes 2 or 3 tries to be successful from PropellerIDE I would start to suspect hardware problems, perhaps even a ground loop problem. Can you try powering the board from the same laptop just to check if that is any better?
There is another issue: How to set IP configuration?
AFAICS:
&192.168.2.1 == myGW
&192.168.2.124 == myIP
&255.255.255.0 == mySN
WCOLD could do - but doesn't.
ifconfig returns:
BTW is there a word to print dotted decimals a la &123.321.1.2 ?
@Proplem
as quoted often: "just check the source" ;-)
if you can print it with ifconfig then there is the answer ... BOLD does not work inside [ code] ...
so it is .IP
EDIT: was too fast again ;-( .IP does not print the & ...
but a quick search for '&' EMIT showed:
so if you remove the last line it should do what you want ...
EDIT: maybe not exactly ;-(
try this q&d hack propably Peter has a shorter solution ...
@MJB - thanks to your reply. Of course you are right with "check the source". Definitely yes. I want to explain that I'm permanently short in time and therefore I'm very thankful If someone helps me with something I could investigate myself which I'd have to spend a lot more time. I also agree that I would learn better/faster if I would more often read the source. Nevertheless I can not spend more time on tachyon as I'm currently doing. Often I do have pauses of a few weeks in which I forget again half what I learned in the sessions between. So please help me with a short hint if you can but don't spend much time to figure out things that I can do myself. In these cases I appreciate also the advice "check the source" which is sometimes also helpful.
Best regards,
proplem
PS:
the q&d hack works fine.
actually I also have far too little time for Tachyon ... and everything else ;-)
but sometimes I get curious and want to know myself.
I have a hard time after I knew Tachyon V1 and V2 quite well to keep up with Peter's fast pace in changing and advancing Tachyon.
With V4 I have to relearn much of the kernels internals again ...
- AFAICS there is no .& in kernel or EXTEND. Maybe you could add MJB's version three posts before?
- second: there seems no UMOUNT or EJECT to be existing. Wouldn't this be necessary? I'm always unsure changing an sd card during operation and I think it's no good idea to do.
if you FLUSH and close the open files then it is safe to eject the SD card.
Since Peter makes normally no use of the FAT itself, just writing sectors,
after FLUSH of the actual buffer taking the SD out is safe.
And the APPEND word scans a file for an empty sector / EOF ($00)
so there is no need for writing the actual file size all the time.
If you understand how it works internally, and you use tit right, then you gain some 'peace of mind' ;-) - and can just pull the SD card out any time.
No, STRING has not been implemented properly yet but that's easily fixed. You may have noticed that I don't use the STRING construct in my V4 Forth code as it was easy enough to just allocate memory but the real reason is that I'm not happy about having two types of strings with no way of telling if one has a preceding max count or not. Now if the string always had a end stop with the 8th bit set then the null terminator could be anywhere in between. But for that to work properly all strings would have to be the same. So I find it easier I think if I make STRING not worry about maximum size, so therefore there is no need for ERASE$ which would wipe the whole string buffer but needed to know the size.
But STRING is very good for creating a string constant at compile time as these strings can be passed as message etc. So the V4 version may just skip the maximum count internally although we would still specify it so memory can be allocated. We just know it's maximum size from the source, It's a bit like the Propeller chip, it doesn't have something built-in that says it only has 32k RAM, we just know it does from the datasheet.
I mentioned before how wordcode allows us to revector any wordcode definition very easily as all we need to do is write the new vector to the first word of the wordcode. Here is an example of this in action for when we have EASYFILE loaded and we would like an LED connected to indicate that the card is busy. EASYFILE has a dummy function called SDBUSY that normally drops the ON/OFF flag passed to it. Here in this example we define a function to handle the LED being sourced from P0 and then write the address/vector of that to SDBUSY. Now whenever you access the SD card the LED on P0 will flash. If you wanted the LED connected to VDD instead of ground then a simple NOT is all that you require in BSYLED before 0 PIN!
In the case of SDBUSY the default definition was simple and it didn't matter if the new function returned: However for most functions or even all functions you can change the vector to a jump instead of a call simply by setting its lsb which is easily done if you add 1.
Here is how a jump is done (before and after)
A more complex example where LEDs are connected over I2C can be found in the SDLEDS.FTH file in the V4 folder.
EDIT: I have now defined REVECTOR in EXTEND as a standard word with a from/to syntax just like ALIAS etc.
Normally the AUTORUN vector on reset points to BOOT in EXTEND but after loading other modules we have redirect AUTORUN to our own boot routine which then needs to call BOOT. Rather than doing this I have introduced +INIT so that modules may add their INIT vector to the list which is handled by BOOT as the last thing it does. This means that small routines that may need to setup hardware can be included and also the main application autostart can now just be added as a +INIT also. This list does not depend upon the dictionary although a check will be made to make sure that the code pointer HERE is greater than the INIT vector, just in case we run a FORGET and the init vector points to this section.
So !PCB has been done away with and up to 16 vectors may be added to the list in code memory so it can be backed up.
I want to define a fixed length string buffer say 100 bytes. Hmm. Reading sources ...
Ok: could be replaced by something like: Now I have to concatenate:
This isn't working because NUM>STR is gone with the wind.
Peter I can't believe that in V4 we have to write our own number to text conversion don't we ;-))
you can easily define a string-output-stream by revectoring EMIT to I did a generalized version of this for T2, but would need to search for it ...
but this should do
the beauty of FORTH / Tachyon :-)
Thanks for persisting with this proplem, I know that you have many other things on your plate. However as MJB pointed out there are requirements where the nice and easy to use "automatic targeting" systems won't cut the mustard. If that's all that the "don't mess with it yourself, let me do it all for you" compiler will do then you're stuck with it. But like Luke we can use the "Forth", although he had to be reminded that it was there. When he did it saved his bacon.
Try the code that MJB posted and since you have the Forth you can even enhance your X-wing fighter as a proper string output device to recognize new lines etc.
Use the Forth
I think I need to have a Tachyon blog running where I can make announcements etc...
Anyway, as I haven't been so sidetracked lately I've been updating various sections of Tachyon which should be a cause, not for dismay, but for joy joy, really.
Virtual file memory
A while back I updated EASYFILE to handle virtual file memory as opposed to virtual SD memory. As you know a 32-bit pointer will only read 4GB and many SD cards are larger than that and a problem occurs if a file is on a sector that >4GB, and then the FILE@ and XC@ operators etc cannot work properly. This was fixed in Tachyon for the P2 and only recently I updated EASYFILE with virtual file memory. So even though the old FILE@ and XC@ type words are still there, they are being deprecated in favor of filesystem words such as FSC@ to read a byte from a file etc. Rather than FILE@ I am using FSECT@ to return with the starting sector of the file, since in EASYFILE it assumes (and never fails) to find all file sectors consecutive.
Immediate words
Standard Forth also uses a : to start a new definition which from the start I augmented with pub and pri which later did differentiate a definition so that private headers could be automatically removed with RECLAIM. But there were also pub or : words that could have their IMMEDIATE attribute set as these needed to be executed as they were encountered rather than be compiled. Such words as IF ELSE THEN BEGIN AGAIN WHILE REPEAT etc are all such immediate words. But I find IMMEDIATE distracting and unnecessary when we could just as easily substitute the pub or colon for another word which says this should be public and immediate. I've chosen "pre" in keeping with the three letter p words and short for preemptive. So instead of saying: We can now say
Some other points have already been mentioned in other posts. I may "blog" these notes into a Tachyon document at least with a table of contents but as always having some help from all you Tachyon users is only of help if you actively edit and add content rather than maybe just commenting on formatting etc. This may mean you will need to sign in to Google to edit a document, but don't be afraid to do so. Remember though that this is more of an on-line document and not really intended to be printed and pretty, just make it functional first. If you have a suggestion then I may not have time to read and fully understand or implement what you are suggesting, so just add it in and like me you will also find that while it serves as a basis for the present, you will find better ways of presenting that information.
btw - On comp.lang.forth which I infrequently read due to its focus on PCs and the language itself rather than what it is most useful for (getting things done), there was a post about a "Forth Pet" but I think they meant mascot. However I quite like the rebel fighter as a Forth icon with the "Use the Forth" caption. What do you think?
I like the way that the init list runs at startup, it is much more versatile than a single AUTORUN vector.
Tachyon has always displayed system information at startup. Now I am just adding and filling in some more details such as
initializations, Modules, ROMS, I2C devices, Clock frequency, Forth stats etc.
V4 also uses single keystroke commands which are most useful for those odd control characters too. There's a summary at the end of this post.
edit: .& to print in IP notation has been added to EXTEND (different from EASYNET's version as the digits are in big endian order in the Wiznet).
System before COMPACT which moves dictionary to EEPROM after which almost 12kB is free even with filesystem and buffers etc.
Control and shortcut keys