From 1ced1e9f3596f6ba30e0129476c2f25ff67ac402 Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Nihei Date: Wed, 7 Dec 2022 17:55:30 -0300 Subject: [PATCH] risc-v/esp32c3: Move files shared between boards into a common folder Signed-off-by: Gustavo Henrique Nihei --- boards/Kconfig | 3 + boards/risc-v/esp32c3/common/Kconfig | 61 +++++ .../common/include/esp32c3_board_adc.h | 74 ++++++ .../include/esp32c3_board_apds9960.h} | 83 +++---- .../common/include/esp32c3_board_bmp180.h | 74 ++++++ .../common/include/esp32c3_board_i2c.h | 74 ++++++ .../common/include/esp32c3_board_ledc.h | 74 ++++++ .../common/include/esp32c3_board_oneshot.h | 75 ++++++ .../common/include/esp32c3_board_spidev.h | 74 ++++++ .../common/include/esp32c3_board_spiflash.h | 74 ++++++ .../include/esp32c3_board_spislavedev.h | 74 ++++++ .../common/include/esp32c3_board_twai.h | 74 ++++++ .../common/include/esp32c3_board_wdt.h | 74 ++++++ .../common/include/esp32c3_board_wlan.h | 74 ++++++ .../kernel/Makefile | 14 +- .../kernel/esp32c3_userspace.c | 0 .../src/Makefile => common/src/Make.defs} | 89 +++---- .../src/esp32c3_board_adc.c} | 7 +- .../src/esp32c3_board_apa102.c} | 3 +- .../src/esp32c3_board_apds9960.c} | 8 +- .../src/esp32c3_board_bmp180.c} | 27 +-- .../src/esp32c3_board_gc9a01.c} | 2 +- .../src/esp32c3_board_i2c.c} | 8 +- .../src/esp32c3_board_ledc.c} | 15 +- .../src/esp32c3_board_oneshot.c} | 10 +- .../src/esp32c3_board_spi.c | 2 +- .../src/esp32c3_board_spidev.c | 13 +- .../src/esp32c3_board_spiflash.c} | 15 +- .../src/esp32c3_board_spislavedev.c | 4 +- .../src/esp32c3_board_st7735.c} | 2 +- .../src/esp32c3_board_st7789.c} | 2 +- .../src/esp32c3_board_twai.c} | 18 +- .../src/esp32c3_board_wdt.c} | 9 +- .../src/esp32c3_board_wlan.c | 7 +- .../configs/shiftgame/defconfig | 1 + .../src/{Makefile => Make.defs} | 33 +-- .../src/esp32c3-devkit-rust-1.h | 228 ------------------ .../src/esp32c3_bringup.c | 2 +- boards/risc-v/esp32c3/esp32c3-devkit/Kconfig | 70 ------ .../esp32c3-devkit/configs/adc/defconfig | 1 + .../esp32c3-devkit/configs/autopm/defconfig | 1 + .../esp32c3-devkit/configs/ble/defconfig | 1 + .../esp32c3-devkit/configs/bmp180/defconfig | 1 + .../esp32c3-devkit/configs/cxx/defconfig | 1 + .../esp32c3-devkit/configs/efuse/defconfig | 1 + .../esp32c3-devkit/configs/elf/defconfig | 1 + .../esp32c3-devkit/configs/gpio/defconfig | 1 + .../esp32c3-devkit/configs/knsh/defconfig | 3 +- .../esp32c3-devkit/configs/lvgl/defconfig | 1 + .../configs/mcuboot_slot_confirm/defconfig | 1 + .../esp32c3-devkit/configs/module/defconfig | 1 + .../configs/nvcfgdata/defconfig | 1 + .../esp32c3-devkit/configs/oneshot/defconfig | 1 + .../esp32c3-devkit/configs/ostest/defconfig | 1 + .../esp32c3-devkit/configs/pm/defconfig | 1 + .../esp32c3-devkit/configs/pwm/defconfig | 1 + .../esp32c3-devkit/configs/random/defconfig | 1 + .../esp32c3-devkit/configs/romfs/defconfig | 1 + .../esp32c3-devkit/configs/rtc/defconfig | 1 + .../esp32c3-devkit/configs/sotest/defconfig | 1 + .../esp32c3-devkit/configs/spiflash/defconfig | 1 + .../configs/sta_softap/defconfig | 1 + .../esp32c3-devkit/configs/tickless/defconfig | 1 + .../esp32c3-devkit/configs/timer/defconfig | 1 + .../esp32c3-devkit/configs/twai/defconfig | 1 + .../esp32c3-devkit/configs/uid/defconfig | 1 + .../configs/usbconsole/defconfig | 1 + .../esp32c3-devkit/configs/wapi/defconfig | 1 + .../esp32c3-devkit/configs/watchdog/defconfig | 1 + .../esp32c3-devkit/configs/watcher/defconfig | 1 + .../esp32c3/esp32c3-devkit/src/Make.defs | 54 +++++ .../esp32c3-devkit/src/esp32c3-devkit.h | 199 --------------- .../esp32c3-devkit/src/esp32c3_bringup.c | 20 +- 73 files changed, 1167 insertions(+), 690 deletions(-) create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_adc.h rename boards/risc-v/esp32c3/{esp32c3-devkit-rust-1/src/esp32c3_board_spi.c => common/include/esp32c3_board_apds9960.h} (60%) create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_bmp180.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_i2c.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_ledc.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_oneshot.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_spidev.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_spiflash.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_spislavedev.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_twai.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_wdt.h create mode 100644 boards/risc-v/esp32c3/common/include/esp32c3_board_wlan.h rename boards/risc-v/esp32c3/{esp32c3-devkit => common}/kernel/Makefile (83%) rename boards/risc-v/esp32c3/{esp32c3-devkit => common}/kernel/esp32c3_userspace.c (100%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/Makefile => common/src/Make.defs} (57%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_adc.c => common/src/esp32c3_board_adc.c} (97%) rename boards/risc-v/esp32c3/{esp32c3-devkit-rust-1/src/esp32c3_apa102.c => common/src/esp32c3_board_apa102.c} (96%) rename boards/risc-v/esp32c3/{esp32c3-devkit-rust-1/src/esp32c3_apds9960.c => common/src/esp32c3_board_apds9960.c} (96%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_bmp180.c => common/src/esp32c3_board_bmp180.c} (68%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_gc9a01.c => common/src/esp32c3_board_gc9a01.c} (98%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_i2c.c => common/src/esp32c3_board_i2c.c} (94%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_ledc.c => common/src/esp32c3_board_ledc.c} (90%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_oneshot.c => common/src/esp32c3_board_oneshot.c} (92%) rename boards/risc-v/esp32c3/{esp32c3-devkit => common}/src/esp32c3_board_spi.c (97%) rename boards/risc-v/esp32c3/{esp32c3-devkit => common}/src/esp32c3_board_spidev.c (84%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_spiflash.c => common/src/esp32c3_board_spiflash.c} (97%) rename boards/risc-v/esp32c3/{esp32c3-devkit => common}/src/esp32c3_board_spislavedev.c (96%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_st7735.c => common/src/esp32c3_board_st7735.c} (98%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_st7789.c => common/src/esp32c3_board_st7789.c} (98%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_twai.c => common/src/esp32c3_board_twai.c} (88%) rename boards/risc-v/esp32c3/{esp32c3-devkit/src/esp32c3_wdt.c => common/src/esp32c3_board_wdt.c} (94%) rename boards/risc-v/esp32c3/{esp32c3-devkit => common}/src/esp32c3_board_wlan.c (95%) rename boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/{Makefile => Make.defs} (70%) create mode 100644 boards/risc-v/esp32c3/esp32c3-devkit/src/Make.defs diff --git a/boards/Kconfig b/boards/Kconfig index b4207505fcc..d97ab045b27 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -3790,6 +3790,9 @@ endif if ARCH_CHIP_ESP32S3 source "boards/xtensa/esp32s3/common/Kconfig" endif +if ARCH_CHIP_ESP32C3 +source "boards/risc-v/esp32c3/common/Kconfig" +endif if ARCH_CHIP_SAMV7 source "boards/arm/samv7/common/Kconfig" endif diff --git a/boards/risc-v/esp32c3/common/Kconfig b/boards/risc-v/esp32c3/common/Kconfig index b043409381b..9c32bbd2086 100644 --- a/boards/risc-v/esp32c3/common/Kconfig +++ b/boards/risc-v/esp32c3/common/Kconfig @@ -11,3 +11,64 @@ config ESP32C3_MERGE_BINS device. This is only useful when the path to binary files (e.g. bootloader) is provided via the ESPTOOL_BINDIR variable. + +choice ESP32C3_SPIFLASH_FS + prompt "Mount SPI Flash MTD on bring-up" + default ESP32C3_SPIFLASH_SMARTFS + depends on ESP32C3_MTD + optional + ---help--- + Mount the SPI Flash MTD with the selected File System format on board + bring-up. + If not selected, the MTD will be registered as a device node on /dev. + + config ESP32C3_SPIFLASH_SMARTFS + bool "SmartFS" + select FS_SMARTFS + select MTD_SMART + depends on !ESP32C3_SECURE_FLASH_ENC_ENABLED + + comment "SmartFS not supported with Flash Encryption" + depends on ESP32C3_SECURE_FLASH_ENC_ENABLED + + config ESP32C3_SPIFLASH_NXFFS + bool "NXFFS" + select FS_NXFFS + depends on !ESP32C3_SECURE_FLASH_ENC_ENABLED + + comment "NXFFS not supported with Flash Encryption" + depends on ESP32C3_SECURE_FLASH_ENC_ENABLED + + config ESP32C3_SPIFLASH_SPIFFS + bool "SPIFFS" + select FS_SPIFFS + depends on !ESP32C3_SECURE_FLASH_ENC_ENABLED + + comment "SPIFFS not supported with Flash Encryption" + depends on ESP32C3_SECURE_FLASH_ENC_ENABLED + + config ESP32C3_SPIFLASH_LITTLEFS + bool "LittleFS" + select FS_LITTLEFS + + config ESP32C3_SPIFLASH_MTD_CONFIG + bool "Non-volatile storage" + +endchoice + +config ESP32C3_SPIFLASH_FS_MOUNT_PT + string "File-system Mount Point" + depends on ESP32C3_SPIFLASH_LITTLEFS + default "/data" + +if LCD_ST7735 || LCD_ST7789 || LCD_GC9A01 + +config ESP32C3_LCD_RSTPIN + int "LCD reset pin" + default 9 + +config ESP32C3_LCD_BLPIN + int "LCD backlight pin" + default 18 + +endif # LCD_ST7735 || LCD_ST7789 || LCD_GC9A01 diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_adc.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_adc.h new file mode 100644 index 00000000000..5faff36ff41 --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_adc.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_adc.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_ADC_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_ADC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_adc_init + * + * Description: + * Configure the ADC driver. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ADC +int board_adc_init(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_ADC_H */ diff --git a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_board_spi.c b/boards/risc-v/esp32c3/common/include/esp32c3_board_apds9960.h similarity index 60% rename from boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_board_spi.c rename to boards/risc-v/esp32c3/common/include/esp32c3_board_apds9960.h index 55fb02aa6f4..8aa05e802b4 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_board_spi.c +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_apds9960.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_board_spi.c + * boards/risc-v/esp32c3/common/include/esp32c3_board_apds9960.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,66 +18,57 @@ * ****************************************************************************/ +#ifndef __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_APDS9960_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_APDS9960_H + /**************************************************************************** * Included Files ****************************************************************************/ #include -#include -#include -#include - -#include - -#include "esp32c3_gpio.h" - /**************************************************************************** - * Private Functions + * Pre-processor Definitions ****************************************************************************/ -/**************************************************************************** - * Public Functions - ****************************************************************************/ +#ifndef __ASSEMBLY__ -/**************************************************************************** - * Name: esp32c3_spi2_status - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_SPI2 - -uint8_t esp32c3_spi2_status(struct spi_dev_s *dev, uint32_t devid) +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { - uint8_t status = 0; - - return status; -} - +#else +#define EXTERN extern #endif /**************************************************************************** - * Name: esp32c3_spi2_cmddata + * Public Function Prototypes ****************************************************************************/ -#if defined(CONFIG_ESP32C3_SPI2) && defined(CONFIG_SPI_CMDDATA) - -int esp32c3_spi2_cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd) -{ - if (devid == SPIDEV_DISPLAY(0)) - { - /* This is the Data/Command control pad which determines whether the - * data bits are data or a command. - */ - - esp32c3_gpiowrite(CONFIG_ESP32C3_SPI2_MISOPIN, !cmd); - - return OK; - } - - spiinfo("devid: %" PRIu32 " CMD: %s\n", devid, cmd ? "command" : - "data"); - - return -ENODEV; -} +/**************************************************************************** + * Name: board_apds9960_initialize + * + * Description: + * Initialize and register the APDS9960 gesture sensor. + * + * Input Parameters: + * devno - The device number, used to build the device path as /dev/gestN + * busno - The I2C bus number + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ +#ifdef CONFIG_SENSORS_APDS9960 +int board_apds9960_initialize(int devno, int busno); #endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_APDS9960_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_bmp180.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_bmp180.h new file mode 100644 index 00000000000..211e1919dcb --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_bmp180.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_bmp180.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_BMP180_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_BMP180_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_bmp180_initialize + * + * Description: + * Initialize and register the BMP180 Pressure Sensor driver. + * + * Input Parameters: + * devno - The device number, used to build the device path as /dev/pressN + * busno - The I2C bus number + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SENSORS_BMP180 +int board_bmp180_initialize(int devno, int busno); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_BMP180_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_i2c.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_i2c.h new file mode 100644 index 00000000000..0404336f4ef --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_i2c.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_i2c.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_I2C_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_I2C_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_i2c_init + * + * Description: + * Configure the I2C driver. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_I2C_DRIVER +int board_i2c_init(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_I2C_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_ledc.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_ledc.h new file mode 100644 index 00000000000..adfb93f052b --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_ledc.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_ledc.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_LEDC_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_LEDC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_ledc_setup + * + * Description: + * Initialize LEDC PWM and register the PWM device. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ESP32C3_LEDC +int board_ledc_setup(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_LEDC_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_oneshot.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_oneshot.h new file mode 100644 index 00000000000..8722b9e978b --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_oneshot.h @@ -0,0 +1,75 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_oneshot.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_ONESHOT_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_ONESHOT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_oneshot_init + * + * Description: + * Configure the oneshot timer driver. + * + * Input Parameters: + * timer - Timer instance to be used as oneshot timer. + * resolution - Oneshot timer resolution. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ONESHOT +int board_oneshot_init(int timer, uint16_t resolution); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_ONESHOT_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_spidev.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_spidev.h new file mode 100644 index 00000000000..d015b224c05 --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_spidev.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_spidev.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPIDEV_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPIDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_spidev_initialize + * + * Description: + * Initialize SPI driver and register the /dev/spi device. + * + * Input Parameters: + * bus - The SPI bus number, used to build the device path as /dev/spiN + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_DRIVER +int board_spidev_initialize(int bus); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPIDEV_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_spiflash.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_spiflash.h new file mode 100644 index 00000000000..4229983b708 --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_spiflash.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_spiflash.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPIFLASH_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPIFLASH_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_spiflash_init + * + * Description: + * Initialize the SPIFLASH and register the MTD device. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ESP32C3_SPIFLASH +int board_spiflash_init(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPIFLASH_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_spislavedev.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_spislavedev.h new file mode 100644 index 00000000000..b98f4b034ff --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_spislavedev.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_spislavedev.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPISLAVEDEV_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPISLAVEDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_spislavedev_initialize + * + * Description: + * Initialize SPI Slave driver and register the /dev/spislv device. + * + * Input Parameters: + * bus - The SPI bus number, used to build the device path as /dev/spislvN + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_SLAVE +int board_spislavedev_initialize(int bus); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_SPISLAVEDEV_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_twai.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_twai.h new file mode 100644 index 00000000000..57b5b1f9428 --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_twai.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_twai.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_TWAI_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_TWAI_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_twai_setup + * + * Description: + * Configure the TWAI driver. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_CAN +int board_twai_setup(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_TWAI_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_wdt.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_wdt.h new file mode 100644 index 00000000000..df7e89a071a --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_wdt.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_wdt.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_WDT_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_WDT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_wdt_init + * + * Description: + * Configure the Watchdog Timer driver. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_WATCHDOG +int board_wdt_init(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_WDT_H */ diff --git a/boards/risc-v/esp32c3/common/include/esp32c3_board_wlan.h b/boards/risc-v/esp32c3/common/include/esp32c3_board_wlan.h new file mode 100644 index 00000000000..fdca410a6aa --- /dev/null +++ b/boards/risc-v/esp32c3/common/include/esp32c3_board_wlan.h @@ -0,0 +1,74 @@ +/**************************************************************************** + * boards/risc-v/esp32c3/common/include/esp32c3_board_wlan.h + * + * 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_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_WLAN_H +#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_WLAN_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_wlan_init + * + * Description: + * Configure the wireless subsystem. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ESP32C3_WIRELESS +int board_wlan_init(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP32C3_BOARD_WLAN_H */ diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/kernel/Makefile b/boards/risc-v/esp32c3/common/kernel/Makefile similarity index 83% rename from boards/risc-v/esp32c3/esp32c3-devkit/kernel/Makefile rename to boards/risc-v/esp32c3/common/kernel/Makefile index 2b6b056e1fd..c5b22e6a918 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/kernel/Makefile +++ b/boards/risc-v/esp32c3/common/kernel/Makefile @@ -29,13 +29,13 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_INIT_ENTRYPOINT)) # is appropriate for the host OS USER_LIBPATHS = $(addprefix -L,$(call CONVERT_PATH,$(addprefix $(TOPDIR)$(DELIM),$(dir $(USERLIBS))))) -USER_LDSCRIPT = -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32c3_out.ld) -USER_LDSCRIPT += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld) -USER_LDSCRIPT += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32c3_rom.ld) +USER_LDSCRIPT = $(call CONVERT_PATH,$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld) +USER_LDSCRIPT += $(call CONVERT_PATH,$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld) +USER_LDSCRIPT += $(call CONVERT_PATH,$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32c3_rom.ld) USER_HEXFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.hex) USER_BINFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.bin) -USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT) -melf32lriscv +USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(addprefix -T,$(addsuffix .tmp,$(USER_LDSCRIPT))) -melf32lriscv ifeq ($(CONFIG_DEBUG_LINK_MAP),y) USER_LDFLAGS += --cref -Map="$(TOPDIR)$(DELIM)User.map" @@ -68,9 +68,12 @@ all: $(TOPDIR)$(DELIM)nuttx_user.elf $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) +$(addsuffix .tmp,$(USER_LDSCRIPT)): $(USER_LDSCRIPT) + $(call PREPROCESS,$(patsubst %.tmp,%,$@),$@) + # Create the nuttx_user.elf file containing all of the user-mode code -nuttx_user.elf: $(OBJS) +nuttx_user.elf: $(OBJS) $(addsuffix .tmp,$(USER_LDSCRIPT)) $(Q) $(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) $(OBJS) $(LDSTARTGROUP) $(USER_LDLIBS) $(LDENDGROUP) $(USER_LIBGCC) $(TOPDIR)$(DELIM)nuttx_user.elf: nuttx_user.elf @@ -84,6 +87,7 @@ ifeq ($(CONFIG_RAW_BINARY),y) $(Q) echo "CP: nuttx_user.bin" $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx_user.elf $(USER_BINFILE) endif + $(Q) $(call DELFILE,$(addsuffix .tmp,$(USER_LDSCRIPT))) .depend: diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/kernel/esp32c3_userspace.c b/boards/risc-v/esp32c3/common/kernel/esp32c3_userspace.c similarity index 100% rename from boards/risc-v/esp32c3/esp32c3-devkit/kernel/esp32c3_userspace.c rename to boards/risc-v/esp32c3/common/kernel/esp32c3_userspace.c diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile b/boards/risc-v/esp32c3/common/src/Make.defs similarity index 57% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile rename to boards/risc-v/esp32c3/common/src/Make.defs index 30dc881d7f1..78ca51f6fdd 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile +++ b/boards/risc-v/esp32c3/common/src/Make.defs @@ -1,5 +1,5 @@ ############################################################################# -# boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile +# boards/risc-v/esp32c3/common/src/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,99 +18,78 @@ # ############################################################################# -include $(TOPDIR)/Make.defs - -SCRIPTDIR = $(BOARD_DIR)$(DELIM)scripts - -CONFIGFILE = $(TOPDIR)$(DELIM)include$(DELIM)nuttx$(DELIM)config.h - -CSRCS = esp32c3_boot.c esp32c3_bringup.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += esp32c3_appinit.c -ifeq ($(CONFIG_BOARDCTL_RESET),y) -CSRCS += esp32c3_reset.c -endif - -endif - -ifeq ($(CONFIG_ESP32C3_SPIFLASH),y) -CSRCS += esp32c3_spiflash.c -endif - -ifeq ($(CONFIG_ESP32C3_WIRELESS),y) -CSRCS += esp32c3_board_wlan.c -endif - -ifeq ($(CONFIG_DEV_GPIO),y) -CSRCS += esp32c3_gpio.c -endif +ifeq ($(CONFIG_ARCH_BOARD_COMMON),y) ifeq ($(CONFIG_ESP32C3_SPI),y) -CSRCS += esp32c3_board_spi.c + CSRCS += esp32c3_board_spi.c endif ifeq ($(CONFIG_SPI_DRIVER),y) -CSRCS += esp32c3_board_spidev.c + CSRCS += esp32c3_board_spidev.c endif ifeq ($(CONFIG_SPI_SLAVE_DRIVER),y) -CSRCS += esp32c3_board_spislavedev.c + CSRCS += esp32c3_board_spislavedev.c +endif + +ifeq ($(CONFIG_ESP32C3_SPIFLASH),y) + CSRCS += esp32c3_board_spiflash.c endif ifeq ($(CONFIG_I2C_DRIVER),y) -CSRCS += esp32c3_i2c.c + CSRCS += esp32c3_board_i2c.c +endif + +ifeq ($(CONFIG_ESP32C3_WIRELESS),y) + CSRCS += esp32c3_board_wlan.c endif ifeq ($(CONFIG_CAN),y) -CSRCS += esp32c3_twai.c -endif - -ifeq ($(CONFIG_SENSORS_BMP180),y) -CSRCS += esp32c3_bmp180.c + CSRCS += esp32c3_board_twai.c endif ifeq ($(CONFIG_WATCHDOG),y) -CSRCS += esp32c3_wdt.c + CSRCS += esp32c3_board_wdt.c endif ifeq ($(CONFIG_ONESHOT),y) -CSRCS += esp32c3_oneshot.c + CSRCS += esp32c3_board_oneshot.c endif ifeq ($(CONFIG_PWM),y) -CSRCS += esp32c3_ledc.c + CSRCS += esp32c3_board_ledc.c endif ifeq ($(CONFIG_ADC),y) -CSRCS += esp32c3_adc.c + CSRCS += esp32c3_board_adc.c +endif + +ifeq ($(CONFIG_SENSORS_BMP180),y) + CSRCS += esp32c3_board_bmp180.c endif ifeq ($(CONFIG_LCD_ST7735),y) -CSRCS += esp32c3_st7735.c + CSRCS += esp32c3_board_st7735.c endif ifeq ($(CONFIG_LCD_ST7789),y) -CSRCS += esp32c3_st7789.c + CSRCS += esp32c3_board_st7789.c endif ifeq ($(CONFIG_LCD_GC9A01),y) -CSRCS += esp32c3_gc9a01.c + CSRCS += esp32c3_board_gc9a01.c endif -ifeq ($(CONFIG_BOARDCTL_IOCTL),y) -CSRCS += esp32c3_ioctl.c +ifeq ($(CONFIG_SENSORS_APDS9960),y) + CSRCS += esp32c3_board_apds9960.c endif -ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y) -CSRCS += esp32c3_uid.c +ifeq ($(CONFIG_LCD_APA102),y) + CSRCS += esp32c3_board_apa102.c endif -ifeq ($(CONFIG_NSH_ROMFSETC),y) -ifneq ($(CONFIG_NSH_CUSTOMROMFS),y) - RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS - RCRAWS = etc/group etc/passwd -endif -endif +DEPPATH += --dep-path src +VPATH += :src +CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src) -include $(TOPDIR)/boards/Board.mk +endif diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_adc.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_adc.c similarity index 97% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_adc.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_adc.c index 710e0b1e03a..15c418eeda5 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_adc.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_adc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_adc.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_adc.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -29,7 +29,7 @@ #include "esp32c3_adc.h" -#include "esp32c3-devkit.h" +#include "esp32c3_board_adc.h" /**************************************************************************** * Pre-processor Definitions @@ -45,6 +45,9 @@ * Description: * Configure the ADC driver. * + * Input Parameters: + * None. + * * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. diff --git a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_apa102.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_apa102.c similarity index 96% rename from boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_apa102.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_apa102.c index e21a32ed561..afa4e7efad0 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_apa102.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_apa102.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_apa102.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_apa102.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -37,7 +37,6 @@ #include "esp32c3_gpio.h" #include "esp32c3_spi.h" -#include "esp32c3-devkit-rust-1.h" /**************************************************************************** * Pre-processor Definitions diff --git a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_apds9960.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_apds9960.c similarity index 96% rename from boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_apds9960.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_apds9960.c index 17924b4f742..fb34f345ab1 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_apds9960.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_apds9960.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_apds9960.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_apds9960.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -36,6 +36,8 @@ #include "esp32c3_i2c.h" #include "esp32c3_gpio.h" +#include "esp32c3_board_apds9960.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -136,7 +138,7 @@ static int apds9960_irq_attach(struct apds9960_config_s *state, ****************************************************************************/ /**************************************************************************** - * Name: apds9960_initialize + * Name: board_apds9960_initialize * * Description: * Initialize and register the APDS9960 gesture sensor. @@ -150,7 +152,7 @@ static int apds9960_irq_attach(struct apds9960_config_s *state, * ****************************************************************************/ -int apds9960_initialize(int devno, int busno) +int board_apds9960_initialize(int devno, int busno) { struct i2c_master_s *i2c; char devpath[12]; diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bmp180.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_bmp180.c similarity index 68% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bmp180.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_bmp180.c index b8532b96c17..8acba5655d8 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bmp180.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_bmp180.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bmp180.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_bmp180.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -32,31 +32,8 @@ #include #include "esp32c3_i2c.h" -#include "esp32c3-devkit.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ +#include "esp32c3_board_bmp180.h" /**************************************************************************** * Public Functions diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gc9a01.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_gc9a01.c similarity index 98% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gc9a01.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_gc9a01.c index 74381f6ea3e..285620cfcd1 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gc9a01.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_gc9a01.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gc9a01.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_gc9a01.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_i2c.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_i2c.c similarity index 94% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_i2c.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_i2c.c index 6896c019172..6ad33d61ab5 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_i2c.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_i2c.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_i2c.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_i2c.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -30,7 +30,8 @@ #include #include "esp32c3_i2c.h" -#include "esp32c3-devkit.h" + +#include "esp32c3_board_i2c.h" /**************************************************************************** * Public Functions @@ -42,6 +43,9 @@ * Description: * Configure the I2C driver. * + * Input Parameters: + * None. + * * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_ledc.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_ledc.c similarity index 90% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_ledc.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_ledc.c index 5771aeb85f6..835430b934d 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_ledc.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_ledc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_ledc.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_ledc.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -36,6 +36,8 @@ #include "chip.h" #include "esp32c3_ledc.h" +#include "esp32c3_board_ledc.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -45,14 +47,21 @@ ****************************************************************************/ /**************************************************************************** - * Name: esp32c3_pwm_setup + * Name: board_ledc_setup * * Description: * Initialize LEDC PWM and register the PWM device. * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * ****************************************************************************/ -int esp32c3_pwm_setup(void) +int board_ledc_setup(void) { int ret; struct pwm_lowerhalf_s *pwm; diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_oneshot.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_oneshot.c similarity index 92% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_oneshot.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_oneshot.c index 3ac14d0b8e7..ada850f6829 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_oneshot.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_oneshot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_oneshot.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_oneshot.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -26,10 +26,12 @@ #include #include + #include #include #include -#include "esp32c3-devkit.h" + +#include "esp32c3_board_oneshot.h" /**************************************************************************** * Pre-processor Definitions @@ -45,6 +47,10 @@ * Description: * Configure the oneshot timer driver. * + * Input Parameters: + * timer - Timer instance to be used as oneshot timer. + * resolution - Oneshot timer resolution. + * * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spi.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_spi.c similarity index 97% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spi.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_spi.c index 9030f6c9fd9..b29b822eefc 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spi.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_spi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spi.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_spi.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spidev.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_spidev.c similarity index 84% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spidev.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_spidev.c index f55215d01bc..834b72fdb85 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spidev.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_spidev.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spidev.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_spidev.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -32,6 +32,8 @@ #include "esp32c3_spi.h" +#include "esp32c3_board_spidev.h" + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -40,7 +42,14 @@ * Name: board_spidev_initialize * * Description: - * Initialize and register SPI driver for the specified SPI port. + * Initialize SPI driver and register the /dev/spi device. + * + * Input Parameters: + * bus - The SPI bus number, used to build the device path as /dev/spiN + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. * ****************************************************************************/ diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_spiflash.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_spiflash.c similarity index 97% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_spiflash.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_spiflash.c index c6386f6f291..79a10547c20 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_spiflash.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_spiflash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_spiflash.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_spiflash.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -45,7 +45,8 @@ #include "esp32c3_spiflash.h" #include "esp32c3_spiflash_mtd.h" -#include "esp32c3-devkit.h" + +#include "esp32c3_board_spiflash.h" /**************************************************************************** * Pre-processor Definitions @@ -553,7 +554,15 @@ static int init_storage_partition(void) * Name: board_spiflash_init * * Description: - * Initialize the SPIFLASH and register the MTD device. + * Initialize the SPI Flash and register the MTD device. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * ****************************************************************************/ int board_spiflash_init(void) diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spislavedev.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_spislavedev.c similarity index 96% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spislavedev.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_spislavedev.c index 3869f9f5686..c6721661df0 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spislavedev.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_spislavedev.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_spislavedev.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_spislavedev.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -32,6 +32,8 @@ #include "esp32c3_spi.h" +#include "esp32c3_board_spislavedev.h" + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7735.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_st7735.c similarity index 98% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7735.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_st7735.c index 3e191f223da..d2f40dad06e 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7735.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_st7735.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7735.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_st7735.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7789.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_st7789.c similarity index 98% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7789.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_st7789.c index 0c8588a0bc4..99c82855c75 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7789.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_st7789.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_st7789.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_st7789.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_twai.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_twai.c similarity index 88% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_twai.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_twai.c index 6c284b63cb5..2e80ab043ab 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_twai.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_twai.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_twai.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_twai.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -34,7 +34,8 @@ /* #include "arm_arch.h" */ #include "esp32c3_twai.h" -#include "esp32c3-devkit.h" + +#include "esp32c3_board_twai.h" #ifdef CONFIG_CAN @@ -51,14 +52,21 @@ ****************************************************************************/ /**************************************************************************** - * Name: esp32c3_twai_setup + * Name: board_twai_setup * * Description: - * Initialize TWAI and register the TWAI device + * Configure the TWAI driver. + * + * Input Parameters: + * None. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. * ****************************************************************************/ -int esp32c3_twai_setup(void) +int board_twai_setup(void) { #ifdef CONFIG_ESP32C3_TWAI0 struct can_dev_s *twai; diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_wdt.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_wdt.c similarity index 94% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_wdt.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_wdt.c index f4d19a14cce..fead26bdb30 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_wdt.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_wdt.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_wdt.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_wdt.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -30,7 +30,7 @@ #include "esp32c3_wdt_lowerhalf.h" #include "esp32c3_wdt.h" -#include "esp32c3-devkit.h" +#include "esp32c3_board_wdt.h" /**************************************************************************** * Pre-processor Definitions @@ -44,7 +44,10 @@ * Name: board_wdt_init * * Description: - * Configure the watchdog timer driver. + * Configure the Watchdog Timer driver. + * + * Input Parameters: + * None. * * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_wlan.c b/boards/risc-v/esp32c3/common/src/esp32c3_board_wlan.c similarity index 95% rename from boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_wlan.c rename to boards/risc-v/esp32c3/common/src/esp32c3_board_wlan.c index 2c357098203..35b621eafbb 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_wlan.c +++ b/boards/risc-v/esp32c3/common/src/esp32c3_board_wlan.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_board_wlan.c + * boards/risc-v/esp32c3/common/src/esp32c3_board_wlan.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -36,6 +36,8 @@ #include "esp32c3_spiflash.h" #include "esp32c3_wlan.h" +#include "esp32c3_board_wlan.h" + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -46,6 +48,9 @@ * Description: * Configure the wireless subsystem. * + * Input Parameters: + * None. + * * Returned Value: * Zero (OK) is returned on success; A negated errno value is returned * to indicate the nature of any failure. diff --git a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/configs/shiftgame/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/configs/shiftgame/defconfig index d325c34036d..1df5b660a38 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/configs/shiftgame/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/configs/shiftgame/defconfig @@ -11,6 +11,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit-rust-1" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT_RUST1=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/Makefile b/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/Make.defs similarity index 70% rename from boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/Makefile rename to boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/Make.defs index 3411e428e60..82726a35c2a 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/Makefile +++ b/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/Make.defs @@ -20,37 +20,24 @@ include $(TOPDIR)/Make.defs -SCRIPTDIR = $(BOARD_DIR)$(DELIM)scripts - -CONFIGFILE = $(TOPDIR)$(DELIM)include$(DELIM)nuttx$(DELIM)config.h - CSRCS = esp32c3_boot.c esp32c3_bringup.c ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += esp32c3_appinit.c -ifeq ($(CONFIG_BOARDCTL_RESET),y) -CSRCS += esp32c3_reset.c -endif + CSRCS += esp32c3_appinit.c + + ifeq ($(CONFIG_BOARDCTL_RESET),y) + CSRCS += esp32c3_reset.c + endif endif ifeq ($(CONFIG_ARCH_LEDS),y) -CSRCS += esp32c3_autoleds.c + CSRCS += esp32c3_autoleds.c endif ifeq ($(CONFIG_BOARDCTL_IOCTL),y) -CSRCS += esp32c3_ioctl.c + CSRCS += esp32c3_ioctl.c endif -ifeq ($(CONFIG_ESP32C3_SPI),y) -CSRCS += esp32c3_board_spi.c -endif - -ifeq ($(CONFIG_SENSORS_APDS9960),y) -CSRCS += esp32c3_apds9960.c -endif - -ifeq ($(CONFIG_LCD_APA102),y) -CSRCS += esp32c3_apa102.c -endif - -include $(TOPDIR)/boards/Board.mk +DEPPATH += --dep-path board +VPATH += :board +CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3-devkit-rust-1.h b/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3-devkit-rust-1.h index 7fe5bd301e3..3af1674d8ae 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3-devkit-rust-1.h +++ b/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3-devkit-rust-1.h @@ -75,233 +75,5 @@ int esp32c3_bringup(void); -/**************************************************************************** - * Name: esp32c3_gpio_init - ****************************************************************************/ - -#ifdef CONFIG_DEV_GPIO -int esp32c3_gpio_init(void); -#endif - -/**************************************************************************** - * Name: board_wdt_init - * - * Description: - * Configure the timer driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_WATCHDOG -int board_wdt_init(void); -#endif - -/**************************************************************************** - * Name: board_spidev_initialize - * - * Description: - * Initialize SPI driver and register the /dev/spi device. - * - * Input Parameters: - * bus - The SPI bus number, used to build the device path as /dev/spiN - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_DRIVER -int board_spidev_initialize(int bus); -#endif - -/**************************************************************************** - * Name: board_spislavedev_initialize - * - * Description: - * Initialize SPI Slave driver and register the /dev/spislv device. - * - * Input Parameters: - * bus - The SPI bus number, used to build the device path as /dev/spislvN - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_SLAVE -int board_spislavedev_initialize(int bus); -#endif - -/**************************************************************************** - * Name: board_i2c_init - * - * Description: - * Configure the I2C driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_I2C_DRIVER -int board_i2c_init(void); -#endif - -/**************************************************************************** - * Name: board_twai_setup - * - * Description: - * Configure the TWAI driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_CAN -int esp32c3_twai_setup(void); -#endif - -/**************************************************************************** - * Name: board_oneshot_init - * - * Description: - * Configure the oneshot timer driver. - * - * Input Parameters: - * timer - Timer instance to be used as oneshot timer. - * resolution - Oneshot timer resolution. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ONESHOT -int board_oneshot_init(int timer, uint16_t resolution); -#endif - -/**************************************************************************** - * Name: board_bmp180_initialize - * - * Description: - * Initialize and register the BMP180 Pressure Sensor driver. - * - * Input Parameters: - * devno - The device number, used to build the device path as /dev/pressN - * busno - The I2C bus number - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_SENSORS_BMP180 -int board_bmp180_initialize(int devno, int busno); -#endif - -/**************************************************************************** - * Name: board_wlan_init - * - * Description: - * Configure the wireless subsystem. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_WIRELESS -int board_wlan_init(void); -#endif - -/**************************************************************************** - * Name: board_spiflash_init - * - * Description: - * Initialize the SPIFLASH and register the MTD device. - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_SPIFLASH -int board_spiflash_init(void); -#endif - -/**************************************************************************** - * Name: esp32c3_spiflash_encrypt_test - * - * Description: - * Test ESP32-C3 SPI Flash driver read/write with encryption. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_SPIFLASH_ENCRYPTION_TEST -void esp32c3_spiflash_encrypt_test(void); -#endif - -/**************************************************************************** - * Name: esp32c3_ledc_setup - * - * Description: - * Initialize LEDC PWM and register the PWM device. - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_LEDC -int esp32c3_pwm_setup(void); -#endif - -/**************************************************************************** - * Name: board_adc_init - * - * Description: - * Configure the ADC driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADC -int board_adc_init(void); -#endif - -/**************************************************************************** - * Name: apds9960_initialize - * - * Description: - * - * Initialize and register the APDS9960 gesture sensor. - * - * Input Parameters: - * devno - The device number, used to build the device path as /dev/gestN - * busno - The I2C bus number - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * Initialize the APDS-9960 sensor - * - ****************************************************************************/ - -#ifdef CONFIG_SENSORS_APDS9960 -int apds9960_initialize(int devno, int busno); -#endif - #endif /* __ASSEMBLY__ */ #endif /* __BOARDS_RISCV_ESP32C3_ESP32C3_DEVKIT_RUST1_SRC_ESP32C3_DEVKIT_RUST1_H */ diff --git a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_bringup.c b/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_bringup.c index 72c0f5be475..b53838446e6 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_bringup.c +++ b/boards/risc-v/esp32c3/esp32c3-devkit-rust-1/src/esp32c3_bringup.c @@ -147,7 +147,7 @@ int esp32c3_bringup(void) #ifdef CONFIG_SENSORS_APDS9960 /* Register the APDS-9960 gesture sensor */ - ret = apds9960_initialize(0, 0); + ret = board_apds9960_initialize(0, 0); if (ret < 0) { syslog(LOG_ERR, "ERROR: board_apds9960_initialize() failed: %d\n", diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/Kconfig b/boards/risc-v/esp32c3/esp32c3-devkit/Kconfig index fe9591a434f..737c22452fa 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/Kconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/Kconfig @@ -41,15 +41,6 @@ config ESP32C3_DEVKIT_RUN_IRAM bool "Run from IRAM" default n -config ESP32C3_MERGE_BINS - bool "Merge raw binary files into a single file" - default n - ---help--- - Merge the raw binary files into a single file for flashing to the - device. - This is only useful when the path to binary files (e.g. bootloader) - is provided via the ESPTOOL_BINDIR variable. - config ESP32C3_STORAGE_MTD_ENCRYPT bool "Encrypt Storage MTD partition" default y @@ -70,65 +61,4 @@ config ESP32C3_STORAGE_MTD_SIZE ---help--- MTD size in SPI Flash. -choice ESP32C3_SPIFLASH_FS - prompt "Mount SPI Flash MTD on bring-up" - default ESP32C3_SPIFLASH_SMARTFS - depends on ESP32C3_MTD - optional - ---help--- - Mount the SPI Flash MTD with the selected File System format on board - bring-up. - If not selected, the MTD will be registered as a device node on /dev. - - config ESP32C3_SPIFLASH_SMARTFS - bool "SmartFS" - select FS_SMARTFS - select MTD_SMART - depends on !ESP32C3_SECURE_FLASH_ENC_ENABLED - - comment "SmartFS not supported with Flash Encryption" - depends on ESP32C3_SECURE_FLASH_ENC_ENABLED - - config ESP32C3_SPIFLASH_NXFFS - bool "NXFFS" - select FS_NXFFS - depends on !ESP32C3_SECURE_FLASH_ENC_ENABLED - - comment "NXFFS not supported with Flash Encryption" - depends on ESP32C3_SECURE_FLASH_ENC_ENABLED - - config ESP32C3_SPIFLASH_SPIFFS - bool "SPIFFS" - select FS_SPIFFS - depends on !ESP32C3_SECURE_FLASH_ENC_ENABLED - - comment "SPIFFS not supported with Flash Encryption" - depends on ESP32C3_SECURE_FLASH_ENC_ENABLED - - config ESP32C3_SPIFLASH_LITTLEFS - bool "LittleFS" - select FS_LITTLEFS - - config ESP32C3_SPIFLASH_MTD_CONFIG - bool "Non-volatile storage" - -endchoice - -config ESP32C3_SPIFLASH_FS_MOUNT_PT - string "File-system Mount Point" - depends on ESP32C3_SPIFLASH_LITTLEFS - default "/data" - -if LCD_ST7735 || LCD_ST7789 || LCD_GC9A01 - -config ESP32C3_LCD_RSTPIN - int "LCD reset pin" - default 9 - -config ESP32C3_LCD_BLPIN - int "LCD backlight pin" - default 18 - -endif # LCD_ST7735 || LCD_ST7789 || LCD_GC9A01 - endif # ARCH_BOARD_ESP32C3_DEVKIT diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/adc/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/adc/defconfig index 34a593896eb..da5ee733ced 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/adc/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/adc/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/autopm/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/autopm/defconfig index dc26562eb32..bae71a4fa42 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/autopm/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/autopm/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/ble/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/ble/defconfig index bf74f07abdc..33db79264f8 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/ble/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/ble/defconfig @@ -8,6 +8,7 @@ CONFIG_ALLOW_BSD_COMPONENTS=y CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/bmp180/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/bmp180/defconfig index e9c8ffb7fb3..00f1058f1d2 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/bmp180/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/bmp180/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/cxx/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/cxx/defconfig index c9f8647af42..476ee9715f0 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/cxx/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/cxx/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/efuse/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/efuse/defconfig index c4f66fcdf8b..fa60cc64f36 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/efuse/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/efuse/defconfig @@ -13,6 +13,7 @@ # CONFIG_NSH_DISABLE_MW is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/elf/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/elf/defconfig index 615b9a340b1..8768478fc55 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/elf/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/elf/defconfig @@ -8,6 +8,7 @@ # CONFIG_NSH_DISABLE_LOSMART is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/gpio/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/gpio/defconfig index 679b5766356..76522b4013f 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/gpio/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/gpio/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/knsh/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/knsh/defconfig index 32aa9889598..8676826ae85 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/knsh/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/knsh/defconfig @@ -11,6 +11,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y @@ -43,7 +44,7 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_NSH_STRERROR=y CONFIG_NUTTX_USERSPACE=0x3c080018 -CONFIG_PASS1_BUILDIR="boards/risc-v/esp32c3/esp32c3-devkit/kernel" +CONFIG_PASS1_BUILDIR="boards/risc-v/esp32c3/common/kernel" CONFIG_PREALLOC_TIMERS=0 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/lvgl/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/lvgl/defconfig index 0cd89e1adbc..bbcb3473a2e 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/lvgl/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/lvgl/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/mcuboot_slot_confirm/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/mcuboot_slot_confirm/defconfig index 323dbc4993e..45cd0adccbd 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/mcuboot_slot_confirm/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/mcuboot_slot_confirm/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/module/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/module/defconfig index abc01a4c159..cd9b17b499e 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/module/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/module/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/nvcfgdata/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/nvcfgdata/defconfig index 5a8fa6a3d4b..f4f4a3c8dc2 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/nvcfgdata/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/nvcfgdata/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/oneshot/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/oneshot/defconfig index 8d5fb32a024..8e675bb801c 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/oneshot/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/oneshot/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/ostest/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/ostest/defconfig index 207214c8065..019a19b12b2 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/ostest/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/ostest/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/pm/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/pm/defconfig index 2675c8d9872..b2a6060624b 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/pm/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/pm/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/pwm/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/pwm/defconfig index 9dea4cca62a..d2e1006cd24 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/pwm/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/pwm/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/random/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/random/defconfig index 5238d2f6dc3..2d90c92b0e1 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/random/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/random/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/romfs/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/romfs/defconfig index 9bb798c7ab4..ca44d522be3 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/romfs/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/romfs/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/rtc/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/rtc/defconfig index e60c1b7906c..a586b31abf9 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/rtc/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/rtc/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/sotest/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/sotest/defconfig index 8e0df81b771..6e611e63dad 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/sotest/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/sotest/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/spiflash/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/spiflash/defconfig index 6d9cfe0bc4a..2abf0e7fb3b 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/spiflash/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/spiflash/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/sta_softap/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/sta_softap/defconfig index c31c0ae0fcf..8a8959be088 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/sta_softap/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/sta_softap/defconfig @@ -11,6 +11,7 @@ CONFIG_ALLOW_BSD_COMPONENTS=y CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/tickless/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/tickless/defconfig index c3328d76527..6b77b996545 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/tickless/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/tickless/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/timer/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/timer/defconfig index 0211314da54..286b321e781 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/timer/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/timer/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/twai/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/twai/defconfig index 2fa7de36b09..9408d0f920f 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/twai/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/twai/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/uid/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/uid/defconfig index 26082f6e2f5..edac5f44f10 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/uid/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/uid/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/usbconsole/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/usbconsole/defconfig index 5aa8adc2bd4..6af88da4054 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/usbconsole/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/usbconsole/defconfig @@ -11,6 +11,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/wapi/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/wapi/defconfig index de56a90bd4b..fb48072532d 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/wapi/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/wapi/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/watchdog/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/watchdog/defconfig index e72ba4fcaec..f7654de37ef 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/watchdog/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/watchdog/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/configs/watcher/defconfig b/boards/risc-v/esp32c3/esp32c3-devkit/configs/watcher/defconfig index 1240d2070e8..ccf43f7b8cf 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/configs/watcher/defconfig +++ b/boards/risc-v/esp32c3/esp32c3-devkit/configs/watcher/defconfig @@ -10,6 +10,7 @@ # CONFIG_NSH_CMDPARMS is not set CONFIG_ARCH="risc-v" CONFIG_ARCH_BOARD="esp32c3-devkit" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y CONFIG_ARCH_CHIP="esp32c3" CONFIG_ARCH_CHIP_ESP32C3=y diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/Make.defs b/boards/risc-v/esp32c3/esp32c3-devkit/src/Make.defs new file mode 100644 index 00000000000..a92896e7ca7 --- /dev/null +++ b/boards/risc-v/esp32c3/esp32c3-devkit/src/Make.defs @@ -0,0 +1,54 @@ +############################################################################# +# boards/risc-v/esp32c3/esp32c3-devkit/src/Makefile +# +# 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)/Make.defs + +CSRCS = esp32c3_boot.c esp32c3_bringup.c + +ifeq ($(CONFIG_BOARDCTL),y) + CSRCS += esp32c3_appinit.c + + ifeq ($(CONFIG_BOARDCTL_RESET),y) + CSRCS += esp32c3_reset.c + endif +endif + +ifeq ($(CONFIG_DEV_GPIO),y) + CSRCS += esp32c3_gpio.c +endif + +ifeq ($(CONFIG_BOARDCTL_IOCTL),y) + CSRCS += esp32c3_ioctl.c +endif + +ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y) + CSRCS += esp32c3_uid.c +endif + +ifeq ($(CONFIG_NSH_ROMFSETC),y) +ifneq ($(CONFIG_NSH_CUSTOMROMFS),y) + RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS + RCRAWS = etc/group etc/passwd +endif +endif + +DEPPATH += --dep-path board +VPATH += :board +CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3-devkit.h b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3-devkit.h index 582eba795c7..860c090d66a 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3-devkit.h +++ b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3-devkit.h @@ -79,204 +79,5 @@ int esp32c3_bringup(void); int esp32c3_gpio_init(void); #endif -/**************************************************************************** - * Name: board_wdt_init - * - * Description: - * Configure the timer driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_WATCHDOG -int board_wdt_init(void); -#endif - -/**************************************************************************** - * Name: board_spidev_initialize - * - * Description: - * Initialize SPI driver and register the /dev/spi device. - * - * Input Parameters: - * bus - The SPI bus number, used to build the device path as /dev/spiN - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_DRIVER -int board_spidev_initialize(int bus); -#endif - -/**************************************************************************** - * Name: board_spislavedev_initialize - * - * Description: - * Initialize SPI Slave driver and register the /dev/spislv device. - * - * Input Parameters: - * bus - The SPI bus number, used to build the device path as /dev/spislvN - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_SLAVE -int board_spislavedev_initialize(int bus); -#endif - -/**************************************************************************** - * Name: board_i2c_init - * - * Description: - * Configure the I2C driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_I2C_DRIVER -int board_i2c_init(void); -#endif - -/**************************************************************************** - * Name: board_twai_setup - * - * Description: - * Configure the TWAI driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_CAN -int esp32c3_twai_setup(void); -#endif - -/**************************************************************************** - * Name: board_oneshot_init - * - * Description: - * Configure the oneshot timer driver. - * - * Input Parameters: - * timer - Timer instance to be used as oneshot timer. - * resolution - Oneshot timer resolution. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ONESHOT -int board_oneshot_init(int timer, uint16_t resolution); -#endif - -/**************************************************************************** - * Name: board_bmp180_initialize - * - * Description: - * Initialize and register the BMP180 Pressure Sensor driver. - * - * Input Parameters: - * devno - The device number, used to build the device path as /dev/pressN - * busno - The I2C bus number - * - * Returned Value: - * Zero (OK) on success; a negated errno value on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_SENSORS_BMP180 -int board_bmp180_initialize(int devno, int busno); -#endif - -/**************************************************************************** - * Name: board_wlan_init - * - * Description: - * Configure the wireless subsystem. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_WIRELESS -int board_wlan_init(void); -#endif - -/**************************************************************************** - * Name: board_spiflash_init - * - * Description: - * Initialize the SPIFLASH and register the MTD device. - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_SPIFLASH -int board_spiflash_init(void); -#endif - -/**************************************************************************** - * Name: esp32c3_spiflash_encrypt_test - * - * Description: - * Test ESP32-C3 SPI Flash driver read/write with encryption. - * - * Input Parameters: - * None - * - * Returned Value: - * None. - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_SPIFLASH_ENCRYPTION_TEST -void esp32c3_spiflash_encrypt_test(void); -#endif - -/**************************************************************************** - * Name: esp32c3_ledc_setup - * - * Description: - * Initialize LEDC PWM and register the PWM device. - * - ****************************************************************************/ - -#ifdef CONFIG_ESP32C3_LEDC -int esp32c3_pwm_setup(void); -#endif - -/**************************************************************************** - * Name: board_adc_init - * - * Description: - * Configure the ADC driver. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_ADC -int board_adc_init(void); -#endif - #endif /* __ASSEMBLY__ */ #endif /* __BOARDS_RISCV_ESP32C3_ESP32C3_DEVKIT_SRC_ESP32C3_DEVKIT_H */ diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c index b7b5f5e8fef..c46cf07baf9 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c +++ b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c @@ -40,7 +40,19 @@ #include "esp32c3_wlan.h" #include "esp32c3_spiflash.h" #include "esp32c3_partition.h" + #include "esp32c3-devkit.h" +#include "esp32c3_board_adc.h" +#include "esp32c3_board_bmp180.h" +#include "esp32c3_board_i2c.h" +#include "esp32c3_board_ledc.h" +#include "esp32c3_board_oneshot.h" +#include "esp32c3_board_spiflash.h" +#include "esp32c3_board_spidev.h" +#include "esp32c3_board_spislavedev.h" +#include "esp32c3_board_twai.h" +#include "esp32c3_board_wdt.h" +#include "esp32c3_board_wlan.h" #ifdef CONFIG_SPI # include "esp32c3_spi.h" @@ -224,10 +236,10 @@ int esp32c3_bringup(void) /* Initialize TWAI and register the TWAI driver. */ - ret = esp32c3_twai_setup(); + ret = board_twai_setup(); if (ret < 0) { - syslog(LOG_ERR, "ERROR: esp32c3_twai_setup failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: board_twai_setup failed: %d\n", ret); } #endif @@ -334,10 +346,10 @@ int esp32c3_bringup(void) #endif /* CONFIG_ESP32C3_WIRELESS */ #ifdef CONFIG_ESP32C3_LEDC - ret = esp32c3_pwm_setup(); + ret = board_ledc_setup(); if (ret < 0) { - syslog(LOG_ERR, "ERROR: esp32c3_pwm_setup() failed: %d\n", ret); + syslog(LOG_ERR, "ERROR: board_ledc_setup() failed: %d\n", ret); } #endif /* CONFIG_ESP32C3_LEDC */