Estimate memory required to assist in MCU selection

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,163
I have asked related questions in other threads. I have since come to believe there are IDEs which can simulate execution of programs during development. I would also expect they can provide an estimate of the memory required.

I am porting a program written in Freebasic on a Windows PC to an MCU. The language does not have to be Basic; it could be C or a variant thereof. In fact, Freebasic is very C-like. The minimum requirements beyond the root language constructs would be bidirectional serial communications (TTL levels)

So a) can this be done and b) do you have any recommendations?

Thanks and Happy New Year!
 
Last edited:

panic mode

Joined Oct 10, 2011
2,751
I see no point in squeezing memory - get mcu with plenty of memory. this will be your development board which will be re-used for bunch of developments so no point in being scrooge. $0.50 is not worth switching to another development board and starting over.

once your application is complete and you happy the way things are, THEN it is time to choose target chip. by that time you will know used memory and selecting suitable OTP for mass production should be easy (if this is what you have in mind). if you do not consider mass production, why bother, just get reprogrammable chip with plenty of memory.
 

t06afre

Joined May 11, 2009
5,934
If this is a hobbyist project. It is no need to skimp on memory. Just get select the controller in the series you plan to use. With as much ROM and RAM as you can. As long as it is compatible with your programmer.
 

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,163
I am comfortable with these suggestions and not skimping. The original program actually implements an entire interpretive language, so my concern was if it I could implement it in an MCU at all. Hence, the original question of whether the IDEs supported simulation, so that could be my first step.

And mass production is not out of the question, yet.

Thanks for your comments.
 

Markd77

Joined Sep 7, 2009
2,806
I think most IDEs have simulation, certainly the MPAB IDE has one. BASIC interpreters on microcontrollers are already available (PICAXE, BASIC Stamp, probably others) so it's certainly possible. I think it should be possible in under 2 KB of program memory, plus whatever the user program takes.
 

ErnieM

Joined Apr 24, 2011
8,377
The Basic Stamp runs inside a PIC, though you need a PC to write the tokenized code you upload.

I once worked on a version of an interpretive Tiny Basic that used the ASCII source directly to run inside a PIC. Unfortunately I was adapting someone else work and it was a terrible archetecture, and I gave up trying to remove all his cludges. It worked after a fashion, but could not get it clean.

So it can be fit inside a micro.
 

Thread Starter

djsfantasi

Joined Apr 11, 2010
9,163
The full featured program takes 784k of memory in Windows. But I plan on splitting that into two. One part to pre-process the code. The second part (on the MCU) to run the tokenized program. Also, it has code for connecting via TCP/IP sockets, which I plan on stripping out as well. The only floating point is for a random number function.
 
Top