<Croran>
You're welcome. One of the things that struck me was the 'Model-T-Shirt Programming' and how it seems related to Forth words or Forth 'Screens'.
<tabemann>
hey guys
<tp>
hey tabemann
* tabemann
is currently working on a multitasker for zeptoforth
<tp>
tabemann, Ive just made my first really simple scheduler for Mecrisp-Stellaris
<tp>
tabemann, I needed something that didn't use many resources to schedule operations such as the Touch Sense Controller running under a interrupt
<tp>
Mecrisp-Stellaris has a cooperative multitasker but it uses 800 bytes of ram per task which is way too much for me plus intertask comms is at your ad-hoc pleasure
<tp>
a simple scheduler just runs words at set intervals
<tabemann>
mine can use far less than that if the user wishes to use really small stacks
<tabemann>
the user doesn't need to use 256 bytes per stack
<tp>
Croran, I'm a user of a more modern embedded forth, I use files on my pc instead of screens
<tp>
tabemann, with really small embedded it's usually not a matter of choice, everything has to be really small
<tp>
i have 64kB of flash and 8kB of ram, thats it
<tp>
your M4 has virtually unlimited resources from my pov
<Croran>
tp: Yeah. I still think the concept can be useful. I think the human brain works better with relatively small pieces of code, and the concept of the 'screen' tends to enforce such a presciption.
<tp>
Croran, I definitely agree
<tp>
Croran, we tend to keep our Forth Words short 3 - 4 lines so they can be independently tested and easily understood
<tp>
here is a example of my proto scheduler task
<tp>
: task-1 ( u -- )
<tp>
now-time? task1-time @ - swap u>= if
<tp>
blue-on ." blue-on " now-time. cr
<tp>
then
<tp>
now-time? task1-time !
<tp>
;
<Croran>
nice
jfe has quit [Read error: Connection reset by peer]
<tp>
Croran, I'm a electronics tech not a proper programmer
jfe has joined #forth
<tp>
Croran, but I manage to scrape by ;-)
<tp>
I find one of the challenges with using interrupts is keeping the interrupt handler as short as possible and then handling the result, hence my recent need for a scheduler
<Croran>
I installed Mecrisp on an STM32. It was pretty neat getting the Forth interpreter responding over serial.
<tabemann>
getting Mecrisp-Stellaris working was a breeze
<tp>
tabemann, I came across a stack-exchange question that related to the stm32 TSC peripheral that was 12 months old, the few respondents advised using a library as dealing with registers 'is too complex'
<tp>
Croran, yes, Mecrisp-Stellaris is excellent, Ive been using it since 2014
<tp>
tabemann, no one actually supplied a answer. I looked at all the config and found one was wrong :)
<tabemann>
tp: ugh
jfe has quit [Ping timeout: 265 seconds]
<tp>
this is one of the reasons that I think C sucks
<tp>
TSC->IOSCR |= 0x04; //enable G1_IO3 (PA2) as sampling capacitor ** WRONG this is enabling G1_IO4 (PA3) not PA2
<tp>
this business of |= 0x04 for instance
<tp>
|= 0x01 means 'set bit 0'
<Kumool>
ha
<tp>
very confusing, and although the designer had got the TSC configs correct, which is not trivial, he bumbled on this
<tabemann>
I am used to twiddling bits in C, but I see how that'd be misleading
<tp>
tabemann, and Kumool yeah, very error prone I think
<tabemann>
note that a lot of compsci students these days don't even know how to manipulate bits
<Kumool>
and why would you
<Kumool>
you don't need to
<Kumool>
to display shiny webpages
<tabemann>
as if web pages were the end all and be all of computing
<tabemann>
when I was in school I learned MIPS assembly and digital logic design (even got to design and test a microprocessor), but these days...
<MrMobius>
|=BIT0 also means set bit 0 if your header has BITx defined
<tp>
Kumool, hahah
<Kumool>
tabemann: are you a whoosh man?
<tabemann>
whoosh?
<Kumool>
as in, things just zoom past you
<Kumool>
sorry, I forgot a /s in my comment
<tabemann>
these days I do web programming for a living, but I'd prefer to do something closer to the metal
jfe has joined #forth
<tabemann>
but my job is convenient and pays well, so I stick with it
<Kumool>
but we all use chromium tabemann
<Kumool>
that's a metal
<Kumool>
maybe a browser called iron needs to be made
<tp>
MrMobius, yeah, but it's interesting that after 1 year on stack-exchange no one picked that error up
<tp>
MrMobius, I prefer "0 bit TSC_IOSCR bis!" myself
<tp>
Kumool, I don't use chromium, it's modern crap that can't print to a LPRNG print spooler
<Kumool>
tp: another woosh
boru` has joined #forth
boru has quit [Disconnected by services]
boru` is now known as boru
<tabemann>
g'night guys
<tp>
night tabemann
_whitelogger has joined #forth
<Croran>
Everyone's set their clocks foward today?
<tp>
not in Australia :)
<Croran>
ah, a sane government.
<tp>
no, we have 'daylight saving' but currently we are in our spring, summer just finished and daylight saving wont end for a while yet
<Croran>
oh really? so you change clocks too?
<Croran>
lame.
rdrop-exit has joined #forth
<tp>
yeah
<rdrop-exit>
Good morning Forthwrights c[]
<tp>
if we don't the curtains turn yellow and the milk curdles ;-)
<tp>
morning Zen Guru of Forth!
<rdrop-exit>
Hi Forth Master Technician (tm)!
<tp>
rdrop-exit, Ive just finished my first ever FSS (Forth simple scheduler)
<Croran>
tp: haha
<rdrop-exit>
cool!
<Croran>
If it were up to me, everyone would be on GMT.
<tp>
rdrop-exit,
<rdrop-exit>
No DST here
<tp>
0 variable taskx-time
<tp>
now-time? task1-time @ - time-interval-to-run-task-x u>= if
<tp>
now-time? task1-time !
<tp>
: task-x ( u -- ) \ functional basic example
<tp>
do-stuff
<tp>
then
<tp>
;
<Croran>
rdrop-exit: Arizona?
<rdrop-exit>
Manila
<Croran>
rdrop-exit: nice
<tp>
rdrop-exit, ignore stack comment it's wrong
<rdrop-exit>
ok :)
<tp>
rdrop-exit, as the time-interval-to-run-task-x in now a parameter in my latest version
<tp>
in = is
<tp>
rdrop-exit, doesn't your milk curdle if you don't have DST ?
<rdrop-exit>
life is simpler without DST
<rdrop-exit>
don't really need it in a tropical country
<tp>
o don't really notice it as my sundial is DST aware
<rdrop-exit>
we don't really have seasons in the traditional sense
<rdrop-exit>
just rain or no-rain
<tp>
rdrop-exit, you just have 100% humidity or heavy rain ;-)
<rdrop-exit>
yup
<rdrop-exit>
(downloading the Alan Kay paper)
<tp>
fortunately it's raining a bit today here, 25,25 C / 77,67 F
<tp>
we are exactly the same as you rdrop-exit ... except we dont have the rain part
<rdrop-exit>
34C today
<tp>
with rain ?
<rdrop-exit>
no rain, sunny
<tp>
I think some cyclone is affecting our weather
<Croran>
rdrop-exit: What got me interested in that was Alan Kay's talk at CMU. If you don't have the patience for the paper, the talk is interesting too.
<tp>
the usb id is "Mecrisp STM32F10x Forth Serial Port, class 2/0, rev 2.00/2.00, "
<tp>
Croran, it's under 64kB so openocd will be happy to flash it
<Croran>
rdrop-exit: oh ok. are yours accessed in a different way?
<tp>
Croran, yes, rdrop-exit inputs code into his Forth with a 'etch-a-sketch'
<tp>
;-)
<tp>
Croran, my binary is a full Mecrisp-Stellaris so outside the menu, you can use it.
<rdrop-exit>
On a PC Forth I just treat all the Forth's RAM as blocks.
<tp>
rdrop-exit, when you look at each ram chip in a pc, they do look like little black blocks ...
<rdrop-exit>
I can point my block editor/viewer to any block within the Forth's RAM.
<rdrop-exit>
The lower so many blocks are the dictionary.
<tp>
rdrop-exit, you've permanently altered how I see Forth with a comment you made a while ago while refactoring one of my Words when you wrote here ... "the data is on the stack already"
<rdrop-exit>
cool :)
<tp>
rdrop-exit, my days of using the return stack as a local variable may be over as a result
<rdrop-exit>
The blocks beyond the dictionary can hold source or data
<tp>
rdrop-exit, is it true that "Forth blocks are just a C programmers attempt at abstraction" ?
<rdrop-exit>
tp, never heard that
<tp>
rdrop-exit, i just invented it :)
<rdrop-exit>
For me Forth blocks are just a useful unit of memory, just as is a byte, or 16,32,64 bits
<tp>
as a tech I see memory as having a start and end, I cant see it as 'blocks'
<rdrop-exit>
It's just a convenient chunking
<rdrop-exit>
1k is a convenient chunking for some things, 64k for others, 8 bytes for others, etc...
<rdrop-exit>
it just so happens that I find it the most convenient chunking for source, and for a small viewport into memory
<Croran>
tp: I loaded your diagnostic
<tp>
i do admit when I used 'riscy pygness' I quite enjoyed using blocks
<Croran>
tp: It appears to have found another 64K of flash
<tp>
Croran, told ya :)
<tp>
Croran, what does it think the chip type is ?
<Croran>
tp: yeah so that's cool. I spent the last 5 minutes trying to figure out what the chip said on the top... The writing is very tiny and faint.
<tp>
reading chip numbers can be hard, especially if they are fakes
<Croran>
tp: It thinks it's an STM32F1 series
<tp>
ahh, then it is a genuine chip :)
<Croran>
nice
<Croran>
not bad for $1.98
<tp>
it's a genuine STM32F103C8
<rdrop-exit>
tp, I find the index card metaphor of blocks more to my liking than the scrolling parchment metaphor of files
<tp>
hard to beat considering it has a 2x xtals, switch, headers, and mcu
<tp>
rdrop-exit, I'll have you know that I use only the highest quality Egyptian papyrus in my files!
<rdrop-exit>
snazzy
<tp>
Croran, the interesting thing about the STM32F103C8 is that they all seem to have 128KB of flash, BUT STM marked them internally as only having 64kB
<Croran>
tp: yeah. to make sure it wasn't going to compete with their more expensive parts maybe? i wonder.
<tp>
Croran, so openocd reads the internal 'flashsize register' which says '64kB' and thats what it uses
<Croran>
tp: I wonder if it's underprovisioned so that it can do wear-leveling...
<tp>
Croran, we all asume it was a marketing thing and that STM used the same die for the STM32F103C8 and the more expensive 128kB STM32F103B8
<tp>
Croran, nah, that chip was designed in 2004, it's ancient
<Croran>
tp: I was thinking it would be cool to find a chip with 4x or even 8x UARTs and build a serial terminal server for my Cisco lab.
<tp>
Croran, fortunately, my binary allows you to use the full 128kB
<Croran>
but none of the cheap ones seem to have more than maybe 2 UARTs
<Croran>
tp: oh yeah? your modified mecrisp/stellaris?
<tp>
Croran, your chip has 3 uarts I think
<tp>
Croran, some stm32's have 6 uarts I think
<tp>
Croran, modyfing the Mecrisp-Stellaris ram or rom is very easy, it's in system.s
<tp>
then just rebuild the binary and youre done
<tp>
Croran, it also uses USART2 with hardware handshaking as a alternative to the USB terminal if you want
<tp>
just enter "-usb" at the prompt (but you'll need a terminal attached to USART2)
<tp>
from that terminal you can go back to the USB with "+usb"
<tp>
Croran, here is a cool thing, at your terminal on the BluePill enter "gpioa." <-- note the trailing period
<tp>
or "rcc."
<Croran>
tp: what's all that?
<tp>
it's the actual real time values of the bits in those registers
<Croran>
nice. and what do those registers correspond to?
<tp>
check the 'reference' PDF for the stm32F1xx
<tp>
GPIOA. are all the Port A registers and control the I/O
<tp>
RCC. is the 'clock' register and controls all the peripherals
<tp>
although OLD, the STM32F1 has 53 peripherals on board,722 registers and 4833 bitfields
<tp>
it's also running at 72 MHz in my binary, so it's not slow
<Croran>
is gpio a parallel port?
<tp>
Croran, yes
<tp>
16 bits wide
<Croran>
oh ok. i didn't realize that.
<tp>
Croran, because it's such a old chip the gpio's are HORRIBLE to configure, don't think the more modern ones are the same because theyre not
<Croran>
weird that some of my gpio pins are high...
<tp>
the stm32f0 for instance came out in 2011 and the GPIOS's are much nicer to configure
<tp>
they are in input,floading mode by default and picking up stray charges etc
dddddd has quit [Remote host closed the connection]
<tp>
therye very sensitive in that mode
<tp>
tho some may actually be high
<tp>
GPIOA is used or the USART2, so some pins will be configured high
<tp>
Croran, if you enter "words4" youll see all the Words on that system now
<Croran>
that's a lot.
<Croran>
is words4 a custom word? I was using just 'words' and the format it outputs is pretty annoying.
<tp>
yeah, thats one of mine
<tp>
everything after "--- Flash Dictionary ---" is stuff Ive added
<tp>
tho only a small amount are my own Words
<Croran>
do you know of a definition for a 'see' word for this platform?
<tp>
sure
<tp>
I had to take it out of that image to keep it small
<tp>
but you can upload mecrisp-stellaris-2.5.3-orig/common/disassembler-m3.txt to it
<tp>
or whatever version of the release you have
proteus-guy has quit [Ping timeout: 260 seconds]
<tp>
when you upload disassembler-m3.txt youll have the word "see"
<tp>
see 2+
<tp>
00002046: 3602 adds r6 #2
<tp>
00002048: 4770 bx lr
<tp>
Bytes: 4 ok.
<tp>
tho my mod adds tha "Byte: .. " at the end
gravicappa has joined #forth
<tp>
bbs
<Croran>
tp: I posted to your sourceforge thread with the xml file for my board :)
<Croran>
I tracked down that disassembler-m3.txt
<Croran>
and got it working
<Croran>
yours words4 makes it look like 'ok.' is a word :)
<Croran>
your*
<Croran>
How do you get 80 I/Os with only 48 pins?
dave0 has joined #forth
[1]MrMobius has joined #forth
MrMobius has quit [Ping timeout: 255 seconds]
[1]MrMobius is now known as MrMobius
proteusguy has quit [Ping timeout: 265 seconds]
proteusguy has joined #forth
jfe has quit [Ping timeout: 255 seconds]
jfe has joined #forth
jfe has quit [Ping timeout: 265 seconds]
[1]MrMobius has joined #forth
proteus-guy has joined #forth
MrMobius has quit [Ping timeout: 265 seconds]
[1]MrMobius is now known as MrMobius
jfe has joined #forth
<proteus-guy>
Good news! A very basic initial implementation of ActorForth is available for your critique and curiosity at https://github.com/scherrey/ActorForth !
<tp>
Croran, great!
<rdrop-exit>
proteus-guy, congrats!
<proteus-guy>
It's type system is fundamental to the architecture - it performs word lookup priority based on the type at TOS then goes to global dict if not found.
jfe has quit [Ping timeout: 256 seconds]
<tp>
Croran, you buy a STM32F103 in a larger package with more pins, they go up to 180 pins I think
<tp>
proteus-guy, awesome!
<proteus-guy>
This makes adding new compilers very simple because you put a compiler type on the stack as you define the new word and now you have compile time behavior for every available word.
dys has joined #forth
<proteus-guy>
Right now there are no flow control or loops - next priority is pattern matching and recursion. Then flow control and loops and at that point it will be a "working" language.
<rdrop-exit>
sounds very sophisticated
<proteus-guy>
Entire thing is written in python. It's pretty small. Eventually it will be self hosted and also target Ethereum EVM.
jfe has joined #forth
<rdrop-exit>
I still haven't gotten around to taking a look at Python
<proteus-guy>
rdrop-exit, haha here's your chance... ;-)
<rdrop-exit>
guess so :)
<proteus-guy>
I'm using the runtime type checking feature of Python so my code will look different than most.
<proteus-guy>
(as most don't use it)
<Croran>
tp: is the stm32G series a good upgrade in terms of peripherals and lower power usage?
<tp>
Croran, I don't know
<tp>
Croran, I mainly deal with the STM32F051 released in 2011 I think
<Croran>
tp: the 'readout protection' feature is interesting
<Croran>
tp: "Level 2: chip readout protection: debug features (Cortex-M0+ serial wire), boot in
<Croran>
RAM and bootloader selection are disabled. This selection is irreversible."
<tp>
Ive read that the G is pretty fast and capable, tons more than what I use
<tp>
Croran, thanks for you xml file :)
<Croran>
tp: you're welcome. thanks for your diagnostic :)
<Croran>
tp: you know what would be an interesting exercise is to add an SRAM test. like memtest86+ where it just reads and writes patterns to verify consistent operation.
jfe has quit [Ping timeout: 240 seconds]
<tp>
hehe, feel free to write one :)
<tp>
this diagnostic was only to test the actual MCU as there is a BIG counterfeit problem, and to test the 'hidden' second 64kB flash block
<tp>
it has to fit in 64kB as well
<Croran>
tp: how much SRAM does the forth interpreter + dictionary take up?
<tp>
you can find that out by typing "free"
<tp>
it varies of course bepending whats loaded etc
<tp>
depending
<Croran>
ah interesting.
jfe has joined #forth
<Croran>
Used: 9412
<tp>
generally 1.5kB of ram for a base system
<tp>
Croran, that bluepill has been out for a long time, but still no C or any other OS created binary like mine to diagnose it
<tp>
Croran, there have been 180 downloads of my original diagnostic program, but it wasnt as useful at this new one which youve just downloaded
<Croran>
tp: nice
<Croran>
tp: how would i drop all the extra stuff from SRAM and leave just the base system?
<tp>
Croran, you managed to upload the dissasembler-m3.txt ok ?
<tp>
Croran, if you do that youll loose your USB connection
<tp>
and *have* to connect via USART2 or reload the binary to get USB back
<Croran>
tp: yeah i uploaded the disassembler
<Croran>
tp: ah well i don't want to lose that part :)
<tp>
Croran, typing 'eraseflash' will erase all my extra stuff
jfe has quit [Ping timeout: 265 seconds]
<tp>
inc the usb driver
<Croran>
tp: but reloading the binary wouldn't be the worst problem
<Croran>
tp: so that removes it from flash. will that free my SRAM?
<tp>
no but altho youd have a base system, you wouldnt be able to connect
<tp>
sure, it will free the sram apart from what Mecrisp-Stellaris wants
jfe has joined #forth
<tp>
the usb driver takes a fair bit of that ram I think
<Croran>
huh. i wonder what all is in the SRAM. some kind of dictionary index? and then the USB driver, and the base Forth interpreter...
<tp>
I've no idea, thats a programmer question :)
<tp>
but the german assembly source for everything is in the tarball you have
<tp>
tho there are a lot of english comments as well
<tp>
the usbdriver is in flash, I put it there
<Croran>
yeah. i assume it has some kind of buffers in SRAM though
<tp>
definitely
jfe has quit [Ping timeout: 260 seconds]
jfe has joined #forth
jfe has quit [Ping timeout: 240 seconds]
<tp>
Croran, re the stm32G, it's not the high power unit I was thinking of
<tp>
but it looks like the latest amalgamation of the M0+ but in high clock speed with the latest peripherals
<tp>
so, a very recent new model based on all the good bits of the M0/M0+ series
<tp>
there is no Mecrisp-Stellaris for the G model but I bet it runs once the USART is set up