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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ environment+=BAO_DEMOS_SDCARD=/media/$$USER/boot
all: platform

bao_repo:=https://github.com/bao-project/bao-hypervisor
bao_version:=demo-next
bao_version:=feat/tricore
bao_src:=$(wrkdir_src)/bao
bao_cfg_repo:=$(wrkdir_demo_imgs)/config
wrkdirs+=$(bao_cfg_repo)
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ c) For RISC-V (both RV64 and RV32), use the **riscv64-unknown-elf-** toolchain.

Download it from [Bao's Project RISC-V Toolchain repo](riscv-toolchains).

d) For Tricore, use the **tricore-elf-** toolchain.

Download it from [Infineon's website][tricore-toolchains].

Install the toolchain. Then, set the **CROSS_COMPILE** environment variable
with the reference toolchain prefix path:

Expand Down Expand Up @@ -232,6 +236,9 @@ Build the firmware and deploy the system according to the target platform:
#### RISC-V platforms:
* [QEMU virt](platforms/qemu-riscv64-virt/README.md)

#### Tricore platforms:
* [TC4Dx COM](platforms/tc4dx/README.md)

---

## Appendix I
Expand All @@ -250,6 +257,7 @@ Build the firmware and deploy the system according to the target platform:
| FVP-R AArch32 | fvp-r-aarch32 | aarch32 |
| QEMU RV64 virt | qemu-riscv64-virt | riscv64 |
| QEMU RV32 virt | qemu-riscv32-virt | riscv32 |
| Infineon TC4Dx COM | tc4dx | tricore |


| | DEMO |
Expand All @@ -275,6 +283,8 @@ Build the firmware and deploy the system according to the target platform:
| fvp-r-aarch32 | x | | | x |
| qemu-riscv64-virt | x | x | | |
| qemu-riscv32-virt | x | x | | |
| tc4dx | x | | | |



---
Expand All @@ -292,10 +302,12 @@ Build the firmware and deploy the system according to the target platform:
| mkimage | 2022.01 |
| cmake | 3.22.1 |
| ninja | 1.10.1 |
| tricore-elf-gcc | 11.3.1 |


<!-- Links -->

[aarch64-toolchains]: https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-elf.tar.xz
[aarch32-toolchains]: https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz
[riscv-toolchains]: https://github.com/bao-project/bao-riscv-toolchain/releases/download/gc891d8dc23e/riscv-unknown-linux-gnu-13.2.0-ubuntu-22.04.tar.gz
[tricore-toolchains]: https://softwaretools-hosting.infineon.com/packages/com.ifx.tb.tool.aurixgcc/versions/05-2025/artifacts/aurixgcc_05-2025_Linux_x86-x64.zip/download
57 changes: 57 additions & 0 deletions demos/baremetal/configs/tc4dx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <config.h>

VM_IMAGE(baremetal_image, XSTR(BAO_DEMOS_WRKDIR_IMGS/baremetal.bin))

struct config config = {

.vmlist_size = 1,
.hyp.base_addr = 0xA0000000,

.vmlist = (struct vm_config[]){
{
.image = {
.base_addr = 0x90100000,
.load_addr = VM_IMAGE_OFFSET(baremetal_image),
.size = VM_IMAGE_SIZE(baremetal_image),
},

.entry = 0x90100000,
.platform = {
.cpu_num = 6,
.region_num = 1,
.regions = (struct vm_mem_region[]){
{
.base = 0x90100000,
.size = 0x100000
},
},
.dev_num = 3,
.devs = (struct vm_dev_region[]){
{ //TIMER
.pa = 0xF8800000,
.va = 0xF8800000,
.size = 0x1000,
.interrupt_num = 1,
.interrupts = (irqid_t[]) {10},
},
{ //Ports 13 and 14 base is 13, 0x400 for each port
.pa = 0xF003D400,
.va = 0xF003D400,
.size = 0x800,
},
{ //UART
.pa = 0xF46C0000,
.va = 0xF46C0000,
.size = 0x200,
.interrupt_num = 1,
.interrupts = (irqid_t[]) {173},
}
},
.arch = {
.gspr_num = 1,
.gspr_groups = (unsigned long int[]){1},
}
}
},
},
};
13 changes: 8 additions & 5 deletions demos/baremetal/src/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,24 @@

irq_set_handler(UART_IRQ_ID, uart_rx_handler);
irq_set_handler(TIMER_IRQ_ID, timer_handler);
irq_set_handler(IPI_IRQ_ID, ipi_handler);


uart_enable_rxirq();

timer_set(TIMER_INTERVAL);
irq_enable(TIMER_IRQ_ID);
irq_set_prio(TIMER_IRQ_ID, IRQ_MAX_PRIO);
irq_set_prio(TIMER_IRQ_ID, TIMER_IRQ_PRIO);

master_done = true;
}

irq_enable(UART_IRQ_ID);
irq_set_prio(UART_IRQ_ID, IRQ_MAX_PRIO);
irq_set_prio(UART_IRQ_ID, UART_IRQ_PRIO);

irq_set_handler(IPI_IRQ_ID, ipi_handler);

irq_enable(IPI_IRQ_ID);
irq_set_prio(IPI_IRQ_ID, IRQ_MAX_PRIO);
irq_set_prio(IPI_IRQ_ID, IPI_IRQ_PRIO);

while(!master_done);
spin_lock(&print_lock);
Expand All @@ -69,4 +72,4 @@

while(1) wfi();
}


2 changes: 1 addition & 1 deletion guests/baremetal/make.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
baremetal_src:=$(wrkdir_src)/baremetal
baremetal_repo:=https://github.com/bao-project/bao-baremetal-guest.git
baremetal_branch:=demo-next
baremetal_branch:=feat/tricore

$(baremetal_src):
git clone $(baremetal_repo) $@ --branch $(baremetal_branch)
Expand Down
3 changes: 3 additions & 0 deletions platforms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ well as RISC-V using RV64:

#### RISC-V platforms:
* [QEMU virt](qemu-riscv64-virt/README.md)

#### Tricore platforms:
* [TC4Dx COM](platforms/tc4dx/README.md)
44 changes: 44 additions & 0 deletions platforms/tc4dx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Infineon Tricore TC4DX COM

---

**NOTE**

We use TRACE32 platform to program the board. A generated .cmm script
will be available after the build to flash and run the demo.

---

<!--- instruction#1 -->
## 1) Setup board

Make sure you have the debug probe to connected to the board.
The all pins in the HW Boot Configuration Dipswitch should be off.

<!--- instruction#2 -->
## 2) Flash the demo

Run the following command:

` t32mtc -s ./platforms/tc4dx/startup.cmm `

<!--- instruction#end -->

The startup.cmm opens several windows inside TRACE32, including the main script
window. If you want to do it manually, open TRACE32 and select edit
the template.cmm or the tc4_demo.cmm file

<!--- instruction#3 -->
## 3) Run the script

Click GO on the central window.

<!--- instruction#end -->

Alternatively, if you want to re-flash and run the demo, select the option DO
on the window with the main script. And then, click GO on the main window to
run the demo.

<!-- Links -->

[AURIX-GCC]: https://softwaretools.infineon.com/assets/com.ifx.tb.tool.aurixgcc
57 changes: 57 additions & 0 deletions platforms/tc4dx/config.t32
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
;
;please refer the installation guide for more information
;about your configuration
;
;
;uncomment the following 3 lines if you don't use already environment variables
;changes to the actual directory names are necessary
;OS=
;SYS=/opt/t32
;TMP=/usr/tmp

;uncomment the following 4 lines if you use PowerTrace, PowerNexus or PowerDebugEthernet
;with onhost driver executable (t32m*) via ethernet interface
;the nodename t32 is only an example, please replace it with the actual node name
;PBI=
;NET
;NODE=t32
;PACKLEN=1024

;uncomment the following 2 lines if you use PowerTrace, PowerNexus, PowerDebugEthernet or
;PowerDebugInterface USB with onhost driver executable (t32m*) via USB interface
;please refer the installation manual (file icd_quick_installation.pdf) about more details
;concerning USB driver installation
;PBI=
;USB

;uncomment the following 3 lines if you use an ICE or PodbusEthernetController
;with standard hostdriver executable (t32cde) via ethernet interface
;the nodename t32 is only an example, please replace it with the actual node name
;LINK=NET
;NODE=t32
;PACKLEN=1024

;uncomment the following 1 lines if you use SCSI interface (ICE)
;LINK=SCSI

;uncomment the following line and add more options if required (see installation guide)
;SCREEN=

;uncomment the following 3 lines if you want to use TRACE32 fonts
;SCREEN=
;FONT=DEC
;FONT=SMALL

;uncomment the following 2 lines if you want to use TRACE32 bitmap fonts
;SCREEN=
;FONTMODE=3

;uncomment the following 2 lines if you use OPENWINDOWS
;SCREEN=
;WMGR=OW16

;uncomment the following 2 lines if you use MOTIF
;SCREEN=
;WMGR=MOTIF16


25 changes: 25 additions & 0 deletions platforms/tc4dx/make.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ARCH:=tricore

instructions:=$(bao_demos)/platforms/$(PLATFORM)/README.md
template:=$(bao_demos)/platforms/$(PLATFORM)/template.cmm
script:=$(bao_demos)/platforms/$(PLATFORM)/tc4_demo.cmm

baremetal_elf:=$(wrkdir_src)/baremetal/build/tc4dx/baremetal.elf
bao_elf:=$(bao_src)/bin/tc4dx/$(DEMO)/bao.elf

#the script can run without the guest elf. That might make this script
#cleaner. It is worth consdering, and adding that to the readme.

# add a way to auto run the script after a command.

script_generation:
@sed \
-e 's|@BAO_ELF@|$(bao_elf)|g' \
-e 's|@BAREMETAL_ELF@|$(baremetal_elf)|g' \
$(template) > $(script)

platform: $(bao_image) $(flash_image) script_generation
$(call print-instructions, $(instructions), 1, false)
$(call print-instructions, $(instructions), 2, false)
$(call print-instructions, $(instructions), 3, true)

40 changes: 40 additions & 0 deletions platforms/tc4dx/startup.cmm
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
B::

TOOLBAR ON
STATUSBAR ON
FramePOS 274.29,1.8,,,Maximized
WinPAGE.RESet

WinPAGE.Create P000
WinCLEAR

WinPOS 0.0 0.0 78. 32. 14. 0. W008
PEDIT "/home/mafs/bao-demos/platforms/tc4dx/tc4_demo.cmm"
DO "/home/mafs/bao-demos/platforms/tc4dx/tc4_demo.cmm"


WinPOS 2.4286 37.8 75. 16. 0. 0. W002
Register

WinPOS 195.57 43.067 75. 10. 0. 1. W003
WinTABS 20. 250.
CORE.List

WinPOS 81.571 43.133 110. 8. 0. 0. W005
Var.Watch


WinPOS 198.57 0.0 72. 27. 5. 0. W006
Frame /Locals /Caller

WinPOS 198.14 31.8 73. 5. 23. 1. W000
WinTABS 13. 0. 0. 0. 0. 0. 0. 0. 0. 22.
Break.List

WinPOS 81.286 0.0 114. 37. 13. 1. W001
WinTABS 10. 10. 25.
List

WinPAGE.select P000

ENDDO
Loading