Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/build-tricore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tricore Build

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

jobs:

build-tricore:
runs-on: ubuntu-latest
container: baoproject/bao:latest
strategy:
matrix:
platform: [
"tc4dx",
]
cross_compile: [
"CROSS_COMPILE=tricore-elf-",
]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- run: make PLATFORM=${{ matrix.platform }} \
CONFIG=null ${{ matrix.cross_compile }}
36 changes: 36 additions & 0 deletions scripts/arch/tricore/platform_defs_gen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* SPDX-License-Identifier: Apache-2.0
* Copyright (c) Bao Project and Contributors. All rights reserved
*/

#include <stdio.h>
#include <platform.h>

extern uint32_t plat_ints[];
extern uint32_t plat_int_size;

void arch_platform_defs() {
unsigned int bitmap[64] = {0};
unsigned int count = plat_int_size;

for(int i = 0; i < count; i++){
unsigned int irq = plat_ints[i];
unsigned int index = irq / 32;
unsigned int bit = irq % 32;

if(index < 64 && bit < 32)
bitmap[index] |= 1UL << bit;
}

printf ("#define INTERRUPTS_COUNT %d\n", count);
printf("#define INTERRUPTS_BITMAP {\t");
for(int i = 0; i < 64; i++)
{
if(i && i % 4 == 0)
printf(" \\\n\t\t\t\t\t\t");
if(i != 63)
printf("0x%x, ", bitmap[i]);
else printf("0x%x }\n", bitmap[i]);
}

}
14 changes: 14 additions & 0 deletions src/arch/tricore/arch.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## SPDX-License-Identifier: Apache-2.0
## Copyright (c) Bao Project and Contributors. All rights reserved.

CROSS_COMPILE ?= tricore-elf-

clang_arch_target:=tricore-unknown-unknown-elf

arch-cppflags+=
arch-ldflags=

arch_mem_prot:=mpu
plat_mem:=non_unified
PAGE_SIZE:=64
mmio_slave_side_prot:=y
32 changes: 32 additions & 0 deletions src/arch/tricore/asm_defs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* SPDX-License-Identifier: Apache-2.0
* Copyright (c) Bao Project and Contributors. All rights reserved.
*/

#include <bao.h>
#include <cpu.h>
#include <vm.h>
#include <platform.h>

__attribute__((used)) static void cpu_defines(void)
{
DEFINE_SIZE(CPU_SIZE, struct cpu);

DEFINE_OFFSET(CPU_STACK_OFF, struct cpu, stack);
DEFINE_SIZE(CPU_STACK_SIZE, ((struct cpu*)NULL)->stack);

DEFINE_OFFSET(CPU_VCPU_OFF, struct cpu, vcpu);
}

__attribute__((used)) static void vcpu_defines(void)
{
DEFINE_OFFSET(VCPU_REGS_OFF, struct vcpu, regs);
DEFINE_OFFSET(VCPU_VM_OFF, struct vcpu, vm);
DEFINE_OFFSET(VCPU_REGS_LOWER_CTX_OFF, struct vcpu, regs.lower_ctx);
DEFINE_OFFSET(REGS_A0_OFF, struct arch_regs, a0);
DEFINE_OFFSET(REGS_A1_OFF, struct arch_regs, a1);
DEFINE_OFFSET(REGS_A8_OFF, struct arch_regs, a8);
DEFINE_OFFSET(REGS_A9_OFF, struct arch_regs, a9);
}

__attribute__((used)) static void platform_defines(void) { }
Loading
Loading