Estimate memory required to assist in MCU selection

Discussion in 'Embedded Systems and Microcontrollers' started by djsfantasi, Dec 28, 2013.

  1. djsfantasi

    Thread Starter AAC Fanatic!

    Apr 11, 2010
    2,810
    834
    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: Dec 28, 2013
  2. panic mode

    Senior Member

    Oct 10, 2011
    1,321
    304
    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.
     
    djsfantasi likes this.
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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.
     
    djsfantasi likes this.
  4. djsfantasi

    Thread Starter AAC Fanatic!

    Apr 11, 2010
    2,810
    834
    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.
     
  5. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    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.
     
    djsfantasi likes this.
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    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.
     
    djsfantasi likes this.
  7. djsfantasi

    Thread Starter AAC Fanatic!

    Apr 11, 2010
    2,810
    834
    Thanks. I appreciate you sharing your experiences.
     
  8. russ_hensel

    Well-Known Member

    Jan 11, 2009
    818
    47
    Almost any compiler/assembler should show you the size of the program it has processed. You should not have to guess.
     
  9. djsfantasi

    Thread Starter AAC Fanatic!

    Apr 11, 2010
    2,810
    834
    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.
     
Loading...