Skip to content

Commit 0e5ea75

Browse files
feat(tricore): Initial commit
Signed-off-by: Miguel Silva <[email protected]>
1 parent 504bce1 commit 0e5ea75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4357
-2
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ ifeq ($(CC_IS_GCC),y)
237237
-Wmissing-prototypes -Wmissing-declarations \
238238
-Wswitch-default -Wshadow -Wshadow=global \
239239
-Wcast-qual -Wunused-macros \
240-
-Wstrict-prototypes -Wunused-but-set-variable
240+
-Wstrict-prototypes -Wunused-but-set-variable \
241+
-Wno-multistatement-macros
241242

242243
override CFLAGS+=-Wno-unused-command-line-argument \
243244
-pedantic -pedantic-errors

configs.zip

5.47 KB
Binary file not shown.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved
4+
*/
5+
6+
#include <stdio.h>
7+
#include <platform.h>
8+
9+
extern uint32_t plat_ints[];
10+
extern uint32_t plat_int_size;
11+
12+
void arch_platform_defs() {
13+
unsigned int bitmap[64] = {0};
14+
unsigned int count = plat_int_size;
15+
16+
for(int i = 0; i < count; i++){
17+
unsigned int irq = plat_ints[i];
18+
unsigned int index = irq / 32;
19+
unsigned int bit = irq % 32;
20+
21+
if(index < 64 && bit < 32)
22+
bitmap[index] |= 1UL << bit;
23+
}
24+
25+
printf ("#define INTERRUPTS_COUNT %d\n", count);
26+
printf("#define INTERRUPTS_BITMAP {\t");
27+
for(int i = 0; i < 64; i++)
28+
{
29+
if(i && i % 4 == 0)
30+
printf(" \\\n\t\t\t\t\t\t");
31+
if(i != 63)
32+
printf("0x%x, ", bitmap[i]);
33+
else printf("0x%x }\n", bitmap[i]);
34+
}
35+
36+
}

src/arch/tricore/arch.mk

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## SPDX-License-Identifier: Apache-2.0
2+
## Copyright (c) Bao Project and Contributors. All rights reserved.
3+
4+
CROSS_COMPILE ?= tricore-elf-
5+
6+
clang_arch_target:=tricore-unknown-unknown-elf
7+
8+
arch-cppflags+=
9+
#arch-cflags=-march=tc18
10+
#arch-asflags=-march=tc18
11+
arch-ldflags=
12+
13+
arch_mem_prot:=mpu
14+
plat_mem:=non_unified
15+
PAGE_SIZE:=64

src/arch/tricore/asm_defs.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#include <bao.h>
7+
#include <cpu.h>
8+
#include <vm.h>
9+
#include <platform.h>
10+
11+
__attribute__((used)) static void cpu_defines(void)
12+
{
13+
DEFINE_SIZE(CPU_SIZE, struct cpu);
14+
15+
DEFINE_OFFSET(CPU_STACK_OFF, struct cpu, stack);
16+
DEFINE_SIZE(CPU_STACK_SIZE, ((struct cpu*)NULL)->stack);
17+
18+
DEFINE_OFFSET(CPU_VCPU_OFF, struct cpu, vcpu);
19+
}
20+
21+
__attribute__((used)) static void vcpu_defines(void)
22+
{
23+
DEFINE_SIZE(VCPU_ARCH_SIZE, struct vcpu_arch);
24+
DEFINE_OFFSET(VCPU_REGS_OFF, struct vcpu, regs);
25+
DEFINE_OFFSET(VCPU_VM_OFF, struct vcpu, vm);
26+
DEFINE_OFFSET(VCPU_REGS_LOWER_CTX_OFF, struct vcpu, regs.lower_ctx);
27+
DEFINE_OFFSET(REGS_A0_OFF, struct arch_regs, a0);
28+
DEFINE_OFFSET(REGS_A1_OFF, struct arch_regs, a1);
29+
DEFINE_OFFSET(REGS_A8_OFF, struct arch_regs, a8);
30+
DEFINE_OFFSET(REGS_A9_OFF, struct arch_regs, a9);
31+
DEFINE_SIZE(VCPU_REGS_SIZE, struct arch_regs);
32+
}
33+
34+
__attribute__((used)) static void platform_defines(void)
35+
{
36+
DEFINE_OFFSET(PLAT_CPUNUM_OFF, struct platform, cpu_num);
37+
DEFINE_OFFSET(PLAT_ARCH_OFF, struct platform, arch);
38+
}

0 commit comments

Comments
 (0)