Hi there,
I followed Kolban's youtube tutorial https://www.youtube.com/watch?v=-ttiPfmrehU&t=41s, and managed to build successfully and later flashed to ESP-WROOM-32 board. However, I got this message and stayed there forever. It looks like something RAM configurations has failed. However, I have confirmed with non-C++ program, the helloworld and it works.
Can someone advise please?
-- ---- message from Esp32 board ------------------
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:4316
load:0x40078000,len:0
load:0x40078000,len:11312
entry 0x40078c98
I (593) heap_init: Initializing. RAM available for dynamic allocation:
I (594) heap_init: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (612) heap_init: At 3FFB5F88 len 0002A078 (168 KiB): DRAM
I (670) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (728) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (788) heap_init: At 40092570 len 0000DA90 (54 KiB): IRAM
my first C++ needs help
Re: my first C++ needs help
Do you have any global or static objects with non-trivial constructors in your code?
Re: my first C++ needs help
The global and static variable is tag[]. Is this the cause of the problem?
#include <esp_log.h>
#include <string>
#include "sdkconfig.h"
static char tag[]="cpp_helloworld";
extern "C" {
void app_main(void);
}
class Greeting {
public:
void helloEnglish() {
ESP_LOGD(tag, "Hello %s", name.c_str());
}
void helloFrench() {
ESP_LOGD(tag, "Bonjour %s", name.c_str());
}
void setName(std::string name) {
this->name = name;
}
private:
std::string name = "";
};
void app_main(void)
{
Greeting myGreeting;
myGreeting.setName("Neil");
myGreeting.helloEnglish();
myGreeting.helloFrench();
}
#include <esp_log.h>
#include <string>
#include "sdkconfig.h"
static char tag[]="cpp_helloworld";
extern "C" {
void app_main(void);
}
class Greeting {
public:
void helloEnglish() {
ESP_LOGD(tag, "Hello %s", name.c_str());
}
void helloFrench() {
ESP_LOGD(tag, "Bonjour %s", name.c_str());
}
void setName(std::string name) {
this->name = name;
}
private:
std::string name = "";
};
void app_main(void)
{
Greeting myGreeting;
myGreeting.setName("Neil");
myGreeting.helloEnglish();
myGreeting.helloFrench();
}
Re: my first C++ needs help
Howdy,
I'm delighted to say the solution for this is easy (because Ive seen it before).
Look at this statement:
ESP_LOGD(tag, "Hello %s", name.c_str());
This is what performs the logging of the message to the console. We can log at a variety of levels:
ESP_LOGD - means log at debug level.
Change the ESP_LOGD statements to ESP_LOGI (which means log at the information level).
Alternative, use "make menuconfig" and enable logging at "debug or above".
Please try the above and post back if it doesn't work or isn't clear.
I'm delighted to say the solution for this is easy (because Ive seen it before).
Look at this statement:
ESP_LOGD(tag, "Hello %s", name.c_str());
This is what performs the logging of the message to the console. We can log at a variety of levels:
ESP_LOGD - means log at debug level.
Change the ESP_LOGD statements to ESP_LOGI (which means log at the information level).
Alternative, use "make menuconfig" and enable logging at "debug or above".
Please try the above and post back if it doesn't work or isn't clear.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
[closed] Re: my first C++ needs help
Hi Kolban,
Many thanks for the detailed explanation. I read about this in the other discussion. However, did not really understand until you explained here.
It works now
Thank you so much
Many thanks for the detailed explanation. I read about this in the other discussion. However, did not really understand until you explained here.
It works now
Thank you so much
Who is online
Users browsing this forum: No registered users and 89 guests