stm32f7: Add support to ProjectLab base board

This commit is contained in:
Alan Carvalho de Assis 2023-08-27 19:05:48 -03:00 committed by Petro Karashchenko
parent 69a0c28557
commit b41f526fa6
8 changed files with 276 additions and 17 deletions

View File

@ -64,4 +64,14 @@ config MEADOW_PWR_MGMT_SUPPORT
default n
config BOARD_MEADOW_PROJECTLAB
bool "ProjectLab Mainboard"
default n
select ARCH_BOARD_COMMON
---help---
ProjectLab is a main board with a Meadow F7Micro
module soldered on it. The projectLab has a lot of
sensors, RS485, a 3.2" TFT Display, and Grove, Qwiic
and mikroBUS connectors for expansion.
endif # ARCH_BOARD_MEADOW_F7MICRO

View File

@ -0,0 +1,80 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_STM32F7_USE_LEGACY_PINMAP is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f777zit6-meadow"
CONFIG_ARCH_BOARD_MEADOW_F7MICRO=y
CONFIG_ARCH_CHIP="stm32f7"
CONFIG_ARCH_CHIP_STM32F777ZI=y
CONFIG_ARCH_CHIP_STM32F7=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_DCACHE=y
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
CONFIG_ARMV7M_DTCM=y
CONFIG_ARMV7M_ICACHE=y
CONFIG_BCH=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=43103
CONFIG_BOARD_MEADOW_PROJECTLAB=y
CONFIG_BUILTIN=y
CONFIG_CDCACM=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_CDCACM_PRODUCTID=0x0001
CONFIG_CDCACM_PRODUCTSTR="Wilderness Labs"
CONFIG_CDCACM_VENDORID=0x2E6A
CONFIG_CDCACM_VENDORSTR="Meadow F7 Micro"
CONFIG_CRYPTO=y
CONFIG_CRYPTO_RANDOM_POOL=y
CONFIG_DEBUG_ERROR=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_SENSORS=y
CONFIG_DEBUG_SENSORS_ERROR=y
CONFIG_DEBUG_SENSORS_INFO=y
CONFIG_DEBUG_SENSORS_WARN=y
CONFIG_DEBUG_WARN=y
CONFIG_DEV_URANDOM=y
CONFIG_DEV_URANDOM_RANDOM_POOL=y
CONFIG_FS_LITTLEFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MM_REGIONS=3
CONFIG_MTD=y
CONFIG_MTD_BYTE_WRITE=y
CONFIG_MTD_PARTITION=y
CONFIG_MTD_SECT512=y
CONFIG_MTD_W25QXXXJV=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=245760
CONFIG_RAM_START=0x20010000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SENSORS=y
CONFIG_SENSORS_BH1750FVI=y
CONFIG_SENSORS_BMI270=y
CONFIG_SENSORS_BMI270_I2C=y
CONFIG_SPI=y
CONFIG_START_DAY=14
CONFIG_STM32F7_I2C1=y
CONFIG_STM32F7_OTGFS=y
CONFIG_STM32F7_QUADSPI=y
CONFIG_STM32F7_USART1=y
CONFIG_SYSTEM_FLASH_ERASEALL=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=64
CONFIG_USBDEV=y
CONFIG_W25QXXXJV_QSPI_FREQUENCY=64000000

View File

@ -1,5 +1,5 @@
/****************************************************************************
* boards/arm/stm32f7/stm32f777zit6-meadow/scripts/flash.ld
* boards/arm/stm32f7/stm32f777zit6-meadow/scripts/ld.script
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,22 +1,22 @@
############################################################################
# ##############################################################################
# boards/arm/stm32f7/stm32f77zit6-meadow/src/CMakeLists.txt
#
# 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
# 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
# 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.
# License for the specific language governing permissions and limitations under
# the License.
#
############################################################################
# ##############################################################################
set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c)
@ -27,7 +27,7 @@ else()
endif()
if(CONFIG_ARCH_BUTTONS)
list(APPEND SRCS stm32_buttons.c)
list(APPEND SRCS stm32_buttons.c)
endif()
if(CONFIG_BOARDCTL)
@ -57,4 +57,4 @@ endif()
target_sources(board PRIVATE ${SRCS})
set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld")
set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script")

View File

@ -0,0 +1,84 @@
/****************************************************************************
* boards/arm/stm32f7/stm32f777zit6-meadow/src/board_projlab.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/fs/fs.h>
#include "stm32_bh1750.h"
#include "stm32_bmi270.h"
#include "stm32f777zit6-meadow.h"
/****************************************************************************
* Preprocessor definitions
****************************************************************************/
#if !defined(CONFIG_SENSORS_BH1750FVI)
# error ProjectLab boards needs Light Sensor BH1750FVI enabled.
#endif
#if !defined(CONFIG_SENSORS_BMI270_I2C)
# error ProjectLab boards needs Inertial Sensor BMI270 enabled.
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: init_projectlab
*
* Description:
* Initialize the fixed devices from ProjectLab board
*
****************************************************************************/
int init_projectlab(void)
{
int ret = OK;
/* Initialize Light Sensor BH1750 */
ret = board_bh1750_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: init BH1750 failed: %d\n", ret);
}
/* Initialize Accelerometer BMI270 */
ret = board_bmi270_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: init BMI270 failed: %d\n", ret);
}
return ret;
}

View File

@ -134,8 +134,7 @@ void board_late_initialize(void)
qspi = stm32f7_qspi_initialize(0);
if (!qspi)
{
syslog(LOG_ERR, "ERROR: sam_qspi_initialize muiled\n");
return;
syslog(LOG_ERR, "ERROR: sam_qspi_initialize failed\n");
}
mtd = w25qxxxjv_initialize(qspi, true);
@ -185,6 +184,8 @@ void board_late_initialize(void)
*/
board_app_initialize();
#else
stm32_bringup();
#endif
}
#endif

View File

@ -31,13 +31,71 @@
#include <errno.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h>
#include "stm32f777zit6-meadow.h"
/****************************************************************************
* Private Functions
****************************************************************************/
#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL)
static void stm32_i2c_register(int bus)
{
struct i2c_master_s *i2c;
int ret;
i2c = stm32_i2cbus_initialize(bus);
if (i2c == NULL)
{
syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus);
}
else
{
ret = i2c_register(i2c, bus);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n",
bus, ret);
stm32_i2cbus_uninitialize(i2c);
}
}
}
#endif
/****************************************************************************
* Name: stm32_i2ctool
*
* Description:
* Register I2C drivers for the I2C tool.
*
****************************************************************************/
#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL)
static void stm32_i2ctool(void)
{
stm32_i2c_register(1);
#if 0
stm32_i2c_register(1);
stm32_i2c_register(2);
#endif
}
#else
# define stm32_i2ctool()
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_i2c_register
*
* Description:
* Register one I2C drivers for the I2C tool.
*
****************************************************************************/
/****************************************************************************
* Name: stm32_bringup
*
@ -56,6 +114,10 @@ int stm32_bringup(void)
{
int ret = OK;
#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL)
stm32_i2ctool();
#endif
#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */
@ -68,7 +130,7 @@ int stm32_bringup(void)
#endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
/* initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
@ -77,5 +139,15 @@ int stm32_bringup(void)
}
#endif
#ifdef CONFIG_BOARD_MEADOW_PROJECTLAB
/* Initialize all devices in the ProjectLab */
ret = init_projectlab();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: ProjectLab init failed: %d\n", ret);
}
#endif
return ret;
}

View File

@ -154,6 +154,18 @@ void stm32_sdram_initialize(void);
void stm32_disablefmc(void);
#endif
/****************************************************************************
* Name: init_projectlab
*
* Description:
* Initialize the fixed devices from ProjectLab board
*
****************************************************************************/
#ifdef CONFIG_BOARD_MEADOW_PROJECTLAB
int init_projectlab(void);
#endif
void stm32_quadspi_init(void);
#endif /* __ASSEMBLY__ */