dts: posix: Add DTS support for POSIX architecture
Added device tree support for POSIX architecture based boards. Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
This commit is contained in:
parent
951a82d029
commit
7a246c30bd
|
@ -179,6 +179,7 @@
|
|||
/dts/bindings/*/sifive* @mateusz-holenko @kgugala @pgielda @nategraff-sifive
|
||||
/dts/bindings/*/litex* @mateusz-holenko @kgugala @pgielda
|
||||
/dts/bindings/*/vexriscv* @mateusz-holenko @kgugala @pgielda
|
||||
/dts/posix/ @aescolar @vanwinkeljan
|
||||
/ext/hal/atmel/asf/sam/include/same70*/ @aurel32
|
||||
/ext/hal/atmel/asf/sam0/include/samr21/ @benpicco
|
||||
/ext/hal/cmsis/ @MaureenHelm @galak
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
config BOARD_NATIVE_POSIX
|
||||
bool "Native POSIX"
|
||||
depends on SOC_POSIX
|
||||
select HAS_DTS
|
||||
select NATIVE_POSIX_TIMER
|
||||
select NATIVE_POSIX_CONSOLE
|
||||
help
|
||||
|
|
9
boards/posix/native_posix/dts_fixup.h
Normal file
9
boards/posix/native_posix/dts_fixup.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Jan Van Winkel (jan.van_winkel@dxplore.eu)
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_FLASH_DEV_NAME DT_ZEPHYR_NATIVE_POSIX_FLASH_CONTROLLER_0_LABEL
|
||||
#define DT_UART_0_DEV_NAME DT_ZEPHYR_NATIVE_POSIX_UART_1_LABEL
|
||||
|
74
boards/posix/native_posix/native_posix.dts
Normal file
74
boards/posix/native_posix/native_posix.dts
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Jan Van Winkel (jan.van_winkel@dxplore.eu)
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include <posix/posix.dtsi>
|
||||
|
||||
/ {
|
||||
model = "Native POSIX Board";
|
||||
compatible = "zephyr,posix";
|
||||
|
||||
chosen {
|
||||
zephyr,console = &uart0;
|
||||
zephyr,shell-uart = &uart0;
|
||||
zephyr,uart-mcumgr = &uart0;
|
||||
zephyr,flash = &flash0;
|
||||
};
|
||||
|
||||
|
||||
flash-controller@0 {
|
||||
compatible = "zephyr,native-posix-flash-controller";
|
||||
reg = <0x00000000 DT_SIZE_K(2048)>;
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
label = "flash_ctrl";
|
||||
|
||||
flash0: flash@0 {
|
||||
status = "ok";
|
||||
compatible = "soc-nv-flash";
|
||||
label = "flash";
|
||||
erase-block-size = <1>;
|
||||
write-block-size = <1>;
|
||||
reg = <0x00000000 DT_SIZE_K(2048)>;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
boot_partition: partition@0 {
|
||||
label = "mcuboot";
|
||||
reg = <0x000000000 0x0000C000>;
|
||||
};
|
||||
slot0_partition: partition@c000 {
|
||||
label = "image-0";
|
||||
reg = <0x0000C000 0x000069000>;
|
||||
};
|
||||
slot1_partition: partition@75000 {
|
||||
label = "image-1";
|
||||
reg = <0x00075000 0x000069000>;
|
||||
};
|
||||
scratch_partition: partition@de000 {
|
||||
label = "image-scratch";
|
||||
reg = <0x000de000 0x0001e000>;
|
||||
};
|
||||
storage_partition: partition@fc000 {
|
||||
label = "storage";
|
||||
reg = <0x000fc000 0x00004000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
uart0: uart@1 {
|
||||
status = "ok";
|
||||
compatible = "zephyr,native-posix-uart";
|
||||
reg = <1 0>;
|
||||
label = "UART_0";
|
||||
};
|
||||
};
|
|
@ -12,13 +12,6 @@ config UART_NATIVE_POSIX
|
|||
|
||||
if UART_NATIVE_POSIX
|
||||
|
||||
config UART_NATIVE_POSIX_PORT_0_NAME
|
||||
string "Port 0 Device Name"
|
||||
default "UART_0"
|
||||
help
|
||||
This is the device name for the first UART, and is included in the
|
||||
device struct.
|
||||
|
||||
choice
|
||||
prompt "Native UART Port 0 connection"
|
||||
default NATIVE_UART_0_ON_OWN_PTY
|
||||
|
|
|
@ -201,8 +201,7 @@ static int np_uart_0_init(struct device *dev)
|
|||
d = (struct native_uart_status *)dev->driver_data;
|
||||
|
||||
if (IS_ENABLED(CONFIG_NATIVE_UART_0_ON_OWN_PTY)) {
|
||||
int tty_fn = open_tty(d, CONFIG_UART_NATIVE_POSIX_PORT_0_NAME,
|
||||
auto_attach);
|
||||
int tty_fn = open_tty(d, DT_UART_0_DEV_NAME, auto_attach);
|
||||
|
||||
d->in_fd = tty_fn;
|
||||
d->out_fd = tty_fn;
|
||||
|
@ -337,7 +336,7 @@ static int np_uart_tty_poll_in(struct device *dev, unsigned char *p_char)
|
|||
}
|
||||
|
||||
DEVICE_AND_API_INIT(uart_native_posix0,
|
||||
CONFIG_UART_NATIVE_POSIX_PORT_0_NAME, &np_uart_0_init,
|
||||
DT_UART_0_DEV_NAME, &np_uart_0_init,
|
||||
(void *)&native_uart_status_0, NULL,
|
||||
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&np_uart_driver_api_0);
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: Native POSIX Flash Controller
|
||||
version: 0.1
|
||||
|
||||
description: >
|
||||
This binding gives a base representation of the Native POSIX flash
|
||||
controller
|
||||
|
||||
inherits:
|
||||
!include flash-controller.yaml
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
constraint: "zephyr,native-posix-flash-controller"
|
||||
|
||||
...
|
19
dts/bindings/serial/zephyr,native-posix-uart.yaml
Normal file
19
dts/bindings/serial/zephyr,native-posix-uart.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# Copyright (c) 2019, Jan Van Winkel (jan.van_winkel@dxplore.eu)
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
---
|
||||
title: Native POSIX UART
|
||||
version: 0.1
|
||||
|
||||
description: >
|
||||
This binding gives a base representation of the Native POSIX UART
|
||||
|
||||
inherits:
|
||||
!include uart.yaml
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
constraint: "zephyr,native-posix-uart"
|
||||
...
|
9
dts/posix/posix.dtsi
Normal file
9
dts/posix/posix.dtsi
Normal file
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Jan Van Winkel (jan.van_winkel@dxplore.eu)
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "skeleton.dtsi"
|
||||
#include <mem.h>
|
||||
|
|
@ -17,6 +17,9 @@
|
|||
#ifndef ZEPHYR_INCLUDE_ARCH_POSIX_ARCH_H_
|
||||
#define ZEPHYR_INCLUDE_ARCH_POSIX_ARCH_H_
|
||||
|
||||
/* Add include for DTS generated information */
|
||||
#include <generated_dts_board.h>
|
||||
|
||||
#include <toolchain.h>
|
||||
#include <irq.h>
|
||||
#include <arch/posix/asm_inline.h>
|
||||
|
|
Loading…
Reference in a new issue