slviajero / tinybasic

A BASIC interpreter for Arduino, ESP, RP2040, STM32, Infineon XMC and POSIX with IoT and microcontroller features.
GNU General Public License v3.0
203 stars 31 forks source link

External EEPROM as program storage #33

Closed EncomLab closed 1 year ago

EncomLab commented 1 year ago

Stefan can you speak further to the use of an external EEPROM - specifically an EEPROM module utilizing the 24C256 - to expand the primary program space?

slviajero commented 1 year ago

WIll do! Give me time till weekend, currently I am very busy with my day job. I have a subsystem for serial RAM chips and options for EEPROM use ready.

Am 07.11.2022 um 17:44 schrieb Encom Lab @.***>:

Stefan can you speak further to the use of an external EEPROM - specifically an EEPROM module utilizing the 24C256 - to expand the primary program space?

— Reply to this email directly, view it on GitHub https://github.com/slviajero/tinybasic/issues/33, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSY56FOBA3W7A4VOOUOASDWHEWYJANCNFSM6AAAAAARZMLXEI. You are receiving this because you are subscribed to this thread.

slviajero commented 1 year ago

I wrote a few words now by updating the wiki article

https://github.com/slviajero/tinybasic/wiki/SD-Cards,-SPIFFS,-File-commands,-EEPROM,-and-I-O-channels.

In brief words: External EEPROM can be connected with the ARDUINOI2CEEPROM option in the code now. I added this only recently. You can save a program to the external EEPROM and then run it from there. Using SET 1,1 you can set it to autorun. Autorun modules start on an Arduino without loading the program to RAM. It runs purely from EEPROM and the entire memory is free for variables.

The fun thing about it is that you can create the module on an Arduino with a lot of memory, like a MEGA256 and then use it on an UNO as the modules and the code is interchangeable. This way you can run 8kB programs on an 1 kB UNO.

I so far have not added the possibility to edit programs stored in EEPROM. You need to create and edit the program in RAM, then save it to EEPROM and then run it from there with the autorun feature.

Adding editing of the EEPROM code is not super difficult but will be very slow.

Let me know you thoughts on that! What would be the use case you have in mind?

By the way: there is some info on connecting EEPROMs in general here: https://create.arduino.cc/projecthub/sl001/use-i2c-eeproms-as-a-file-system-on-an-arduino-c8f2a2 https://create.arduino.cc/projecthub/sl001/use-i2c-eeproms-as-a-file-system-on-an-arduino-c8f2a2

A further, yet undocumented feature is that you can use 23C512 modules as RAM extension. This is serial SPI SRAM. 32KB or 64 kB RAM is possible with these modules. This is the ARDUINOSPIRAM option in the code.

Am 07.11.2022 um 17:44 schrieb Encom Lab @.***>:

Stefan can you speak further to the use of an external EEPROM - specifically an EEPROM module utilizing the 24C256 - to expand the primary program space?

— Reply to this email directly, view it on GitHub https://github.com/slviajero/tinybasic/issues/33, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSY56FOBA3W7A4VOOUOASDWHEWYJANCNFSM6AAAAAARZMLXEI. You are receiving this because you are subscribed to this thread.

slviajero commented 1 year ago

I have now added true EEPROM program support as an experimental code.

Currently it is only checked in here: https://github.com/slviajero/tinybasic/tree/main/TinybasicArduino https://github.com/slviajero/tinybasic/tree/main/TinybasicArduino

With the setting

define ARDUINOPGMEEPROM

all the EEPROM memory is used for program storage and can be changed interactively. You have practically EEPROM size + Memory size as BASIC memory. I added limits internally so that program can only be in EEPROM and variables only in RAM to avoid noodling the EEPROM to death in a loop.

The code has some limits and is very experimental. I only tested it with the internal EEPROM of an UNO. It should work with an external EEPROM but I didn’t test it so far.

The main limit is that the string length can only be max 128 bytes. So, no more arbitrary length strings. This is because I need two buffers in true RAM to copy strings around.

Am 07.11.2022 um 17:44 schrieb Encom Lab @.***>:

Stefan can you speak further to the use of an external EEPROM - specifically an EEPROM module utilizing the 24C256 - to expand the primary program space?

— Reply to this email directly, view it on GitHub https://github.com/slviajero/tinybasic/issues/33, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSY56FOBA3W7A4VOOUOASDWHEWYJANCNFSM6AAAAAARZMLXEI. You are receiving this because you are subscribed to this thread.

EncomLab commented 1 year ago

This is amazing - the ability to use a cheap Uno as the interface to a larger memory capacity system is a game changer.

Sent from my T-Mobile 5G Device Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Stefan Lenz @.> Sent: Saturday, November 19, 2022 3:21:18 PM To: slviajero/tinybasic @.> Cc: Brian Decker @.>; Author @.> Subject: Re: [slviajero/tinybasic] External EEPROM as program storage (Issue #33)

I have now added true EEPROM program support as an experimental code.

Currently it is only checked in here: https://github.com/slviajero/tinybasic/tree/main/TinybasicArduino https://github.com/slviajero/tinybasic/tree/main/TinybasicArduino

With the setting

define ARDUINOPGMEEPROM

all the EEPROM memory is used for program storage and can be changed interactively. You have practically EEPROM size + Memory size as BASIC memory. I added limits internally so that program can only be in EEPROM and variables only in RAM to avoid noodling the EEPROM to death in a loop.

The code has some limits and is very experimental. I only tested it with the internal EEPROM of an UNO. It should work with an external EEPROM but I didn’t test it so far.

The main limit is that the string length can only be max 128 bytes. So, no more arbitrary length strings. This is because I need two buffers in true RAM to copy strings around.

Am 07.11.2022 um 17:44 schrieb Encom Lab @.***>:

Stefan can you speak further to the use of an external EEPROM - specifically an EEPROM module utilizing the 24C256 - to expand the primary program space?

— Reply to this email directly, view it on GitHub https://github.com/slviajero/tinybasic/issues/33, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSY56FOBA3W7A4VOOUOASDWHEWYJANCNFSM6AAAAAARZMLXEI. You are receiving this because you are subscribed to this thread.

— Reply to this email directly, view it on GitHubhttps://github.com/slviajero/tinybasic/issues/33#issuecomment-1320961886, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEWSDGUM2PYHEW6EMR3EKYTWJEZD5ANCNFSM6AAAAAARZMLXEI. You are receiving this because you authored the thread.Message ID: @.***>

slviajero commented 1 year ago

Thank you! Please be careful with the code. It is test code, there will be many bugs and unwanted side effects. Will take me a week to find them and fix them.

Am 20.11.2022 um 00:50 schrieb Encom Lab @.***>:

This is amazing - the ability to use a cheap Uno as the interface to a larger memory capacity system is a game changer.

Sent from my T-Mobile 5G Device Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Stefan Lenz @.> Sent: Saturday, November 19, 2022 3:21:18 PM To: slviajero/tinybasic @.> Cc: Brian Decker @.>; Author @.> Subject: Re: [slviajero/tinybasic] External EEPROM as program storage (Issue #33)

I have now added true EEPROM program support as an experimental code.

Currently it is only checked in here: https://github.com/slviajero/tinybasic/tree/main/TinybasicArduino https://github.com/slviajero/tinybasic/tree/main/TinybasicArduino

With the setting

define ARDUINOPGMEEPROM

all the EEPROM memory is used for program storage and can be changed interactively. You have practically EEPROM size + Memory size as BASIC memory. I added limits internally so that program can only be in EEPROM and variables only in RAM to avoid noodling the EEPROM to death in a loop.

The code has some limits and is very experimental. I only tested it with the internal EEPROM of an UNO. It should work with an external EEPROM but I didn’t test it so far.

The main limit is that the string length can only be max 128 bytes. So, no more arbitrary length strings. This is because I need two buffers in true RAM to copy strings around.

Am 07.11.2022 um 17:44 schrieb Encom Lab @.***>:

Stefan can you speak further to the use of an external EEPROM - specifically an EEPROM module utilizing the 24C256 - to expand the primary program space?

— Reply to this email directly, view it on GitHub https://github.com/slviajero/tinybasic/issues/33, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSY56FOBA3W7A4VOOUOASDWHEWYJANCNFSM6AAAAAARZMLXEI. You are receiving this because you are subscribed to this thread.

— Reply to this email directly, view it on GitHubhttps://github.com/slviajero/tinybasic/issues/33#issuecomment-1320961886, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEWSDGUM2PYHEW6EMR3EKYTWJEZD5ANCNFSM6AAAAAARZMLXEI. You are receiving this because you authored the thread.Message ID: @.***> — Reply to this email directly, view it on GitHub https://github.com/slviajero/tinybasic/issues/33#issuecomment-1320994079, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSY56HSHVBFJL3W62LMLSTWJFRURANCNFSM6AAAAAARZMLXEI. You are receiving this because you commented.

slviajero commented 1 year ago

Code is clean now in beta state in the folder https://github.com/slviajero/tinybasic/tree/main/TinybasicArduino

Please download the newest version of EepromFS from https://github.com/slviajero/EepromFS if you want to use it with I2C EEPROMS

Limitations: