dave0 has joined #forth
tp___ is now known as tp
<tabemann> hey
<tp> tabemann, hey
dbucklin has left #forth ["WeeChat 2.3"]
* tabemann just implemented systick
<tp> excellent!
<tp> it's dead simple compared to even the simplest timer
<tp> I always use systick with a interrupt
<tp> and the systick priority is higher than any peripherals by default
<tabemann> what I'm doing is setting systick to fire every millisecond
<tabemann> and having it increment a counter when it fires
<tabemann> the multitasker each time it PAUSEs checks that counter to see if it changed
<tabemann> well wait
<tabemann> forget that
<tabemann> the task code can have a built in time to wait for for each task
<tp> thats what Im doing
<tabemann> well wait, that's a little to specific, because the more general code should be able to handle other interrupts
<tp> actually I have systick interrupt every 0.1 milliseconds
<tp> the interrupt then increments a register
<tabemann> good idea
<tp> I do that so I can get an accurate 1ms count
<tp> a 32 bit counter is good for 18 hrs with this method
<tp> counter = register
<tabemann> thanks for the tips
<tabemann> how do you handle counter rollover?
<tabemann> specifically if let's say one is waiting for $FFFFFFFF, and the current time is $FFFFFFFE
<tp> there is a very clever way to do that
<tabemann> and then one misses a systick, so it ends up as $00000000
<tp> let me find the link
<tabemann> so one has to wait until a whole nother time around
<tabemann> oh I got it
<tabemann> one checks if the counter either is higher than what is being waited for, or is lower than it originally was
<tabemann> thanks again
<tp> no problemo
<tp> that technique is what I'm using and it all tested fine
<dave0> tp: a version of windows had the timer rollover error like in that article :-)
<dave0> it would crash after 49.7 days
<tp> dave0, yes, I remember that. Amazingly as Windows users always turn their PC's off after use or they locked up before 49.7 days, it was never a problem
<dave0> haha
<tp> the uptime on this FreeBSD pc is exactly the same as my last electricity outage
<dave0> 49.7 was just an upper bound :-)
<tp> as it never gets turned off
<tp> I think the longest the power has remained on here without a outage is 115 days
<tp> I had about 320 days uptime on a old Linux server box once, but long uptimes also mean long unpatched vuln's
<tp> dave0, in those days it was unusual for a windows box to go 2 weeks without locking up
<tabemann> back
<tabemann> I practically never reboot my work laptop, which, as you might assume, runs Windows 10
<tp> it's been a few years since the 49.7 day windows bug :)
<tp> tabemann, and 'practically never reboot my laptop' has a whole different meaning to 'never reboot' :)
<tabemann> well, yes, I hibernate it regularly
<tp> but it's cool, the 'uptime wars' finished decades ago
<tp> unless youre a VM rental business I guess ?
<tp> I noticed a test I was running on a STM32F051 was crashing after a period of time recently and immediately knew what was happening
<tp> every so often something was left on the stack and eventually all ram was used up
<tp> i didnt time it to see if the crash was every 49.7 minutes tho ;-)
<tabemann> lol
<tabemann> on zeptoforth I limited the stacks to 512 bytes, because I allocate other stuff as well high in RAM, specifically stacks and dictionaries for other tasks
<tabemann> and after each line of code is entered, it checks for whether the RP and SP are in range
<tp> Mecrisp-Stellaris does the same checking I guess
<tp> I occasionally get a 'ram full' or 'flash full' warning
<tp> always when some program is out of controll
<tp> -l
<tabemann> I haven't implemented dictionary bounds checks yet though
<tp> bbl
WickedShell has quit [Remote host closed the connection]
boru` has joined #forth
boru has quit [Disconnected by services]
boru` is now known as boru
X-Scale` has joined #forth
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale` is now known as X-Scale
logand``` has joined #forth
logand`` has quit [Ping timeout: 250 seconds]
_whitelogger has joined #forth
<tp> bal
<tp> bak
iyzsong has joined #forth
dave0 has quit [Quit: dave's not here]
gravicappa has joined #forth
_whitelogger has joined #forth
gravicappa has quit [Ping timeout: 264 seconds]
reepca has quit [Ping timeout: 250 seconds]
_whitelogger has joined #forth
jsoft has joined #forth
dddddd has quit [Ping timeout: 264 seconds]
mtsd has joined #forth
_whitelogger has joined #forth
X-Scale has quit [Ping timeout: 258 seconds]
X-Scale` has joined #forth
X-Scale` is now known as X-Scale
gravicappa has joined #forth
mjl has quit [Ping timeout: 272 seconds]
mjl has joined #forth
kieselsteini has joined #forth
dys has joined #forth
xek has joined #forth
jsoft has quit [Ping timeout: 246 seconds]
dys has quit [Ping timeout: 256 seconds]
_whitelogger has joined #forth
the_cuckoo has joined #forth
mtsd_ has joined #forth
mtsd has quit [Ping timeout: 256 seconds]
mtsd_ has quit [Quit: Leaving]
kieselsteini has quit [Quit: Palaver https://palaverapp.com]
iyzsong has quit [Remote host closed the connection]
iyzsong has joined #forth
dave0 has joined #forth
jsoft has joined #forth
dddddd has joined #forth
<tp> tabemann, after much work, my svd2forth now differentiates "read-only" registers in it's output
<tp> tabemann, as theyre "read-only" it adds a "-?" to the name and appends the "bit@" word before the ":"
<tp> for single bits: ": IWDG_SR_WVU-? ( -- x ) 2 bit IWDG_SR bit@ ; \ IWDG_SR_WVU, Watchdog counter window value update"
<tp> for multi bits: ": I2C2_RXDR_RXDATA-? ( %bbbbbbbb -- x ) I2C2_RXDR bit@ ; \ I2C2_RXDR_RXDATA, 8-bit receive data"
dys has joined #forth
<tp> the latter being a bad example as it's a receive data byte, unless one is looking for a specific byte I gues
iyzsong has quit [Ping timeout: 256 seconds]
iyzsong has joined #forth
reepca has joined #forth
iyzsong has quit [Ping timeout: 256 seconds]
iyzsong has joined #forth
iyzsong has quit [Client Quit]
_whitelogger has quit [Remote host closed the connection]
_whitelogger_ has joined #forth
<tp> \ I2C2_TXDR (read-write)
<tp> : I2C2_TXDR_TXDATA ( %bbbbbbbb -- x ) I2C2_TXDR ; \ I2C2_TXDR_TXDATA, 8-bit transmit data
<tp> in the above case there are only 8 bits that start at bit position 0, so no shifting is needed
<tp> in this case bitfield "sclh" starts at bit 8
<tp> : I2C2_TIMINGR_SCLH ( %bbbbbbbb -- x ) 8 lshift I2C2_TIMINGR ; \ I2C2_TIMINGR_SCLH, SCL high period master mode
<tabemann> wouldn't there be two words for each RW register?
<tp> in the case of I2C2_TIMINGR_SCLH one use may be "$11111111 I2C2_TIMINGR_SCLH bis!"
<tp> to set all the bits
<tp> or "$11111111 I2C2_TIMINGR_SCLH BIC!" to clear all the bits
<tp> or even just "$11111111 I2C2_TIMINGR_SCLH !"
<tp> depends what the programmer wants
<tp> in the case of read-only words they are all input to bit@ as the bits can only be tested not written
<tabemann> gotcha
<tp> these are all template words of course, premade to provide the most useful syntax
<tp> itr had been bugging me for a while now that my existing code treated "read-only" like all the other registers
<tp> I eventually plan to make a parser that creates the low level config words based on the higher level code
<tp> by simply pulling out all the bitfield templates corresponding to bitfields named in the higher level part of the program
<tp> and putting them into a 'config.fs' file
<tabemann> that's be cool
<tabemann> *that'd
<tp> so say you added "$11111111 I2C2_TIMINGR_SCLH BIC!" to your main program and then click make
<tp> the 'config.fs' file would now contain ": I2C2_TIMINGR_SCLH ( %bbbbbbbb -- x ) 8 lshift I2C2_TIMINGR ; \ I2C2_TIMINGR_SCLH, SCL high period master mode"
<tp> but I need to study a compiler type application or perhaps practice using Retro to do it instead
<tp> tempted as I am to do it in shell
<tp> of course rdrop-exit would say "Id just write all the code" but I still believe he doesnt fully appreciate the extend of the work involved
<tp> for instance, ADC0 in a GD32Vf103 contains
<tp> 1 peripherals
<tp> 21 registers
<tp> 88 bitfields
<tp> and to hand enter that stuff from the tech manual which has a lot of errors .... :(
<tabemann> yeeeah
<tp> how long would it have taken you to nut out the blinky code from the tech manual only ?
<tp> a programmer has enough to learn just finding out what 'open drain' or 'push pull' means
<tabemann> lol
<tabemann> a while
<tabemann> I have no clue as to what those mean
<tp> and thats probably the easiest task that can be done
<tabemann> well, I did figure out how to use systick just from ARM's documentation
<tp> it's the hardware world equivalent of "hello world"
<tabemann> but that was trivial
<tp> thats because systick is all software
<tp> any programmer would find systick easy enough
<tp> systick doesnt interact with the outside world
<tabemann> okay, well, I should go off to work
<tp> but systick is vital
<tp> okies, cya!
<tabemann> (yes, they're still making me come in unless I'm sick or the weather is inclement)
<tp> it's 1:30 am here
<tp> bastards!
<tabemann> it's 9:30 am here
<tabemann> see ya
<tp> as the infection stage is contagious and the patient doesnt know he/she is infected, seems pretty dumb to me
<tabemann> that's why you tell everyone to not come in
<tabemann> not just the sick people
<tp> exactly
<tp> ah well, good luck :)
<tabemann> k, off to work
<tp> bye
<MrMobius> hmm, I wonder if anyone has made a forth bot like geordi for C
<MrMobius> like if you type "geordi, int main() {return 2+3;}" it compiles it and runs it then answers back 5
<tp> sure
<tp> there was one here, may still be here
<tp> retrobot
<tp> CRC had it running here for ages
<tp> retro: #2 #15 * #12 + n:put
<tp> but the server it was on needed to be rebuilt
<MrMobius> neato
<tp> that code would answer "42"
<MrMobius> oh hmm, why the #?
<tp> retrobot was here until a couple of months ago
<tp> # means decimal
<tp> retro compiled in a flash and has been bugfree here on this FreeBSD machine, but I don't know retro well
<tp> retro is different to the gforth and the usual forths
<tp> in that it has different classes of Words
<tp> "n:" for instance is the 'number class' I think
<MrMobius> did the bot keep your stack or was it new every time?
<tp> i think it was new every time
<tp> I think CRC made sure it was "Mobius safe"
<MrMobius> lol
<crc> I'll have the retrobot back soon
cartwright has quit [Remote host closed the connection]
cartwright has joined #forth
TwoNotes has joined #forth
TwoNotes has left #forth [#forth]
jsoft has quit [Ping timeout: 256 seconds]
ecraven has quit [Quit: bye]
ecraven has joined #forth
dave0 has quit [Quit: dave's not here]
WickedShell has joined #forth
xek has quit [Ping timeout: 250 seconds]
logand``` has quit [Ping timeout: 246 seconds]
gravicappa has quit [Ping timeout: 250 seconds]
jsoft has joined #forth
<tp> crc, excellent!