#@TYPE: Machine
#@NAME: microblaze-generic
#@DESCRIPTION: Generic microblaze defaults to little-endian v11.0 barrel-shift pattern-compare reorder divide-hard multiple-high support

# Deprecated board config
USE_BOARD = "${@"conf/machine/include/xilinx-board-pre.inc" if d.getVar("BOARD") or d.getVar("BOARD_VARIANT") else ""}"
require ${USE_BOARD}
unset USE_BOARD

#### Preamble
MACHINEOVERRIDES =. "${@['', 'microblaze-generic:']['microblaze-generic' != '${MACHINE}']}"
#### Regular settings follow

# Set the default for a modern full feature microblaze...
TUNE_FEATURES:tune-microblaze ?= "microblaze v11.0 barrel-shift pattern-compare reorder divide-hard multiply-high"
DEFAULTTUNE ?= "microblaze"

require conf/machine/include/soc-tune-include.inc
require conf/machine/include/machine-xilinx-default.inc
require conf/machine/include/machine-xilinx-qemu.inc

# The default MACHINE_ARCH is dynmic for microblaze, since the architecture is not fixed
# Based on core bitbake.conf
DEF_MACHINE_ARCH = "${@[d.getVar('TUNE_PKGARCH'), d.getVar('MACHINE')][bool(d.getVar('MACHINE'))].replace('-', '_')}"
# Enable a dynamic machine_arch
MB_MACHINE_ARCH = "${@[d.getVar('TUNE_PKGARCH'), d.getVar('TUNE_PKGARCH') + '-generic'][bool(d.getVar('MACHINE'))].replace('-', '_')}"

MACHINE_ARCH = "${@['${MB_MACHINE_ARCH}', '${DEF_MACHINE_ARCH}']['microblaze-generic' != "${MACHINE}"]}"

MACHINE_FEATURES = ""

KERNEL_IMAGETYPE = "linux.bin.ub"
KERNEL_IMAGETYPES = ""

SERIAL_CONSOLES ?= "115200;ttyS0"

EXTRA_IMAGEDEPENDS += "libyaml-native python3-cython-native python3-pyyaml-native"

UBOOT_MACHINE ?= "microblaze-generic_defconfig"
UBOOT_INITIAL_ENV = ""

#### No additional settings should be after the Postamble
#### Postamble
PACKAGE_EXTRA_ARCHS:append = "${@['', ' ${MB_MACHINE_ARCH}']['microblaze-generic' != "${MACHINE}"]}"

# Deprecated board config
USE_BOARD = "${@"conf/machine/include/xilinx-board-post.inc" if d.getVar("BOARD") or d.getVar("BOARD_VARIANT") else ""}"
require ${USE_BOARD}
unset USE_BOARD
