summaryrefslogtreecommitdiff
path: root/src/arch/infineon-tc1796-mock
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/infineon-tc1796-mock')
-rw-r--r--src/arch/infineon-tc1796-mock/Kconfig7
-rw-r--r--src/arch/infineon-tc1796-mock/Makefile.inc94
-rw-r--r--src/arch/infineon-tc1796-mock/arch.cc86
-rw-r--r--src/arch/infineon-tc1796-mock/driver/counter.cc9
-rw-r--r--src/arch/infineon-tc1796-mock/driver/gpio.cc8
-rw-r--r--src/arch/infineon-tc1796-mock/driver/stdout.cc74
-rw-r--r--src/arch/infineon-tc1796-mock/prompt1
7 files changed, 0 insertions, 279 deletions
diff --git a/src/arch/infineon-tc1796-mock/Kconfig b/src/arch/infineon-tc1796-mock/Kconfig
deleted file mode 100644
index 5efcbdc..0000000
--- a/src/arch/infineon-tc1796-mock/Kconfig
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright 2022 Daniel Friesel
-#
-# SPDX-License-Identifier: CC0-1.0
-
-config arch_infineon_tc1796_mock_driver_counter
-bool "Cycle Counter"
-select meta_driver_counter
diff --git a/src/arch/infineon-tc1796-mock/Makefile.inc b/src/arch/infineon-tc1796-mock/Makefile.inc
deleted file mode 100644
index 7fcdd69..0000000
--- a/src/arch/infineon-tc1796-mock/Makefile.inc
+++ /dev/null
@@ -1,94 +0,0 @@
-# vim:ft=make
-#
-# Copyright 2022 Daniel Friesel
-#
-# SPDX-License-Identifier: BSD-2-Clause
-
-CPU = tc1796
-
-cpu_freq ?= 150000000
-counter_freq ?= 75000000
-uart_freq ?= 115200
-SERIAL_PORT ?= ttyUSB0
-QEMU_PORT ?= 12345
-
-COMMON_FLAGS += -mcpu=${CPU} -DMULTIPASS_ARCH_tc1796
-
-ARCH_SHORTNAME = tc1796
-
-LICENSE = -mlicense-dir=${HOME}/var/source/aurix-infineon-hightec-tricore
-CC = wine ${HOME}/.wine/drive_c/HighTec/toolchains/tricore/v4.9.3.0-infineon-1.0/bin/tricore-gcc.exe ${LICENSE}
-CXX = wine ${HOME}/.wine/drive_c/HighTec/toolchains/tricore/v4.9.3.0-infineon-1.0/bin/tricore-g++.exe ${LICENSE}
-OBJCOPY = wine ${HOME}/.wine/drive_c/HighTec/toolchains/tricore/v4.9.3.0-infineon-1.0/bin/tricore-objcopy.exe
-OBJDUMP = wine ${HOME}/.wine/drive_c/HighTec/toolchains/tricore/v4.9.3.0-infineon-1.0/bin/tricore-objdump.exe ${LICENSE}
-SIZE = wine ${HOME}/.wine/drive_c/HighTec/toolchains/tricore/v4.9.3.0-infineon-1.0/bin/tricore-size.exe
-
-CXX_TARGETS += src/arch/infineon-tc1796-mock/arch.cc
-CXX_TARGETS += src/arch/infineon-tc1796-mock/driver/gpio.cc
-CXX_TARGETS += src/arch/infineon-tc1796-mock/driver/stdout.cc
-
-ifneq (${cpu_freq}, )
- COMMON_FLAGS += -DF_CPU=${cpu_freq}U
-else
- COMMON_FLAGS += -DF_CPU=150000000U
-endif
-
-ifneq ($(findstring counter,${arch_drivers}), )
- CONFIG_arch_infineon_tc1796_mock_driver_counter = y
-endif
-
-ifdef CONFIG_arch_infineon_tc1796_mock_driver_counter
- CXX_TARGETS += src/arch/infineon-tc1796-mock/driver/counter.cc
-endif
-
-OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o} ${ASM_TARGETS:.S=.o}
-
-%.o : %.cc | include/config.h
- ${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} -c -o $@ ${@:.o=.cc}
-
-%.o : %.c | include/config.h
- ${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}
-
-%.o : %.S | include/config.h
- ${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} -Wa,-gstabs,-ggdb -x assembler-with-cpp -c -o $@ ${@:.o=.S}
-
-build/system.elf: ${OBJECTS}
- ${QUIET}mkdir -p build
- ${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} \
- -Wl,--gc-sections \
- -o $@ ${OBJECTS}
-
-build/system.bin: build/system.elf
- ${QUIET}${OBJCOPY} -O binary $< $@
-
-# Needs a Debian3.1 VM with ios:/ess/dortmund/proj/compiler/tricore-gcc-3.4.5 installed to /opt/trigcc345,
-# http://archive.debian.org/debian-security/pool/updates/main/r/resmgr/libresmgr1_1.0-2sarge2_i386.deb http://archive.debian.org/debian-security/pool/updates/main/r/resmgr/resmgr_1.0-2sarge2_i386.deb installed,
-# and SSH via localhost:2222. E.g.:
-# > qemu-system-i386 -boot c -m 2048 -hda debian3-1.qcow2 -machine type=pc,accel=kvm:tcg --enable-kvm -net nic,model=ne2k_pci -net user,hostfwd=tcp::2022-:22 -smp cores=1,threads=2 -usb -monitor telnet::${QEMU_PORT},server,nowait
-# Must already be running in the background before 'make program' can be used.
-program: build/system.bin
- ${QUIET}echo 'device_add usb-host,vendorid=0x058b,productid=0x0028,id=tricore' | nc -q 1 localhost ${QEMU_PORT}
- ${QUIET}scp -oKexAlgorithms=+diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-rsa -P 2022 build/system.bin root@localhost:/tmp/system.bin
- ${QUIET}ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-rsa -p 2022 root@localhost "/opt/trigcc345/bin/tricore-jtag-usb-flash /opt/trigcc345/tricore/flash_driver/intern/tc1796/flashprg.elf /tmp/system.bin"
- ${QUIET}echo 'device_del tricore' | nc -q 1 localhost ${QEMU_PORT}
-
-monitor:
- ${QUIET}screen /dev/${SERIAL_PORT} ${uart_freq}
-
-arch_clean:
- ${QUIET}rm -f ${OBJECTS} build/system.elf
-
-arch_help:
- @true
-
-arch_info:
- @echo "CPU Freq: ${cpu_freq} Hz"
- @echo "Count Freq: ${counter_freq} Hz"
-
-attributes: build/system.elf
- ${QUIET}script/size.py "${SIZE}" text,rodata bss
-
-nfpvalues: build/system.elf
- ${QUIET}script/nfpvalues.py "${SIZE}" text,rodata bss
-
-.PHONY: arch_clean arch_help arch_info attributes monitor program
diff --git a/src/arch/infineon-tc1796-mock/arch.cc b/src/arch/infineon-tc1796-mock/arch.cc
deleted file mode 100644
index 73ebd2d..0000000
--- a/src/arch/infineon-tc1796-mock/arch.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2022 Daniel Friesel
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-#include "arch.h"
-
-extern "C" {
-#include <machine/wdtcon.h>
-#include <tc1796b/scu.h>
-#include <tc1796b/pmi.h>
-}
-
-#ifdef __acweaving
-#define __delay_cycles(x)
-#endif
-
-#define OF_BYP 29
-#define OF_NDIV 16
-#define OF_PDIV 13
-#define OF_KDIV 8
-#define OF_VCOSEL 6
-#define OF_SYSFS 2
-
-#define STM_CLC (*(volatile unsigned int*)0xf0000200)
-#define STM_TIM5 (*(volatile unsigned int*)0xf0000224)
-
-void Arch::setup(void)
-{
- /*
- * 20 MHz Crystal -> 150 MHz clock
- * PLL_CLC := (NDIV = 29; PDIV = 0; KDIV = 3; VCOSEL = 2)
- */
- unlock_wdtcon();
- (*(unsigned int*)0xf0000040) = (29 << OF_NDIV) | (0 << OF_PDIV) | (3 << OF_KDIV) | (2 << OF_VCOSEL);
- STM_CLC = 0x00000100;
- lock_wdtcon();
-}
-
-#if defined(CONFIG_loop)
-extern void loop();
-unsigned int old_tim5 = 0;
-#endif
-
-volatile bool sleep_done = false;
-
-void Arch::sleep_ms(unsigned int const ms)
-{
- delay_ms(ms);
-}
-
-void Arch::delay_us(unsigned int const us)
-{
- for (unsigned int i = 0; i < us; i++) {
- for (unsigned int c = 0; c < F_CPU/1000000; c++) {
- asm volatile("nop");
- }
- }
-}
-void Arch::delay_ms(unsigned int const ms)
-{
- for (unsigned int i = 0; i < ms; i++) {
- for (unsigned int c = 0; c < F_CPU/1000; c++) {
- asm volatile("nop");
- }
- }
-}
-
-void Arch::idle_loop(void)
-{
- while (1) {
-#if defined(CONFIG_loop)
- // STM_TIM5 will overflow once every 1.9 years.
- if ((STM_TIM5 - old_tim5 > 70) || (old_tim5 > STM_TIM5)) {
- old_tim5 = STM_TIM5;
- loop();
- }
-#endif
- }
-}
-
-void Arch::idle(void)
-{
-}
-
-Arch arch;
diff --git a/src/arch/infineon-tc1796-mock/driver/counter.cc b/src/arch/infineon-tc1796-mock/driver/counter.cc
deleted file mode 100644
index 0277d07..0000000
--- a/src/arch/infineon-tc1796-mock/driver/counter.cc
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright 2022 Daniel Friesel
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-#include "arch.h"
-#include "driver/counter.h"
-
-Counter counter;
diff --git a/src/arch/infineon-tc1796-mock/driver/gpio.cc b/src/arch/infineon-tc1796-mock/driver/gpio.cc
deleted file mode 100644
index b66add2..0000000
--- a/src/arch/infineon-tc1796-mock/driver/gpio.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright 2022 Daniel Friesel
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-#include "driver/gpio.h"
-
-GPIO gpio;
diff --git a/src/arch/infineon-tc1796-mock/driver/stdout.cc b/src/arch/infineon-tc1796-mock/driver/stdout.cc
deleted file mode 100644
index 499b2ab..0000000
--- a/src/arch/infineon-tc1796-mock/driver/stdout.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2022 Daniel Friesel
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-#include "driver/stdout.h"
-#include <machine/wdtcon.h>
-#include <tc1796b/port5-struct.h>
-#include <tc1796b/asc0-struct.h>
-
-#define OF_BYP 29
-#define OF_NDIV 16
-#define OF_PDIV 13
-#define OF_KDIV 8
-#define OF_VCOSEL 6
-#define OF_SYSFS 2
-
-#define OF_RMC 8
-#define ASC0_CLC (*(volatile unsigned int*)0xf0000a00)
-#define ASC0_PISEL (*(volatile unsigned int*)0xf0000a04)
-#define ASC0_CON (*(volatile unsigned int*)0xf0000a10)
-#define ASC0_BG (*(volatile unsigned int*)0xf0000a14)
-#define ASC0_FDV (*(volatile unsigned int*)0xf0000a18)
-#define ASC0_TBUF (*(volatile unsigned int*)0xf0000a20)
-#define ASC0_TBSRC (*(volatile unsigned int*)0xf0000afc)
-
-#define SRC_SRE (1 << 12)
-#define SRC_SRR (1 << 13)
-#define SRC_CLRR (1 << 14)
-#define SRC_SETR (1 << 15)
-
-void StandardOutput::setup()
-{
- // P5_IOCR0.PC1 = OUT_PPALT1
- (*(volatile unsigned int*)0xf0001110) = 0x9 << 12;
- // P5_IOMR.PS1 = 1
- (*(volatile unsigned int*)0xf0001104) = 0x00000001;
-
- /* Configure for 115200 Baud @ 75 MHz fSYS, see table 19-4 */
- unsigned int const reload_value = 0x17;
- unsigned int const fdv = 0x12e;
-
- unlock_wdtcon();
- // ASC0_CLC: enable (DISR := 0), RMC := 1 (clock divider == 1 -> clock == system clock "fsys"?)
- ASC0_CLC = 1 << OF_RMC;
- lock_wdtcon();
- // ASC0_CON = 0
- ASC0_CON = 0;
- // ASC0_BG = reload_value
- ASC0_BG = reload_value;
- // ASC0_FDV = fdv
- ASC0_FDV = fdv;
- // ASC0_CON := (M := ASCM_8ASYNC == 1; FDE := 1; R := 1
- ASC0_CON = (1 << 0) | (1 << 11) | (1 << 15);
-
- /* After initialization, the transmit buffer is ready to accept writes. */
- ASC0_TBSRC = SRC_SETR;
-}
-
-void StandardOutput::put(char c)
-{
- while (!(ASC0_TBSRC & SRC_SRR)) ;
-
- /* Clear service request flag -- we're filling up TBUF */
- ASC0_TBSRC = SRC_CLRR;
-
- ASC0_TBUF = c;
-
- if (c == '\n') {
- put('\r');
- }
-}
-
-StandardOutput kout;
diff --git a/src/arch/infineon-tc1796-mock/prompt b/src/arch/infineon-tc1796-mock/prompt
deleted file mode 100644
index 19d4ab6..0000000
--- a/src/arch/infineon-tc1796-mock/prompt
+++ /dev/null
@@ -1 +0,0 @@
-Infineon TC1796 Mock (for Starter Kit)