bblanchon / ArduinoJson

📟 JSON library for Arduino and embedded C++. Simple and efficient.
https://arduinojson.org
MIT License
6.71k stars 1.12k forks source link

error: a15 cannot be used in asm here #1525

Closed Tony763 closed 3 years ago

Tony763 commented 3 years ago

Hello, I have a problem compiling deserializeJson example in PlatformIO and Espressif 8266 (2.6.2).

Code is placed in function called from class function:

StaticJsonDocument<200> doc_in;
DeserializationError error = deserializeJson(doc_in, msgch);

if (error) {
    Serial.print(F("deserializeJson() failed: "));
    Serial.println(error.f_str());
    return;
}

Above code gives me error error: a15 cannot be used in asm here.

Problem will be with use of error.f_str() as if I comment whole Serial.println(error.f_str()); then code will compile.

bblanchon commented 3 years ago

Hi @Tony763,

This seems to be a problem in the ESP8266 core, can you try to upgrade/reinstall it? If this doesn't work, replace error.f_str() with error.c_str(). You may also need to set ARDUINOJSON_ENABLE_PROGMEM to 0.

Best regards, Benoit

Tony763 commented 3 years ago

Hi @bblanchon, I updated to latest version of ESP core without change.

With error.c_str() it's works, could it be mentioned in examples? Thank you.

jjsuwa-sys3175 commented 3 years ago

some information:

bblanchon commented 3 years ago

@jjsuwa-sys3175, thanks for the information. I confirm that I can compile with 2.7.4 without any error.

Tony763 commented 3 years ago

Hi, I use PlatformIO allows me only to update to version 2.6.3. I will open a issue there. Thank You

bblanchon commented 3 years ago

@Tony763, there seem to be two versions in the Espressif 8266 platform on PlatformIO: the platform version and the framework version.

image

As you can see, I installed 2.6.3, but the framework is 2.7.4. I find this really confusing, and I'd love to get an explanation... @jjsuwa-sys3175, do you know why it's like that?

Tony763 commented 3 years ago

Yes I found out that I mistook them. I raised an issue on platformio repository with ask for help.

Tony763 commented 3 years ago

My version is exactly a same.

CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp01_1m.html
PLATFORM: Espressif 8266 (2.6.3) > Espressif Generic ESP8266 ESP-01 1M
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 3.20704.0 (2.7.4) 
 - tool-esptool 1.413.0 (4.13) 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - toolchain-xtensa 2.40802.200502 (4.8.2)

Did you successfully build the example with Arduino IDE and Platform IO or just with one of them?

bblanchon commented 3 years ago

I build it successfully with both. The CI contains a build with PlatformIO on ESP8266 as well.