Start adding custom board
This commit is contained in:
parent
a038b91e67
commit
c8df9b3f20
|
@ -1,5 +1,10 @@
|
|||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
list(APPEND DTS_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
list(APPEND BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(BOARD minico2)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
|
||||
project(blink)
|
||||
project(minico2)
|
||||
target_sources(app PRIVATE src/main.c)
|
||||
|
|
7
boards/xtensa/minico2/Kconfig.board
Normal file
7
boards/xtensa/minico2/Kconfig.board
Normal file
|
@ -0,0 +1,7 @@
|
|||
config BOARD_MINICO2
|
||||
bool "MiniCO2 Carbon Dioxide Monitor"
|
||||
depends on SOC_SERIES_ESP32
|
||||
|
||||
choice SOC_PART_NUMBER
|
||||
default SOC_ESP32_WROOM_32UE_N4
|
||||
endchoice
|
12
boards/xtensa/minico2/Kconfig.defconfig
Normal file
12
boards/xtensa/minico2/Kconfig.defconfig
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config BOARD
|
||||
default "minico2"
|
||||
depends on BOARD_MINICO2
|
||||
|
||||
config ENTROPY_GENERATOR
|
||||
default y
|
||||
|
||||
config HEAP_MEM_POOL_SIZE
|
||||
default 98304
|
10
boards/xtensa/minico2/Kconfig.sysbuild
Normal file
10
boards/xtensa/minico2/Kconfig.sysbuild
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
choice BOOTLOADER
|
||||
default BOOTLOADER_MCUBOOT
|
||||
endchoice
|
||||
|
||||
choice BOOT_SIGNATURE_TYPE
|
||||
default BOOT_SIGNATURE_TYPE_NONE
|
||||
endchoice
|
11
boards/xtensa/minico2/board.cmake
Normal file
11
boards/xtensa/minico2/board.cmake
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
|
||||
set(OPENOCD OPENOCD-NOTFOUND)
|
||||
endif()
|
||||
|
||||
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
|
||||
|
||||
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
|
16
boards/xtensa/minico2/minico2-pinctrl.dtsi
Normal file
16
boards/xtensa/minico2/minico2-pinctrl.dtsi
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
|
||||
#include <dt-bindings/pinctrl/esp32-pinctrl.h>
|
||||
#include <zephyr/dt-bindings/pinctrl/esp32-gpio-sigmap.h>
|
||||
|
||||
&pinctrl {
|
||||
uart0_default: uart0_default {
|
||||
group1 {
|
||||
pinmux = <UART0_TX_GPIO1>;
|
||||
output-high;
|
||||
};
|
||||
group2 {
|
||||
pinmux = <UART0_RX_GPIO3>;
|
||||
bias-pull-up;
|
||||
};
|
||||
};
|
||||
};
|
70
boards/xtensa/minico2/minico2.dts
Normal file
70
boards/xtensa/minico2/minico2.dts
Normal file
|
@ -0,0 +1,70 @@
|
|||
/dts-v1/;
|
||||
#include <espressif/esp32/esp32_wroom_32ue_n4.dtsi>
|
||||
#include "minico2-pinctrl.dtsi"
|
||||
|
||||
/ {
|
||||
model = "MiniCO2 Revision 0";
|
||||
compatible = "espressif,esp32";
|
||||
|
||||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,console = &uart0;
|
||||
zephyr,shell-uart = &uart0;
|
||||
zephyr,flash = &flash0;
|
||||
};
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
clock-frequency = <ESP32_CLK_CPU_240M>;
|
||||
};
|
||||
|
||||
&cpu1 {
|
||||
clock-frequency = <ESP32_CLK_CPU_240M>;
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
pinctrl-0 = <&uart0_default>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
/* Stolen from an Espressif devkit's dts, thanks Espressif */
|
||||
&flash0 {
|
||||
status = "okay";
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/* Reserve 60kB for the bootloader */
|
||||
boot_partition: partition@1000 {
|
||||
label = "mcuboot";
|
||||
reg = <0x00001000 0x0000F000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
/* Reserve 1024kB for the application in slot 0 */
|
||||
slot0_partition: partition@10000 {
|
||||
label = "image-0";
|
||||
reg = <0x00010000 0x00100000>;
|
||||
};
|
||||
|
||||
/* Reserve 1024kB for the application in slot 1 */
|
||||
slot1_partition: partition@110000 {
|
||||
label = "image-1";
|
||||
reg = <0x00110000 0x00100000>;
|
||||
};
|
||||
|
||||
/* Reserve 256kB for the scratch partition */
|
||||
scratch_partition: partition@210000 {
|
||||
label = "image-scratch";
|
||||
reg = <0x00210000 0x00040000>;
|
||||
};
|
||||
|
||||
storage_partition: partition@250000 {
|
||||
label = "storage";
|
||||
reg = <0x00250000 0x00006000>;
|
||||
};
|
||||
};
|
||||
};
|
13
boards/xtensa/minico2/minico2_defconfig
Normal file
13
boards/xtensa/minico2/minico2_defconfig
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
CONFIG_BOARD_MINICO2=y
|
||||
CONFIG_SOC_SERIES_ESP32=y
|
||||
|
||||
CONFIG_MAIN_STACK_SIZE=2048
|
||||
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_CONSOLE=y
|
||||
|
||||
CONFIG_GPIO=y
|
|
@ -10,11 +10,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1699858083,
|
||||
"narHash": "sha256-EXmVoYDYszdWlaxRzedQ3Q7ehbqIGfbe9EaHSBD4cgQ=",
|
||||
"lastModified": 1700363859,
|
||||
"narHash": "sha256-zT0vd5Vhd9dR3bTJpFCwtiBRkjY0+iYhvXVifIQ7vSo=",
|
||||
"ref": "refs/heads/canon",
|
||||
"rev": "453af715eebd7102131d2cc6846dd23d49f853ac",
|
||||
"revCount": 12,
|
||||
"rev": "6400d73e5f103f15550beb8bfb0315a98121dfef",
|
||||
"revCount": 13,
|
||||
"type": "git",
|
||||
"url": "https://git.mildlyfunctional.gay/artemist/packages.git"
|
||||
},
|
||||
|
|
40
src/main.c
40
src/main.c
|
@ -1,44 +1,4 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
|
||||
/* 1000 msec = 1 sec */
|
||||
#define SLEEP_TIME_MS 1000
|
||||
|
||||
/* The devicetree node identifier for the "led0" alias. */
|
||||
#define LED0_NODE DT_ALIAS(led0)
|
||||
|
||||
/*
|
||||
* A build error on this line means your board is unsupported.
|
||||
* See the sample documentation for information on how to fix this.
|
||||
*/
|
||||
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!gpio_is_ready_dt(&led)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
||||
if (ret < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
ret = gpio_pin_toggle_dt(&led);
|
||||
if (ret < 0) {
|
||||
return 0;
|
||||
}
|
||||
k_msleep(SLEEP_TIME_MS);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue