1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Export pgmspace symbols to C (#3955)

This commit is contained in:
Sebastian Andersson 2017-12-14 07:38:09 +01:00 committed by Ivan Grokhotkov
parent cc9e799fc1
commit 4a0cdca28c
2 changed files with 11 additions and 5 deletions

View File

@ -24,6 +24,8 @@
#include <stdarg.h>
#include "pgmspace.h"
extern "C" {
size_t strnlen_P(PGM_P s, size_t size) {
const char* cp;
for (cp = s; size != 0 && pgm_read_byte(cp) != '\0'; cp++, size--);
@ -286,3 +288,5 @@ int vsnprintf_P(char* str, size_t strSize, PGM_P formatP, va_list ap) {
return ret;
}
} // extern "C"

View File

@ -4,16 +4,14 @@
#include <stdint.h>
#include <stdio.h>
#ifdef __ets__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __ets__
#include "ets_sys.h"
#include "osapi.h"
#ifdef __cplusplus
}
#endif
#define PROGMEM ICACHE_RODATA_ATTR
#define PGM_P const char *
@ -136,4 +134,8 @@ static inline uint16_t pgm_read_word_inlined(const void* addr) {
#define pgm_read_float_far(addr) pgm_read_float(addr)
#define pgm_read_ptr_far(addr) pgm_read_ptr(addr)
#ifdef __cplusplus
}
#endif
#endif //__PGMSPACE_H_