Code: Select all
int main()
{
int c = 0;
for (int i = 0; i < 1000; i ++)
{
for (int j = 0; j < 1000; j ++)
{
c++;
}
}
}
Code: Select all
SECTIONS
{
.literal : {*(.literal)}
.text : {*(.text)}
}
Code: Select all
xtensa-esp32-elf-gcc.exe -Xlinker -T link.ld -std=c99 -Os -nostdlib -c main.c -o out/main.o
xtensa-esp32-elf-objcopy -O binary out/main.o out/APP.bin
Code: Select all
0x36, 0x41, 0x00, 0x0C, 0x02, 0x1D, 0xF0
Code: Select all
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_attr.h"
#define SIZE 7
IRAM_ATTR uint32_t PROGRAM[SIZE] = {
0x36, 0x41, 0x00, 0x0C, 0x02, 0x1D, 0xF0
};
const void* PTR = (void*)PROGRAM;
void exec_bin()
{
typedef void func(void);
func* f = (func*)(PTR);
printf("\nIT'S NOW ...\n");
f(); // ESP32 CRASHES HERE <<---
}
void app_main()
{
printf("\n\nGoint to exec code ...\n\n");
vTaskDelay(1000 / portTICK_RATE_MS);
exec_bin();
printf("Done");
}
Code: Select all
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception)
Debug exception reason: BREAK instr
* Sorry for my english. I speak portuguese. This is the first time I use this forum.