43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
|
#include <platform/platform.h>
|
||
|
#include <platform/printf.h>
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#define RAM_START 0x20000000
|
||
|
#define RAM_END RAM_START + 0x00400000
|
||
|
#define LIB_MAGIC 0xDEADBEEFu
|
||
|
|
||
|
typedef int (*func_t)(void);
|
||
|
|
||
|
void execute_library_function() {
|
||
|
printf("Scanning RAM...\n");
|
||
|
volatile uint32_t *ptr = (uint32_t *)RAM_START;
|
||
|
|
||
|
while ((uint32_t)ptr < RAM_END) {
|
||
|
if (*ptr == LIB_MAGIC) {
|
||
|
printf("Found libpqscheme_test!\n");
|
||
|
uint32_t entry_point = *(ptr + 4);
|
||
|
printf("%X\n", entry_point);
|
||
|
entry_point += 4;
|
||
|
printf("%X\n", entry_point);
|
||
|
func_t test_func = (func_t)entry_point;
|
||
|
if (test_func) {
|
||
|
printf("Try exec...%X\n", entry_point);
|
||
|
printf(">> %d\n", test_func());
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
ptr++;
|
||
|
}
|
||
|
|
||
|
printf("Test binary not found!\n");
|
||
|
}
|
||
|
|
||
|
void main() {
|
||
|
platform_init(PLATFORM_CLOCK_MAX);
|
||
|
platform_sync();
|
||
|
|
||
|
printf("Runner started\n");
|
||
|
execute_library_function();
|
||
|
printf("Execution finished\n");
|
||
|
}
|