-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest.c
72 lines (63 loc) · 2.33 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <stdint.h>
#include "ipc_rpmsg_linux_resource_table.h"
#include <string.h>
void Reset_Handler (void) __attribute__ ((naked));
void Default_Handler(void);
void Undef_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
void PAbt_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
void DAbt_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
void IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
void FIQ_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
__attribute__((naked, section(".isr_vector"))) void vectors() {
asm volatile(
"LDR PC, =Reset_Handler \n"
"LDR PC, =Undef_Handler \n"
"LDR PC, =SVC_Handler \n"
"LDR PC, =PAbt_Handler \n"
"LDR PC, =DAbt_Handler \n"
"NOP \n"
"LDR PC, =IRQ_Handler \n"
"LDR PC, =FIQ_Handler \n"
);
}
extern void _start();
void Reset_Handler() {
_start();
}
void Default_Handler() {
while(1);
}
#define DebugP_MEM_LOG_SIZE 1024
__attribute__((section (".log_shared_mem"))) char gDebugMemLog[DebugP_MEM_LOG_SIZE];
const RPMessage_ResourceTable gRPMessage_linuxResourceTable __attribute__ ((section (".resource_table"), aligned (4096))) =
{
{
1U, /* we're the first version that implements this */
2U, /* number of entries, MUST be 2 */
{ 0U, 0U, } /* reserved, must be zero */
},
/* offsets to the entries */
{
offsetof(RPMessage_ResourceTable, vdev),
offsetof(RPMessage_ResourceTable, trace),
},
/* vdev entry */
{
RPMESSAGE_RSC_TYPE_VDEV, RPMESSAGE_RSC_VIRTIO_ID_RPMSG,
0U, 1U, 0U, 0U, 0U, 2U, { 0U, 0U },
},
/* the two vrings */
{ RPMESSAGE_RSC_VRING_ADDR_ANY, 4096U, 256U, 1U, 0U },
{ RPMESSAGE_RSC_VRING_ADDR_ANY, 4096U, 256U, 2U, 0U },
{
(RPMESSAGE_RSC_TRACE_INTS_VER0 | RPMESSAGE_RSC_TYPE_TRACE),
(uint32_t)gDebugMemLog, DebugP_MEM_LOG_SIZE,
0, "trace:r5fss0_0",
},
};
const char* msg = "Hello world!\n";
int main() {
strcpy(gDebugMemLog, msg);
return 0;
}