libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] an optimalisation hint - less SRAM memory


From: Christian Grothoff
Subject: Re: [libmicrohttpd] an optimalisation hint - less SRAM memory
Date: Wed, 30 Jan 2013 13:11:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10

Absolutely right.  Changed as suggested in SVN 25941.

Happy hacking!

-Christian

On 01/30/2013 12:11 PM, Martin Velek wrote:
Hello,

could be possible to change declarations for arrays of strings in the
file reason_phrase.c?

Currently it is static const char * []. This places all strings into
.rodata section and pointers to them into LMA of .text and also into
.data in VMA.

E.g. for an ARM Cortex M3 (flash + SRAM) compiled with a arm-none-eabi-gcc
static const char *one_hundred[] = {
"Continue",
"Switching Protocols",
"Processing"
};


Strings "Continue", "Switching Protocols", "Processing" are stored in
flash. Also an array with pointers to strings is stored in flash. In
addition, this array is copied into SRAM (+16 bytes). If you would
change it to "static const char * const one_hundred[]" ... it would
occupy only flash.

and
struct MHD_Reason_Block
{
......
   const char * const * data;
};

I agree, it is not relevant on a PC but on most microcontroller the SRAM
is a limiting factor not the rom(flash).

Best
Martin Velek








reply via email to

[Prev in Thread] Current Thread [Next in Thread]