<rdrop-exit>
I haven't programmed in about 10 days, starting to miss it
<tabemann>
hey proteusguy
<rdrop-exit>
am now caught up with r/Forth and clf
<tabemann>
zeptoforth is coming along awfully well
<tabemann>
now I need to just debug the damn thing
<rdrop-exit>
cool
<tabemann>
the only problem is I don't know how to use a debugger with ST-Link
<tabemann>
because simply trying to run it will probably just result in it doing nothing, which is kind of useless
<proteusguy>
is there a link to any information about zeptoforth tabemann ?
<tabemann>
it's just a pile of assembly code at the moment, with no docs aside from comments
<tabemann>
currently the only platform it supports is the stm32l476
<tabemann>
chosen solely because I am the proud owner of a DISCOVERY board
<proteusguy>
tabemann, what's different, new, cool about it vs other implementations for that platform?
<proteusguy>
is this a token based forth?
<tabemann>
no
<tabemann>
it's a native code forth
<proteusguy>
DTC or something else?
<tabemann>
SRT
<proteusguy>
ah ok.
<tabemann>
honestly, it's pretty similar to mecrisp-stellaris aside from being in a far less-developed state
<proteusguy>
doing thumb asm?
<tabemann>
yep
<tabemann>
I chose to abandon my approach I was taking for hashforth because it became apparent that I wouldn't be able to get adequate performance out of it on something like the stm32l476
<tabemann>
even though the token approach would have been significantly more memory-efficient, particularly w.r.t. ram-to-flash calls
<tabemann>
e.g. a ram-to-flash call would take just 3 instructions with my new approach, even though the call would have taken 80 bits of RAM
<tabemann>
whereas with the token approach I could have gotten a call down to just 16 bits, but it would have been significantly slower
<rdrop-exit>
80 bits, wow
<tabemann>
the overhead of tokens can be tolerated on a PC, but on a device with an MHz only in the double digits that overhead builds up
<tabemann>
rdrop-exit: a move 32 instruction, a movet instruction, and a blx instruction
<tabemann>
the move 32 sets the lower 16 bits of the address, the movet sets the upper 32 bits of the address, and the blx does the actual call
<tabemann>
*upper 16 bits
<tabemann>
the problem is that RAM and flash are in completely different sections of address space
<tabemann>
so I need to do this to call from one to the other
<tabemann>
because they are too far apart for a PC-relative bl call
<rdrop-exit>
80 bits sounds extravagant
<tabemann>
whereas two words compiled to flash can call each other with just PC-relative bl instructions
<tabemann>
it is extravagant
<tabemann>
the solution is to compile as much code as possible into flash
<tabemann>
or compile stubs of code to ram that call code in flash
<tabemann>
and have other code compiled to ram call these stubs
<tabemann>
because ram to ram calls are cheap too memory-wise
<tabemann>
I might even write code that autogenerates these stubs so they're available immediately upon startup
<tp>
tabemann,
<tp>
i can show you how to use gdb wityh stlink under unix ?
<rdrop-exit>
a call on RISC-V is 64 bits with the non-compressed ISA
<tp>
tabemann, I have a example file with everything set up nicely, I'll upload it to my doc site shortly
<tp>
rdrop-exit, I finished and used my 488 line Forth Word
<tp>
:)
dave0 has joined #forth
<tabemann>
can you email me the URL?
<rdrop-exit>
the shame! the shame! ;-)
<tp>
tabemann, sure
<tp>
rdrop-exit, I've sent it to the Guinness Book of Records, I'm after "Longest Forth Word"
<tabemann>
lol
<tp>
;-)
<tabemann>
okay, I forgot a critical word to implement: .
<tabemann>
not going to implement it now, as I plan on hitting the sack soon
<tp>
I might as well be famous for something before I die, you know etch my name "tp" in stone in the granite book of history!
<tp>
tabemann, no worries, I have it nicely set up with a script, one command and youre in the debugger
<rdrop-exit>
longest colon definition in the Forth Hall of Shame
<tp>
tabemann, along with a demo c file
<tp>
tabemann, make that a demo assembly file
<tabemann>
that's more like it
<tp>
rdrop-exit, no, not shame, it's fame!
<tp>
no one can make this Word shorter
<tp>
it's the shortest fetch and print of 488 non consecutive memory addresses generated by a XML file
<rdrop-exit>
You get the Kolmogorov award
<tp>
but Komrade Kolmogorov was sent to a Koncentration Kamp Kapisch ?
<rdrop-exit>
tp doesn't Mecrisp Forth have loops?
<tp>
sure
<tp>
wont help in this case tho
<rdrop-exit>
why not?
<tp>
every address is unique
<rdrop-exit>
so?
<tp>
488 unique addresses
<tp>
you cant simplify with with loops, spells or wishful thinking
<rdrop-exit>
get address, do something with it, get another... ad nauseum
<tp>
exctly
<rdrop-exit>
that's a loop, isn't it?
<tp>
no, it's a list of addresses
<tp>
it has a beginning and a end
<tp>
and it's 488 lines long :)
<rdrop-exit>
get first in list, do something with it, get another, ad nauseum
<tp>
thats what I do
<rdrop-exit>
I'm lost, you need 488 lines for a loop?
<tp>
the Word itself is automatically generated by another program
<tp>
no, I have a list, you have the loop
<rdrop-exit>
So it's self-imposed bloat
<tp>
no it's a automatically generated work list
<tp>
no bloat, it's lean mean and 488 lines long
<rdrop-exit>
open file, get first item, process first item, get next item... ad nauseum, close file
<rdrop-exit>
6 or 7 lines at most
<rdrop-exit>
or
<rdrop-exit>
If you're externally generating the source, no need for a colon definition just load the file
<rdrop-exit>
using the outer interpreter as your "loop"
<rdrop-exit>
No need for a 488 line colon definition, just load a source file with 488 lines of source
<rdrop-exit>
use the interpreter
<tp>
sure I could
<tp>
but I wanted that Guiness record!
<tp>
anyway, forget my new found Infamy, I have more interesting news!
<rdrop-exit>
no need to compile a huge colon definition into your dictionary, just interpret the source
<rdrop-exit>
"what we have here is failure to communicate"
<tp>
it's actually quick and simple! can't your Forth handle a 488 line Word like mine ?
<rdrop-exit>
no, nor should it
<tp>
lol, let me guess, youd have a 1k block limitation ?
<tp>
one advantage of a modern Forth is no 1k block limitation :)
<tp>
I wonder if you recall why I *needed* my 488 line Word ?
<rdrop-exit>
it just seems unecessary to compile something into the dictionary that you don't want there in the first place.
<tp>
it was needed to investigate a hardware problem
<tp>
it's only used in one special case, it doesnt stay in the dictionary forever
<rdrop-exit>
but why put it there in the first place?
<tp>
I definitely wanted it there, and it helped me solve my problem
<tp>
I needed to do a 'snapshot' of every MCU register, all 488 of them
<tp>
which I did, then I captured it in the terminal log, ran something else on the mcu and did it again, then diffed the logs
<rdrop-exit>
sure, but the colon definition isn't the snaphot, it's the camera
<tp>
absolutelt
<tabemann>
but you need to define each individual register you are reading in the colon definition
<tp>
exactly
<tp>
and print their names
<tabemann>
you could put the register definitions in a block of memory
<tabemann>
but you need to put them somewhere
<rdrop-exit>
that's the snapshot, not the camera
<tp>
remember, the Word is automatically made from a huge XML file
<tabemann>
and simply having a list of ." name: " REGISTER @ . CR one after another is the simplest way of doing it
<tp>
I only made the XSLT
<tabemann>
yes! zeptoforth actually builds
jsoft has quit [Ping timeout: 272 seconds]
<tabemann>
well, it still lacks .
<rdrop-exit>
there's no problem with having a list of commands one after the other executing when you load the source file, there's just no need to wrap all that in a colon definition and append it to your dictionary.
<tp>
tabemann, something like this ?
<tp>
." PWR_CR:" $40007000 $0 + hex. cr
<tp>
." PWR_CSR:" $40007000 $4 + hex. cr
<tp>
." RCC_CR:" $40021000 $0 + hex. cr
<tp>
." RCC_CIR:" $40021000 $8 + hex. cr
<tp>
." RCC_CFGR:" $40021000 $4 + hex. cr
<rdrop-exit>
" camera.4th" fload
<tp>
and so on for another 483 lines
<rdrop-exit>
would run all that without poluting your dictionary
<tabemann>
rdrop-exit: the problem with that is you risk disturbing more state
<tp>
easy peasy
<tabemann>
putting everything in a single word simplifies things, and thus reduces the disruption to the system state that you are trying to capture
<tp>
I have 100kB of dictionary space in Flash
<tp>
tabemann, exactly
<tp>
but this isnt even the most interesting part!
<rdrop-exit>
state is going to be disturbed no matter what unless you use the chips debug interface to get at the info
<tp>
rdrop-exit, it took maybe 3 seconds to upload and compile that 488 line word
<tp>
rdrop-exit, sure, but Im after minimal disruption, I'm only reading peripheral registers
<tp>
so my problem was that I could ONLY read a STM32F103 debug register from Forth WHILE the JTAG debugger was attached
<tp>
the specs said it could be read from a user program (forth) but I could only read $00
<tp>
the register was there, and it had data, but that data could only be read by the debugger
<rdrop-exit>
not all debug registers are shared with user programs
<tp>
so I wrote my 488 line word, snapshotted all the regs with and without the debugger connected and diffed them
<tabemann>
this was a bug though
<tabemann>
clones of this chip by various chinese manufacturers fixed this bug
jsoft has joined #forth
<tp>
eventually I found that this BUG is listed t=in the STM32F103 errata
<tp>
tabemann, exactly!
<tp>
thats the ironic thing
<rdrop-exit>
sneaky
<tp>
stm never fixed it, why would they, that chip is 16 years old
<tp>
but the CLONERS fixed it with their own 'compatible' implementations
<rdrop-exit>
crazy world we live in
<tp>
so by accident I stumbled on one way to tell if a chip is a genuine STM32F103 or a clone
<tp>
:)
<tp>
rdrop-exit, it is a crazy world
<tabemann>
okay, I'm gonna go hit the sack, now that zeptoforth is actually building properly
<rdrop-exit>
goodnight tabemann
<tabemann>
not that it actually works, it most likely does not
<tabemann>
g'night guys
<tp>
rdrop-exit, the illegal forger of the STM32F103 make a chip named "CS32F103C8", it's been decapped and is totally different to the genuine STM chip, yet while that chip is for same everywhere, no one knows who makes it!
<tp>
night tabemann
<tp>
rdrop-exit, whats ironic is that there is no datasheet anywhere for that counterfeit chip
<tp>
rdrop-exit, the "CS32F103C8" fixes that debugger bug, and it could have stood on it's own as a separate STM32F103 'compatible' chip but the mfr decided that to do so would take too long to make money, so they just sold them as STM32F103 complete with chip marking and forged chip ID's inside it
<rdrop-exit>
he
<tp>
and NO ONE in China knows where they are made .... uhuh
<tp>
the chip is branded 'CKS' yet the CKS website has no listing of such a chip, and no warning that someone is using their company name on a STM32F103 clone
<tp>
honestly, the material for a spy thriller is there! I'm waiting for a Tom Cruise spy thriller about it one day
<rdrop-exit>
:)
<tp>
your daughter could play the part of the scientist who was forced to make it to protect her family!
<rdrop-exit>
ha
<tp>
she could wear traditional HAN clothing and operate out of a hidden FAB in Wuhan ?
<rdrop-exit>
My wife toured a few of the Huawei facilities, she was amazed.
<rdrop-exit>
humongous places
<tp>
Jet Li could play her boyfriend trying to rescue here from the evil chine clone makers
<tp>
-e
proteus-guy has joined #forth
<tp>
oh yeah, Huawei is amazing
<tp>
I have one of their phones
<rdrop-exit>
bbiab
WickedShell has quit [Remote host closed the connection]
<Kumool>
i bought a huawei sdcard, it did not work
<proteus-guy>
Kumool, you're just assuming it was meant for you to listen to. It's really meant for the PRC govt to listen to and I understand it's working perfectly! ;-)
<MrMobius>
how many variables do I need on the stack before I can resort to local variables without angering the Forth gods?
<MrMobius>
up to 9 for this word and no obvious way to make subwords
Croran has quit [Ping timeout: 256 seconds]
proteus-guy has quit [Ping timeout: 256 seconds]
dddddd has joined #forth
ryke has joined #forth
<crc>
MrMobius: 9 parameters to the word?
gravicappa has quit [Ping timeout: 272 seconds]
<tp>
Investigators probing the botched flight of Boeing’s Starliner spacecraft in December have found widespread and “fundamental” problems with the company’s software that could have led to a disastrous outcome more grievous than previously known, the agency said Friday.
<tp>
Boeing is now reviewing all 1 million lines of code in the capsule’s computer systems, officials said. How long that review will take is uncertain, Boeing officials said.
<MrMobius>
crc, 3 parameters then 6 more things on the stack calculated from that
gravicappa has joined #forth
<crc>
Sounds unpleasant if all the values need to be kept on the stack
<crc>
tbh, I'm a pragmatic person: if your forth has local variables, and they let you get the job done, go ahead and use them.
<crc>
a purely stack based solution may be more elegant, but (depending on the problem and target constraints), getting the job done and having it be something you can understand and maintain is more important
dave0 has joined #forth
gravicappa has quit [Ping timeout: 240 seconds]
Croran has joined #forth
Croran has quit [Client Quit]
Croran has joined #forth
cartwright has quit [Remote host closed the connection]