Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By felfert
#95347 Hi,

I am using the ESP8266_RTOS_SDK trying to write my first app.

I use the COMPONENT_EMBED_TXTFILES feature in the component.mk to embed some certificate (PEM).
The following code then embeds the certificate and corresponding key:

Code: Select allstatic uint8_t d_client_crt_start[] asm("_binary_client_crt_start");
static uint8_t client_crt_end[]   asm("_binary_client_crt_end");
static uint8_t client_key_start[] asm("_binary_client_key_start");
static uint8_t client_key_end[]   asm("_binary_client_key_end");

When I put this code in a .c file, it works flawlessly, however if this is in a .cpp file, i get the following
error during compilation:

Code: Select allapp.cpp:45:16: error: storage size of 'client_crt_start' isn't known
 static uint8_t client_crt_start[] asm("_binary_client_crt_start");
                ^~~~~~~~~~~~~~~~

For now, I have put the embedding code into a separate .c file but I really would like to have it
in the main app.cpp. I am unfamiliar with using gcc's asm(...) in C++, so I would appreciate
any help here.

Thanks
-Fritz