Closed tius2000 closed 3 years ago
Hello Matthias,
I won't have access to my computer until the weekend, but what you want to do is possible. I made a version that ran on the arduino (I think it might be in my arduino repository, which contains other junk in it). It memory mapped the dictionary and I think it ran with 256 bytes of RAM. As for the loads and stores, you could modify the vm to handle that quite easily if it is a problem.
Memory mapping does slow the implementation down though.
I can be more help later, Thanks!
Thank you very much, sounds great!
Dear @howerj,
I had a look on https://github.com/howerj/arduino and think I got the idea how the memory mapping is done and it looks very clever to me. However, for the ESP8266 the additional level of indirection might not be required as long as everything fits into RAM.
Would it be easy to change the virtual memory size to e. g. $1000 cells or is it hard coded within eForth? I could find a few definitions regarding this within embed.fth but I understand very little about it.
Thanks again for you help!
Yeah, I added a bunch of indirection but it does slow things down. If you include all of the virtual machine source files and make the function definitions static, so long as the callbacks are the same file, the compiler can usually figure things out inline everything.
It's been quite a while since I have done anything with this project, but by the looks of it, you will not need to modify the eForth image, but you might need to be aware of the memory map of the program running in the VM. The eForth submodule is pointing to the head of the "embed" project, and was not modified to work specifically with the arduino project. You should just be able to change either the number of pages or their size.
Unfortunately I did not include a memory map (or I could not find one quickly) for the eForth image (and I cannot remember what I put where :D ).
It will take a little while to understand the embed.fth file, but there's nothing to complex about it. It's just a cross compiler written in Forth used to generate new eForth images, I hope the comments help.
Did you have any more questions? I prefer to close issues as soon as I can to keep things neat. Cheers.
Hi @howerj, it took me a while, but I think I found everything needed to get things up and running now. Thanks again for your help!
Dear @howerj,
I am looking for a way to add scripting to a project on a small embedded platform with very limited RAM (ESP8266) and Embed seems to be a very promising option! However, the default image requires much more RAM than available on this system. I am not sure, how to change this, perhaps you give me some hints?
Thank you very much for your help! Matthias