On Friday 16 January 2015 16:40:01 Agrawal, Sachin wrote:
> >#ifndef ARDUINO
> >void OICLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer,
> >uint16_t bufferSize); #else void OICLogBuffer(LogLevel level, PROGMEM
> >const char * tag, const uint8_t * buffer, uint16_t bufferSize); #endif
> >
> >The use of a macro seems to point to a coding practice of just #define'ing
> >it to empty on other systems. Do other projects do that? Is that
> >recommended?
> >
> >--
> >Thiago Macieira - thiago.macieira (AT) intel.com
> >  Software Architect - Intel Open Source Technology Center
> 
> Hi Thiago,
> 
> On Arduino, if we do not classify the 'logging string' as PROGMEM, it will
> sit in the .data segment and will occupy space in SRAM. On ArduinoMega
> 2560, this becomes a problem as we have ONLY 8Kb of SRAM to play with and
> our stack (when debug mode enabled) cannot run successfully without forcing
> all the strings to Flash memory.

Hi Sachin

Thanks, I think I understand now what the macro is for.

But I was asking for a best practice in writing code that works on both 
Arduino and in other platforms, avoiding #ifdef heavy solutions. Adding a 
#define PROGMEM somewhere in our headers seem like a simple solution for this 
particular case, for example. Are there any other suggestions from people who 
have done Arduino development more extensively?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Reply via email to