const char PAGE_NetworkConfiguration[] PROGMEM = R”=====(
<!DOCTYPE html>
<html>
<head>
</head>
<body>
hello!
</body>
</html>
)=====”;
For STM32, I’ve never try it.
For STM32, I’ve never try it.
instead of
char* msg1[] PROGMEM = {"~Maple Mini~> Serial Mon> SD Check ~> I2C Scan ` Press AnyKey"
The main issue is RAM ! If you have a PROGMEM which is, lets say, an JPG with 64K size. You don’t want to have to all those bytes copied to RAM to do a TCP transmit (either HTTP or something else). It need to be transmit by chunks, such as ESP MTU 1640 packet size, but directly from Flash.
So, when I said “For STM32, I’ve never try it.”, it is because I’ve never have to do such thing, especially that ESP8266WebServer never been ported to STM32
const char PAGE_NetworkConfiguration[] PROGMEM = R”=====(
<!DOCTYPE html>
<html>
<head>
</head>
<body class=”bodyclass”>
hello!
</body>
</html>
)=====”;
this is standard Arduino construction (content have to be wrapped in quotes):
const char PAGE_NetworkConfiguration[] PROGMEM = {“
<!DOCTYPE html>
<html>
<head>
</head>
<body class=\”bodyclass\”>
hello!
</body>
</html>
“};
So question is, if it is possible to make similar PROGMEM construction like in esp8266: long string without quotes.
const char PAGE_NetworkConfiguration[] PROGMEM = R”=====(
…
)=====“;
So question is, if it is possible to make similar PROGMEM construction like in esp8266: long string without quotes.
If this is an ESP8266 question, you would probably be better off posting to a forum for the ESP8266
In general I no longer use the PROGMEM or F directives/ macros, as I hardly ever use AVR devices any more.
In fact I find on the ESP8266 that I get strange issues when using the F macro when sending data via TCP, so when recently porting some AVR code to ESP8266 I had remove all the F macros.
I am trying to port esp8266WebServer to ST32. I would like to be as much as compatible as possible.
Moreover I thing it is great idea to have PROGMEM working as above (no need to use string quotation).
One more question: what big chunks I can use to transfer strings over TCP with ST32?
I am trying to port esp8266WebServer to ST32. I would like to be as much as compatible as possible.
Moreover I thing it is great idea to have PROGMEM working as above (no need to use string quotation).
One more question: what big chunks I can use to transfer strings over TCP with ST32?
I don’t know all the mechanics in details, but it all about using Flash directly without bringing it into RAM cache, which is helpful in case of huge data.
Since the Flash is an external SPI on ESP8266, there are functions such as memcpy_P(), strcpy_P(), strlen_P, etc. to access bytes, words, etc. thru macros pgm_read_byte(), pgm_read_word(), etc. which takes care of addressing alignments.
Of course, on STM32, all that mechanics can be removed, but maybe it is a good idea to keep some of the macros just to have compatible application code.
Of course, to avoid having constants in flash copied to RAM as initialized variables, you have to declare such variables with the “const” attribute, rather than PROGMEM. The current Arduino for AVR will work as well, with this change.
<…>
The current Arduino for AVR will work as well, with this change.
For the ARMs and other conventional single-address-space MCUs and CPUS, it’s not needed but for ARM is is “NOP” macro like
#define F(x) x
So that compiling for ARM targets can ignore the F() macro
That web page half-incorrectly says “…because the compiler defaults to allocating strings in RAM …”
More correctly, an initialized variable that is not declared as const (or the same using PROGMEM or F() macro for strings), is stored in flash and copied to RAM by the C startup code.
On Harvard architecture MCUs like the AVR (and PIC) the flash and RAM are separate address spaces and special code is needed to read data within flash.




