<MrMobius>
so how do they handle writing words to flash on those avr forths? can you just pick whether it goes into ram or rom?
<lispmacs[work]>
MrMobius: in FlashForth, the `create' word creates an entry in the dictionary (flash) but other words like `allot' use whatever data section you currently have set
<lispmacs[work]>
which is set with the `flash', `eeprom', or `ram' words
<lispmacs[work]>
by default you are in `ram' mode
<lispmacs[work]>
so, the following would create an array called `foo' in ram:
<lispmacs[work]>
create foo 10 allot
<lispmacs[work]>
but to have the array in flash:
<lispmacs[work]>
flash create foo 10 allot ram
<lispmacs[work]>
the usual : foo etc ; will create a word in flash
<Zarutian_HTC>
I have been trying to find out something regarding avr and arduino
<Zarutian_HTC>
there is an 'bootloader' in portion of avr flash that can write to rest of the flash
<Zarutian_HTC>
some moons ago I came across a function that allowed to write to flash from arduino c code
dave0 has quit [Quit: dave's not here]
<Zarutian_HTC>
what I surmised was there was a call into a small write flash primitive function that is now part of the standard ardunio 'bootloader'
<Zarutian_HTC>
what I like to know is where that primitive function is in the 'bootloader' section is and how one might invoke it from forth
<Zarutian_HTC>
no idea if this is even current codebase for the arduino bootloader
<Zarutian_HTC>
sigh looks like it is easier to just have instructions on how to use an arduino as an In-circuitSerialProgrammer to flash another atmega328p ( DualInlinePackage version )
<Zarutian_HTC>
with an forth compatible and ArduinoISP protocol compatible bootloader
<lispmacs[work]>
Zarutian_HTC: I would recommend the very convenient DIYMORE AVR ISP Shield that fits on the Arduino UNO. It has a ZIF socket for inserting and programming 328p chips
<lispmacs[work]>
it also has a 6pin header which i have used to program Arduino Nano boards
<lispmacs[work]>
so far I have used this tool to load FlashForth 5 on three 328P MCs, two of which were DIPs I used in UNO boards and one on a Nano
<Zarutian_HTC>
sounds nice, might not be available everywhere where ardino boards are sold
<Zarutian_HTC>
arduino
<lispmacs[work]>
I bought mine from Amazon for a few dollars
<Zarutian_HTC>
lispmacs[work]: you are making an assumption here, can you spot it?
<Zarutian_HTC>
the assumption is that everyone can or want to order it, wait a few days to ship, etc
<Zarutian_HTC>
it is not uncommon for hobby stores and even some consumer electronics store to sell those 'standard' arduino uno kits
<Zarutian_HTC>
so the instructions might be 'you need two arduino uno boards and you could just borrow the one used as the isp'
<lispmacs[work]>
Zarutian_HTC: there are no hobby stores remotely close to where I live in Alaska. The last radioshack closed years ago
<lispmacs[work]>
but I am glad they still exist somewhere
<KipIngram>
lispmacs[work]: Digikey and Mouser are good sources.
<Zarutian_HTC>
you get my point, plus lot of hackerspaces sell or have arduino unos laying around
<lispmacs[work]>
well, i won't force you at gunpoint, but I do recommend those convenient DIYMORE programming shields if you can somehow manage to get one
* lispmacs[work]
leaves work
<KipIngram>
And there are some very economical printed circuit board fab places that you can deal with online.
<Zarutian_HTC>
I can add my recommendation for Digikey, best parametric search engine and it keeps your query in the url plus they deal with wierd orders without much hassle
<KipIngram>
I used to think I wanted to fab my own PCBs but now that I understand the options better there's just no way I ever will try that.
<lispmacs[work]>
I use OSH Park to print my PCBs
<KipIngram>
It's so limiting.
* Zarutian_HTC
has etched and cnc his own pcbs
<tabemann>
hey guys
<Zarutian_HTC>
I have yet to try the laser etching technique I heard about
* tabemann
is too ignorant about hardware to even consider designing his own boards, much the less etching them
<Zarutian_HTC>
that technique uses the trick of having the pcb leaning nearly flat to prevent back mirrowing into the laser tube
<Zarutian_HTC>
but the fablab that I have access to has a vinyl cutter
<KipIngram>
I hadn't heard of that technique.
<MrMobius>
Zarutian_HTC, doesnt the bootloader run independently of the code it's loading?
<Zarutian_HTC>
it is mostly used for cuting out stickers which are the sometimes used for masking in spray painting or silk printing
<KipIngram>
Mostly I think of buying PCBs because I want at least four layers, and maybe six.
<KipIngram>
I usually feel like I want solid power and ground planes.
<MrMobius>
like if you can just put yout forth at whatever the bootloader jumps to, it seems like you would be good
<Zarutian_HTC>
but one of the sticker material on offer has aluminum foil as it top layer
<Zarutian_HTC>
MrMobious: yeah that is not the problem, but I want that forth to be able to append to its flash progmem which usually is only allowed to be written to from bootloader though there might be some fuse bit config that controls that
<MrMobius>
oh hmm. why is it only allowed from bootloader? that would have to be some special region that the manufacturer set aside for bootloading. thats not how it works is it?
<Zarutian_HTC>
there is also the choice of copperfoil topped sticker material
* tabemann
wonders why one would want to use arduino anyways, considering that STM32 MCU's are infinitely more capable, and boards with them often come with integrated ST-Flash programmers
<Zarutian_HTC>
MrMobious: that is how it works at least from what I can tell from the full AVR ATmega328p datasheet
<tabemann>
and if you really want to use Arduino shields, there's always Nucleo boards
<Zarutian_HTC>
tabemann: immediate availability
<tabemann>
oh yeah, you're in iceland, where you can't readily get ST products
<MrMobius>
tabemann, no STM32s in dip
<tabemann>
tis true
boru` has joined #forth
boru has quit [Disconnected by services]
boru` is now known as boru
<Zarutian_HTC>
sure I can order them and then wait, wait some more, deal with customs&toll, wait some more and so one
mark4 has joined #forth
<Zarutian_HTC>
MrMobious: doesnt adafruid sell breakout boards for say tqfn package to dip compatible male headers on bottom?
<MrMobius>
could be but that's still not the same
<Zarutian_HTC>
so with this copper topped sticker vinyl material, I got thinking. Why not cut it out in the pcb-layout and apply it onto a prepped two layer pcb?
<Zarutian_HTC>
MrMobious: not electrically or pin compatible?
<tabemann>
I think MrMobius wants to make his own boards and stick DIP's in them
<tabemann>
(especially considering that DIP's are far more hand-soldering-friendly than SMT's)
<Zarutian_HTC>
prepped in the sense that non conducting layout cut sticker layer has been applied first and 'via' holes in that layer filled with solder
<Zarutian_HTC>
tabemann: yeah I am still recovering from mitxela vid where the madman hand solders to a bga chip
<tabemann>
I assume that BGA chip was being hand-soldered in dead-bug fashion
<Zarutian_HTC>
(bga stands for ball grid array fyi for future log readers)
<tabemann>
wow
<tabemann>
I watched the whole thing
<tabemann>
I was on-edge the whole time
sts-q has quit [Ping timeout: 246 seconds]
LispSporks has joined #forth
sts-q has joined #forth
LispSporks has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LispSporks has joined #forth
<MrMobius>
ya dip is easier to solder and you probably dont want to use those break outs for one off things since theyre expensive
LispSporks has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LispSporks has joined #forth
<KipIngram>
I'd not try soldering fine pitch solder mount without a stencil.
<KipIngram>
But if you've got a stencil, you can do some interesting things with certain toaster ovens.
<KipIngram>
SURFACE mount. :-|
LispSporks has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LispSporks has joined #forth
LispSporks has quit [Client Quit]
<KipIngram>
You know, that little Cortex Itsy Bitsy has a nice said of signal processing resources on it. I found myself if a simple software defined radio could be developed on it. Use PWM out and a filter to set the frequency, mix that with the signal, pass it through a filter, and use the ADC (which would get you about a 500 kHz band width) to tune.
<KipIngram>
I'm sure I couldn't do one that would rival a dedicated dongle, but it would just be "for the fun of it" anyway.
LispSporks has joined #forth
<KipIngram>
You know, I miss international shortwave broadcasts. That was a fun way to spend an evening - seeing what you could turn up "on the bands."
<KipIngram>
The internet just killed it, though.
LispSporks has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mtsd has joined #forth
gravicappa has joined #forth
<Zarutian_HTC>
KipIngram: re stencils: one can make one out of a cut soda can
sts-q has quit [Quit: ]
sts-q has joined #forth
dave0 has joined #forth
<dave0>
maw
actuallybatman has quit [Ping timeout: 252 seconds]
proteus-guy has quit [Ping timeout: 246 seconds]
<DKordic>
So what can You possibly get with Arduino!? A punishment (that it is)!?
mtsd_ has joined #forth
mtsd has quit [Ping timeout: 246 seconds]
wineroots has quit [Read error: Connection reset by peer]
mtsd_ has quit [Ping timeout: 252 seconds]
wineroots has joined #forth
mtsd has joined #forth
dave0 has quit [Quit: dave's not here]
proteus-guy has joined #forth
andrei-n has joined #forth
andrei-n has quit [Read error: Connection reset by peer]
andrei-n has joined #forth
mtsd has quit [Ping timeout: 252 seconds]
mtsd has joined #forth
tech_exorcist has joined #forth
Zarutian_HTC has quit [Ping timeout: 252 seconds]
actuallybatman has joined #forth
<KipIngram>
Zarutian_HTC: I suppose you good, but how precise would it be?
<KipIngram>
could
<KipIngram>
What do you cut your soda can with?
mark4 has quit [Remote host closed the connection]
mark4 has joined #forth
lispmacs[work] has quit [Read error: Connection reset by peer]
lispmacs[work] has joined #forth
gravicappa has quit [Ping timeout: 246 seconds]
<KipIngram>
A good stencil is a precision piece of gear - if the stencil is sloppy it can cause all manner of problems.
<KipIngram>
Hey, it occurs to me that Forth doesn't really provide a "conventional" way of accessinng the instruction stream, does it? It's easy to do from primitives, but there's not really a way to access that value from Forth itself, is there?
<KipIngram>
Oh wait - never mind.
<KipIngram>
Of course there is - in a colon definition that will be on top of the return stack.
<KipIngram>
Duh...
<KipIngram>
I was thinking about getting at the actual IP, but now I can't thinkn of a reason one would ever want that.
<MrMobius>
what type of assessment are you trying to do?
<KipIngram>
MrMobius: Was that aimed at me?
<KipIngram>
I was just thinking about accessing inline arguments. Primitives can do it easily, since they can use the IP register to address the arg. I was wondering if there was an equivalent ability "at the Forth level," and of course there is - if you call a Forth word then the address of the argument gets pushed onto the return stack and you've got to bump it forward before returning.
<KipIngram>
So it was a dumb question.
<KipIngram>
Induced by lack of caffeine.
<MrMobius>
KipIngram, yes
<KipIngram>
I can't really think of a case where you'd need the actual IP in Forth - annytime you are in a position to act on it it's been pushed to the return stack.
<KipIngram>
I made this change to my system yesterday, where there's a bit in the header that will instruct the compiler to compile the usual word call but then follow it with a byte offset back to the start of the definition.
<KipIngram>
It was to avoid having to write immediate wrappers for all of my plethora of conditional looping words.
<KipIngram>
I realized this morning that I'll also be able to use that bit for words I define, so long as I provide a way of setting it.
<KipIngram>
I don't particularly like complicating the compiler - probably a slippery slope. But I particularly HATED the idea of 41 extra immediate words in my dictionary.
<KipIngram>
So what this is boiling down to is that in my Forth there's only ever one jump target: back to the start of the word.
<KipIngram>
I don't have IF ... THEN and so on that specify other jump targets.
<KipIngram>
So all of my loops are essentially tail recursion loops, though in a few places I don't do it just at the tail.
<KipIngram>
In several places I have infinite tail recursion loops, but then there will be a conditional return somewhere in the loop body.
<KipIngram>
That's how I get out.
<KipIngram>
It simplifies the system to do it that way - makes it so the jump target is always available via LATEST.
<KipIngram>
Doesn't have to be noted on the stack, paired with a code of some kind.
<KipIngram>
Another thing I do in the compiler is each time I tick a word into the dictionary I remember it in a variable. ; uses that to do tail optimization - basically if the CFA of the word points to (:) / docol then it does the tail optimization - if it doesn't, it doesn't.
<KipIngram>
Also execution of an immediate word would clear that variable - that took care of the case where you don't want to tail optimize here:
<KipIngram>
: foo ... IF ... <: word> THEN ;
<KipIngram>
You can't tail optimize that, because there has to be something down there for the IF to jump to.
<KipIngram>
It will be the ; runntime if you don't optimize, and things will be happy.
<KipIngram>
But if you tail optimize it then the last thing in the definition will be a jump to <: word>, and that's part of what you want to skip over if the IF jumps.
<KipIngram>
Since I don't use IF THEN anymore I don't have that case to worry about.
<KipIngram>
Storing that variable was the resolution of a lot of scratching around trying to figure out when to optimize and when not to solely by looking at what I'd just compiled. You can't - because for all you know something back upstream will try to jump over that last word to the ; runtime. You have to have more global knowledge in order to do it right.
<KipIngram>
"Global knowledge" of the whole compile process just isn't something Forth excels at offering you.
<KipIngram>
The other problem with just trying to look at the last cell to see if it designates a : definition is that it could be a literal number, and that means it could have any value whatsoever.
<KipIngram>
Including one that WOULD be a : def, if it weren't a number.
<KipIngram>
So you really must have a small bit of state.
<KipIngram>
If you actually put a : def word into the definition (and you can be sure of it WHEN YOU'RE DOING IT), set the state; if you put anything else in the dictionary clear the state.
<KipIngram>
Then ; knows what to do.
<KipIngram>
So, the changes yesterday to my flags enabled these definitions for nfa and lfa (starting form cfa):
<KipIngram>
: nfa 1- .c@ x:80 and 0=me ;
<KipIngram>
: lfa nfa 2- ;
logand has joined #forth
andrei-n has quit [Quit: Leaving]
mtsd has quit [Ping timeout: 240 seconds]
<KipIngram>
I think I got all the nuances of the interpret/compile code straightened out now. Time to let it sit there in front of me for a few days.
<KipIngram>
It handles the creation of that tail optimization state and also adds the offset after words that have that loop bit set in the header.
<KipIngram>
When I parse words from the input stream the place I store them is where they will need to be if they become part of the dictionary. So CREATE will just need to add some info in around that data and adjust some pointers.
Zarutian_HTC has joined #forth
dave0 has joined #forth
tech_exorcist has quit [Ping timeout: 268 seconds]
<dave0>
maw
pointfree has joined #forth
<KipIngram>
So, when I recompile my system, it's not only the base addresses and dictionary pointers I need to switch to an "image area." I need for everything to go there. The search path and the contents of CURRENT have to refer to the image as well.
<KipIngram>
But I probably need access to my system search path as well.
<KipIngram>
This needs some careful thought before I box myself into a corner.
<KipIngram>
It feels like one of those things that could go very well if it's approached right, but become a nightmare if it's not.
<KipIngram>
And this stuff I've just coded may be affected.
Vedran has quit [Quit: Ping timeout (120 seconds)]
Vedran has joined #forth
pointfree has quit [Quit: Connection closed for inactivity]