Fixes for esp32c3

This commit is contained in:
Stephan Hadinger 2021-04-19 19:37:59 +02:00
parent df0c5c9693
commit c6f433be91
3 changed files with 23 additions and 7 deletions

View File

@ -44,6 +44,7 @@ extern "C" {
#define PSTR(s) (__extension__({static const char __c[] __attribute__((__aligned__(4))) PROGMEM = (s); &__c[0];}))
#endif
#ifdef ESP8266
// Flash memory must be read using 32 bit aligned addresses else a processor
// exception will be triggered.
// The order within the 32 bit values are:
@ -87,6 +88,26 @@ static inline uint16_t pgm_read_word_inlined(const void* addr) {
#define pgm_read_ptr(addr) (*(const void* const*)(addr))
#endif
#else // ESP8266
#ifdef __cplusplus
#define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t*>(addr))
#define pgm_read_word(addr) (*reinterpret_cast<const uint16_t*>(addr))
#define pgm_read_dword(addr) (*reinterpret_cast<const uint32_t*>(addr))
#define pgm_read_float(addr) (*reinterpret_cast<const float>(addr))
#define pgm_read_ptr(addr) (*reinterpret_cast<const void* const *>(addr))
#else
#define pgm_read_byte(addr) (*(const uint8_t*)(addr))
#define pgm_read_word(addr) (*(const uint16_t*)(addr))
#define pgm_read_dword(addr) (*(const uint32_t*)(addr))
#define pgm_read_float(addr) (*(const float)(addr))
#define pgm_read_ptr(addr) (*(const void* const *)(addr))
#endif
#endif // ESP8266
#define pgm_read_byte_near(addr) pgm_read_byte(addr)
#define pgm_read_word_near(addr) pgm_read_word(addr)
#define pgm_read_dword_near(addr) pgm_read_dword(addr)

View File

@ -33,11 +33,6 @@
#include <errno.h>
#include <algorithm>
extern "C" {
#include "osapi.h"
#include "ets_sys.h"
}
#include "debug.h"
#include "WiFiClientSecureLightBearSSL.h" // needs to be before "ESP8266WiFi.h" to avoid conflict with Arduino headers
#include "ESP8266WiFi.h"
#include "WiFiClient.h"

View File

@ -196,8 +196,8 @@ int32_t callBerryEventDispatcher(const char *type, const char *cmd, int32_t idx,
/*********************************************************************************************\
* VM Observability
\*********************************************************************************************/
void BerryObservability(bvm *vm, int32_t event...);
void BerryObservability(bvm *vm, int32_t event...) {
void BerryObservability(bvm *vm, int event...);
void BerryObservability(bvm *vm, int event...) {
va_list param;
va_start(param, event);
static int32_t vm_usage = 0;