This commit is contained in:
2026-05-16 01:44:07 +07:00
parent 676634a3c7
commit 09224c1552
27 changed files with 3741 additions and 2396 deletions
+28
View File
@@ -0,0 +1,28 @@
#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);
}