Go Down

Topic: PROGMEM (Read 4434 times) previous topic - next topic


Oct 20, 2008, 03:49 pm Last Edit: Oct 20, 2008, 03:50 pm by paulb Reason: 1

I had no problem compiling the PROGMEM example in either 011 or 012 IDE. I don't know what your issue may have been with that. My memory was with a different piece of code I realized.

Too bad about your decision to kill PROGMEM in the docs, is it moving somewhere? Or are we burying it, so only the cognoscenti can find it when they need it?

If so, this post is at least a crumb for future users to follow. Search for PROGMEM in the reference docs and you might find something.



Paulb, could you share some context for your post. I have no idea what decision you are referring to.


Oct 20, 2008, 04:31 pm Last Edit: Oct 20, 2008, 04:32 pm by wayoda Reason: 1
Hi mem,
there had been a discussion on the devlopers mailing list (Thread : Extended Reference)
about (my interpretation of it) the target audience of the reference pages.
David Mellis wants the Reference to be targeted at beginners (or non-programmers) while Paul has put (I don't know how much) work into the Reference-pages aiming at completeness.

Progmem seems to be the first victim of a clean-up for beginners process.

I'm a bit undecided on the whole topic. I wish the playground was a little bit more organized. My inner voice says it would be the right place for a PROGMEM article, but hard to find without a proper index.



PROGMEM is important in an arduino-like sytem, but it's a bit complex to deal with from the beginner perspective.  What would be nice is to wrap the most common PROGMEM usage within an easier-to-use set of primitives:
Code: [Select]
Serial.print(FLASHMEM("this is a string in flash"));


Not sure if this or the developers mailing list is the better place to discuss this, but FWIW here is my two cents worth.

IMO, the Arduino reference pages should be targeted at beginners. Much better leaving out details then to overwhelm non technical users with too much information. A fundamental characteristic of Arduino is to make technology accessible and usable by people interested in completing their project rather than understanding the intricacies of the language.

That said, the reference pages could be divided into a main 'overview for beginners' and a separate section with details for experts.


Focus on beginners; advanced users can get everything they need from the Atmega datasheet and the AVR-GCC reference.
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store


Oct 20, 2008, 07:47 pm Last Edit: Oct 20, 2008, 07:48 pm by mem Reason: 1
Focus on beginners; advanced users can get everything they need from the Atmega datasheet and the AVR-GCC reference.

The Arduino specific abstractions aren't covered in the datasheet.

For example, documenting something like the wire library is tricky because although there does need to be someplace to cover details like the return codes, the main reference article probably would not need to go into detail on each of the return codes but this information does need to be covered somewhere.


I think PROGMEM is useful.  We should find a nice, "Arduino-like" way to incorporate its functionality into the language (e.g. making Serial.print() working transparently with PROGMEM strings, if possible).  Until then, I think it's best to document it in the playground, since it's more of a "hidden" feature.  

On the other hand, I agree that it can be tough to find things in the playground.  Suggestions welcome.  


Actually, whatever we decide to include the Arduino language (and reference), there will always be useful code that doesn't quite seem to belong.  To make it easier to find such things, I added links from the reference and extended reference to the code library and tutorials page on the playground.  That seems like a good place to document things like PROGMEM that are useful but don't quite fit into the main language.  This is similar to the way that the official hardware page links to the community-maintained list in the playground.  This might be simpler (and more user friendly) than trying to recreate the entire reference in the playground.  What do you think?


What about tagging reference pages/features as "advanced", or maybe an advanced reference section in addition to the standard reference?



Oct 21, 2008, 02:21 am Last Edit: Oct 21, 2008, 02:24 am by dcb Reason: 1
Progmem is EXTREMELY useful.  So useful that maybe there should be some way to make it the default storage for const variables.  Though how you automate access to everything progmem const in all existing functions/whatnot is more than a little tricky.  

I suppose a pre-processor *could* handle it and resolve the consts into flash constants and extract them into ram temporarily where they are used for function calls, etc?

i.e. a storeConstsInFlash setting?


Oct 21, 2008, 07:14 am Last Edit: Oct 21, 2008, 07:30 am by paulb Reason: 1
Somehow I posted this in the hardware section, my apologies.

PROGMEM is extremely useful - and as I said in a post to the developer's list, try doing a large LCD project without it. And it's not that puzzling to implement once you have some example code.

So what's the big deal in having the example code in the extended reference section? I thought that was why we made an EXTENDED reference section, so that slightly more advanced concepts would be shielded from beginners. David seems to have some kind of idea of formalist or ideological purity for the reference pages, which I can't figure out.

All I'm arguing for is that the EXTENDED reference section should have nice little details, pointing the way for slightly-past-beginner programmers to get the job done, as well as for beginners to be able to find most of the elements of the C language, so they can begin to understand half of the programs posted in the forum. What the heck is wrong with letting people have information in an organized and sensible way. In my view, the EXTENDED reference page was not getting out of control with irrelevant links or information.

This has not just been about PROGMEM, things like the diagram of the ATEMGA168 chip mapping, was a handy and useful reference on the EXTENDED reference page. This too, somehow runs afoul of some kind of formalist or ideological purity. I personally used the pin diagram  a lot from that page while coding and teaching, and I'll bet others did too. The reference page is still very small compared to Processing and Wiring  and was definitely not in danger of becoming a swiss army knife IMHO. Others may disagree.

If I hadn't worked on writing so much of the material on that page, I wouldn't be so exercised about this issue. No doubt I am embarrassing myself somewhat and I expect many people are scratching their heads and muttering "get a life", which I understand, viewed from the outside, is entirely appropriate. Lest readers wonder about who edited and wrote most of the material on the reference pages, just click a few of the page history links and look at the authorship. (Some may repeat the "get a life" remark). Users who have been around for a while can remember the reference pages from spring 07 when I began filling them in, and my students remarked to me "why do I have to dig through the forum to try to find out how to do anything, instead of finding it on the reference page"

I DO think we need a complete reference in the public section of the website and one that is collectively edited, instead of being micromanaged from the top. I would like to have a place to document the Arduino language (and bugs and quirks), and hopefully make a robust, publicly-edited reference that lets beginners and more advanced coders alike get the job done as quickly as possible. Another editorial viewpoint from the official one also seems entirely useful.

I just don't have time to do it right now - although much of my work can just be copied from the reference pages at first and then added to. And perhaps after it's in place in the public section of the site, it can be deleted from the "official" reference pages so they will have the minimal elegance that seems to be desired at the top.  I'll be happy to help work on reference pages in the public section of the website, should someone else take the lead. I'd like to propose the name "Cabinet" for the public reference to differentiate if from the reference section, but maybe someone has a better name.

Let me say that much of this has been discussed in conversations between DM and myself in the past, and I have tried to have a thick skin about it in the spirit of compromise and cooperation on an open-source project. I have seldom had much of a sense of compromise or attempt to see things from another angle from the other party. Time to get a life and work on other things.

Paul Badger


there had been a discussion on the developers mailing list (Thread : Extended Reference)

Slightly OT but this makes me realise I haven't had any developer mailing list mail since mid-September and checking the Arduino Developers list online archive suggests it hasn't received any either.

Anyone know what's up with that?



Thanks to a helpful PM I discovered the Arduino Developers list has been moved.

It seems my address might have somehow got lost during the move?


Go Up