Arduino clones with more RAM than Uno?

From a post I saw a week or so ago, I have a feeling that the new version 1.5 IDE does report the amount of RAM allocated statically by your code.

Using dynamic memory allocation (including the String class) is a bad idea in small embedded systems.

dc42:
From a post I saw a week or so ago, I have a feeling that the new version 1.5 IDE does report the amount of RAM allocated statically by your code.

Using dynamic memory allocation (including the String class) is a bad idea in small embedded systems.

I'm not seeing it.
I only see the same stuff:
.cpp arduino munged files, .d dependency files, .o objects, .elf image file, and .hex image

I don't see any .lss or nm output files being created.

Do you have a link to that post?

--- bill

Check out this improved 1.0.2 IDE: http://arduino.cc/forum/index.php/topic,118440.0/topicseen.html
You'd think they'd roll those improvements into the new 1.5 IDE, but I guess not. Can lead a horse to water, can't make him drink....

That's probably the IDE that was referred to in the post I saw, not the 1.5 IDE!

Well if the improvements don't make it into the final 1.5, I'm sure those guys will apply them to 1.5 afterwards, like they did with 1.0.2..

I used FreeRam function to test how much RAM is being used.
Running my clock sketch it shows from 1167 to 922 available (depending which menu I'm in).
However as soon as I enable Waveutil.h library it jumps down to 110 bytes. I'm not even playing audio at this point. So I don't think there's anything I can do to optimize it (I don't want to mess with WaveHC library) other than upgrade RAM :frowning:

How about posting your clock sketch?

dc42:
How about posting your clock sketch?

Ok :slight_smile:

HT1632_clock_9.rar (17.4 KB)

Look at the nm output.
You can see what is eating up your space.

The wavehc stuff appears to be commented out however
a a quick looks show two 512 byte buffers in wevehc.

Another big guy is a 256 byte shadow buffer for the graphics.
That is quite a bit just right there.
Total BSS without wavehc is currently 0x2c8 which is 35% of your
total RAM. Add in 0x400 for the wavehc buffer1 and buffer2 buffers and you up to 0x6c8
which only leaves 0x138 for everything else including stack and
I'm sure there are other variables in the library as well too.

There are several variables in the main sketch that look like they are not
changing and could (should) be declared const to eliminate some storage there.

The wavehc does run on m168 and will automatically drop the buffers down to 256 if on
that part. There are some other limitations that come with that (bit rate etc) but you
may want look in the wavehc header and see if you can get away with using the smaller
buffers by patching the defines like they are on a m168.

Best thing is to run nm and objdump to start looking at where the memory is going
and see if there is anything easy (like putting the wavehc in m168 mode) that can be done
to save RAM.

--- bill

bss.txt (2.25 KB)

Duemilanove-style 1284 is not hard to make.



I sell bare boards for $5 shipped to US locations, scrounge the parts you need or pick up for ~$15 at mouser.
On board (MIKROE483) or off board USB/Serial (FTDI Cable or similar) supported too.
PL here Cross Roads Electronics

bperrybap:
The wavehc stuff appears to be commented out however
a a quick looks show two 512 byte buffers in wevehc.

Another big guy is a 256 byte shadow buffer for the graphics.
That is quite a bit just right there.
Total BSS without wavehc is currently 0x2c8 which is 35% of your
total RAM. Add in 0x400 for the wavehc buffer1 and buffer2 buffers and you up to 0x6c8
which only leaves 0x138 for everything else including stack and
I'm sure there are other variables in the library as well too.

There are several variables in the main sketch that look like they are not
changing and could (should) be declared const to eliminate some storage there.

The wavehc does run on m168 and will automatically drop the buffers down to 256 if on
that part. There are some other limitations that come with that (bit rate etc) but you
may want look in the wavehc header and see if you can get away with using the smaller
buffers by patching the defines like they are on a m168.

Best thing is to run nm and objdump to start looking at where the memory is going
and see if there is anything easy (like putting the wavehc in m168 mode) that can be done
to save RAM.

--- bill

Wow thank you! I'll give it a try. I also had no idea that declaring consts instead of variables will save ram.

CrossRoads:
Duemilanove-style 1284 is not hard to make.
I sell bare boards for $5 shipped to US locations, scrounge the parts you need or pick up for ~$15 at mouser.
On board (MIKROE483) or off board USB/Serial (FTDI Cable or similar) supported too.
PL here Cross Roads Electronics

That's a beauty! I think I'll order a PCB from you. Will it work with 644p? I had hard time finding 1284, they seem to be out of stock almost everywhere. I did request 644p sample from Amtel and it's on it's way.

Will it work with 644p?

Yes, 1284p and 644p in DIP at least have same pin out.

Lefty

@Bratan

CrossRoads could probably hook you up with a chip. I have purchased several of CrossRoads PCBs and one of his Bobuinos that is loaded with features! CrossRoads does some great work!

Also, on the subject of the 1284, I am using one of CrossRoads SMT 1284 boards to make a 20MHz version for fun. Someone recently made a bootloader so, that the chip will work properly at the higher frequency. I am considering putting a socket for the crystal to sit in so that I can try other frequencies. The socket will be easy to remove later if I do not like it.

Thanks cyclegadget :slight_smile:

I took a look at your sketch. Which DS1307 library are you using?

As well as changing the variables that represent unchanging data (e.g. pin numbers) to const, another easy win is to replace Serial.println("text") in setup() by Serial.println(F("text")).

I was unable to find monthShortStr(), but I suspect the month strings are another candidate for moving into PROGMEM.

Table divider[12] occupies RAM but appears to be unused.

Variable tempString should be local to the function in which it is used, like timeString. Similarly for tempChar.

CrossRoads:
Duemilanove-style 1284 is not hard to make.
I sell bare boards for $5 shipped to US locations, scrounge the parts you need or pick up for ~$15 at mouser.
On board (MIKROE483) or off board USB/Serial (FTDI Cable or similar) supported too.

i had a similar requirement for large ram and was given one of your m1284 boards. im very impressed with the design. do you have a link to a bootloader? also can you tell me what avrdude command line would be used to load a small test program to that with a com5 dongle?

Here is the thread about the 20MHz bootloader for the 1284P. I have not tested it yet. atMega1284P-AU @ 20Mhz - #9 by cyclegadget - Microcontrollers - Arduino Forum

Here is the bootloader I use for boards from CrossRoads GitHub - maniacbug/mighty-1284p: Mighty 1284P Platform for Arduino

By the way, the board has to be selected as Bobuino or your pins will not match. There are other 1284 variants that have different pin mapping. The problem may apply to the first link I gave you.

thanks. im using the standard bobuino16mhz at the moment but both those links may prove useful. tom gave me a set of his customized bootloaders and while the m8 ones worked im having no luck with any of the m1284 ones. maybe for some of the reasons discussed in that thread. thanks again.

It works!!! I just tried it with Mega 2560 and it has enough RAM to run my clock and WaveShield!!! Mega 2560 was just a proof of concept, now I need to get it working on 644p (which just arrived). Thank you all for you suggestions!

I like your work and your display! The voice sounds pretty good too!

What is the distance between LEDs on the display? I am thinking about making one similar but, I need to know how far apart to put the LEDs to make it look nice like yours.