This commit is contained in:
2026-06-08 23:39:25 +07:00
parent 09224c1552
commit 3a194bdb2a
11 changed files with 360 additions and 91 deletions
-28
View File
@@ -1,28 +0,0 @@
#include <stdio.h>
#include <string.h>
#include "esp_heap_caps.h"
#include "esp_cpu.h"
typedef int (*func_t)(void);
void run_app_from_iram(void)
{
uint8_t code[] = {
0x36, 0x41, 0x00, 0x2c, 0xa2, 0x1d, 0xf0
};
void *exec = heap_caps_malloc(sizeof(code),
MALLOC_CAP_EXEC | MALLOC_CAP_8BIT);
memcpy(exec, code, sizeof(code));
//esp_cpu_invalidate_icache_all();
func_t f = (func_t)exec;
int result = f();
printf("Result = %d\n", result); // Должно быть 42
heap_caps_free(exec);
}