Compiler generate wrong binary file

dalmat
Posts: 3
Joined: Sun Apr 24, 2016 1:04 pm

Compiler generate wrong binary file

Postby dalmat » Fri Oct 06, 2023 5:00 pm

Hello
I am new to the ESP32 platform, but I have a lot of experience with other microcontrollers. I use VisualStudio2022 and VisualGDB as IDE. I'm trying to make a binary file to download to the ESP32C3 using the OTA bootloader. I took a simple blink example, and it doesn't work. I looked at the resulting blink.bin file. It seems that the file I get is not a pure bin file. I opened the file with a text editor and I see some things related to the project. How do I get a clean bin file???
Below is a part of the bin file that contains some information about the project and directories.

0UL //IDF/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c ***ERROR*** A stack overflow in task has been detected. [0;32mI (%lu) %s: Starting scheduler. [0m
_prvTaskExitError esp_task_wdt_init(&twdt_config) /IDF/components/freertos/FreeRTOS-Kernel/portable/port_common.c main res == pdTRUE //IDF/components/freertos/FreeRTOS-Kernel/portable/port_common.c pxTCBBufferTemp != NULL pxStackBufferTemp != NULL vApplicationGetIdleTaskMemory main_task esp_startup_start_app_common esp_intr_alloc(ETS_SYSTIMER_TARGET0_EDGE_INTR_SOURCE + cpuid, ESP_INTR_FLAG_IRAM | level, SysTickIsrHandler, &systimer_hal, NULL) /IDF/components/freertos/FreeRTOS-Kernel/portable/port_systick.c vPortSetupTimer pxQueueSetContainer //IDF/components/freertos/FreeRTOS-Kernel/queue.c pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength pxQueue uxQueueLength > ( UBaseType_t ) 0 pxStaticQueue != ((void *)0) !( ( pucQueueStorage != ((void *)0) ) && ( uxItemSize == 0 ) ) !( ( pucQueueStorage == ((void *)0) ) && ( uxItemSize != 0 ) ) xSize == sizeof( Queue_t ) ( uxItemSize == 0 ) || ( uxQueueLength == ( xQueueSizeInBytes / uxItemSize ) ) ( sizeof( Queue_t ) + xQueueSizeInBytes ) > xQueueSizeInBytes !( ( pvItemToQueue == ((void *)0) ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) !( ( xCopyPosition == ( ( BaseType_t ) 2 ) ) && ( pxQueue->uxLength != 1 ) ) !( ( xTaskGetSchedulerState() == ( ( BaseType_t ) 0 ) ) && ( xTicksToWait != 0 ) ) pxQueue->pcHead != ((void *)0) || pxQueue->u.xSemaphore.xMutexHolder == ((void *)0) || pxQueue->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle() pxMutex pxQueue->uxItemSize == 0 !( ( pxQueue->pcHead == ((void *)0) ) && ( pxQueue->u.xSemaphore.xMutexHolder != ((void *)0) ) ) ( pxQueue ) !( ( ( pvBuffer ) == ((void *)0) ) && ( ( pxQueue )->uxItemSize != ( UBaseType_t ) 0U ) ) xInheritanceOccurred == ( ( BaseType_t ) 0 ) !( ( pvBuffer == ((void *)0) ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U )

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: Compiler generate wrong binary file

Postby ESP_Sprite » Sat Oct 07, 2023 8:28 am

Those are bits of the text that get printed out when an assert hits; they're part of the binary. It's similar to if you would do a printf("Hello world!") in a project; if you inspect the binary you would find the plain-text string "Hello world!" in there. In other words, there's no such thing as a 'clean' bin file; the bin file you have is as clean as they get.

MicroController
Posts: 1707
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Compiler generate wrong binary file

Postby MicroController » Sat Oct 07, 2023 12:22 pm

See also https://en.cppreference.com/w/c/error/assert :
assert outputs implementation-specific diagnostic information on the standard error output and calls abort(). The diagnostic information is required to include the text of expression, as well as the values of the predefined variable __func__ and of (since C99) the predefined macros __FILE__ and __LINE__.
That's why this information is included as constant string data in the binary.

Who is online

Users browsing this forum: No registered users and 81 guests