<jackdaniel>
runtime interactions with c code may be achieved with dlopen
<crest>
jackdaniel: which isn't available on bare metal
<MrMobius>
how do you mean? not sure about gcc but other compilers will give you a list of fixed global variable addresses with assembly output
<crest>
unless you implement it
<jackdaniel>
fair enough
<crest>
it would probably be easier to generate forth code from the symbol file
jedb has joined #forth
<MrMobius>
ya maybe
<crest>
the build system would have to build the C code, generate forth code from the C symbol file, build the forth system, combine both in a single image
<MrMobius>
hmm ya. that's a bit complicated for most people I think
<crest>
make build
<crest>
make flash
<MrMobius>
better alternative might be to compile C and Forth all at once so you don't have to change any make files then run something to extract global addresses and transfer that over serial to the forth
<crest>
do you want to write compiler for C and forth?
<MrMobius>
definitely not for C. maybe enough of a forth for debugging but hopefully not that either
<MrMobius>
crest, is the 20k for mecrisp stellaris what runs on the parent board?
<crest>
thats for mecrisp stellaris running selfhosted on a stm32f103
<crest>
it has to be rounded to full 2048 byte flash pages
<MrMobius>
so it programs itself instead of a slave stm32?
<crest>
yes
<crest>
it's an untethered forth
<crest>
picocom is enough to interact with it
gravicappa has quit [Ping timeout: 240 seconds]
gravicappa has joined #forth
Zarutian_HTC has quit [Read error: Connection reset by peer]
Zarutian_HTC has joined #forth
xek has joined #forth
<MrMobius>
they were discussing debug consoles on slack for C programs and someone suggested Forth
<MrMobius>
so I was curious if anyone had implemented this for stm32 yet
<MrMobius>
someone said Forth looks like a large programming environment and he prefers Circuit Python, lol
<crest>
ROFL
<crest>
you could write a very small token threaded forth on a cortext m3/m4
<crest>
you could even support a mixture of 8bit and 16bit tokens
<MrMobius>
thats exactly what I was thinking to keep it really small
<crest>
and the inner interpreter could be short
<MrMobius>
I was thinking 8-bit tokens and one token for user defined words
<crest>
why so limited
<MrMobius>
why would you need 16-bit tokens? you only need enough for built in words I think
<crest>
because 256 tokens are an annoying limitation
TCZ has joined #forth
<MrMobius>
why? you could implement a full Forth with less than 255 words and then you only need the one token to signify a user defined word and you can have as many of those as you like
<crest>
okay so you want to encode longer tokens in 3 bytes e.g. 0xff <hi> <lo>
<crest>
you can keep it all in a single jump table
<crest>
your inner interpreter only has to expand short tokens into their index in the table
<MrMobius>
ya that would work
Zarutian_HTC has quit [Remote host closed the connection]
<MrMobius>
the other problem besides getting global names from C into Forth is saving useful words between reflashing
<crest>
that's not a problem
proteus-guy has joined #forth
<crest>
keep them in different flash pages
<crest>
after all TBH has a 128kB forward jump range
<crest>
that should be enough to cover multiple flash pages on any sane microcontroller
TCZ has quit [Quit: Leaving]
<MrMobius>
for that you'd have to understand how the image created by the C compiler gets flashed
<MrMobius>
so assuming it just starts at the first sector and goes in order
<MrMobius>
thats also one more thing to go wrong if the person setting it up doesnt know which flash sector is the last one
<MrMobius>
although I guess you could provide a header where all they have to do is indicate which stm32 they are using
asl2 has quit [Quit: Leaving.]
jedb has quit [Ping timeout: 256 seconds]
xek has quit [Quit: Leaving]
andrei-n has joined #forth
dys has quit [Ping timeout: 260 seconds]
Zarutian_HTC has joined #forth
dys has joined #forth
andrei-n has quit [Quit: Leaving]
gravicappa has quit [Ping timeout: 256 seconds]
dave0 has joined #forth
dave0 has quit [Read error: Connection reset by peer]
dave0 has joined #forth
dave0 has quit [Read error: Connection reset by peer]