libmicrohttpd
[Top][All Lists]
Advanced

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

[libmicrohttpd] an optimalisation hint - less SRAM memory


From: Martin Velek
Subject: [libmicrohttpd] an optimalisation hint - less SRAM memory
Date: Wed, 30 Jan 2013 12:11:44 +0100

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]