Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/add hpmicro device support #46329

Closed
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
6 changes: 6 additions & 0 deletions boards/riscv/hpm6750evkmini/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2022 HPMicro
# SPDX-License-Identifier: Apache-2.0

config BOARD_HPM6750EVKMINI
bool "HPMicro HPM6750EVKMINI"
depends on SOC_HPM6750
17 changes: 17 additions & 0 deletions boards/riscv/hpm6750evkmini/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2022 HPMicro
# SPDX-License-Identifier: Apache-2.0

if BOARD_HPM6750EVKMINI

DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition

config BOARD
default "hpm6750evkmini"

config FLASH_LOAD_OFFSET
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))

config FLASH_LOAD_SIZE
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))

endif # BOARD_HPM6750EVKMINI
11 changes: 11 additions & 0 deletions boards/riscv/hpm6750evkmini/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0

if(NOT CONFIG_XIP)
board_runner_args(openocd "--use-elf")
endif()
board_runner_args(openocd "--config=${BOARD_DIR}/support/probes/ft2232.cfg"
"--config=${BOARD_DIR}/support/soc/hpm6750-single-core.cfg"
"--config=${BOARD_DIR}/support/boards/hpm6750evkmini.cfg")
board_runner_args(openocd --target-handle=_CHIPNAME.cpu0)

include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions boards/riscv/hpm6750evkmini/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
.. _hpm6750evkmini:

HPMicro HPM6750EVKMINI
######################

Overview
********

The HPM6750 is a dual-core flashless MCU running 816Mhz.
It has a 2MB continuous on-chip ram.
Also, it provides various memory interfaces, including SDRAM, Quad SPI NOR Flash, SD/eMMC.

The figure shows the HPM6750EVKMINI board.

.. image:: img/hpm6750evkmini.png
:align: center
:alt: HPM6750EVKMINI

Hardware
********

The HPM6750EVKMINI platform integrates 2 cores 32-bit 816MHz RISC-V CPUs, DSP,
willChuai marked this conversation as resolved.
Show resolved Hide resolved
willChuai marked this conversation as resolved.
Show resolved Hide resolved
2MB RAM, Cache, SPI flash memory, ethernet controller and other peripherals.

- HPM6750IVM MCU (816Mhz, 2MB OCRAM)
- Onboard Memory
- 128Mb SDRAM
willChuai marked this conversation as resolved.
Show resolved Hide resolved
- 64Mb Quad SPI NOR Flash
- Display & Camera
- LCD connector
- Camera (DVP)
- WiFi
- RW007 over SPI
- USB
- USB type C (USB 2.0 OTG) connector x2
- Audio
- Mic
- DAO
- Others
- TF Slot
- FT2232
- Beeper
- RGB LED
- Expansion port
- ART-PI extension port

For more information about the HPMICRO SoC and HPM6750EVKMINI board:

- `HPMICRO Design Resources`_

Serial Port
===========

The HPM6750EVKMINI platform has 2 UARTs.
The Zephyr console output is by default assigned to UART0 and the default
settings are 115200 8N1.

Programming and debugging
*************************

Building
========

You can build applications in the usual way. Here is an example for
the :ref:`hello_world` application.

.. zephyr-app-commands::
:board: hpm6750evkmini
willChuai marked this conversation as resolved.
Show resolved Hide resolved
:zephyr-app: samples/hello_world
:goals: build

Flashing
========

If you want to use XIP mode (``CONFIG_XIP=y``).
If ``CONFIG_XIP=n``, you can load the program into RAM directly
and execute it.

.. zephyr-app-commands::
:board: hpm6750evkmini
:zephyr-app: samples/hello_world
:goals: flash

Open a serial terminal with the following settings:

- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1

you should see the following message in the terminal:

.. code-block:: console

Hello World! hpm6750evkmini

Debugging
=========

.. zephyr-app-commands::
:board: hpm6750evkmini
:zephyr-app: samples/hello_world
:goals: debug

References
==========

.. _HPMICRO Design Resources:
http://www.hpmicro.com/resources/resources.html
29 changes: 29 additions & 0 deletions boards/riscv/hpm6750evkmini/hpm6750evkmini-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2022 HPMicro
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/pinctrl/hpmicro-pinctrl-common.h>
&pinctrl {
pinmux_uart0: pinmux_uart0 {
group0 {
pinmux =
<HPMICRO_PINMUX(HPMICRO_PORTY, 7, IOC_TYPE_IOC, 0, 2)>,
<HPMICRO_PINMUX(HPMICRO_PORTY, 6, IOC_TYPE_IOC, 0, 2)>,
<HPMICRO_PINMUX(HPMICRO_PORTY, 7, IOC_TYPE_PIOC, 0, 3)>,
<HPMICRO_PINMUX(HPMICRO_PORTY, 6, IOC_TYPE_PIOC, 0, 3)>;
drive-strength = "r000";
power-source = "3v3";
};
};
pinmux_gpiob: pinmux_gpiob {
group0 {
pinmux =
<HPMICRO_PINMUX(HPMICRO_PORTB, 18, IOC_TYPE_IOC, 0, 0)>,
<HPMICRO_PINMUX(HPMICRO_PORTB, 19, IOC_TYPE_IOC, 0, 0)>,
<HPMICRO_PINMUX(HPMICRO_PORTB, 20, IOC_TYPE_IOC, 0, 0)>;
bias-pull-down;
drive-strength = "r000";
power-source = "3v3";
};
};
};
95 changes: 95 additions & 0 deletions boards/riscv/hpm6750evkmini/hpm6750evkmini.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright (c) 2022 HPMicro
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <hpmicro/hpm6750.dtsi>
#include "hpm6750evkmini-pinctrl.dtsi"

/ {
model = "HPMicro HPM6750EVKMINI";
compatible = "HPMicro,hpm6750evkmini";

chosen {
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,sram = &sram;
zephyr,itcm = &ilm;
zephyr,dtcm = &dlm;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
};

dram: memory@40000000 {
device_type = "memory";
reg = <0x40000000 DT_SIZE_M(16)>;
};

aliases {
led0 = &led_r;
led1 = &led_g;
led2 = &led_b;
};

leds {
compatible = "gpio-leds";
led_r: led_r {
gpios = <&gpiob 19 GPIO_ACTIVE_LOW>;
label = "LEDR";
};
led_g: led_g {
gpios = <&gpiob 18 GPIO_ACTIVE_LOW>;
label = "LEDG";
};
led_b: led_b {
gpios = <&gpiob 20 GPIO_ACTIVE_LOW>;
label = "LEDB";
};
};
};

&gpio0 {

gpiob: gpio@1 {
compatible = "hpmicro,hpm-gpio";
reg = <0x0 0x4000>;
gpio-controller;
#gpio-cells = <2>;
hpmicro-gpio-port = <1>;
interrupts = <2 1>;
interrupt-parent = <&plic0>;
};

};

&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&pinmux_uart0>;
pinctrl-names = "default";
};
&gpiob {
pinctrl-0 = <&pinmux_gpiob>;
pinctrl-names = "default";
status = "okay";
};
&flash0 {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "mcuboot";
reg = <0x0 0x3000>;
};

slot0_partition: partition@3000 {
label = "image-0";
reg = <0x3000 DT_SIZE_M(4)>;
};
};
};
17 changes: 17 additions & 0 deletions boards/riscv/hpm6750evkmini/hpm6750evkmini.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2022 HPMicro
# SPDX-License-Identifier: Apache-2.0

identifier: hpm6750evkmini
name: HPMicro HPM6750EVKMINI
type: mcu
arch: riscv32
toolchain:
- zephyr
- cross-compile
ram: 2048
supported:
- gpio
- uart
testing:
ignore_tags:
- bluetooth
21 changes: 21 additions & 0 deletions boards/riscv/hpm6750evkmini/hpm6750evkmini_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CONFIG_SOC_SERIES_HPMICRO=y
CONFIG_SOC_HPM6750=y
CONFIG_BOARD_HPM6750EVKMINI=y
CONFIG_XIP=n
CONFIG_PLIC=y
CONFIG_RISCV_MACHINE_TIMER=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_PINCTRL=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_CLOCK_CONTROL=y

# Serial driver options
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# GPIO driver options
CONFIG_GPIO=y

# HW DSP options
#CONFIG_SOC_ANDES_V5_HWDSP=y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out config option?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using dsp requires the user to provide a toolchain that supports the dsp command.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Why isn't CONFIG_SOC_ANDES_V5_HWDSP defined in any Kconfig file? Or am I missing something?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a problem with the first commit, and the second commit fixed the problem with the file soc\riscv\riscv-privilege\hpmicro\Kconfig.soc

5 changes: 5 additions & 0 deletions boards/riscv/hpm6750evkmini/pre_dt_board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2022, hpmicro
# SPDX-License-Identifier: Apache-2.0

# Suppress "simple_bus_reg" on HPMicro boards as all GPIO ports use the same register.
list(APPEND EXTRA_DTC_FLAGS "-Wno-simple_bus_reg")
Loading
Loading