mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
boards/esp32: Add initial support to heltec_wifi_lora32
This commit adds basic/initial support to Heltec WiFi LoRa32 board. Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
committed by
Alan C. Assis
parent
3bf8b55d64
commit
30a7420349
@@ -218,7 +218,7 @@ config ESP32_IGNORE_CHIP_REVISION_CHECK
|
|||||||
old boards are still available in the market or in some users'
|
old boards are still available in the market or in some users'
|
||||||
hand and in this case it is necessary to enable this bypass to
|
hand and in this case it is necessary to enable this bypass to
|
||||||
use this boards.
|
use this boards.
|
||||||
WARNING: Use it only for your own board, not in a product.
|
WARNING: Use it only for your own board, not in a product.
|
||||||
|
|
||||||
menu "ESP32 Peripheral Selection"
|
menu "ESP32 Peripheral Selection"
|
||||||
|
|
||||||
|
|||||||
@@ -272,6 +272,15 @@ config ARCH_BOARD_ESP32_DEVKITC
|
|||||||
of two CPUs is symmetric, meaning they use the same addresses to
|
of two CPUs is symmetric, meaning they use the same addresses to
|
||||||
access the same memory.
|
access the same memory.
|
||||||
|
|
||||||
|
config ARCH_BOARD_HELTEC_WIFI_LORA32
|
||||||
|
bool "Heltec WiFi LoRa32"
|
||||||
|
depends on ARCH_CHIP_ESP32WROOM32 || ARCH_CHIP_ESP32WROOM32_8MB || ARCH_CHIP_ESP32WROOM32_16MB || ARCH_CHIP_ESP32WROVER || ARCH_CHIP_ESP32SOLO1
|
||||||
|
select ARCH_HAVE_LEDS
|
||||||
|
select ARCH_HAVE_BUTTONS
|
||||||
|
select ARCH_HAVE_IRQBUTTONS if ESP32_GPIO_IRQ
|
||||||
|
---help---
|
||||||
|
This is a Heltec board with ESP32 and a SX1276 LoRa transceiver.
|
||||||
|
|
||||||
config ARCH_BOARD_TLSR8278ADK80D
|
config ARCH_BOARD_TLSR8278ADK80D
|
||||||
bool "Telink tlsr8278adk80d board"
|
bool "Telink tlsr8278adk80d board"
|
||||||
depends on ARCH_CHIP_TLSR82
|
depends on ARCH_CHIP_TLSR82
|
||||||
@@ -3535,6 +3544,7 @@ config ARCH_BOARD
|
|||||||
default "quickfeather" if ARCH_BOARD_QUICKFEATHER
|
default "quickfeather" if ARCH_BOARD_QUICKFEATHER
|
||||||
default "esp32-audio-kit" if ARCH_BOARD_ESP32_AUDIO_KIT
|
default "esp32-audio-kit" if ARCH_BOARD_ESP32_AUDIO_KIT
|
||||||
default "esp32-devkitc" if ARCH_BOARD_ESP32_DEVKITC
|
default "esp32-devkitc" if ARCH_BOARD_ESP32_DEVKITC
|
||||||
|
default "heltec_wifi_lora32" if ARCH_BOARD_HELTEC_WIFI_LORA32
|
||||||
default "ttgo_eink5_v2" if ARCH_BOARD_TTGO_T5V2_ESP32
|
default "ttgo_eink5_v2" if ARCH_BOARD_TTGO_T5V2_ESP32
|
||||||
default "esp32-ethernet-kit" if ARCH_BOARD_ESP32_ETHERNETKIT
|
default "esp32-ethernet-kit" if ARCH_BOARD_ESP32_ETHERNETKIT
|
||||||
default "esp32-lyrat" if ARCH_BOARD_ESP32_LYRAT
|
default "esp32-lyrat" if ARCH_BOARD_ESP32_LYRAT
|
||||||
@@ -4884,6 +4894,9 @@ endif
|
|||||||
if ARCH_BOARD_ESP32_DEVKITC
|
if ARCH_BOARD_ESP32_DEVKITC
|
||||||
source "boards/xtensa/esp32/esp32-devkitc/Kconfig"
|
source "boards/xtensa/esp32/esp32-devkitc/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
if ARCH_BOARD_HELTEC_WIFI_LORA32
|
||||||
|
source "boards/xtensa/esp32/heltec_wifi_lora32/Kconfig"
|
||||||
|
endif
|
||||||
if ARCH_BOARD_TTGO_T5V2_ESP32
|
if ARCH_BOARD_TTGO_T5V2_ESP32
|
||||||
source "boards/xtensa/esp32/ttgo_eink5_v2/Kconfig"
|
source "boards/xtensa/esp32/ttgo_eink5_v2/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ARCH_BOARD_HELTEC_WIFI_LORA32
|
||||||
|
|
||||||
|
endif # ARCH_BOARD_HELTEC_WIFI_LORA32
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_ARCH_LEDS is not set
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ARCH="xtensa"
|
||||||
|
CONFIG_ARCH_BOARD="heltec_wifi_lora32"
|
||||||
|
CONFIG_ARCH_BOARD_COMMON=y
|
||||||
|
CONFIG_ARCH_BOARD_HELTEC_WIFI_LORA32=y
|
||||||
|
CONFIG_ARCH_CHIP="esp32"
|
||||||
|
CONFIG_ARCH_CHIP_ESP32=y
|
||||||
|
CONFIG_ARCH_CHIP_ESP32WROVER=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARCH_XTENSA=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_ESP32_IGNORE_CHIP_REVISION_CHECK=y
|
||||||
|
CONFIG_ESP32_UART0=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INIT_STACKSIZE=3072
|
||||||
|
CONFIG_INTELHEX_BINARY=y
|
||||||
|
CONFIG_LINE_MAX=64
|
||||||
|
CONFIG_MM_REGIONS=3
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=114688
|
||||||
|
CONFIG_RAM_START=0x20000000
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_START_DAY=6
|
||||||
|
CONFIG_START_MONTH=12
|
||||||
|
CONFIG_START_YEAR=2011
|
||||||
|
CONFIG_SYSLOG_BUFFER=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32/heltec_wifi_lora32/include/board.h
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_INCLUDE_BOARD_H
|
||||||
|
#define __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_INCLUDE_BOARD_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Clocking *****************************************************************/
|
||||||
|
|
||||||
|
/* The ESP32 Devkit board is fitted with either a 26 a 40MHz crystal */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_XTAL_26MHz
|
||||||
|
# define BOARD_XTAL_FREQUENCY 26000000
|
||||||
|
#else
|
||||||
|
# define BOARD_XTAL_FREQUENCY 40000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ
|
||||||
|
# define BOARD_CLOCK_FREQUENCY (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000)
|
||||||
|
#else
|
||||||
|
# define BOARD_CLOCK_FREQUENCY 80000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
|
||||||
|
/* Define how many LEDs this board has (needed by userleds) */
|
||||||
|
|
||||||
|
#define BOARD_NLEDS 1
|
||||||
|
|
||||||
|
/* GPIO pins used by the GPIO Subsystem */
|
||||||
|
|
||||||
|
#define BOARD_NGPIOOUT 1 /* Amount of GPIO Output pins */
|
||||||
|
#define BOARD_NGPIOIN 1 /* Amount of GPIO Input without Interruption */
|
||||||
|
#define BOARD_NGPIOINT 1 /* Amount of GPIO Input w/ Interruption pins */
|
||||||
|
|
||||||
|
#endif /* __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_INCLUDE_BOARD_H */
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32/heltec_wifi_lora32/include/board_memorymap.h
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_INCLUDE_BOARD_MEMORYMAP_H
|
||||||
|
#define __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_INCLUDE_BOARD_MEMORYMAP_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Kernel ROM */
|
||||||
|
|
||||||
|
#define KIROM_START (uintptr_t)__kirom_start
|
||||||
|
#define KIROM_SIZE (uintptr_t)__kirom_size
|
||||||
|
#define KDROM_START (uintptr_t)__kdrom_start
|
||||||
|
#define KDROM_SIZE (uintptr_t)__kdrom_size
|
||||||
|
|
||||||
|
/* Kernel RAM */
|
||||||
|
|
||||||
|
#define KIRAM_0_START (uintptr_t)__kiram_0_start
|
||||||
|
#define KIRAM_0_SIZE (uintptr_t)__kiram_0_size
|
||||||
|
#define KIRAM_0_END (uintptr_t)__kiram_0_end
|
||||||
|
#define KIRAM_1_START (uintptr_t)__kiram_1_start
|
||||||
|
#define KIRAM_1_SIZE (uintptr_t)__kiram_1_size
|
||||||
|
#define KIRAM_1_END (uintptr_t)__kiram_1_end
|
||||||
|
#define KDRAM_0_START (uintptr_t)__kdram_0_start
|
||||||
|
#define KDRAM_0_SIZE (uintptr_t)__kdram_0_size
|
||||||
|
#define KDRAM_0_END (uintptr_t)__kdram_0_end
|
||||||
|
#define KDRAM_1_START (uintptr_t)__kdram_1_start
|
||||||
|
#define KDRAM_1_SIZE (uintptr_t)__kdram_1_size
|
||||||
|
#define KDRAM_1_END (uintptr_t)__kdram_1_end
|
||||||
|
|
||||||
|
/* Exception vectors */
|
||||||
|
|
||||||
|
#define VECTORS_START (uintptr_t)__vectors_start
|
||||||
|
#define VECTORS_END (uintptr_t)__vectors_end
|
||||||
|
|
||||||
|
/* User ROM */
|
||||||
|
|
||||||
|
#define UIROM_START (uintptr_t)__uirom_start
|
||||||
|
#define UIROM_SIZE (uintptr_t)__uirom_size
|
||||||
|
#define UIROM_END (uintptr_t)__uirom_end
|
||||||
|
#define UDROM_START (uintptr_t)__udrom_start
|
||||||
|
#define UDROM_SIZE (uintptr_t)__udrom_size
|
||||||
|
#define UDROM_END (uintptr_t)__udrom_end
|
||||||
|
|
||||||
|
/* User RAM */
|
||||||
|
|
||||||
|
#define UIRAM_START (uintptr_t)__uiram_start
|
||||||
|
#define UIRAM_SIZE (uintptr_t)__uiram_size
|
||||||
|
#define UIRAM_END (uintptr_t)__uiram_end
|
||||||
|
#define UDRAM_START (uintptr_t)__udram_start
|
||||||
|
#define UDRAM_SIZE (uintptr_t)__udram_size
|
||||||
|
#define UDRAM_END (uintptr_t)__udram_end
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Kernel ROM (RX) */
|
||||||
|
|
||||||
|
extern uint8_t __kirom_start[];
|
||||||
|
extern uint8_t __kirom_size[];
|
||||||
|
extern uint8_t __kdrom_start[];
|
||||||
|
extern uint8_t __kdrom_size[];
|
||||||
|
|
||||||
|
/* Kernel RAM (RW) */
|
||||||
|
|
||||||
|
extern uint8_t __kiram_0_start[];
|
||||||
|
extern uint8_t __kiram_0_size[];
|
||||||
|
extern uint8_t __kiram_0_end[];
|
||||||
|
extern uint8_t __kiram_1_start[];
|
||||||
|
extern uint8_t __kiram_1_size[];
|
||||||
|
extern uint8_t __kiram_1_end[];
|
||||||
|
extern uint8_t __kdram_0_start[];
|
||||||
|
extern uint8_t __kdram_0_size[];
|
||||||
|
extern uint8_t __kdram_0_end[];
|
||||||
|
extern uint8_t __kdram_1_start[];
|
||||||
|
extern uint8_t __kdram_1_size[];
|
||||||
|
extern uint8_t __kdram_1_end[];
|
||||||
|
|
||||||
|
/* Exception vectors */
|
||||||
|
|
||||||
|
extern uint8_t __vectors_start[];
|
||||||
|
extern uint8_t __vectors_end[];
|
||||||
|
|
||||||
|
/* User ROM (RX) */
|
||||||
|
|
||||||
|
extern uint8_t __uirom_start[];
|
||||||
|
extern uint8_t __uirom_size[];
|
||||||
|
extern uint8_t __uirom_end[];
|
||||||
|
extern uint8_t __udrom_start[];
|
||||||
|
extern uint8_t __udrom_size[];
|
||||||
|
extern uint8_t __udrom_end[];
|
||||||
|
|
||||||
|
/* User RAM (RW) */
|
||||||
|
|
||||||
|
extern uint8_t __uiram_start[];
|
||||||
|
extern uint8_t __uiram_size[];
|
||||||
|
extern uint8_t __uiram_end[];
|
||||||
|
extern uint8_t __udram_start[];
|
||||||
|
extern uint8_t __udram_size[];
|
||||||
|
extern uint8_t __udram_end[];
|
||||||
|
|
||||||
|
#endif /* __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_INCLUDE_BOARD_MEMORYMAP_H */
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/xtensa/esp32/heltec_wifi_lora32/scripts/Make.defs
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/.config
|
||||||
|
include $(TOPDIR)/tools/Config.mk
|
||||||
|
include $(TOPDIR)/tools/esp32/Config.mk
|
||||||
|
include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs
|
||||||
|
|
||||||
|
# Pick the linker scripts from the board level if they exist, if not
|
||||||
|
# pick the common linker scripts.
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld)
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld)
|
||||||
|
else
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
|
||||||
|
else
|
||||||
|
ARCHSCRIPT += $(call FINDSCRIPT,esp32_sections.ld)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHPICFLAGS = -fpic
|
||||||
|
|
||||||
|
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/xtensa/esp32/heltec_wifi_lora32/src/Make.defs
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
CSRCS = esp32_boot.c esp32_bringup.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BOARDCTL),y)
|
||||||
|
CSRCS += esp32_appinit.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEPPATH += --dep-path board
|
||||||
|
VPATH += :board
|
||||||
|
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||||
|
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32/heltec_wifi_lora32/src/esp32_appinit.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#include "heltec_wifi_lora32.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARDCTL
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_app_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform application specific initialization. This function is never
|
||||||
|
* called directly from application code, but only indirectly via the
|
||||||
|
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||||
|
* implementation without modification. The argument has no
|
||||||
|
* meaning to NuttX; the meaning of the argument is a contract
|
||||||
|
* between the board-specific initialization logic and the
|
||||||
|
* matching application logic. The value could be such things as a
|
||||||
|
* mode enumeration value, a set of DIP switch settings, a
|
||||||
|
* pointer to configuration data read from a file or serial FLASH,
|
||||||
|
* or whatever you would like to do with it. Every implementation
|
||||||
|
* should accept zero/NULL as a default configuration.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_app_initialize(uintptr_t arg)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||||
|
/* Board initialization already performed by board_late_initialize() */
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
|
/* Perform board-specific initialization */
|
||||||
|
|
||||||
|
return esp32_bringup();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BOARDCTL */
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32/heltec_wifi_lora32/src/esp32_boot.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <nuttx/mm/mm.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
#include <arch/esp32/memory_layout.h>
|
||||||
|
|
||||||
|
#include "heltec_wifi_lora32.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32_board_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All ESP32 architectures must provide the following entry point.
|
||||||
|
* This entry point is called early in the initialization -- after all
|
||||||
|
* memory has been configured and mapped but before any devices have been
|
||||||
|
* initialized.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void esp32_board_initialize(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_late_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
|
||||||
|
* initialization call will be performed in the boot-up sequence to a
|
||||||
|
* function called board_late_initialize(). board_late_initialize() will
|
||||||
|
* be called immediately after up_initialize() is called and just before
|
||||||
|
* the initial application is started. This additional initialization
|
||||||
|
* phase may be used, for example, to initialize board-specific device
|
||||||
|
* drivers.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||||
|
void board_late_initialize(void)
|
||||||
|
{
|
||||||
|
/* Perform board-specific initialization */
|
||||||
|
|
||||||
|
esp32_bringup();
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* To avoid corrupting the heap, this region of memory (~3KB) is not
|
||||||
|
* included until the APP CPU has started.
|
||||||
|
* So we can't add it with the rest of the regions at xtensa_add_region(),
|
||||||
|
* that function is called early from up_initialize(). We wait until the
|
||||||
|
* SMP bringup is complete.
|
||||||
|
*/
|
||||||
|
|
||||||
|
umm_addregion((void *)HEAP_REGION_ROMAPP_START,
|
||||||
|
(size_t)(HEAP_REGION_ROMAPP_END - HEAP_REGION_ROMAPP_START));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32/heltec_wifi_lora32/src/esp32_bringup.c
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#include "heltec_wifi_lora32.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32_bringup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture-specific initialization
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||||
|
* Called from board_late_initialize().
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y :
|
||||||
|
* Called from the NSH library
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp32_bringup(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
#ifdef CONFIG_FS_PROCFS
|
||||||
|
/* Mount the procfs file system */
|
||||||
|
|
||||||
|
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_FS_TMPFS
|
||||||
|
/* Mount the tmpfs file system */
|
||||||
|
|
||||||
|
ret = nx_mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to mount tmpfs at %s: %d\n",
|
||||||
|
CONFIG_LIBC_TMPDIR, ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If we got here then perhaps not all initialization was successful, but
|
||||||
|
* at least enough succeeded to bring-up NSH with perhaps reduced
|
||||||
|
* capabilities.
|
||||||
|
*/
|
||||||
|
|
||||||
|
UNUSED(ret);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/xtensa/esp32/heltec_wifi_lora32/src/heltec_wifi_lora32.h
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_SRC_HELTEC_WIFI_LORA32_H
|
||||||
|
#define __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_SRC_HELTEC_WIFI_LORA32_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Heltec WiFi LoRa32 GPIOs *************************************************/
|
||||||
|
|
||||||
|
/* BOOT Button */
|
||||||
|
|
||||||
|
#define BUTTON_BOOT 0
|
||||||
|
|
||||||
|
/* LED
|
||||||
|
*
|
||||||
|
* This is an externally connected LED used for testing.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_LED1 2
|
||||||
|
|
||||||
|
/* PCNT Quadrature Encoder IDs */
|
||||||
|
|
||||||
|
#define PCNT_QE0_ID 0
|
||||||
|
|
||||||
|
/* MCP2515 Interrupt pin */
|
||||||
|
|
||||||
|
#define GPIO_MCP2515_IRQ 22
|
||||||
|
|
||||||
|
/* TIMERS */
|
||||||
|
|
||||||
|
#define TIMER0 0
|
||||||
|
#define TIMER1 1
|
||||||
|
#define TIMER2 2
|
||||||
|
#define TIMER3 3
|
||||||
|
|
||||||
|
/* ONESHOT */
|
||||||
|
|
||||||
|
#define ONESHOT_TIMER 1
|
||||||
|
#define ONESHOT_RESOLUTION_US 1
|
||||||
|
|
||||||
|
/* RMT gpio */
|
||||||
|
|
||||||
|
#define RMT_RXCHANNEL 1
|
||||||
|
#define RMT_TXCHANNEL 0
|
||||||
|
|
||||||
|
#ifdef CONFIG_RMT_LOOP_TEST_MODE
|
||||||
|
# define RMT_INPUT_PIN 0
|
||||||
|
# define RMT_OUTPUT_PIN 0
|
||||||
|
#else
|
||||||
|
# define RMT_INPUT_PIN 2
|
||||||
|
# define RMT_OUTPUT_PIN 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32_bringup
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture-specific initialization
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||||
|
* Called from board_late_initialize().
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y :
|
||||||
|
* Called from the NSH library via board_app_initialize()
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp32_bringup(void);
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __BOARDS_XTENSA_ESP32_HELTEC_WIFI_LORA32_SRC_HELTEC_WIFI_LORA32_H */
|
||||||
Reference in New Issue
Block a user