Skip to content

Enabling C++ Exceptions compiler option #6187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
srgbin opened this issue Jan 25, 2022 · 7 comments
Closed
1 task done

Enabling C++ Exceptions compiler option #6187

srgbin opened this issue Jan 25, 2022 · 7 comments
Assignees
Labels
Area: LIB Builder Depends on Lib Builder Chip: ESP32-C3 Issue is related to support of ESP32-C3 Chip Status: Solved
Milestone

Comments

@srgbin
Copy link

srgbin commented Jan 25, 2022

Board

ESP32-C3

Device Description

ESP32-C3

Hardware Configuration

no

Version

v2.0.2

IDE Name

Arduino IDE

Operating System

Ubuntu 20.04

Flash frequency

80Mhz

PSRAM enabled

no

Upload speed

115200

Description

Compiling ESP32 BLE Arduino library by nkolban requires the C++ Exceptions compiler option to be enabled.

Sketch

/*
    Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleServer.cpp
    Ported to Arduino ESP32 by Evandro Copercini
    updates by chegewara
*/

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>

// See the following for generating UUIDs:
// https://www.uuidgenerator.net/

#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"

void setup() {
  Serial.begin(115200);
  Serial.println("Starting BLE work!");

  BLEDevice::init("Long name works now");
  BLEServer *pServer = BLEDevice::createServer();
  BLEService *pService = pServer->createService(SERVICE_UUID);
  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                         CHARACTERISTIC_UUID,
                                         BLECharacteristic::PROPERTY_READ |
                                         BLECharacteristic::PROPERTY_WRITE
                                       );

  pCharacteristic->setValue("Hello World says Neil");
  pService->start();
  // BLEAdvertising *pAdvertising = pServer->getAdvertising();  // this still is working for backward compatibility
  BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
  pAdvertising->addServiceUUID(SERVICE_UUID);
  pAdvertising->setScanResponse(true);
  pAdvertising->setMinPreferred(0x06);  // functions that help with iPhone connections issue
  pAdvertising->setMinPreferred(0x12);
  BLEDevice::startAdvertising();
  Serial.println("Characteristic defined! Now you can read it in your phone!");
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(2000);
}

Debug Message

#error "C++ exception handling must be enabled within make menuconfig. See Compiler Options > Enable C++ Exceptions."

Other Steps to Reproduce

Enabling option in the sdkconfig file does not solve the problem

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@srgbin srgbin added the Status: Awaiting triage Issue is waiting for triage label Jan 25, 2022
@atanisoft
Copy link
Collaborator

C++ Exceptions ARE enabled in 2.0.x:

CONFIG_COMPILER_CXX_EXCEPTIONS=y
CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE=0

Is there a reason you are not using the built-in BLE library that is based on the no longer maintained https://github.com/nkolban/esp32-snippets/ repository?

@srgbin
Copy link
Author

srgbin commented Jan 26, 2022

C++ Exceptions ARE disabled in 2.0.x: for esp32c3

# CONFIG_COMPILER_CXX_EXCEPTIONS is not set

I am using the library https://github.com/nkolban/ESP32_BLE_Arduino. By built-in BLE library do you mean the ArduinoBLE library https://www.arduino.cc/en/Reference/ArduinoBLE?
Indicated that this library does not support esp32c3.

@atanisoft
Copy link
Collaborator

Ahh, normally these are kept in sync. I'm not sure why the C3 file would not have it enabled whereas the others do.

If you can, please open a PR to modify this file and @me-no-dev will review for merge and it will show up over here in this repository soon thereafter via an IDF sync PR.

@igrr
Copy link
Member

igrr commented Jan 26, 2022

@me-no-dev I think we could convert the existing target-specific sdkconfig files into:

sdkconfig.defaults (common options which are different from the default ones)
sdkconfig.defaults.esp32 (esp32-specific options)
sdkconfig.defaults.esp32s2 (esp32s2-specific options)

and so on.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#target-dependent-sdkconfig-defaults
(i can submit a PR to arduino-lib-builder for this, if you agree)

@igrr igrr added Area: LIB Builder Depends on Lib Builder Chip: ESP32-C3 Issue is related to support of ESP32-C3 Chip Status: To be implemented Selected for Development and removed Status: Awaiting triage Issue is waiting for triage labels Jan 26, 2022
@srgbin
Copy link
Author

srgbin commented Jan 26, 2022

Great, it would be great if you submit a PR for this.

@me-no-dev
Copy link
Member

@me-no-dev I think we could convert the existing target-specific sdkconfig files into:

sdkconfig.defaults (common options which are different from the default ones) sdkconfig.defaults.esp32 (esp32-specific options) sdkconfig.defaults.esp32s2 (esp32s2-specific options)

and so on.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#target-dependent-sdkconfig-defaults (i can submit a PR to arduino-lib-builder for this, if you agree)

I do agree :)

@me-no-dev
Copy link
Member

This will come when we merge the S3 support

@VojtechBartoska VojtechBartoska added this to the 2.0.3 milestone Feb 24, 2022
@VojtechBartoska VojtechBartoska moved this from In Progress to In Review in Arduino ESP32 Core Project Roadmap Feb 24, 2022
Repository owner moved this from In Review to Done in Arduino ESP32 Core Project Roadmap Mar 28, 2022
Jason2866 added a commit to Jason2866/esp32-arduino-lib-builder that referenced this issue Mar 28, 2022
* Support extern Ethernet (#60)

see espressif/arduino-esp32#6318

* Revert "Support extern Ethernet (#60)" (#61)

This reverts commit 8c5ac76.

* Fix missing BLE 4.2 from ESP32-S3

* Allow selecting Arduino branch based on the current lib-builder branch

* For CI builds get branch from env

* dump env

* Update update-components.sh

* Update update-components.sh

* Add support for CPP exceptions for C3

Fixes: espressif/arduino-esp32#6187

* Script improvements, rainmaker and esp-sr

* Optimized for Tasmota

* Update build.sh

* Update config.sh

* Update install-esp-idf.sh

* AR_BRANCH="master"

* Update push.yml

* Update defconfig.esp32s3

* Update defconfig.esp32s2

Co-authored-by: me-no-dev <hristo@espressif.com>
@VojtechBartoska VojtechBartoska added Status: Solved and removed Status: To be implemented Selected for Development labels Apr 6, 2022
Jason2866 added a commit to Jason2866/esp32-arduino-lib-builder that referenced this issue May 4, 2022
* Support extern Ethernet (#60)

see espressif/arduino-esp32#6318

* Revert "Support extern Ethernet (#60)" (#61)

This reverts commit 8c5ac76.

* Fix missing BLE 4.2 from ESP32-S3

* Allow selecting Arduino branch based on the current lib-builder branch

* For CI builds get branch from env

* dump env

* Update update-components.sh

* Update update-components.sh

* Add support for CPP exceptions for C3

Fixes: espressif/arduino-esp32#6187

* Script improvements, rainmaker and esp-sr

* Optimized for Tasmota

* Update build.sh

* Update config.sh

* Update install-esp-idf.sh

* AR_BRANCH="master"

* Update push.yml

* Update defconfig.esp32s3

* Update defconfig.esp32s2

* space in path fix

* fix space in path

* Update install-esp-idf.sh

* Update README.md

* esp littlesfs broken going back to commit 4ee58815

* lfn

* lfn

* lfn

* lfn

* use actual littlefs

* esp_littlefs commit 4ee58815093

* Update config.sh

* use latest littlefs

* AR_BRANCH="work"

* IDF branch v4.4_work

* Update push.yml

* Update defconfig.esp32

* Update fb_gfx.h

* Update fb_gfx.c

* IDF_BRANCH="v4.4.1"

* Update push.yml

Co-authored-by: me-no-dev <hristo@espressif.com>
Jason2866 added a commit to tasmota/esp32-arduino-lib-builder that referenced this issue May 17, 2022
* Support extern Ethernet (Jason2866#60)

see espressif/arduino-esp32#6318

* Revert "Support extern Ethernet (Jason2866#60)" (Jason2866#61)

This reverts commit 8c5ac76.

* Fix missing BLE 4.2 from ESP32-S3

* Allow selecting Arduino branch based on the current lib-builder branch

* For CI builds get branch from env

* dump env

* Update update-components.sh

* Update update-components.sh

* Add support for CPP exceptions for C3

Fixes: espressif/arduino-esp32#6187

* Script improvements, rainmaker and esp-sr

* Optimized for Tasmota

* Update build.sh

* Update config.sh

* Update install-esp-idf.sh

* AR_BRANCH="master"

* Update push.yml

* Update defconfig.esp32s3

* Update defconfig.esp32s2

* space in path fix

* fix space in path

* Update install-esp-idf.sh

* Update README.md

* esp littlesfs broken going back to commit 4ee58815

* lfn

* lfn

* lfn

* lfn

* use actual littlefs

* esp_littlefs commit 4ee58815093

* Update config.sh

* use latest littlefs

* AR_BRANCH="work"

* IDF branch v4.4_work

* Update push.yml

* Update defconfig.esp32

* Update fb_gfx.h

* Update fb_gfx.c

* IDF_BRANCH="v4.4.1"

* Update push.yml

* remove CONFIG_SPI_FLASH_ROM_IMPL

since it breaks dangerous writes

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* Update README.md

* Update README.md

* IDF_BRANCH="v4.4_dev"

* 2.0.4dev

Co-authored-by: me-no-dev <hristo@espressif.com>
Jason2866 added a commit to tasmota/esp32-arduino-lib-builder that referenced this issue May 17, 2022
* Support extern Ethernet (Jason2866#60)

see espressif/arduino-esp32#6318

* Revert "Support extern Ethernet (Jason2866#60)" (Jason2866#61)

This reverts commit 8c5ac76.

* Fix missing BLE 4.2 from ESP32-S3

* Allow selecting Arduino branch based on the current lib-builder branch

* For CI builds get branch from env

* dump env

* Update update-components.sh

* Update update-components.sh

* Add support for CPP exceptions for C3

Fixes: espressif/arduino-esp32#6187

* Script improvements, rainmaker and esp-sr

* Optimized for Tasmota

* Update build.sh

* Update config.sh

* Update install-esp-idf.sh

* AR_BRANCH="master"

* Update push.yml

* Update defconfig.esp32s3

* Update defconfig.esp32s2

* space in path fix

* fix space in path

* Update install-esp-idf.sh

* Update README.md

* esp littlesfs broken going back to commit 4ee58815

* lfn

* lfn

* lfn

* lfn

* use actual littlefs

* esp_littlefs commit 4ee58815093

* Update config.sh

* use latest littlefs

* AR_BRANCH="work"

* IDF branch v4.4_work

* Update push.yml

* Update defconfig.esp32

* Update fb_gfx.h

* Update fb_gfx.c

* IDF_BRANCH="v4.4.1"

* Update push.yml

* remove CONFIG_SPI_FLASH_ROM_IMPL

since it breaks dangerous writes

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* Update README.md

* Update README.md

* IDF_BRANCH="v4.4_dev"

* 2.0.4dev

* branch Arduino release_203 and IDF v4.4.1

Co-authored-by: me-no-dev <hristo@espressif.com>
Jason2866 added a commit to Jason2866/esp32-arduino-lib-builder that referenced this issue May 18, 2022
* update to core 2.0.3 (#18)

* Support extern Ethernet (#60)

see espressif/arduino-esp32#6318

* Revert "Support extern Ethernet (#60)" (#61)

This reverts commit 8c5ac76.

* Fix missing BLE 4.2 from ESP32-S3

* Allow selecting Arduino branch based on the current lib-builder branch

* For CI builds get branch from env

* dump env

* Update update-components.sh

* Update update-components.sh

* Add support for CPP exceptions for C3

Fixes: espressif/arduino-esp32#6187

* Script improvements, rainmaker and esp-sr

* Optimized for Tasmota

* Update build.sh

* Update config.sh

* Update install-esp-idf.sh

* AR_BRANCH="master"

* Update push.yml

* Update defconfig.esp32s3

* Update defconfig.esp32s2

* space in path fix

* fix space in path

* Update install-esp-idf.sh

* Update README.md

* esp littlesfs broken going back to commit 4ee58815

* lfn

* lfn

* lfn

* lfn

* use actual littlefs

* esp_littlefs commit 4ee58815093

* Update config.sh

* use latest littlefs

* AR_BRANCH="work"

* IDF branch v4.4_work

* Update push.yml

* Update defconfig.esp32

* Update fb_gfx.h

* Update fb_gfx.c

* IDF_BRANCH="v4.4.1"

* Update push.yml

* remove CONFIG_SPI_FLASH_ROM_IMPL

since it breaks dangerous writes

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* Update README.md

* Update README.md

* IDF_BRANCH="v4.4_dev"

* 2.0.4dev

Co-authored-by: me-no-dev <hristo@espressif.com>

* Nspanel core 2.0.3 (#19)

* Support extern Ethernet (#60)

see espressif/arduino-esp32#6318

* Revert "Support extern Ethernet (#60)" (#61)

This reverts commit 8c5ac76.

* Fix missing BLE 4.2 from ESP32-S3

* Allow selecting Arduino branch based on the current lib-builder branch

* For CI builds get branch from env

* dump env

* Update update-components.sh

* Update update-components.sh

* Add support for CPP exceptions for C3

Fixes: espressif/arduino-esp32#6187

* Script improvements, rainmaker and esp-sr

* Optimized for Tasmota

* Update build.sh

* Update config.sh

* Update install-esp-idf.sh

* AR_BRANCH="master"

* Update push.yml

* Update defconfig.esp32s3

* Update defconfig.esp32s2

* space in path fix

* fix space in path

* Update install-esp-idf.sh

* Update README.md

* esp littlesfs broken going back to commit 4ee58815

* lfn

* lfn

* lfn

* lfn

* use actual littlefs

* esp_littlefs commit 4ee58815093

* Update config.sh

* use latest littlefs

* AR_BRANCH="work"

* IDF branch v4.4_work

* Update push.yml

* Update defconfig.esp32

* Update fb_gfx.h

* Update fb_gfx.c

* IDF_BRANCH="v4.4.1"

* Update push.yml

* remove CONFIG_SPI_FLASH_ROM_IMPL

since it breaks dangerous writes

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* Update README.md

* Update README.md

* IDF_BRANCH="v4.4_dev"

* 2.0.4dev

* branch Arduino release_203 and IDF v4.4.1

Co-authored-by: me-no-dev <hristo@espressif.com>

* Update defconfig.esp32

* Update push.yml

Co-authored-by: me-no-dev <hristo@espressif.com>
Jason2866 added a commit to Jason2866/esp32-arduino-lib-builder that referenced this issue Jun 25, 2022
* Support extern Ethernet (#60)

see espressif/arduino-esp32#6318

* Revert "Support extern Ethernet (#60)" (#61)

This reverts commit 8c5ac76.

* Fix missing BLE 4.2 from ESP32-S3

* Allow selecting Arduino branch based on the current lib-builder branch

* For CI builds get branch from env

* dump env

* Update update-components.sh

* Update update-components.sh

* Add support for CPP exceptions for C3

Fixes: espressif/arduino-esp32#6187

* Script improvements, rainmaker and esp-sr

* Optimized for Tasmota

* Update build.sh

* Update config.sh

* Update install-esp-idf.sh

* AR_BRANCH="master"

* Update push.yml

* Update defconfig.esp32s3

* Update defconfig.esp32s2

* space in path fix

* fix space in path

* Update install-esp-idf.sh

* Update README.md

* esp littlesfs broken going back to commit 4ee58815

* lfn

* lfn

* lfn

* lfn

* use actual littlefs

* esp_littlefs commit 4ee58815093

* Update config.sh

* use latest littlefs

* AR_BRANCH="work"

* IDF branch v4.4_work

* Update push.yml

* Update defconfig.esp32

* Update fb_gfx.h

* Update fb_gfx.c

* IDF_BRANCH="v4.4.1"

* Update push.yml

* remove CONFIG_SPI_FLASH_ROM_IMPL

since it breaks dangerous writes

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* Update README.md

* Update README.md

* IDF_BRANCH="v4.4_dev"

* 2.0.4dev

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update Kconfig.projbuild

* Do not append digest to the bootloader bin

* Update .gitignore

* Update copy-libs.sh

* --non-interactive

* Update install-esp-idf.sh

* CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000

* CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000

* CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000

* CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000

* Improve support for hand-written asm source files in PIO

* Improve support for hand-written asm source files in PIO

* CONFIG_LWIP_IPV6_AUTOCONFIG=y

* CONFIG_LWIP_IPV6_AUTOCONFIG=y

* CONFIG_LWIP_IPV6_AUTOCONFIG=y

* CONFIG_LWIP_IPV6_AUTOCONFIG=y

* Update CMakeLists.txt

* Update builds.json

* Update copy-libs.sh

* Update copy-mem-variant.sh

Co-authored-by: me-no-dev <hristo@espressif.com>
Jason2866 added a commit to Jason2866/esp32-arduino-lib-builder that referenced this issue Jul 29, 2022
* Support extern Ethernet (#60)

see espressif/arduino-esp32#6318

* Revert "Support extern Ethernet (#60)" (#61)

This reverts commit 8c5ac76.

* Fix missing BLE 4.2 from ESP32-S3

* Allow selecting Arduino branch based on the current lib-builder branch

* For CI builds get branch from env

* dump env

* Update update-components.sh

* Update update-components.sh

* Add support for CPP exceptions for C3

Fixes: espressif/arduino-esp32#6187

* Script improvements, rainmaker and esp-sr

* Optimized for Tasmota

* Update build.sh

* Update config.sh

* Update install-esp-idf.sh

* AR_BRANCH="master"

* Update push.yml

* Update defconfig.esp32s3

* Update defconfig.esp32s2

* space in path fix

* fix space in path

* Update install-esp-idf.sh

* Update README.md

* esp littlesfs broken going back to commit 4ee58815

* lfn

* lfn

* lfn

* lfn

* use actual littlefs

* esp_littlefs commit 4ee58815093

* Update config.sh

* use latest littlefs

* AR_BRANCH="work"

* IDF branch v4.4_work

* Update push.yml

* Update defconfig.esp32

* Update fb_gfx.h

* Update fb_gfx.c

* IDF_BRANCH="v4.4.1"

* Update push.yml

* remove CONFIG_SPI_FLASH_ROM_IMPL

since it breaks dangerous writes

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* remove CONFIG_SPI_FLASH_ROM_IMPL

* Update README.md

* Update README.md

* IDF_BRANCH="v4.4_dev"

* 2.0.4dev

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update Kconfig.projbuild

* Do not append digest to the bootloader bin

* Update .gitignore

* Update copy-libs.sh

* --non-interactive

* Update install-esp-idf.sh

* CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000

* CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000

* CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000

* CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000

* Improve support for hand-written asm source files in PIO

* Improve support for hand-written asm source files in PIO

* CONFIG_LWIP_IPV6_AUTOCONFIG=y

* CONFIG_LWIP_IPV6_AUTOCONFIG=y

* CONFIG_LWIP_IPV6_AUTOCONFIG=y

* CONFIG_LWIP_IPV6_AUTOCONFIG=y

* Update CMakeLists.txt

* Update builds.json

* Update copy-libs.sh

* Update copy-mem-variant.sh

* align flash modes with upstream

* Update defconfig.common

* CONFIG_ESP32_ULP_COPROC_ENABLED=y CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=512

* 2.0.4pre

* Branch v4.4.1.1

* Use dout 40M as default

* CONFIG_ESP32S3_ULP_COPROC_ENABLED CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM=1024

* CONFIG_ESP32S2_ULP_COPROC_ENABLED=y CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM=1024

* 2.0.4

* Update push.yml

* Branch v4.4.2

* Branch 2.0.4

* Branch work

* Update push.yml

* CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y

* Skip validate

* skip validate

* skip validate

* Update builds.json

* Update defconfig.esp32

* Update defconfig.esp32c3

* Update defconfig.esp32s2

* Update defconfig.esp32s3

* back to v4.4_dev

* # CONFIG_ESPTOOLPY_FLASHSIZE_DETECT is not set

* # CONFIG_ESPTOOLPY_FLASHSIZE_DETECT is not set

* # CONFIG_ESPTOOLPY_FLASHSIZE_DETECT is not set

* # CONFIG_ESPTOOLPY_FLASHSIZE_DETECT is not set

* Update defconfig.esp32

* Update defconfig.esp32c3

* Update defconfig.esp32s2

* Update defconfig.esp32s3

* 442_test

* Update defconfig.esp32s3

* only TARGET="esp32"

* Enable BT modem sleep

* BT Modem sleep

* TARGET="all"

* IDF_BRANCH="442_esp41"

* Update core_version.h

* AR_BRANCH="speed_OTA"

* rm BT modem sleep

* rm BT modem sleep

* rm lwip ipv6, sntp update delay

* rm lwip ipv6, sntp update delay

* rm lwip ipv6, sntp update delay

* rm lwip ipv6, sntp update delay

* Update push.yml

* Update push.yml

Co-authored-by: me-no-dev <hristo@espressif.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: LIB Builder Depends on Lib Builder Chip: ESP32-C3 Issue is related to support of ESP32-C3 Chip Status: Solved
Projects
Development

Successfully merging a pull request may close this issue.

5 participants