1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-09-09 18:40:33 +03:00

PgmSpace working

PSTR() and F() macros correctly place string into flash memory relying
on PROGMEM
PROGMEM uses ICACHE_RODATA_ATTR
Print and String classes fixed up
str* classes fixed up
This commit is contained in:
Makuna
2015-05-13 11:27:54 -07:00
parent b959e82165
commit 81d27b403e
7 changed files with 295 additions and 29 deletions

View File

@@ -116,7 +116,7 @@ char* strncpy(char * dest, const char * src, size_t n) {
return ets_strncpy(dest, src, n);
}
size_t strnlen(const char *s, size_t len) {
size_t ICACHE_FLASH_ATTR strnlen(const char *s, size_t len) {
// there is no ets_strnlen
const char *cp;
for (cp = s; len != 0 && *cp != '\0'; cp++, len--);
@@ -127,7 +127,7 @@ char* strstr(const char *haystack, const char *needle) {
return ets_strstr(haystack, needle);
}
char* strchr(const char * str, int character) {
char* ICACHE_FLASH_ATTR strchr(const char * str, int character) {
while(1) {
if(*str == 0x00) {
return NULL;
@@ -139,7 +139,7 @@ char* strchr(const char * str, int character) {
}
}
char * strrchr(const char * str, int character) {
char * ICACHE_FLASH_ATTR strrchr(const char * str, int character) {
char * ret = NULL;
while(1) {
if(*str == 0x00) {
@@ -223,7 +223,7 @@ char* ICACHE_FLASH_ATTR strtok(char * str, const char * delimiters) {
return ret;
}
int strcasecmp(const char * str1, const char * str2) {
int ICACHE_FLASH_ATTR strcasecmp(const char * str1, const char * str2) {
int d = 0;
while(1) {
int c1 = tolower(*str1++);