Skip to content

Commit 4d20030

Browse files
committed
PAL file for arm zephyr executor runner
1 parent a1e3d48 commit 4d20030

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#ifndef _ARM_ZEPHYR_PAL_HPP
2+
#define _ARM_ZEPHYR_PAL_HPP
3+
4+
#include <zephyr/kernel.h>
5+
#include <zephyr/sys/printk.h>
6+
7+
void et_pal_init(void) {}
8+
9+
ET_NORETURN void et_pal_abort(void) {
10+
_exit(-1);
11+
}
12+
13+
et_timestamp_t et_pal_current_ticks(void) {
14+
return k_uptime_ticks();
15+
}
16+
17+
et_tick_ratio_t et_pal_ticks_to_ns_multiplier(void) {
18+
// Since we don't know the CPU freq for your target and just cycles in the
19+
// FVP for et_pal_current_ticks() we return a conversion ratio of 1
20+
return {1, 1};
21+
}
22+
23+
/**
24+
* Emit a log message via platform output (serial port, console, etc).
25+
*/
26+
void et_pal_emit_log_message(
27+
ET_UNUSED et_timestamp_t timestamp,
28+
et_pal_log_level_t level,
29+
const char* filename,
30+
ET_UNUSED const char* function,
31+
size_t line,
32+
const char* message,
33+
ET_UNUSED size_t length) {
34+
fprintf(
35+
stderr,
36+
"%c [executorch:%s:%zu %s()] %s\n",
37+
level,
38+
filename,
39+
line,
40+
function,
41+
message);
42+
}
43+
44+
void* et_pal_allocate(ET_UNUSED size_t size) {
45+
return k_malloc(size);
46+
}
47+
48+
void et_pal_free(ET_UNUSED void* ptr) {
49+
k_free(ptr);
50+
}
51+
52+
#endif // _ARM_ZEPHYR_PAL_HPP

0 commit comments

Comments
 (0)