Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into 1220

This commit is contained in:
wlyu
2021-12-31 23:39:20 +08:00
221 changed files with 15553 additions and 1682 deletions

View File

@@ -0,0 +1,224 @@
############################################################################
# apps/Makefile
#
# Copyright (C) 2011 Uros Platise. All rights reserved.
# Copyright (C) 2011-2014, 2018-2019 Gregory Nutt. All rights reserved.
# Authors: Uros Platise <uros.platise@isotel.eu>
# Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
export APPDIR = $(CURDIR)
include $(APPDIR)/Make.defs
include $(APPDIR)/../../../APP_Framework/Make.defs
# Symbol table for loadable apps.
SYMTABSRC = symtab_apps.c
SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
# Build targets
# We first remove libapps.a before letting the other rules add objects to it
# so that we ensure libapps.a does not contain objects from prior build
all:
$(RM) $(BIN)
$(MAKE) $(BIN)
.PHONY: import install dirlinks export .depdirs preconfig depend clean distclean
.PHONY: context clean_context context_all register register_all
.PRECIOUS: $(BIN)
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),all)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),install)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),context)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),register)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),depend)))
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
$(MKDEP): $(TOPDIR)/tools/mkdeps.c
$(HOSTCC) $(HOSTINCLUDES) $(HOSTCFLAGS) $< -o $@
$(INCDIR): $(TOPDIR)/tools/incdir.c
$(HOSTCC) $(HOSTINCLUDES) $(HOSTCFLAGS) $< -o $@
IMPORT_TOOLS = $(MKDEP) $(INCDIR)
# In the KERNEL build, we must build and install all of the modules. No
# symbol table is needed
ifeq ($(CONFIG_BUILD_KERNEL),y)
install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
.import: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) $(MAKE) install
import: $(IMPORT_TOOLS)
$(Q) $(MAKE) context TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) register TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) depend TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
else
# In FLAT and protected modes, the modules have already been created. A
# symbol table is required.
ifeq ($(CONFIG_BUILD_LOADABLE),)
$(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) for app in ${CONFIGURED_APPS}; do \
$(MAKE) -C "$${app}" archive ; \
done
else
$(SYMTABSRC): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) for app in ${CONFIGURED_APPS}; do \
$(MAKE) -C "$${app}" archive ; \
done
$(Q) $(MAKE) install
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) >$@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
$(SYMTABOBJ): %$(OBJEXT): %.c
$(call COMPILE, -fno-lto $<, $@)
$(BIN): $(SYMTABOBJ)
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
$(call ARCHIVE_ADD, "${shell cygpath -w $(BIN)}", $^)
else
$(call ARCHIVE_ADD, $(BIN), $^)
endif
endif # !CONFIG_BUILD_LOADABLE
install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
# Link nuttx
HEAD_OBJ += $(wildcard $(APPDIR)$(DELIM)import$(DELIM)startup$(DELIM)*$(OBJEXT))
HEAD_OBJ += $(wildcard $(APPDIR)$(DELIM)builtin$(DELIM)*$(OBJEXT))
.import: $(BIN) install
$(Q) echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LDLIBPATH) $(EXTRA_LIBPATHS) \
-L$(APPDIR)$(DELIM)import$(DELIM)scripts -T$(LDNAME) \
-o nuttx$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) $(LDSTARTGROUP) \
$(BIN) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifeq ($(CONFIG_INTELHEX_BINARY),y)
$(Q) echo "CP: nuttx.hex"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex nuttx$(EXEEXT) nuttx.hex
endif
ifeq ($(CONFIG_RAW_BINARY),y)
$(Q) echo "CP: nuttx.bin"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx$(EXEEXT) nuttx.bin
endif
$(call POSTBUILD, $(APPDIR))
import: $(IMPORT_TOOLS)
$(Q) $(MAKE) context TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) register TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) depend TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
endif # CONFIG_BUILD_KERNEL
dirlinks:
$(Q) $(MAKE) -C platform dirlinks
context_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_context)
register_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_register)
context:
$(Q) $(MAKE) context_all
$(Q) $(MAKE) register_all
Kconfig:
$(foreach SDIR, $(CONFIGDIRS), $(call MAKE_template,$(SDIR),preconfig))
$(Q) $(MKKCONFIG)
preconfig: Kconfig
export:
ifneq ($(EXPORTDIR),)
ifneq ($(BUILTIN_REGISTRY),)
$(Q) mkdir -p "${EXPORTDIR}"/registry || exit 1; \
for f in "${BUILTIN_REGISTRY}"/*.bdat "${BUILTIN_REGISTRY}"/*.pdat ; do \
[ -f "$${f}" ] && cp -f "$${f}" "${EXPORTDIR}"/registry ; \
done
endif
endif
.depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)
.depend: Makefile .depdirs
$(Q) touch $@
depend: .depend
clean_context:
$(Q) $(MAKE) -C platform clean_context
$(Q) $(MAKE) -C builtin clean_context
clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
$(call DELFILE, $(SYMTABSRC))
$(call DELFILE, $(SYMTABOBJ))
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BINDIR))
$(call CLEAN)
distclean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_distclean)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) ( if exist external ( \
echo ********************************************************" \
echo * The external directory/link must be removed manually *" \
echo ********************************************************" \
)
else
$(Q) ( if [ -e external ]; then \
echo "********************************************************"; \
echo "* The external directory/link must be removed manually *"; \
echo "********************************************************"; \
fi; \
)
endif
$(call DELFILE, .depend)
$(call DELFILE, $(SYMTABSRC))
$(call DELFILE, $(SYMTABOBJ))
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BINDIR))
$(call CLEAN)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,131 @@
############################################################################
# apps/nshlib/Makefile
#
# Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
include $(APPDIR)/Make.defs
# NSH Library
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_script.c nsh_system.c
CSRCS += nsh_command.c nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_mmcmds.c
CSRCS += nsh_timcmds.c nsh_envcmds.c nsh_syscmds.c nsh_dbgcmds.c nsh_Applicationscmd.c
ifeq ($(CONFIG_FILE_STREAM),y)
CSRCS += nsh_session.c
ifeq ($(CONFIG_NSH_CONSOLE_LOGIN),y)
CSRCS += nsh_login.c
endif
else
CSRCS += nsh_stdsession.c
ifeq ($(CONFIG_NSH_CONSOLE_LOGIN),y)
CSRCS += nsh_stdlogin.c
endif
endif
CSRCS += nsh_fsutils.c
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
CSRCS += nsh_builtin.c
endif
ifeq ($(CONFIG_NSH_FILE_APPS),y)
CSRCS += nsh_fileapps.c
endif
ifeq ($(CONFIG_NSH_VARS),y)
CSRCS += nsh_vars.c
endif
ifeq ($(CONFIG_NSH_ROMFSETC),y)
CSRCS += nsh_romfsetc.c
endif
ifeq ($(CONFIG_NET),y)
CSRCS += nsh_netcmds.c
ifeq ($(CONFIG_NET_ROUTE),y)
CSRCS += nsh_routecmds.c
endif
endif
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += nsh_mntcmds.c
endif
ifeq ($(CONFIG_MODULE),y)
ifneq ($(CONFIG_NSH_DISABLE_MODCMDS),y)
CSRCS += nsh_modcmds.c
endif
endif
ifeq ($(CONFIG_NSH_CONSOLE),y)
CSRCS += nsh_consolemain.c
endif
ifneq ($(CONFIG_NSH_DISABLE_PRINTF),y)
CSRCS += nsh_printf.c
endif
ifeq ($(CONFIG_NSH_TELNET),y)
CSRCS += nsh_telnetd.c
ifeq ($(CONFIG_NSH_TELNET_LOGIN),y)
CSRCS += nsh_telnetlogin.c
endif
endif
ifneq ($(CONFIG_NSH_DISABLESCRIPT),y)
CSRCS += nsh_test.c
endif
ifeq ($(CONFIG_USBDEV),y)
CSRCS += nsh_usbconsole.c
endif
ifeq ($(CONFIG_NSH_ALTCONDEV),y)
CSRCS += nsh_altconsole.c
endif
ifeq ($(CONFIG_NSH_USBDEV_TRACE),y)
CSRCS += nsh_usbtrace.c
endif
ifeq ($(CONFIG_NETUTILS_CODECS),y)
CSRCS += nsh_codeccmd.c
endif
ifeq ($(CONFIG_NSH_LOGIN_PASSWD),y)
CSRCS += nsh_passwdcmds.c
endif
include $(APPDIR)/Application.mk

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
/****************************************************************************
* apps/nshlib/nsh_Applicationscmd.c
*
* Copyright (C) 2016 Alan Carvalho de Assis. All rights reserved.
* Author: Alan Carvalho de Assis <acassis@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <libgen.h>
#include <errno.h>
#include "nsh.h"
#include "nsh_console.h"
extern int FrameworkInit(void);
/****************************************************************************
* Name: cmd_Co2Zg09
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_CO2_ZG09) && !defined(CONFIG_NSH_DISABLE_CO2ZG09)
extern void Co2Zg09(void);
int cmd_Co2Zg09(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
printf("Hello, world!\n");
FrameworkInit();
Co2Zg09();
return 0;
}
#endif
/****************************************************************************
* Name: cmd_Pm10Ps5308
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_PM1_0_PS5308) && !defined(CONFIG_NSH_DISABLE_PM1_0PS5308)
extern void Pm10Ps5308(void);
int cmd_Pm10Ps5308(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
printf("Hello, world!\n");
FrameworkInit();
Pm10Ps5308();
return 0;
}
#endif
/****************************************************************************
* Name: cmd_Pm25Ps5308
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_PM2_5_PS5308) && !defined(CONFIG_NSH_DISABLE_PM2_5PS5308)
extern void Pm25Ps5308(void);
int cmd_Pm25Ps5308(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
printf("Hello, world!\n");
FrameworkInit();
Pm25Ps5308();
return 0;
}
#endif
/****************************************************************************
* Name: cmd_Pm10Ps5308
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_PM10_PS5308) && !defined(CONFIG_NSH_DISABLE_PM10PS5308)
extern void Pm100Ps5308(void);
int cmd_Pm100Ps5308(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
printf("Hello, world!\n");
FrameworkInit();
Pm100Ps5308();
return 0;
}
#endif
/****************************************************************************
* Name: cmd_VoiceD124
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_VOICE_D124) && !defined(CONFIG_NSH_DISABLE_VOICED124)
extern void VoiceD124(void);
int cmd_VoiceD124(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
printf("Hello, world!\n");
FrameworkInit();
VoiceD124();
return 0;
}
#endif
/****************************************************************************
* Name: cmd_TempHs300x
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_TEMPERATURE_HS300X) && !defined(CONFIG_NSH_DISABLE_TEMPHS300X)
extern void TempHs300x(void);
int cmd_TempHs300x(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
printf("Hello, world!\n");
FrameworkInit();
TempHs300x();
return 0;
}
#endif
/****************************************************************************
* Name: cmd_HumiHs300x
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_HUMIDITY_HS300X) && !defined(CONFIG_NSH_DISABLE_HUMIHS300X)
extern void HumiHs300x(void);
int cmd_HumiHs300x(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
printf("Hello, world!\n");
FrameworkInit();
HumiHs300x();
return 0;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
export current=$(pwd)
export nuttx=$current/..
export top=$current/../../..
chmod -R +x $top
find $top -name Kconfig -exec dos2unix -q {} \;
cp -rf $current/nuttx $nuttx
cp -rf $current/apps $nuttx
cd ../nuttx

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
############################################################################
# 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.
#
############################################################################
# Check if the system has been configured
ifeq ($(wildcard .config),)
.DEFAULT default:
@echo "NuttX has not been configured!"
@echo "To configure the project:"
@echo " tools/configure.sh <config>"
@echo "For a list of available configurations:"
@echo " tools/configure.sh -L"
else
include .config
# Build any necessary tools needed early in the build.
# incdir - Is needed immediately by all Make.defs file.
TOPDIR := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
DUMMY := ${shell $(MAKE) -C tools -f Makefile.host incdir \
INCDIR="$(TOPDIR)/tools/incdir.sh"}
# Include the correct Makefile for the selected architecture.
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
include tools/Makefile.win
else
export KERNEL_ROOT = $(CURDIR)
include tools/Makefile.unix
endif
endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
/****************************************************************************
* boards/arm/stm32/common/include/stm32_hs300x.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 __STM32_HS300X_H
#define __STM32_HS300X_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_hs300x_initialize
*
* Description:
* Initialize and register the hs300x Temperature Sensor driver.
*
* Input Parameters:
* devno - The device number
* busno - The I2C bus number
* used to build the device path as /dev/i2c1_dev0
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int board_hs300x_initialize(int devno, int busno);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif // __STM32_HS300X_H

View File

@@ -0,0 +1,131 @@
#############################################################################
# boards/arm/stm32/common/src/Make.defs
#
# 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.
#
#############################################################################
ifeq ($(CONFIG_SENSORS_BMP180),y)
CSRCS += stm32_bmp180.c
endif
ifeq ($(CONFIG_LEDS_APA102),y)
CSRCS += stm32_apa102.c
endif
ifeq ($(CONFIG_WS2812),y)
CSRCS += stm32_ws2812.c
endif
ifeq ($(CONFIG_SENSORS_MAX6675),y)
CSRCS += stm32_max6675.c
endif
ifeq ($(CONFIG_SENSORS_VEML6070),y)
CSRCS += stm32_veml6070.c
endif
ifeq ($(CONFIG_INPUT_NUNCHUCK),y)
CSRCS += stm32_nunchuck.c
endif
ifeq ($(CONFIG_AUDIO_TONE),y)
CSRCS += stm32_tone.c
endif
ifeq ($(CONFIG_LCD_BACKPACK),y)
CSRCS += stm32_lcd_backpack.c
endif
ifeq ($(CONFIG_LCD_SSD1306),y)
CSRCS += stm32_ssd1306.c
endif
ifeq ($(CONFIG_SENSORS_LM75),y)
CSRCS += stm32_lm75.c
endif
ifeq ($(CONFIG_WL_NRF24L01),y)
CSRCS += stm32_nrf24l01.c
endif
ifeq ($(CONFIG_SENSORS_HCSR04),y)
CSRCS += stm32_hcsr04.c
endif
ifeq ($(CONFIG_SENSORS_APDS9960),y)
CSRCS += stm32_apds9960.c
endif
ifeq ($(CONFIG_SENSORS_ZEROCROSS),y)
CSRCS += stm32_zerocross.c
endif
ifeq ($(CONFIG_SENSORS_QENCODER),y)
CSRCS += stm32_qencoder.c
endif
ifeq ($(CONFIG_SENSORS_INA219),y)
CSRCS += stm32_ina219.c
endif
ifeq ($(CONFIG_SENSORS_L3GD20),y)
CSRCS += stm32_l3gd20.c
endif
ifeq ($(CONFIG_SENSORS_MPL115A),y)
CSRCS += stm32_mpl115a.c
endif
ifeq ($(CONFIG_SENSORS_DHTXX),y)
CSRCS += stm32_dhtxx.c
endif
ifeq ($(CONFIG_SENSORS_XEN1210),y)
CSRCS += stm32_xen1210.c
endif
ifeq ($(CONFIG_SENSORS_BH1750FVI),y)
CSRCS += stm32_bh1750.c
endif
ifeq ($(CONFIG_SENSORS_MLX90614),y)
CSRCS += stm32_mlx90614.c
endif
ifeq ($(CONFIG_SENSORS_MAX31855),y)
CSRCS += stm32_max31855.c
endif
ifeq ($(CONFIG_LIS3DSH),y)
CSRCS += stm32_lis3dsh.c
endif
ifeq ($(CONFIG_BOARD_STM32_IHM07M1),y)
CSRCS += stm32_ihm07m1.c
endif
ifeq ($(CONFIG_BOARD_STM32_IHM08M1),y)
CSRCS += stm32_ihm08m1.c
endif
ifeq ($(CONFIG_SENSORS_HS300X),y)
CSRCS += stm32_hs300x.c
endif
DEPPATH += --dep-path src
VPATH += :src
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src)

View File

@@ -0,0 +1,103 @@
/****************************************************************************
* boards/arm/stm32/common/src/stm32_hs300x.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 <stdio.h>
#include <errno.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/sensors/hs300x.h>
#include "stm32.h"
#include "stm32_i2c.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_hs300x_initialize
*
* Description:
* Initialize and register the hs300x Temperature Sensor driver.
*
* Input Parameters:
* devno - The device number
* busno - The I2C bus number
* used to build the device path as /dev/i2c1_dev0
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int board_hs300x_initialize(int devno, int busno)
{
FAR struct i2c_master_s *i2c;
char devpath[20];
int ret;
sninfo("Initializing HS300x!\n");
/* Get an instance of the I2C interface */
i2c = stm32_i2cbus_initialize(busno);
if (!i2c)
{
return -ENODEV;
}
/* Then register the temperature sensor,such as /dev/i2c1_dev0. */
snprintf(devpath, 20, "/dev/i2c%d_dev%d", busno, devno);
ret = hs300x_register(devpath, i2c, CONFIG_SENSOR_DEVICE_HS300X_I2C_ADDR);
if (ret < 0)
{
stm32_i2cbus_uninitialize(i2c);
}
return ret;
}

View File

@@ -0,0 +1,99 @@
############################################################################
# boards/arm/stm32/stm32f4discovery/scripts/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
LDSCRIPT = ld.script
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN_CLANGL),y)
ARCHCFLAGS += -nostdlib -ffreestanding
ARCHCXXFLAGS += -nostdlib -ffreestanding
else
ARCHCFLAGS += -funwind-tables
ARCHCXXFLAGS += -fno-rtti -funwind-tables
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += -fno-strength-reduce
endif
endif
CFLAGS := $(APPPATHS) $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
# ELF module definitions
CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs
LDELFFLAGS = -r -e main
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDELFFLAGS += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld}"
else
LDELFFLAGS += -T $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld
endif
ifneq ($(CROSSDEV),arm-nuttx-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

View File

@@ -0,0 +1,551 @@
/****************************************************************************
* boards/arm/stm32/stm32f4discovery/src/stm32_bringup.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 <stdbool.h>
#include <stdio.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_USBMONITOR
# include <nuttx/usb/usbmonitor.h>
#endif
#include "stm32.h"
#include "stm32_romfs.h"
#ifdef CONFIG_STM32_OTGFS
# include "stm32_usbhost.h"
#endif
#ifdef CONFIG_INPUT_BUTTONS
# include <nuttx/input/buttons.h>
#endif
#ifdef CONFIG_USERLED
# include <nuttx/leds/userled.h>
#endif
#ifdef CONFIG_RNDIS
# include <nuttx/usb/rndis.h>
#endif
#include "stm32f4discovery.h"
/* Conditional logic in stm32f4discovery.h will determine if certain features
* are supported. Tests for these features need to be made after including
* stm32f4discovery.h.
*/
#ifdef HAVE_RTC_DRIVER
# include <nuttx/timers/rtc.h>
# include "stm32_rtc.h"
#endif
/* The following are includes from board-common logic */
#ifdef CONFIG_SENSORS_BMP180
#include "stm32_bmp180.h"
#endif
#ifdef CONFIG_SENSORS_MAX6675
#include "stm32_max6675.h"
#endif
#ifdef CONFIG_INPUT_NUNCHUCK
#include "stm32_nunchuck.h"
#endif
#ifdef CONFIG_SENSORS_ZEROCROSS
#include "stm32_zerocross.h"
#endif
#ifdef CONFIG_SENSORS_QENCODER
#include "board_qencoder.h"
#endif
#ifdef CONFIG_SENSORS_BH1750FVI
#include "stm32_bh1750.h"
#endif
#ifdef CONFIG_LIS3DSH
#include "stm32_lis3dsh.h"
#endif
#ifdef CONFIG_LCD_BACKPACK
#include "stm32_lcd_backpack.h"
#endif
#ifdef CONFIG_SENSORS_MAX31855
#include "stm32_max31855.h"
#endif
#ifdef CONFIG_SENSORS_MLX90614
#include "stm32_mlx90614.h"
#endif
#ifdef CONFIG_SENSORS_XEN1210
#include "stm32_xen1210.h"
#endif
#ifdef CONFIG_USBADB
# include <nuttx/usb/adb.h>
#endif
#ifdef CONFIG_SENSORS_HS300X
#include "stm32_hs300x.h"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_i2c_register
*
* Description:
* Register one I2C drivers for the I2C tool.
*
****************************************************************************/
#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL)
static void stm32_i2c_register(int bus)
{
FAR 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
/****************************************************************************
* Name: stm32_bringup
*
* Description:
* Perform architecture-specific initialization
*
* CONFIG_BOARD_LATE_INITIALIZE=y :
* Called from board_late_initialize().
*
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
* Called from the NSH library
*
****************************************************************************/
int stm32_bringup(void)
{
#ifdef HAVE_RTC_DRIVER
FAR struct rtc_lowerhalf_s *lower;
#endif
int ret = OK;
#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL)
stm32_i2ctool();
#endif
#ifdef CONFIG_SENSORS_BMP180
/* Initialize the BMP180 pressure sensor. */
ret = board_bmp180_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize BMP180, error %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_SENSORS_BH1750FVI
ret = board_bh1750_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_bh1750initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_ZEROCROSS
/* Configure the zero-crossing driver */
board_zerocross_initialize(0);
#endif
#ifdef CONFIG_LEDS_MAX7219
ret = stm32_max7219init("/dev/numdisp0");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: max7219_leds_register failed: %d\n", ret);
}
#endif
#ifdef CONFIG_LCD_ST7032
ret = stm32_st7032init("/dev/slcd0");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: st7032_register failed: %d\n", ret);
}
#endif
#ifdef CONFIG_RGBLED
/* Configure the RGB LED driver */
stm32_rgbled_setup();
#endif
#if defined(CONFIG_PCA9635PW)
/* Initialize the PCA9635 chip */
ret = stm32_pca9635_initialize();
if (ret < 0)
{
serr("ERROR: stm32_pca9635_initialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_VIDEO_FB
/* Initialize and register the framebuffer driver */
ret = fb_register(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_LCD_BACKPACK
/* slcd:0, i2c:1, rows=2, cols=16 */
ret = board_lcd_backpack_init(0, 1, 2, 16);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize PCF8574 LCD, error %d\n", ret);
return ret;
}
#endif
#ifdef HAVE_SDIO
/* Initialize the SDIO block driver */
ret = stm32_sdio_initialize();
if (ret != OK)
{
ferr("ERROR: Failed to initialize MMC/SD driver: %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_MMCSD_SPI
/* Initialize the MMC/SD SPI driver (SPI2 is used) */
ret = stm32_mmcsd_initialize(2, CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize SD slot %d: %d\n",
CONFIG_NSH_MMCSDMINOR, ret);
}
#endif
#ifdef HAVE_USBHOST
/* Initialize USB host operation. stm32_usbhost_initialize() starts a
* thread will monitor for USB connection and disconnection events.
*/
ret = stm32_usbhost_initialize();
if (ret != OK)
{
uerr("ERROR: Failed to initialize USB host: %d\n", ret);
return ret;
}
#endif
#ifdef HAVE_USBMONITOR
/* Start the USB Monitor */
ret = usbmonitor_start();
if (ret != OK)
{
uerr("ERROR: Failed to start USB monitor: %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_PWM
/* Initialize PWM and register the PWM device. */
ret = stm32_pwm_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_CAN
/* Initialize CAN and register the CAN driver. */
ret = stm32_can_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret);
}
#endif
#ifdef CONFIG_INPUT_BUTTONS
/* Register the BUTTON driver */
ret = btn_lower_initialize("/dev/buttons");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_INPUT_NUNCHUCK
/* Register the Nunchuck driver */
ret = board_nunchuck_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: nunchuck_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_MLX90614
ret = board_mlx90614_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize MLX90614, error %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_SENSORS_QENCODER
/* Initialize and register the qencoder driver */
ret = board_qencoder_initialize(0, CONFIG_STM32F4DISCO_QETIMER);
if (ret != OK)
{
syslog(LOG_ERR,
"ERROR: Failed to register the qencoder: %d\n",
ret);
return ret;
}
#endif
#ifdef CONFIG_USERLED
/* Register the LED driver */
ret = userled_lower_initialize("/dev/userleds");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_RTC_DS1307
ret = stm32_ds1307_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize DS1307 RTC driver: %d\n", ret);
return ret;
}
#endif
#ifdef HAVE_RTC_DRIVER
/* Instantiate the STM32 lower-half RTC driver */
lower = stm32_rtc_lowerhalf();
if (!lower)
{
serr("ERROR: Failed to instantiate the RTC lower-half driver\n");
return -ENOMEM;
}
else
{
/* Bind the lower half driver and register the combined RTC driver
* as /dev/rtc0
*/
ret = rtc_initialize(0, lower);
if (ret < 0)
{
serr("ERROR: Failed to bind/register the RTC driver: %d\n", ret);
return ret;
}
}
#endif
#ifdef HAVE_CS43L22
/* Configure CS43L22 audio */
ret = stm32_cs43l22_initialize(1);
if (ret != OK)
{
serr("Failed to initialize CS43L22 audio: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_MAX31855
/* Register device 0 on spi channel 2 */
ret = board_max31855_initialize(0, 2);
if (ret < 0)
{
serr("ERROR: stm32_max31855initialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_MAX6675
ret = board_max6675_initialize(0, 2);
if (ret < 0)
{
serr("ERROR: stm32_max6675initialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */
ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
if (ret < 0)
{
serr("ERROR: Failed to mount procfs at %s: %d\n",
STM32_PROCFS_MOUNTPOINT, ret);
}
#endif
#ifdef CONFIG_STM32_ROMFS
ret = stm32_romfs_initialize();
if (ret < 0)
{
serr("ERROR: Failed to mount romfs at %s: %d\n",
CONFIG_STM32_ROMFS_MOUNTPOINT, ret);
}
#endif
#ifdef CONFIG_SENSORS_XEN1210
ret = board_xen1210_initialize(0, 1);
if (ret < 0)
{
serr("ERROR: xen1210_archinitialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_LIS3DSH
/* Create a lis3dsh driver instance fitting the chip built into
* stm32f4discovery
*/
ret = board_lis3dsh_initialize(0, 1);
if (ret < 0)
{
serr("ERROR: Failed to initialize LIS3DSH driver: %d\n", ret);
}
#endif
#ifdef HAVE_HCIUART
ret = hciuart_dev_initialize();
if (ret < 0)
{
serr("ERROR: Failed to initialize HCI UART driver: %d\n", ret);
}
#endif
#if defined(CONFIG_RNDIS)
uint8_t mac[6];
mac[0] = 0xa0; /* TODO */
mac[1] = (CONFIG_NETINIT_MACADDR_2 >> (8 * 0)) & 0xff;
mac[2] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 3)) & 0xff;
mac[3] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 2)) & 0xff;
mac[4] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 1)) & 0xff;
mac[5] = (CONFIG_NETINIT_MACADDR_1 >> (8 * 0)) & 0xff;
usbdev_rndis_initialize(mac);
#endif
#ifdef CONFIG_WL_GS2200M
ret = stm32_gs2200m_initialize("/dev/gs2200m", 3);
if (ret < 0)
{
serr("ERROR: Failed to initialize GS2200M: %d \n", ret);
}
#endif
#ifdef CONFIG_LPWAN_SX127X
ret = stm32_lpwaninitialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize wireless driver:"
" %d\n", ret);
}
#endif /* CONFIG_LPWAN_SX127X */
#ifdef CONFIG_USBADB
usbdev_adb_initialize();
#endif
#ifdef CONFIG_SENSORS_HS300X
ret = board_hs300x_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize HS300x, error %d\n", ret);
}
#endif /* CONFIG_SENSORS_HS300X */
return ret;
}

View File

@@ -0,0 +1,993 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig SENSORS
bool "Sensor Device Support"
select MM_CIRCBUF
default n
---help---
Drivers for various sensors
if SENSORS
config SENSORS_NPOLLWAITERS
int "Number of poll threads"
default 2
---help---
Maximum number of threads than can be waiting for POLL events.
Default: 2
config SENSORS_WTGAHRS2
bool "Wtgahrs2 Sensor Support"
default n
---help---
We can read sensor data by serial interface. It need the hardware sensor
wtgashrs2(JY901) as data source. This sensor can generate accelerometer,
gyroscope, magnetic, barometer and gps data.
config SENSORS_FAKESENSOR
bool "Fake Sensor Support"
default n
---help---
Simulate physical sensor by reading data from csv file.
The file structure is as follows:
First row : set interval, unit millisecond
Second row: csv file header
third row : data
(Each line should not exceed 50 characters)
For example:
interval:12
x,y,z
2.1234,3.23443,2.23456
...
config SENSORS_APDS9960
bool "Avago APDS-9960 Gesture Sensor support"
default n
select I2C
---help---
Enable driver support for the Avago APDS-9960 gesture sensor.
config APDS9960_I2C_FREQUENCY
int "APDS-9960 I2C frequency"
default 400000
depends on SENSORS_APDS9960
config SENSORS_AK09912
bool "Asahi AK09911/AK09912 Compass Sensor"
default n
select I2C
---help---
Enable driver for AK09911/AK09912 Compass sensor.
config SENSORS_AS5048B
bool "AMS AS5048B Magnetic Rotary Encoder support"
default n
select I2C
select SENSORS_QENCODER
---help---
Enable driver support for the AMS AS5048B magnetic rotary encoder.
config SENSORS_AS726X
bool "AMS AS726X Spetral sensor support"
default n
select I2C
---help---
Enable driver support for the AS726X Spectral Sensor.
config SENSORS_BH1750FVI
bool "Rohm BH1750FVI Ambient Light Sensor support"
default n
select I2C
---help---
Enable driver support for the Rohm BH1750FVI light sensor.
config BH1750FVI_I2C_FREQUENCY
int "BH1750FVI I2C frequency"
default 400000
depends on SENSORS_BH1750FVI
config SENSORS_BMG160
bool "Bosch BMG160 Gyroscope Sensor support"
default n
select SPI
---help---
Enable driver support for the Bosch BMG160 gyroscope sensor.
config SENSORS_BMI160
bool "Bosch BMI160 Inertial Measurement Sensor support"
default n
select I2C
---help---
Enable driver support for the Bosch BMI160 Inertial
Measurement sensor
if SENSORS_BMI160
choice
prompt "BMI160 Interface"
default SENSORS_BMI160_SPI
config SENSORS_BMI160_I2C
bool "BMI160 I2C Interface"
select I2C
---help---
Enables support for the I2C interface
config SENSORS_BMI160_SPI
bool "BMI160 SPI Interface"
select SPI
---help---
Enables support for the SPI interface
endchoice
choice
prompt "I2C Address"
default BMI160_I2C_ADDR_68
config BMI160_I2C_ADDR_68
bool "0x68"
---help---
Default address.
If SDO pin is pulled to VDDIO, use 0x69
config BMI160_I2C_ADDR_69
bool "0x69"
---help---
If SDO pin is pulled to VDDIO, use 0x69
endchoice
endif
config SENSORS_BMP180
bool "Bosch BMP180 Barometer Sensor support"
default n
select I2C
---help---
Enable driver support for the Bosch BMP180 barometer sensor.
config SENSORS_BMP280
bool "Bosch BMP280 Barometic Pressure Sensor"
default n
select I2C
---help---
Enable driver for the Bosch BMP280 barometic pressure sensor.
if SENSORS_BMP280
config BMP280_I2C_FREQUENCY
int "BMP280 I2C frequency"
default 400000
endif # SENSORS_BMP280
config SENSORS_DHTXX
bool "DHTxx humidity/temperature Sensor support"
default n
---help---
Enable driver support for the DHTxx humidity/temperature sensor.
config SENSORS_FXOS8700CQ
bool "NXP FXOS8700CQ Motion Sensor support"
default n
select I2C
---help---
Enable driver support for the NXP FXOS8700CQ Motion sensor
config SENSORS_HCSR04
bool "HC-SR04 Distance Measurement Sensor"
default n
---help---
Enable driver support for the HC-SR04 Distance Sensor.
config SENSORS_HYT271
bool "IST HYT271 Humidity and Temperature Sensor support"
default n
---help---
Enable driver support for the HYT271/HYT221/HYT939 humidity/temperature sensor family.
config SENSORS_HYT271_POLL
bool "Enables polling sensor data"
depends on SENSORS_HYT271
default n
---help---
Enables polling of sensor.
config SENSORS_HYT271_POLL_INTERVAL
int "Polling interval in microseconds, default 1 sec"
depends on SENSORS_HYT271 && SENSORS_HYT271_POLL
default 1000000
range 0 4294967295
---help---
The interval until a new sensor measurement will be triggered.
config SENSORS_HYT271_THREAD_STACKSIZE
int "Worker thread stack size"
depends on SENSORS_HYT271 && SENSORS_HYT271_POLL
default 1024
---help---
The stack size for the worker thread.
if SENSORS_HCSR04
config HCSR04_DEBUG
bool "Debug support for the HC-SR04"
default n
---help---
Enables debug features for the HC-SR04
config HCSR04_NPOLLWAITERS
int "Number of waiters to poll"
default 1
---help---
Number of waiters to poll
endif # SENSORS_HCSR04
config SENSORS_ISL29023
bool "Renesas ISL29023 ALS sensor"
default n
select I2C
---help---
Enable driver support for the Renesas ISL29023 ambient light sensor.
if SENSORS_ISL29023
config ISL29023_I2C_FREQUENCY
int "ISL29023 I2C frequency"
default 400000
endif # SENSORS_ISL29023
config SENSORS_HTS221
bool "STMicro HTS221 humidity sensor"
default n
select I2C
---help---
Enable driver support for the STMicro HTS221 humidity sensor.
if SENSORS_HTS221
config HTS221_I2C_FREQUENCY
int "HTS221 I2C frequency"
default 400000
range 1 400000
config HTS221_DEBUG
bool "Debug support for the HTS221"
default n
---help---
Enables debug features for the HTS221
config HTS221_NPOLLWAITERS
int "Number of waiters to poll"
default 1
---help---
Number of waiters to poll
endif # SENSORS_HTS221
config SENSORS_L3GD20
bool "STMicro L3GD20 Gyroscope Sensor support"
default n
select SPI
select SCHED_HPWORK if SENSORS_L3GD20_BUFFER_SIZE > 0
---help---
Enable driver support for the STMicro L3GD20 gyroscope sensor.
config SENSORS_L3GD20_BUFFER_SIZE
int "size of buffer"
default 1
depends on SENSORS_L3GD20
---help---
The size of the circular buffer used. If the value equal to zero,
indicates that the circular buffer is disabled.
config SENSOR_KXTJ9
bool "Kionix KXTJ9 Accelerometer support"
default n
select I2C
if SENSORS_KXTJ9
config KXTJ9_I2C_BUS_SPEED
int "Kionix KXTJ9 Bus Speed in Hz"
default 400000
endif # SENSORS_KXTJ9
config SENSORS_LIS2DH
bool "STMicro LIS2DH device support"
default n
select I2C
---help---
Enable driver support for the STMicro LIS2DH accelerometer
if SENSORS_LIS2DH
config LIS2DH_I2C_FREQUENCY
int "LIS2DH I2C frequency"
default 400000
range 1 400000
config LIS2DH_DEBUG
bool "Debug support for the LIS2DH"
default n
---help---
Enables debug features for the LIS2DH
config LIS2DH_NPOLLWAITERS
int "Number of waiters to poll"
default 2
---help---
Maximum number of threads that can be waiting on poll()
config LIS2DH_DRIVER_SELFTEST
bool "Enable selftest in LIS2DH driver"
default n
---help---
Enable selftest in LIS2DH driver
endif # SENSORS_LIS2DH
config LIS3DSH
bool "STMicro LIS3DSH 3-Axis accelerometer support"
default n
select SPI
---help---
Enable driver support for the STMicro LIS3DSH 3-Axis accelerometer.
config LIS3DH
bool "STMicro LIS3DH 3-Axis accelerometer support"
default n
select SPI
---help---
Enable driver support for the STMicro LIS3DH 3-Axis accelerometer.
config LIS331DL
bool "STMicro LIS331DL device support"
default n
select I2C
config LIS331DL_I2C_FREQUENCY
int "LIS331DL I2C frequency"
default 100000
range 1 100000
depends on LIS331DL
config SENSORS_LSM330SPI
bool "STMicro LSM330 SPI support"
default n
select SPI
---help---
Enable driver support for the STMicro LSM330 on SPI.
config SENSORS_LSM303AGR
bool "STMicro LSM303AGR support"
default n
select I2C
---help---
Enable driver support for the STMicro LSM303AGR.
config LSM303AGR_I2C_FREQUENCY
int "LSM303AGR I2C frequency"
default 400000
range 1 400000
depends on SN_LSM303AGR
config SENSORS_LSM6DSL
bool "STMicro LSM6DSL support"
default n
select I2C
---help---
Enable driver support for the STMicro LSM6DSL.
config LSM6DSL_I2C_FREQUENCY
int "LSM6DSL I2C frequency"
default 400000
range 1 400000
depends on SN_LSM6DSL
config SENSORS_LSM9DS1
bool "STMicro LSM9DS1 support"
default n
select I2C
---help---
Enable driver support for the STMicro LSM9DS1.
config LSM9DS1_I2C_FREQUENCY
int "LSM9DS1 I2C frequency"
default 400000
range 1 400000
depends on SN_LSM9DS1
config SENSORS_LPS25H
bool "STMicro LPS25H pressure sensor"
default n
select I2C
---help---
Enable driver support for the STMicro LPS25H barometer sensor.
if SENSORS_LPS25H
config LPS25H_I2C_FREQUENCY
int "LPS25H I2C frequency"
default 400000
range 1 400000
config DEBUG_LPS25H
bool "Debug support for the LPS25H"
default n
---help---
Enables debug features for the LPS25H
endif # SENSORS_LPS25H
config SENSORS_LTC4151
bool "LTC4151 current and voltage monitor"
default n
select I2C
---help---
Enable driver support for the LinearTechnology LTC4151 current and voltage monitor.
config LTC4151_I2C_FREQUENCY
int "LTC4151 I2C frequency"
default 400000
depends on SENSORS_LTC4151
config SENSORS_INA219
bool "INA219 current and voltage monitor"
default n
select I2C
---help---
Enable driver support for the Texas Instruments INA219 current and voltage monitor.
config INA219_I2C_FREQUENCY
int "INA219 I2C frequency"
default 400000
depends on SENSORS_INA219
config SENSORS_INA226
bool "INA226 current and voltage monitor"
default n
select I2C
---help---
Enable driver support for the Texas Instruments INA226 power monitor.
config INA226_I2C_FREQUENCY
int "INA226 I2C frequency"
default 400000
depends on SENSORS_INA226
config SENSORS_INA3221
bool "INA3221 current and voltage monitor"
default n
select I2C
---help---
Enable driver support for the Texas Instruments INA3221 current and voltage monitor.
config INA3221_I2C_FREQUENCY
int "INA3221 I2C frequency"
default 400000
depends on SENSORS_INA3221
config SENSORS_MB7040
bool "MaxBotix MB7040 Sonar support"
default n
select I2C
---help---
Enable driver support for the MaxBotix MB7040 sonar.
config MB7040_I2C_FREQUENCY
int "MB7040 I2C frequency"
default 400000
range 1 400000
depends on SENSORS_MB7040
config SENSORS_MLX90393
bool "MLX90393 3-Axis Magnetometer"
default n
select SPI
---help---
Enable driver support for the Melex MLX90393 3-Axis magnetometer.
config SENSORS_MLX90614
bool "MLX90614 Infrared Thermometer"
default n
select I2C
---help---
Enable driver support for the Melexis MLX90614 Infrared Thermometer.
if SENSORS_MLX90614
config MLX90614_CRC
bool "Enable CRC Checking (verify if PEC field is valid)"
default n
---help---
Enable checking of CRC-8 (PEC field) checking to guarantee that
read data is valid.
endif
config SENSORS_MCP9844
bool "MCP9844 Temperature Sensor"
default n
select I2C
---help---
Enable driver support for the MCP9844 I2C Temperature sensor.
config MCP9844_I2C_FREQUENCY
int "MCP9844 I2C frequency"
default 400000
range 1 400000
depends on SENSORS_MCP9844
config SENSORS_MS58XX
bool "MEAS MS58XX Altimeter support"
default n
select I2C
---help---
Enable driver support for MEAS MS58XX altimeters.
config MS58XX_I2C_FREQUENCY
int "MS58XX I2C frequency"
default 400000
range 1 400000
depends on SENSORS_MS58XX
config MS58XX_VDD
int "MEAS MS58XX VDD"
default 30
depends on SENSORS_MS58XX
config SENSORS_MPL115A
bool "Freescale MPL115A Barometer Sensor support"
default n
select SPI
---help---
Enable driver support for the Freescale MPL115A barometer sensor.
config MPL115A_REGDEBUG
bool "Debug support for the MPL115A"
default n
depends on SENSORS_MPL115A
---help---
Enables register level debug features for the MPL115A
config SENSORS_ADXL345
bool "Analog Devices ADXL345 Driver"
default n
---help---
Enables support for the ADXL345 driver
if SENSORS_ADXL345
choice
prompt "ADXL345 Interface"
default ADXL345_SPI
config ADXL345_SPI
bool "ADXL345 SPI Interface"
select SPI
---help---
Enables support for the SPI interface.
config ADXL345_I2C
bool "ADXL345 I2C Interface"
select I2C
---help---
Enables support for the I2C interface
endchoice
config ADXL345_ACTIVELOW
bool "Active Low Interrupt"
default n
---help---
The ADXL345 interrupt will be inverted. Instead starting low and going
high, it will start high and will go low when an interrupt is fired.
Default: Active high/rising edge.
config ADXL345_REGDEBUG
bool "Enable Register-Level ADXL345 Debug"
default n
depends on DEBUG_FEATURES
---help---
Enable very low register-level debug output.
endif # SENSORS_ADXL345
config SENSORS_ADXL372
bool "Analog Devices ADXL372 Sensor support"
default n
select SPI
---help---
Enable driver support for the Analog Devices ADXL372 Sensor.
config SENSORS_MPU60X0
bool "Invensense MPU60x0 Sensor support"
default n
---help---
Enable driver support for Invensense MPU60x0 MotionTracker(tm) device.
if SENSORS_MPU60X0
choice
prompt "MPU60x0 Interface"
default MPU60X0_SPI
config MPU60X0_SPI
bool "MPU6000 SPI Interface"
select SPI
---help---
Enables support for the SPI interface (MPU6000 only)
config MPU60X0_I2C
bool "MPU60x0 I2C Interface"
select I2C
---help---
Enables support for the I2C interface (MPU6000
or MPU6050, autodetected during driver initialization)
endchoice
config MPU60X0_I2C_FREQ
int "MPU60x0 I2C Frequency"
depends on MPU60X0_I2C
default 400000
config MPU60X0_EXTI
bool "Enable interrupts"
default n
---help---
Select this when the MPU60x0's INT pin is connected to an
interrupt line on the host processor, and identify the pin
during device registration. The driver will use interrupts to
manage FIFO-full and/or sample-ready events, depending on how
the device is being used. The interface will block until the
next sample is ready, which will naturally synchronize the user
to the sampling rate chosen during operation.
Default: No interrupts or blocking, i.e. user-driven sampling.
endif # SENSORS_MPU60X0
config SENSORS_MAX44009
bool "Maxim MAX44009 ALS sensor"
default n
select I2C
---help---
Enables MAX44009 Ambient Light Sensor
if SENSORS_MAX44009
config MAX44009_I2C_FREQUENCY
int "MAX44009 I2C frequency"
default 400000
range 1 400000
config DEBUG_MAX44009
bool "Enable debug support for the MAX44009"
default n
---help---
Enables debug support for the MAX44009
config MAX44009_NPOLLWAITERS
int "Number of waiters to poll"
default 1
---help---
Number of waiters to poll
endif # SENSORS_MAX44009
config SENSORS_MAX31855
bool "Maxim MAX31855 Driver"
default n
select SPI
---help---
Enables support for the MAX31855 driver
config SENSORS_MAX6675
bool "Maxim MAX6675 Driver"
default n
select SPI
---help---
Enables support for the MAX6675 driver
config SENSORS_LIS3MDL
bool "STMicro LIS3MDL 3-Axis magnetometer support"
default n
select SPI
---help---
Enable driver support for the STMicro LIS3MDL 3-axis magnetometer.
config LM75_I2C
bool
default y if LM75
config SENSORS_LM75
bool "STMicro LM-75 Temperature Sensor support"
default n
select I2C
select LM75_I2C
---help---
Enable driver support for the STMicro LM-75 temperature sensor.
This should also work with compatible temperature sensors such as
the TI TMP100/101.
config LM75_I2C_FREQUENCY
int "LM75 I2C frequency"
default 100000
range 1 100000
depends on LM75_I2C
config SENSORS_LM92
bool "TI LM92 Temperature Sensor support"
default n
select I2C
---help---
Enable driver support for the TI LM92 Temperature Sensor.
config LM92_I2C_FREQUENCY
int "LM92 I2C frequency"
default 400000
range 1 400000
depends on LM92
config SENSORS_SCD30
bool "Sensirion SCD30 CO2, humidity and temperature sensor"
default n
---help---
Enable driver support for the Sensirion SCD30 CO₂, humidity and
temperature sensor.
if SENSORS_SCD30
config SCD30_I2C
bool "Sensirion SCD30 I2C mode"
default y
select I2C
config SCD30_I2C_FREQUENCY
int "SCD30 I2C frequency"
default 100000
range 1 100000
depends on SCD30_I2C
---help---
I2C frequency for SCD30. Note, maximum supported frequency for
this sensor is 100kHz.
config SCD30_DEBUG
bool "Debug support for the SCD30"
default n
---help---
Enables debug features for the SCD30
endif # SENSORS_SCD30
config SENSORS_SGP30
bool "Sensirion SGP30 Gas Platform sensor"
default n
select I2C
---help---
Enable driver support for the Sensirion SCD30 CO₂ and TVOC gas sensor.
if SENSORS_SGP30
config SGP30_I2C_FREQUENCY
int "SGP30 I2C frequency"
default 400000
range 1 400000
config SGP30_DEBUG
bool "Debug support for the SGP30"
default n
---help---
Enables debug features for the SGP30
endif # SENSORS_SGP30
config SENSORS_AHT10
bool "ASAIR AHT10 temperature and humidity sensor"
default n
select I2C
---help---
Enable driver support for the ASAIR AHT10 temperature and humidity sensors.
if SENSORS_AHT10
config AHT10_I2C_FREQUENCY
int "AHT10 I2C frequency"
default 400000
range 1 400000
endif # SENSORS_AHT10
config SENSORS_SHT21
bool "Sensirion SHT21 temperature and humidity sensor"
default n
select I2C
---help---
Enable driver support for the Sensirion SHT20 and SHT21 temperature
and humidity sensors. SHT20 is a budget model with limited humidity
precision.
if SENSORS_SHT21
config SHT21_I2C_FREQUENCY
int "SHT21 I2C frequency"
default 400000
range 1 400000
config SHT21_DEBUG
bool "Debug support for the SHT21"
default n
---help---
Enables debug features for the SHT21
endif # SENSORS_SHT21
config SENSORS_SHT3X
bool "Sensirion SHT3x temperature and humidity sensor"
default n
select I2C
---help---
Enable driver support for the Sensirion SHT3x temperature
and humidity sensors.
if SENSORS_SHT3X
config SHT3X_I2C_FREQUENCY
int "SHT3x I2C frequency"
default 400000
range 1 400000
config SHT3X_I2C_ADDR
hex "SHT3x I2C addr"
default 0x44
range 0x44 0x45
config SHT3X_DEBUG
bool "Debug support for the SHT3x"
default n
---help---
Enables debug features for the SHT3x
endif # SENSORS_SHT3X
config SENSORS_SPS30
bool "Sensirion SPS30 particulate matter sensor"
default n
---help---
Enable driver support for the Sensirion SPS30 particulate matter sensor
sensor.
if SENSORS_SPS30
config SPS30_I2C
bool "Sensirion SPS30 I2C mode"
default y
select I2C
config SPS30_I2C_FREQUENCY
int "SPS30 I2C frequency"
default 100000
range 1 100000
depends on SPS30_I2C
---help---
I2C frequency for SPS30. Note, maximum supported frequency for
this sensor is 100kHz.
config SPS30_DEBUG
bool "Debug support for the SPS30"
default n
---help---
Enables debug features for the SPS30
endif # SENSORS_SPS30
config SENSORS_T67XX
bool "Telair T6713 carbon dioxide sensor"
default n
select I2C
---help---
Enable driver support for the Telair T6713 and T6703 carbon
dioxide sensors.
config SENSORS_QENCODER
bool "Qencoder"
default n
config SENSORS_VEML6070
bool "Vishay VEML6070 UV-A Light Sensor support"
default n
select I2C
---help---
Enable driver support for the Vishay VEML6070 UV-A light sensor.
config VEML6070_I2C_FREQUENCY
int "VEML6070 I2C frequency"
default 100000
depends on SENSORS_VEML6070
config SENSORS_VL53L1X
bool "ST VL53L1X TOF sensor"
default n
select I2C
---help---
Enable driver support for the VL53L1X Time Of Flight sensor.
config SENSORS_XEN1210
bool "Sensixs XEN1210 Magnetometer"
default n
select SPI
---help---
Enable driver support for the Sensixs XEN1210 Magnetometer.
config XEN1210_REGDEBUG
bool "Debug support for the XEN1210"
default n
depends on SENSORS_XEN1210
---help---
Enables register level debug features for the XEN1210
config SENSORS_ZEROCROSS
bool "Zero Cross Sensor"
default n
config SENSORS_ADT7320
bool "Analog Devices ADT7320 Driver"
default n
select SPI
---help---
Enables support for the ADT7320 Driver
config SENSORS_HDC1008
bool "TI HDC1008 temperature and humidity sensor"
default n
select I2C
---help---
Enable driver support for the TI HDC1008 temperature and humidity sensor.
if SENSORS_HDC1008
config HDC1008_I2C_ADDRESS
hex "HDC1008 I2C address"
default 0x40
range 0x40 0x43
---help---
The I2C address of the HDC1008 sensor. It can be configured via straps to
a value between 0x40 and 0x43.
config HDC1008_I2C_FREQUENCY
int "HDC1008 I2C frequency"
default 400000
range 1 400000
config HDC1008_DEBUG
bool "Debug support for the HDC1008"
default n
---help---
Enables debug features for the HDC1008
endif # SENSORS_HDC1008
config HS300X_I2C
bool
default y if HS300X
config SENSORS_HS300X
bool "HS300X Temperature and Humidity Sensor support"
default n
select I2C
select HS300X_I2C
---help---
Enable driver support for the HS300X Temperature and Humidity sensor.
config HS300X_I2C_FREQUENCY
int "HS300X I2C frequency"
default 400000
range 1 900000
depends on HS300X_I2C
endif # SENSORS

View File

@@ -0,0 +1,315 @@
############################################################################
# drivers/sensors/Make.defs
#
# 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 sensor drivers
ifeq ($(CONFIG_SENSORS),y)
CSRCS += sensor.c
ifeq ($(CONFIG_SENSORS_WTGAHRS2),y)
CSRCS += wtgahrs2.c
endif
ifeq ($(CONFIG_SENSORS_FAKESENSOR),y)
CSRCS += fakesensor.c
endif
ifeq ($(CONFIG_SENSORS_HCSR04),y)
CSRCS += hc_sr04.c
endif
ifeq ($(CONFIG_SENSORS_ADXL345),y)
CSRCS += adxl345_base.c
endif
ifeq ($(CONFIG_SENSORS_DHTXX),y)
CSRCS += dhtxx.c
endif
# These drivers depend on I2C support
ifeq ($(CONFIG_I2C),y)
ifeq ($(CONFIG_SENSORS_APDS9960),y)
CSRCS += apds9960.c
endif
ifeq ($(CONFIG_SENSORS_AK09912),y)
CSRCS += ak09912.c
endif
ifeq ($(CONFIG_SENSORS_AS5048B),y)
CSRCS += as5048b.c
endif
ifeq ($(CONFIG_SENSORS_AS726X),y)
CSRCS += as726x.c
endif
ifeq ($(CONFIG_SENSORS_FXOS8700CQ),y)
CSRCS += fxos8700cq.c
endif
ifeq ($(CONFIG_SENSORS_HYT271),y)
CSRCS += hyt271.c
endif
ifeq ($(CONFIG_SENSORS_KXTJ9),y)
CSRCS += kxtj9.c
endif
ifeq ($(CONFIG_SENSORS_LIS2DH),y)
CSRCS += lis2dh.c
endif
ifeq ($(CONFIG_LIS331DL),y)
CSRCS += lis331dl.c
endif
ifeq ($(CONFIG_SENSORS_LSM303AGR),y)
CSRCS += lsm303agr.c
endif
ifeq ($(CONFIG_SENSORS_LSM6DSL),y)
CSRCS += lsm6dsl.c
endif
ifeq ($(CONFIG_SENSORS_LSM9DS1),y)
CSRCS += lsm9ds1.c
endif
ifeq ($(CONFIG_SENSORS_LPS25H),y)
CSRCS += lps25h.c
endif
ifeq ($(CONFIG_ADXL345_I2C),y)
CSRCS += adxl345_i2c.c
endif
ifeq ($(CONFIG_SENSORS_BH1750FVI),y)
CSRCS += bh1750fvi.c
endif
ifeq ($(CONFIG_SENSORS_BMG160),y)
CSRCS += bmg160.c
endif
ifeq ($(CONFIG_SENSORS_BMI160),y)
CSRCS += bmi160.c
endif
ifeq ($(CONFIG_SENSORS_BMP180),y)
CSRCS += bmp180.c
endif
ifeq ($(CONFIG_SENSORS_BMP280),y)
CSRCS += bmp280.c
endif
ifeq ($(CONFIG_SENSORS_ISL29023),y)
CSRCS += isl29023.c
endif
ifeq ($(CONFIG_SENSORS_HTS221),y)
CSRCS += hts221.c
endif
ifeq ($(CONFIG_LM75_I2C),y)
CSRCS += lm75.c
endif
ifeq ($(CONFIG_SENSORS_LM92),y)
CSRCS += lm92.c
endif
ifeq ($(CONFIG_SENSORS_MAX44009),y)
CSRCS += max44009.c
endif
ifeq ($(CONFIG_SENSORS_MB7040),y)
CSRCS += mb7040.c
endif
ifeq ($(CONFIG_SENSORS_MCP9844),y)
CSRCS += mcp9844.c
endif
ifeq ($(CONFIG_SENSORS_MLX90393),y)
CSRCS += mlx90393.c
endif
ifeq ($(CONFIG_SENSORS_MLX90614),y)
CSRCS += mlx90614.c
endif
ifeq ($(CONFIG_SENSORS_MS58XX),y)
CSRCS += ms58xx.c
endif
ifeq ($(CONFIG_SENSORS_LTC4151),y)
CSRCS += ltc4151.c
endif
ifeq ($(CONFIG_SENSORS_INA219),y)
CSRCS += ina219.c
endif
ifeq ($(CONFIG_SENSORS_INA226),y)
CSRCS += ina226.c
endif
ifeq ($(CONFIG_SENSORS_INA3221),y)
CSRCS += ina3221.c
endif
ifeq ($(CONFIG_SENSORS_SCD30),y)
CSRCS += scd30.c
endif
ifeq ($(CONFIG_SENSORS_SGP30),y)
CSRCS += sgp30.c
endif
ifeq ($(CONFIG_SENSORS_AHT10),y)
CSRCS += aht10.c
endif
ifeq ($(CONFIG_SENSORS_SHT21),y)
CSRCS += sht21.c
endif
ifeq ($(CONFIG_SENSORS_SHT3X),y)
CSRCS += sht3x.c
endif
ifeq ($(CONFIG_SENSORS_SPS30),y)
CSRCS += sps30.c
endif
ifeq ($(CONFIG_SENSORS_T67XX),y)
CSRCS += t67xx.c
endif
endif # CONFIG_I2C
# These drivers depend on SPI support
ifeq ($(CONFIG_SPI),y)
ifeq ($(CONFIG_ADXL345_SPI),y)
CSRCS += adxl345_spi.c
endif
ifeq ($(CONFIG_SENSORS_ADXL372),y)
CSRCS += adxl372.c
endif
ifeq ($(CONFIG_LIS3DSH),y)
CSRCS += lis3dsh.c
endif
ifeq ($(CONFIG_LIS3DH),y)
CSRCS += lis3dh.c
endif
ifeq ($(CONFIG_SENSORS_MAX31855),y)
CSRCS += max31855.c
endif
ifeq ($(CONFIG_SENSORS_MAX6675),y)
CSRCS += max6675.c
endif
ifeq ($(CONFIG_SENSORS_MPL115A),y)
CSRCS += mpl115a.c
endif
ifeq ($(CONFIG_SENSORS_LIS3MDL),y)
CSRCS += lis3mdl.c
endif
ifeq ($(CONFIG_SENSORS_LSM330SPI),y)
CSRCS += lsm330_spi.c
endif
ifeq ($(CONFIG_SENSORS_L3GD20),y)
CSRCS += l3gd20.c
endif
ifeq ($(CONFIG_SENSORS_ADT7320),y)
CSRCS += adt7320.c
endif
endif # CONFIG_SPI
ifeq ($(CONFIG_SENSORS_MPU60X0),y)
CSRCS += mpu60x0.c
endif
# Quadrature encoder upper half
ifeq ($(CONFIG_SENSORS_QENCODER),y)
CSRCS += qencoder.c
endif
# Vishay VEML6070
ifeq ($(CONFIG_SENSORS_VEML6070),y)
CSRCS += veml6070.c
endif
# ST VL53L1X
ifeq ($(CONFIG_SENSORS_VL53L1X),y)
CSRCS += vl53l1x.c
endif
# Sensixs XEN1210
ifeq ($(CONFIG_SENSORS_XEN1210),y)
CSRCS += xen1210.c
endif
# Zero Cross upper half
ifeq ($(CONFIG_SENSORS_ZEROCROSS),y)
CSRCS += zerocross.c
endif
# TI HDC1008
ifeq ($(CONFIG_SENSORS_HDC1008),y)
CSRCS += hdc1008.c
endif
# HS300x
ifeq ($(CONFIG_SENSORS_HS300X),y)
CSRCS += hs300x.c
endif
# Include sensor driver build support
DEPPATH += --dep-path sensors
VPATH += :sensors
CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)sensors}
endif # CONFIG_SENSORS

View File

@@ -0,0 +1,253 @@
/****************************************************************************
* drivers/sensors/hs300x.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 <inttypes.h>
#include <stdlib.h>
#include <fixedmath.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/sensors/hs300x.h>
#include <nuttx/random.h>
#if defined(CONFIG_I2C) && defined(CONFIG_HS300X_I2C)
/****************************************************************************
* Private
****************************************************************************/
struct hs300x_dev_s
{
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* I2C Helpers */
static int hs300x_i2c_write(FAR struct hs300x_dev_s *priv, FAR char *buffer, int buflen);
static int hs300x_i2c_read(FAR struct hs300x_dev_s *priv, FAR char *buffer, int buflen);
/* Character driver methods */
static int hs300x_open(FAR struct file *filep);
static int hs300x_close(FAR struct file *filep);
static ssize_t hs300x_read(FAR struct file *filep, FAR char *buffer, size_t buflen);
static ssize_t hs300x_write(FAR struct file *filep, FAR const char *buffer, size_t buflen);
/****************************************************************************
* Private Data
****************************************************************************/
static const struct file_operations g_hs300xfops =
{
hs300x_open,
hs300x_close,
hs300x_read,
hs300x_write,
NULL,
NULL,
NULL
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: hs300x_i2c_write
*
* Description:
* Write to the I2C device.
*
****************************************************************************/
static int hs300x_i2c_write(FAR struct hs300x_dev_s *priv,
FAR char *buffer, int buflen)
{
struct i2c_msg_s msg;
int ret;
/* Setup for the transfer */
msg.frequency = CONFIG_HS300X_I2C_FREQUENCY,
msg.addr = priv->addr;
msg.flags = 0;
msg.buffer = (FAR uint8_t *)buffer; /* Override const */
msg.length = buflen;
/* Then perform the transfer. */
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
return (ret >= 0) ? OK : ret;
}
/****************************************************************************
* Name: hs300x_i2c_read
*
* Description:
* Read from the I2C device.
*
****************************************************************************/
static int hs300x_i2c_read(FAR struct hs300x_dev_s *priv,
FAR char *buffer, int buflen)
{
struct i2c_msg_s msg;
int ret;
/* Setup for the transfer */
msg.frequency = CONFIG_HS300X_I2C_FREQUENCY,
msg.addr = priv->addr,
msg.flags = I2C_M_READ;
msg.buffer = (FAR uint8_t *)buffer;
msg.length = buflen;
/* Then perform the transfer. */
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
return (ret >= 0) ? OK : ret;
}
/****************************************************************************
* Name: hs300x_open
****************************************************************************/
static int hs300x_open(FAR struct file *filep)
{
return OK;
}
/****************************************************************************
* Name: hs300x_close
****************************************************************************/
static int hs300x_close(FAR struct file *filep)
{
return OK;
}
/****************************************************************************
* Name: hs300x_read
****************************************************************************/
static ssize_t hs300x_read(FAR struct file *filep, FAR char *buffer,
size_t buflen)
{
FAR struct inode *inode = filep->f_inode;
FAR struct hs300x_dev_s *priv = inode->i_private;
int ret;
if (buflen != 4)
{
snerr("ERROR: You can't read something other than 32 bits (4 bytes)\n");
return -1;
}
/* Restart and read 32-bits from the register */
ret = hs300x_i2c_read(priv, buffer, 4);
if (ret < 0)
{
snerr("ERROR: i2c_read failed: %d\n", ret);
return (ssize_t)ret;;
}
return buflen;
}
/****************************************************************************
* Name: hs300x_write
****************************************************************************/
static ssize_t hs300x_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen)
{
FAR struct inode *inode = filep->f_inode;
FAR struct hs300x_dev_s *priv = inode->i_private;
int ret;
ret = hs300x_i2c_write(priv, buffer, buflen);
if (ret < 0)
{
snerr("ERROR: i2c_write failed: %d\n", ret);
return (ssize_t)ret;;
}
return buflen;
}
/****************************************************************************
* Name: hs300x_register
*
* Description:
* Register the HS300x character device as 'devpath'
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/i2c1"
* i2c - An instance of the I2C interface to use to communicate with HS300X
* addr - The I2C address of the HS300x. The base I2C address of the HS300X
* is 0x44.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int hs300x_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr)
{
FAR struct hs300x_dev_s *priv;
int ret;
/* Sanity check */
DEBUGASSERT(i2c != NULL);
DEBUGASSERT(addr == CONFIG_SENSOR_DEVICE_HS300X_I2C_ADDR);
/* Initialize the HS300x device structure */
priv = (FAR struct hs300x_dev_s *)kmm_malloc(sizeof(struct hs300x_dev_s));
if (priv == NULL)
{
snerr("ERROR: Failed to allocate instance\n");
return -ENOMEM;
}
priv->i2c = i2c;
priv->addr = addr;
/* Register the character driver */
ret = register_driver(devpath, &g_hs300xfops, 0666, priv);
if (ret < 0)
{
snerr("ERROR: Failed to register driver: %d\n", ret);
kmm_free(priv);
}
sninfo("HS300X driver loaded successfully!\n");
return ret;
}
#endif /* CONFIG_I2C && CONFIG_HS300X_I2C */

View File

@@ -0,0 +1,88 @@
/****************************************************************************
* include/nuttx/sensors/hs300x.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 __INCLUDE_NUTTX_SENSORS_HS300X_H
#define __INCLUDE_NUTTX_SENSORS_HS300X_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/sensors/ioctl.h>
#if defined(CONFIG_I2C) && defined(CONFIG_HS300X_I2C)
/* HS300X Registers frequency and addresses*/
#ifndef CONFIG_HS300X_I2C_FREQUENCY
# define CONFIG_HS300X_I2C_FREQUENCY 400000
#endif
#ifndef CONFIG_SENSOR_DEVICE_HS300X_I2C_ADDR
# define CONFIG_SENSOR_DEVICE_HS300X_I2C_ADDR 0x44
#endif
/****************************************************************************
* Public Types
****************************************************************************/
struct i2c_master_s;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: hs300x_register
*
* Description:
* Register the HS300x character device as 'devpath'
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/i2c1"
* i2c - An instance of the I2C interface to use to communicate with HS300X
* addr - The I2C address of the HS300x. The base I2C address of the HS300X
* is 0x44.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int hs300x_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
uint8_t addr);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_I2C && CONFIG_HS300X_I2C */
#endif /* __INCLUDE_NUTTX_SENSORS_HS300X_H */

View File

@@ -0,0 +1,618 @@
############################################################################
# tools/Makefile.unix
#
# 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.
#
############################################################################
export TOPDIR := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
include $(TOPDIR)/Make.defs
# GIT directory present
GIT_DIR = $(if $(wildcard $(TOPDIR)$(DELIM).git),y,)
ifeq ($(GIT_DIR),y)
GIT_PRESENT = `git rev-parse --git-dir 2> /dev/null`
endif
# In case we cannot get version information from GIT
ifeq ($(GIT_PRESENT),)
-include $(TOPDIR)/.version
# In case the version file does not exist
CONFIG_VERSION_STRING ?= "0.0.0"
CONFIG_VERSION_BUILD ?= "0"
VERSION_ARG = -v $(CONFIG_VERSION_STRING) -b $(CONFIG_VERSION_BUILD)
else
# Generate .version every time from GIT history
.PHONY: $(TOPDIR)/.version
endif
# Process architecture specific directories
ARCH_DIR = arch/$(CONFIG_ARCH)
ARCH_SRC = $(ARCH_DIR)/src
ARCH_INC = $(ARCH_DIR)/include
export APPPATHS = -I$(APPDIR)/../../../APP_Framework/Framework/sensor
APPPATHS += -I$(APPDIR)/../../../APP_Framework/Applications/general_functions/list
APPPATHS += -I$(APPDIR)/../../../APP_Framework/Framework/transform_layer/nuttx
export SRC_APP_DIR = ../../../APP_Framework
# CONFIG_APPS_DIR can be over-ridden from the command line or in the .config file.
# The default value of CONFIG_APPS_DIR is ../apps. Ultimately, the application
# will be built if APPDIR is defined. APPDIR will be defined if a directory containing
# a Makefile is found at the path provided by CONFIG_APPS_DIR
ifeq ($(CONFIG_APPS_DIR),)
CONFIG_APPS_DIR = ../apps
endif
APPDIR := $(realpath ${shell if [ -r $(CONFIG_APPS_DIR)/Makefile ]; then echo "$(CONFIG_APPS_DIR)"; fi})
# External code support
# If external/ contains a Kconfig, we define the EXTERNALDIR variable to 'external'
# so that main Kconfig can find it. Otherwise, we redirect it to a dummy Kconfig
# This is due to kconfig inability to do conditional inclusion.
EXTERNALDIR := $(shell if [ -r $(TOPDIR)/external/Kconfig ]; then echo 'external'; else echo 'dummy'; fi)
# CONTEXTDIRS include directories that have special, one-time pre-build
# requirements. Normally this includes things like auto-generation of
# configuration specific files or creation of configurable symbolic links
# CLEANDIRS are the directories that the clean target will executed in.
# These are all directories that we know about.
# CCLEANDIRS are directories that the clean_context target will execute in.
# The clean_context target "undoes" the actions of the context target.
# Only directories known to require cleaning are included.
# KERNDEPDIRS are the directories in which we will build target dependencies.
# If NuttX and applications are built separately (CONFIG_BUILD_PROTECTED or
# CONFIG_BUILD_KERNEL), then this holds only the directories containing
# kernel files.
# USERDEPDIRS. If NuttX and applications are built separately (CONFIG_BUILD_PROTECTED),
# then this holds only the directories containing user files. If
# CONFIG_BUILD_KERNEL is selected, then applications are not build at all.
include tools/Directories.mk
#
# Extra objects used in the final link.
#
# Pass 1 Incremental (relative) link objects should be put into the
# processor-specific source directory (where other link objects will
# be created). If the pass1 object is an archive, it could go anywhere.
ifeq ($(CONFIG_BUILD_2PASS),y)
EXTRA_OBJS += $(CONFIG_PASS1_OBJECT)
endif
# Library build selections
#
# NUTTXLIBS is the list of NuttX libraries that is passed to the
# processor-specific Makefile to build the final NuttX target.
# USERLIBS is the list of libraries used to build the final user-space
# application
# EXPORTLIBS is the list of libraries that should be exported by
# 'make export' is
ifeq ($(CONFIG_BUILD_PROTECTED),y)
include tools/ProtectedLibs.mk
else ifeq ($(CONFIG_BUILD_KERNEL),y)
include tools/KernelLibs.mk
else
include tools/FlatLibs.mk
endif
# LINKLIBS derives from NUTTXLIBS and is simply the same list with the
# subdirectory removed
LINKLIBS = $(patsubst staging/%,%,$(NUTTXLIBS))
# Export tool definitions
MKEXPORT= tools/mkexport.sh
MKEXPORT_ARGS = -t "$(TOPDIR)" -b "$(BOARD_DIR)"
ifneq ($(CONFIG_BUILD_FLAT),y)
MKEXPORT_ARGS += -u
endif
ifneq ($(APPDIR),)
ifneq ($(shell [ -e $(APPDIR)/Makefile ] && echo yes),)
MKEXPORT_ARGS += -a "$(APPDIR)"
MKEXPORT_ARGS += -m "$(MAKE)"
endif
endif
ifeq ($(V),2)
MKEXPORT_ARGS += -d
endif
# This is the name of the final target (relative to the top level directory)
BIN = nuttx$(EXEEXT)
all: $(BIN)
.PHONY: dirlinks context clean_context config oldconfig menuconfig nconfig qconfig gconfig export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
.PHONY: pass1 pass1dep
.PHONY: pass2 pass2dep
# Target used to copy include/nuttx/lib/math.h. If CONFIG_ARCH_MATH_H is
# defined, then there is an architecture specific math.h header file
# that will be included indirectly from include/math.h. But first, we
# have to copy math.h from include/nuttx/. to include/. Logic within
# include/nuttx/lib/math.h will hand the redirection to the architecture-
# specific math.h header file.
#
# If the CONFIG_LIBM is defined, the Rhombus libm will be built at libc/math.
# Definitions and prototypes for the Rhombus libm are also contained in
# include/nuttx/lib/math.h and so the file must also be copied in that case.
#
# If neither CONFIG_ARCH_MATH_H nor CONFIG_LIBM is defined, then no math.h
# header file will be provided. You would want that behavior if (1) you
# don't use libm, or (2) you want to use the math.h and libm provided
# within your toolchain.
ifeq ($(CONFIG_ARCH_MATH_H),y)
NEED_MATH_H = y
else ifeq ($(CONFIG_LIBM),y)
NEED_MATH_H = y
endif
ifeq ($(NEED_MATH_H),y)
include/math.h: include/nuttx/lib/math.h .clean_context
$(Q) cp -f include/nuttx/lib/math.h include/math.h
else
include/math.h:
endif
# The float.h header file defines the properties of your floating point
# implementation. It would always be best to use your toolchain's float.h
# header file but if none is available, a default float.h header file will
# provided if this option is selected. However there is no assurance that
# the settings in this float.h are actually correct for your platform!
ifeq ($(CONFIG_ARCH_FLOAT_H),y)
include/float.h: include/nuttx/lib/float.h .clean_context
$(Q) cp -f include/nuttx/lib/float.h include/float.h
else
include/float.h:
endif
# Target used to copy include/nuttx/lib/stdarg.h. If CONFIG_ARCH_STDARG_H is
# defined, then there is an architecture specific stdarg.h header file
# that will be included indirectly from include/lib/stdarg.h. But first, we
# have to copy stdarg.h from include/nuttx/. to include/.
ifeq ($(CONFIG_ARCH_STDARG_H),y)
include/stdarg.h: include/nuttx/lib/stdarg.h .clean_context
$(Q) cp -f include/nuttx/lib/stdarg.h include/stdarg.h
else
include/stdarg.h:
endif
# Target used to copy include/nuttx/lib/setjmp.h. If CONFIG_ARCH_SETJMP_H is
# defined, then there is an architecture specific setjmp.h header file
# that will be included indirectly from include/lib/setjmp.h. But first, we
# have to copy setjmp.h from include/nuttx/. to include/.
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
include/setjmp.h: include/nuttx/lib/setjmp.h .clean_context
$(Q) cp -f include/nuttx/lib/setjmp.h include/setjmp.h
else
include/setjmp.h:
endif
# Targets used to build include/nuttx/version.h. Creation of version.h is
# part of the overall NuttX configuration sequence. Notice that the
# tools/mkversion tool is built and used to create include/nuttx/version.h
tools/mkversion$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host mkversion$(HOSTEXEEXT)
# [Re-]create .version if it doesn't already exist.
$(TOPDIR)/.version:
$(Q) echo "Create .version"
$(Q) tools/version.sh $(VERSION_ARG) .version
$(Q) chmod 755 .version
include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion$(HOSTEXEEXT) .clean_context
$(Q) echo "Create version.h"
$(Q) tools/mkversion $(TOPDIR) > $@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
# Targets used to build include/nuttx/config.h. Creation of config.h is
# part of the overall NuttX configuration sequence. Notice that the
# tools/mkconfig tool is built and used to create include/nuttx/config.h
tools/mkconfig$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host mkconfig$(HOSTEXEEXT)
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig$(HOSTEXEEXT) .clean_context
$(Q) tools/mkconfig $(TOPDIR) > $@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
# Targets used to create dependencies
tools/mkdeps$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host mkdeps$(HOSTEXEEXT)
tools/cnvwindeps$(HOSTEXEEXT):
$(Q) $(MAKE) -C tools -f Makefile.host cnvwindeps$(HOSTEXEEXT)
# dirlinks, and helpers
#
# Directories links. Most of establishing the NuttX configuration involves
# setting up symbolic links with 'generic' directory names to specific,
# configured directories.
# Link the arch/<arch-name>/include directory to include/arch
include/arch: .clean_context
@echo "LN: include/arch to $(ARCH_DIR)/include"
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_DIR)/include include/arch
$(Q) touch $@
# Link the boards/<arch>/<chip>/<board>/include directory to include/arch/board
include/arch/board: include/arch
@echo "LN: include/arch/board to $(BOARD_DIR)/include"
$(Q) $(DIRLINK) $(BOARD_DIR)/include include/arch/board
$(Q) touch $@
ifneq ($(BOARD_COMMON_DIR),)
# Link the boards/<arch>/<chip>/common dir to arch/<arch-name>/src/board
# Link the boards/<arch>/<chip>/<board>/src dir to arch/<arch-name>/src/board/board
$(ARCH_SRC)/board: .clean_context
@echo "LN: $(ARCH_SRC)/board to $(BOARD_COMMON_DIR)"
$(Q) $(DIRLINK) $(BOARD_COMMON_DIR) $(ARCH_SRC)/board
@echo "LN: $(ARCH_SRC)/board/board to $(BOARD_DIR)/src"
$(Q) $(DIRLINK) $(BOARD_DIR)/src $(ARCH_SRC)/board/board
$(Q) touch $@
else
# Link the boards/<arch>/<chip>/<board>/src dir to arch/<arch-name>/src/board
$(ARCH_SRC)/board: .clean_context
@echo "LN: $(ARCH_SRC)/board to $(BOARD_DIR)/src"
$(Q) $(DIRLINK) $(BOARD_DIR)/src $(ARCH_SRC)/board
$(Q) touch $@
endif
# Link the boards/<arch>/<chip>/drivers dir to drivers/platform
drivers/platform: .clean_context
@echo "LN: $(TOPDIR)/drivers/platform to $(BOARD_DRIVERS_DIR)"
$(Q) $(DIRLINK) $(BOARD_DRIVERS_DIR) $(TOPDIR)/drivers/platform
$(Q) touch $@
# Link arch/<arch-name>/src/<chip-name> to arch/<arch-name>/src/chip
$(ARCH_SRC)/chip: .clean_context
ifeq ($(CONFIG_ARCH_CHIP_CUSTOM),y)
@echo "LN: $(ARCH_SRC)/chip to $(CHIP_DIR)"
$(Q) $(DIRLINK) $(CHIP_DIR) $(ARCH_SRC)/chip
else ifneq ($(CONFIG_ARCH_CHIP),)
@echo "LN: $(ARCH_SRC)/chip to $(ARCH_SRC)/$(CONFIG_ARCH_CHIP)"
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_SRC)/$(CONFIG_ARCH_CHIP) $(ARCH_SRC)/chip
endif
$(Q) cp -f $(CHIP_KCONFIG) $(TOPDIR)/arch/dummy/Kconfig
$(Q) touch $@
# Link arch/<arch-name>/include/<chip-name> to include/arch/chip
include/arch/chip: include/arch
ifeq ($(CONFIG_ARCH_CHIP_CUSTOM),y)
@echo "LN: include/arch/chip to $(CHIP_DIR)/include"
$(Q) $(DIRLINK) $(CHIP_DIR)/include include/arch/chip
else ifneq ($(CONFIG_ARCH_CHIP),)
@echo "LN: include/arch/chip to $(ARCH_INC)/$(CONFIG_ARCH_CHIP)"
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_INC)/$(CONFIG_ARCH_CHIP) include/arch/chip
endif
$(Q) touch $@
dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip drivers/platform
$(Q) $(MAKE) -C libs/libxx dirlinks
$(Q) $(MAKE) -C boards dirlinks
$(Q) $(MAKE) -C openamp dirlinks
$(Q) $(MAKE) -C $(CONFIG_APPS_DIR) dirlinks
# context
#
# The context target is invoked on each target build to assure that NuttX is
# properly configured. The basic configuration steps include creation of the
# the config.h and version.h header files in the include/nuttx directory and
# the establishment of symbolic links to configured directories.
context: include/nuttx/config.h include/nuttx/version.h include/math.h include/float.h include/stdarg.h include/setjmp.h dirlinks
$(Q) mkdir -p staging
$(Q) for dir in $(CONTEXTDIRS) ; do \
$(MAKE) -C $$dir context || exit; \
done
# clean_context
#
# This is part of the distclean target. It removes all of the header files
# and symbolic links created by the context target.
clean_context:
$(Q) for dir in $(CCLEANDIRS) ; do \
if [ -e $$dir/Makefile ]; then \
$(MAKE) -C $$dir clean_context ; \
fi \
done
$(call DELFILE, include/nuttx/config.h)
$(call DELFILE, include/nuttx/version.h)
$(call DELFILE, include/float.h)
$(call DELFILE, include/math.h)
$(call DELFILE, include/stdarg.h)
$(call DELFILE, include/setjmp.h)
$(call DELFILE, arch/dummy/Kconfig)
$(Q) $(DIRUNLINK) include/arch/board
$(Q) $(DIRUNLINK) include/arch/chip
$(Q) $(DIRUNLINK) include/arch
$(Q) $(DIRUNLINK) $(ARCH_SRC)/board/board
$(Q) $(DIRUNLINK) $(ARCH_SRC)/board
$(Q) $(DIRUNLINK) $(ARCH_SRC)/chip
$(Q) $(DIRUNLINK) $(TOPDIR)/drivers/platform
.clean_context: .config
+$(Q) $(MAKE) clean_context
$(Q) touch $@
# Archive targets. The target build sequence will first create a series of
# libraries, one per configured source file directory. The final NuttX
# execution will then be built from those libraries. The following targets
# build those libraries.
include tools/LibTargets.mk
# pass1 and pass2
#
# If the 2 pass build option is selected, then this pass1 target is
# configured to be built before the pass2 target. This pass1 target may, as an
# example, build an extra link object (CONFIG_PASS1_OBJECT) which may be an
# incremental (relative) link object, but could be a static library (archive);
# some modification to this Makefile would be required if CONFIG_PASS1_OBJECT
# is an archive. Exactly what is performed during pass1 or what it generates
# is unknown to this makefile unless CONFIG_PASS1_OBJECT is defined.
pass1: $(USERLIBS)
pass2: $(NUTTXLIBS)
# $(BIN)
#
# Create the final NuttX executable in a two pass build process. In the
# normal case, all pass1 and pass2 dependencies are created then pass1
# and pass2 targets are built. However, in some cases, you may need to build
# pass1 dependencies and pass1 first, then build pass2 dependencies and pass2.
# in that case, execute 'make pass1 pass2' from the command line.
$(BIN): pass1 pass2
ifeq ($(CONFIG_BUILD_2PASS),y)
$(Q) if [ -z "$(CONFIG_PASS1_BUILDIR)" ]; then \
echo "ERROR: CONFIG_PASS1_BUILDIR not defined"; \
exit 1; \
fi
$(Q) if [ ! -d "$(CONFIG_PASS1_BUILDIR)" ]; then \
echo "ERROR: CONFIG_PASS1_BUILDIR does not exist"; \
exit 1; \
fi
$(Q) if [ ! -f "$(CONFIG_PASS1_BUILDIR)/Makefile" ]; then \
echo "ERROR: No Makefile in CONFIG_PASS1_BUILDIR"; \
exit 1; \
fi
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) LINKLIBS="$(LINKLIBS)" USERLIBS="$(USERLIBS)" "$(CONFIG_PASS1_TARGET)"
endif
$(Q) $(MAKE) -C $(ARCH_SRC) EXTRA_OBJS="$(EXTRA_OBJS)" LINKLIBS="$(LINKLIBS)" EXTRAFLAGS="$(KDEFINE) $(EXTRAFLAGS)" $(BIN)
$(Q) if [ -w /tftpboot ] ; then \
cp -f $(BIN) /tftpboot/$(BIN).${CONFIG_ARCH}; \
fi
$(Q) echo $(BIN) > nuttx.manifest
$(Q) printf "%s\n" *.map >> nuttx.manifest
ifeq ($(CONFIG_INTELHEX_BINARY),y)
@echo "CP: nuttx.hex"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex $(BIN) nuttx.hex
$(Q) echo nuttx.hex >> nuttx.manifest
endif
ifeq ($(CONFIG_MOTOROLA_SREC),y)
@echo "CP: nuttx.srec"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec $(BIN) nuttx.srec
$(Q) echo nuttx.srec >> nuttx.manifest
endif
ifeq ($(CONFIG_RAW_BINARY),y)
@echo "CP: nuttx.bin"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(BIN) nuttx.bin
$(Q) echo nuttx.bin >> nuttx.manifest
endif
ifeq ($(CONFIG_UBOOT_UIMAGE),y)
@echo "MKIMAGE: uImage"
$(Q) mkimage -A $(CONFIG_ARCH) -O linux -C none -T kernel -a $(CONFIG_UIMAGE_LOAD_ADDRESS) \
-e $(CONFIG_UIMAGE_ENTRY_POINT) -n $(BIN) -d nuttx.bin uImage
$(Q) if [ -w /tftpboot ] ; then \
cp -f uImage /tftpboot/uImage; \
fi
$(Q) echo "uImage" >> nuttx.manifest
endif
$(call POSTBUILD, $(TOPDIR))
# download
#
# This is a helper target that will rebuild NuttX and download it to the target
# system in one step. The operation of this target depends completely upon
# implementation of the DOWNLOAD command in the user Make.defs file. It will
# generate an error if the DOWNLOAD command is not defined.
download: $(BIN)
$(call DOWNLOAD, $<)
# pass1dep: Create pass1 build dependencies
# pass2dep: Create pass2 build dependencies
pass1dep: context tools/mkdeps$(HOSTEXEEXT) tools/cnvwindeps$(HOSTEXEEXT)
$(Q) for dir in $(USERDEPDIRS) ; do \
$(MAKE) -C $$dir depend || exit; \
done
pass2dep: context tools/mkdeps$(HOSTEXEEXT) tools/cnvwindeps$(HOSTEXEEXT)
$(Q) for dir in $(KERNDEPDIRS) ; do \
$(MAKE) -C $$dir EXTRAFLAGS="$(KDEFINE) $(EXTRAFLAGS)" depend || exit; \
done
# Configuration targets
#
# These targets depend on the kconfig-frontends packages. To use these, you
# must first download and install the kconfig-frontends package from this
# location: https://bitbucket.org/nuttx/tools/downloads/. See README.txt
# file in the NuttX tools GIT repository for additional information.
config: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-conf Kconfig
oldconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-conf --oldconfig Kconfig
olddefconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-conf --olddefconfig Kconfig
menuconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-mconf Kconfig
nconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-nconf Kconfig
qconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-qconf Kconfig
gconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-gconf Kconfig
savedefconfig: apps_preconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-conf --savedefconfig defconfig.tmp Kconfig
$(Q) kconfig-tweak --file defconfig.tmp -u CONFIG_APPS_DIR
$(Q) grep "CONFIG_ARCH=" .config >> defconfig.tmp
$(Q) grep "^CONFIG_ARCH_CHIP_" .config >> defconfig.tmp; true
$(Q) grep "CONFIG_ARCH_CHIP=" .config >> defconfig.tmp; true
$(Q) grep "CONFIG_ARCH_BOARD=" .config >> defconfig.tmp; true
$(Q) grep "^CONFIG_ARCH_CUSTOM" .config >> defconfig.tmp; true
$(Q) grep "^CONFIG_ARCH_BOARD_CUSTOM" .config >> defconfig.tmp; true
$(Q) export LC_ALL=C; cat defconfig.tmp | sort | uniq > sortedconfig.tmp
$(Q) echo "#" > warning.tmp
$(Q) echo "# This file is autogenerated: PLEASE DO NOT EDIT IT." >> warning.tmp
$(Q) echo "#" >> warning.tmp
$(Q) echo "# You can use \"make menuconfig\" to make any modifications to the installed .config file." >> warning.tmp
$(Q) echo "# You can then do \"make savedefconfig\" to generate a new defconfig file that includes your" >> warning.tmp
$(Q) echo "# modifications." >> warning.tmp
$(Q) echo "#" >> warning.tmp
$(Q) cat warning.tmp sortedconfig.tmp > defconfig
$(Q) rm -f warning.tmp
$(Q) rm -f defconfig.tmp
$(Q) rm -f sortedconfig.tmp
# export
#
# The export target will package the NuttX libraries and header files into
# an exportable package. Caveats: (1) These needs some extension for the KERNEL
# build; it needs to receive USERLIBS and create a libuser.a). (2) The logic
# in tools/mkexport.sh only supports GCC and, for example, explicitly assumes
# that the archiver is 'ar'
export: $(NUTTXLIBS)
$(Q) MAKE=${MAKE} $(MKEXPORT) $(MKEXPORT_ARGS) -l "$(EXPORTLIBS)"
# General housekeeping targets: dependencies, cleaning, etc.
#
# depend: Create both PASS1 and PASS2 dependencies
# clean: Removes derived object files, archives, executables, and
# temporary files, but retains the configuration and context
# files and directories.
# distclean: Does 'clean' then also removes all configuration and context
# files. This essentially restores the directory structure
# to its original, unconfigured stated.
depend: pass1dep pass2dep
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
subdir_clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
ifeq ($(CONFIG_BUILD_2PASS),y)
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) clean
endif
clean: subdir_clean
$(call DELFILE, $(BIN))
$(call DELFILE, nuttx.*)
$(call DELFILE, *.map)
$(call DELFILE, _SAVED_APPS_config)
$(call DELFILE, nuttx-export*.zip)
$(call DELDIR, nuttx-export*)
$(call DELFILE, nuttx_user*)
$(call DELDIR, staging)
$(call DELFILE, uImage)
$(call CLEAN)
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
subdir_distclean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_distclean)
distclean: clean subdir_distclean clean_context
ifeq ($(CONFIG_BUILD_2PASS),y)
$(Q) $(MAKE) -C $(CONFIG_PASS1_BUILDIR) distclean
endif
$(call DELFILE, Make.defs)
$(call DELFILE, defconfig)
$(call DELFILE, .config)
$(call DELFILE, .config.old)
$(call DELFILE, .gdbinit)
$(call DELFILE, .clean_context)
$(Q) $(MAKE) -C tools -f Makefile.host clean
# Application housekeeping targets. The APPDIR variable refers to the user
# application directory. A sample apps/ directory is included with NuttX,
# however, this is not treated as part of NuttX and may be replaced with a
# different application directory. For the most part, the application
# directory is treated like any other build directory in this script. However,
# as a convenience, the following targets are included to support housekeeping
# functions in the user application directory from the NuttX build directory.
#
# apps_preconfig: Prepare applications to be configured
# apps_clean: Perform the clean operation only in the user application
# directory
# apps_distclean: Perform the distclean operation only in the user application
# directory.
apps_preconfig: dirlinks
ifneq ($(APPDIR),)
$(Q) $(MAKE) -C $(APPDIR) preconfig
endif
apps_clean:
ifneq ($(APPDIR),)
$(Q) $(MAKE) -C $(APPDIR) clean
endif
apps_distclean:
ifneq ($(APPDIR),)
$(Q) $(MAKE) -C $(APPDIR) distclean
endif

View File

@@ -0,0 +1,360 @@
/****************************************************************************
* tools/cfgdefine.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 <string.h>
#include <ctype.h>
#include "cfgdefine.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
char line[LINESIZE + 1];
/****************************************************************************
* Private Data
****************************************************************************/
/* These are configuration variable name that are quoted by configuration
* tool but which must be unquoted when used in C code.
*/
static const char *dequote_list[] =
{
/* NuttX */
"CONFIG_DEBUG_OPTLEVEL", /* Custom debug level */
"CONFIG_EXECFUNCS_NSYMBOLS_VAR", /* Variable holding number of symbols in the table */
"CONFIG_EXECFUNCS_SYMTAB_ARRAY", /* Symbol table array used by exec[l|v] */
"CONFIG_INIT_ARGS", /* Argument list of entry point */
"CONFIG_INIT_SYMTAB", /* Global symbol table */
"CONFIG_INIT_NEXPORTS", /* Global symbol table size */
"CONFIG_MODLIB_SYMTAB_ARRAY", /* Symbol table array used by modlib functions */
"CONFIG_MODLIB_NSYMBOLS_VAR", /* Variable holding number of symbols in the table */
"CONFIG_PASS1_BUILDIR", /* Pass1 build directory */
"CONFIG_PASS1_TARGET", /* Pass1 build target */
"CONFIG_PASS1_OBJECT", /* Pass1 build object */
"CONFIG_USER_ENTRYPOINT", /* Name of entry point function */
/* NxWidgets/NxWM */
"CONFIG_NXWM_BACKGROUND_IMAGE", /* Name of bitmap image class */
"CONFIG_NXWM_CALIBRATION_ICON", /* Name of bitmap image class */
"CONFIG_NXWM_HEXCALCULATOR_ICON", /* Name of bitmap image class */
"CONFIG_NXWM_MINIMIZE_BITMAP", /* Name of bitmap image class */
"CONFIG_NXWM_NXTERM_ICON", /* Name of bitmap image class */
"CONFIG_NXWM_STARTWINDOW_ICON", /* Name of bitmap image class */
"CONFIG_NXWM_STOP_BITMAP", /* Name of bitmap image class */
/* apps/ definitions */
"CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME", /* Symbol table array name */
"CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME", /* Name of the variable holding the number of symbols */
NULL /* Marks the end of the list */
};
/****************************************************************************
* Private Functions
****************************************************************************/
/* Skip over any spaces */
static char *skip_space(char *ptr)
{
while (*ptr && isspace((int)*ptr)) ptr++;
return ptr;
}
/* Find the end of a variable string */
static char *find_name_end(char *ptr)
{
while (*ptr && (isalnum((int)*ptr) || *ptr == '_')) ptr++;
return ptr;
}
/* Find the end of a value string */
static char *find_value_end(char *ptr)
{
while (*ptr && !isspace((int)*ptr))
{
if (*ptr == '"')
{
do ptr++; while (*ptr && *ptr != '"');
if (*ptr) ptr++;
}
else
{
do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"');
}
}
return ptr;
}
/* Read the next line from the configuration file */
static char *read_line(FILE *stream)
{
char *ptr;
for (; ; )
{
line[LINESIZE] = '\0';
if (!fgets(line, LINESIZE, stream))
{
return NULL;
}
else
{
ptr = skip_space(line);
if (*ptr && *ptr != '#' && *ptr != '\n')
{
return ptr;
}
}
}
}
/* Parse the line from the configuration file into a variable name
* string and a value string.
*/
static void parse_line(char *ptr, char **varname, char **varval)
{
/* Skip over any leading spaces */
ptr = skip_space(ptr);
/* The first no-space is the beginning of the variable name */
*varname = skip_space(ptr);
*varval = NULL;
/* Parse to the end of the variable name */
ptr = find_name_end(ptr);
/* An equal sign is expected next, perhaps after some white space */
if (*ptr && *ptr != '=')
{
/* Some else follows the variable name. Terminate the variable
* name and skip over any spaces.
*/
*ptr = '\0';
ptr = skip_space(ptr + 1);
}
/* Verify that the equal sign is present */
if (*ptr == '=')
{
/* Make sure that the variable name is terminated (this was already
* done if the name was followed by white space.
*/
*ptr = '\0';
/* The variable value should follow =, perhaps separated by some
* white space.
*/
ptr = skip_space(ptr + 1);
if (*ptr)
{
/* Yes.. a variable follows. Save the pointer to the start
* of the variable string.
*/
*varval = ptr;
/* Find the end of the variable string and make sure that it
* is terminated.
*/
ptr = find_value_end(ptr);
*ptr = '\0';
}
}
}
static char *dequote_value(const char *varname, char *varval)
{
const char **dqnam;
char *dqval = varval;
char *ptr;
int len;
int i;
if (dqval)
{
/* Check if the variable name is in the dequoted list of strings */
for (dqnam = dequote_list; *dqnam; dqnam++)
{
if (strcmp(*dqnam, varname) == 0)
{
break;
}
}
/* Did we find the variable name in the list of configuration variables
* to be dequoted?
*/
if (*dqnam)
{
/* Yes... Check if there is a trailing quote */
len = strlen(dqval);
if (dqval[len - 1] == '"')
{
/* Yes... replace it with a terminator */
dqval[len - 1] = '\0';
len--;
}
/* Is there a leading quote? */
if (dqval[0] == '"')
{
/* Yes.. skip over the leading quote */
dqval++;
len--;
}
/* A special case is a quoted list of quoted strings. In that case
* we will need to remove the backspaces from the internally quoted
* strings. NOTE: this will not handle nested quoted quotes.
*/
for (ptr = dqval; *ptr; ptr++)
{
/* Check for a quoted quote */
if (ptr[0] == '\\' && ptr[1] == '"')
{
/* Delete the backslash by moving the rest of the string */
for (i = 0; ptr[i]; i++)
{
ptr[i] = ptr[i + 1];
}
len--;
}
}
/* Handle the case where nothing is left after dequoting */
if (len <= 0)
{
dqval = NULL;
}
}
}
return dqval;
}
/****************************************************************************
* Public Functions
****************************************************************************/
void generate_definitions(FILE *stream)
{
char *varname;
char *varval;
char *ptr;
/* Loop until the entire file has been parsed. */
do
{
/* Read the next line from the file */
ptr = read_line(stream);
if (ptr)
{
/* Parse the line into a variable and a value field */
parse_line(ptr, &varname, &varval);
/* Was a variable name found? */
if (varname)
{
/* Yes.. dequote the value if necessary */
varval = dequote_value(varname, varval);
/* If no value was provided or if the special value 'n' was
* provided, then undefine the configuration variable.
*/
if (!varval || strcmp(varval, "n") == 0)
{
printf("#undef %s\n", varname);
}
/* Simply define the configuration variable to '1' if it has
* the special value "y"
*/
else if (strcmp(varval, "y") == 0)
{
printf("#define %s 1\n", varname);
printf("#define %s 1\n", &varname[7]);
}
/* Or to '2' if it has the special value 'm' */
else if (strcmp(varval, "m") == 0)
{
printf("#define %s 2\n", varname);
printf("#define %s 2\n", &varname[7]);
}
/* Otherwise, use the value as provided */
else
{
printf("#define %s %s\n", varname, varval);
printf("#define %s %s\n", &varname[7], varval);
}
}
}
}
while (ptr);
}

View File

@@ -56,7 +56,7 @@ else
endif
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CFLAGS := $(APPPATHS) $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)

View File

@@ -116,6 +116,10 @@
# include <nuttx/usb/adb.h>
#endif
#ifdef CONFIG_SENSORS_HS300X
#include "stm32_hs300x.h"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -551,5 +555,13 @@ printf("hello lcd 1");
usbdev_adb_initialize();
#endif
#ifdef CONFIG_SENSORS_HS300X
ret = board_hs300x_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize HS300x, error %d\n", ret);
}
#endif /* CONFIG_SENSORS_HS300X */
return ret;
}

View File

@@ -426,9 +426,6 @@ CONFIG_BSP_DVP_CMOS_PWDN_PIN=44
CONFIG_BSP_DVP_CMOS_XCLK_PIN=46
CONFIG_BSP_DVP_CMOS_PCLK_PIN=47
CONFIG_BSP_DVP_CMOS_HREF_PIN=45
CONFIG_RW007_SPIDEV_NAME="spi11"
CONFIG_RW007_INT_BUSY_PIN=7
CONFIG_RW007_RST_PIN=6
#
# Kendryte SDK Config
@@ -438,10 +435,7 @@ CONFIG_PKG_KENDRYTE_SDK_VERNUM=0x0055
#
# More Drivers
#
CONFIG_PKG_USING_RW007=y
CONFIG_RW007_NOT_USE_EXAMPLE_DRIVERS=y
# CONFIG_RW007_USING_STM32_DRIVERS is not set
CONFIG_RW007_SPI_MAX_HZ=20000000
# CONFIG_PKG_USING_RW007 is not set
CONFIG_DRV_USING_OV2640=y
#
@@ -457,6 +451,11 @@ CONFIG_DRV_USING_OV2640=y
#
CONFIG_MAIN_KTASK_STACK_SIZE=1024
#
# ota app
#
# CONFIG_APPLICATION_OTA is not set
#
# test app
#
@@ -475,11 +474,10 @@ CONFIG_MAIN_KTASK_STACK_SIZE=1024
# knowing app
#
CONFIG_APPLICATION_KNOWING=y
CONFIG_APP_MNIST=y
CONFIG_FACE_DETECT=y
# CONFIG_INSTRUSION_DETECT is not set
# CONFIG_HELMET_DETECT is not set
CONFIG_K210_DETECT_ENTRY=y
# CONFIG_IRIS_ML_DEMO is not set
# CONFIG_K210_FFT_TEST is not set
# CONFIG_USING_IMAGE_PROCESSING_APP is not set
#
# sensor app
@@ -487,8 +485,7 @@ CONFIG_FACE_DETECT=y
CONFIG_APPLICATION_SENSOR=y
# CONFIG_APPLICATION_SENSOR_CO2 is not set
# CONFIG_APPLICATION_SENSOR_PM1_0 is not set
CONFIG_APPLICATION_SENSOR_VOICE=y
CONFIG_APPLICATION_SENSOR_VOICE_D124=y
# CONFIG_APPLICATION_SENSOR_VOICE is not set
# CONFIG_APPLICATION_SENSOR_HUMIDITY is not set
# CONFIG_APPLICATION_SENSOR_TEMPERATURE is not set
@@ -499,27 +496,18 @@ CONFIG_TRANSFORM_LAYER_ATTRIUBUTE=y
CONFIG_ADD_XIUOS_FETURES=y
# CONFIG_ADD_NUTTX_FETURES is not set
# CONFIG_ADD_RTTHREAD_FETURES is not set
CONFIG_SUPPORT_SENSOR_FRAMEWORK=y
# CONFIG_SENSOR_CO2 is not set
# CONFIG_SENSOR_PM is not set
CONFIG_SENSOR_VOICE=y
CONFIG_SENSOR_D124=y
CONFIG_SENSOR_DEVICE_D124="d124_1"
CONFIG_SENSOR_QUANTITY_D124_VOICE="voice_1"
# CONFIG_SENSOR_D124_DRIVER_EXTUART is not set
CONFIG_SENSOR_DEVICE_D124_DEV="/dev/uar2"
# CONFIG_SENSOR_TEMPERATURE is not set
# CONFIG_SENSOR_HUMIDITY is not set
# CONFIG_SUPPORT_SENSOR_FRAMEWORK is not set
# CONFIG_SUPPORT_CONNECTION_FRAMEWORK is not set
CONFIG_SUPPORT_KNOWING_FRAMEWORK=y
CONFIG_USING_TENSORFLOWLITEMICRO=y
CONFIG_USING_TENSORFLOWLITEMICRO_NORMAL=y
# CONFIG_USING_TENSORFLOWLITEMICRO_CMSISNN is not set
# CONFIG_USING_TENSORFLOWLITEMICRO_DEMOAPP is not set
CONFIG_USING_KPU_POSTPROCESSING=y
CONFIG_USING_YOLOV2=y
# CONFIG_USING_TENSORFLOWLITEMICRO is not set
# CONFIG_USING_KNOWING_FILTER is not set
# CONFIG_USING_OTA_MODEL is not set
# CONFIG_USING_IMAGE_PROCESSING is not set
# CONFIG_USING_CMSIS_5 is not set
CONFIG_USING_KPU_PROCESSING=y
CONFIG_USING_YOLOV2=y
CONFIG_USING_YOLOV2_JSONPARSER=y
CONFIG_USING_K210_YOLOV2_DETECT=y
# CONFIG_SUPPORT_CONTROL_FRAMEWORK is not set
#

View File

@@ -31,7 +31,7 @@ config APP_DIR
source "$RTT_DIR/Kconfig"
source "base-drivers/Kconfig"
source "kendryte-sdk/Kconfig"
source "$RT_Thread_DIR/drivers/Kconfig"
source "$RT_Thread_DIR/app_match_rt-thread/Kconfig"
source "$ROOT_DIR/APP_Framework/Kconfig"
config __STACKSIZE__

View File

@@ -51,7 +51,7 @@ stack_lds.write('__STACKSIZE__ = %d;' % stack_size)
stack_lds.close()
# include more drivers
objs.extend(SConscript(os.getcwd() + '/../../drivers/SConscript'))
objs.extend(SConscript(os.getcwd() + '/../../app_match_rt-thread/SConscript'))
# include APP_Framework/Framework
objs.extend(SConscript(os.getcwd() + '/../../../../APP_Framework/Framework/SConscript'))

View File

@@ -291,9 +291,6 @@
#define BSP_DVP_CMOS_XCLK_PIN 46
#define BSP_DVP_CMOS_PCLK_PIN 47
#define BSP_DVP_CMOS_HREF_PIN 45
#define RW007_SPIDEV_NAME "spi11"
#define RW007_INT_BUSY_PIN 7
#define RW007_RST_PIN 6
/* Kendryte SDK Config */
@@ -301,9 +298,6 @@
/* More Drivers */
#define PKG_USING_RW007
#define RW007_NOT_USE_EXAMPLE_DRIVERS
#define RW007_SPI_MAX_HZ 20000000
#define DRV_USING_OV2640
/* APP_Framework */
@@ -314,6 +308,9 @@
#define MAIN_KTASK_STACK_SIZE 1024
/* ota app */
/* test app */
@@ -325,30 +322,21 @@
/* knowing app */
#define APPLICATION_KNOWING
#define APP_MNIST
#define FACE_DETECT
#define K210_DETECT_ENTRY
/* sensor app */
#define APPLICATION_SENSOR
#define APPLICATION_SENSOR_VOICE
#define APPLICATION_SENSOR_VOICE_D124
/* Framework */
#define TRANSFORM_LAYER_ATTRIUBUTE
#define ADD_XIUOS_FETURES
#define SUPPORT_SENSOR_FRAMEWORK
#define SENSOR_VOICE
#define SENSOR_D124
#define SENSOR_DEVICE_D124 "d124_1"
#define SENSOR_QUANTITY_D124_VOICE "voice_1"
#define SENSOR_DEVICE_D124_DEV "/dev/uar2"
#define SUPPORT_KNOWING_FRAMEWORK
#define USING_TENSORFLOWLITEMICRO
#define USING_TENSORFLOWLITEMICRO_NORMAL
#define USING_KPU_POSTPROCESSING
#define USING_KPU_PROCESSING
#define USING_YOLOV2
#define USING_YOLOV2_JSONPARSER
#define USING_K210_YOLOV2_DETECT
/* Security */

View File

@@ -19,7 +19,7 @@ CONFIG_RT_ALIGN_SIZE=4
CONFIG_RT_THREAD_PRIORITY_32=y
# CONFIG_RT_THREAD_PRIORITY_256 is not set
CONFIG_RT_THREAD_PRIORITY_MAX=32
CONFIG_RT_TICK_PER_SECOND=100
CONFIG_RT_TICK_PER_SECOND=1000
CONFIG_RT_USING_OVERFLOW_CHECK=y
CONFIG_RT_USING_HOOK=y
CONFIG_RT_USING_IDLE_HOOK=y
@@ -149,12 +149,12 @@ CONFIG_RT_DFS_ELM_LFN_UNICODE_0=y
CONFIG_RT_DFS_ELM_LFN_UNICODE=0
CONFIG_RT_DFS_ELM_MAX_LFN=255
CONFIG_RT_DFS_ELM_DRIVES=2
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=4096
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
CONFIG_RT_DFS_ELM_REENTRANT=y
CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000
CONFIG_RT_USING_DFS_DEVFS=y
# CONFIG_RT_USING_DFS_ROMFS is not set
CONFIG_RT_USING_DFS_ROMFS=y
# CONFIG_RT_USING_DFS_RAMFS is not set
# CONFIG_RT_USING_DFS_NFS is not set
@@ -191,7 +191,12 @@ CONFIG_RT_USING_PIN=y
CONFIG_RT_USING_SPI=y
# CONFIG_RT_USING_QSPI is not set
CONFIG_RT_USING_SPI_MSD=y
# CONFIG_RT_USING_SFUD is not set
CONFIG_RT_USING_SFUD=y
CONFIG_RT_SFUD_USING_SFDP=y
CONFIG_RT_SFUD_USING_FLASH_INFO_TABLE=y
# CONFIG_RT_SFUD_USING_QSPI is not set
CONFIG_RT_SFUD_SPI_MAX_HZ=50000000
# CONFIG_RT_DEBUG_SFUD is not set
# CONFIG_RT_USING_ENC28J60 is not set
# CONFIG_RT_USING_SPI_WIFI is not set
# CONFIG_RT_USING_WDT is not set
@@ -379,7 +384,7 @@ CONFIG_BSP_USING_USB_TO_USART=y
# CONFIG_BSP_USING_COM2 is not set
# CONFIG_BSP_USING_COM3 is not set
CONFIG_BSP_USING_SRAM=y
# CONFIG_BSP_USING_SPI_FLASH is not set
CONFIG_BSP_USING_SPI_FLASH=y
# CONFIG_BSP_USING_EEPROM is not set
CONFIG_BSP_USING_OV2640=y
# CONFIG_BSP_USING_ETH is not set
@@ -415,8 +420,8 @@ CONFIG_BSP_USING_SPI2=y
# CONFIG_BSP_SPI2_RX_USING_DMA is not set
# CONFIG_BSP_USING_ADC is not set
CONFIG_BSP_USING_I2C1=y
CONFIG_BSP_I2C1_SCL_PIN=54
CONFIG_BSP_I2C1_SDA_PIN=55
CONFIG_BSP_I2C1_SCL_PIN=55
CONFIG_BSP_I2C1_SDA_PIN=54
# CONFIG_BSP_USING_ONCHIP_RTC is not set
# CONFIG_BSP_USING_WDT is not set
# CONFIG_BSP_USING_SDIO is not set
@@ -461,6 +466,11 @@ CONFIG_DRV_USING_OV2640=y
#
CONFIG_MAIN_KTASK_STACK_SIZE=1024
#
# ota app
#
# CONFIG_APPLICATION_OTA is not set
#
# test app
#
@@ -512,11 +522,14 @@ CONFIG_SENSOR_DEVICE_D124_DEV="/dev/uart2"
# CONFIG_SUPPORT_CONNECTION_FRAMEWORK is not set
CONFIG_SUPPORT_KNOWING_FRAMEWORK=y
# CONFIG_USING_TENSORFLOWLITEMICRO is not set
CONFIG_USING_KPU_POSTPROCESSING=y
# CONFIG_USING_YOLOV2 is not set
# CONFIG_USING_KNOWING_FILTER is not set
# CONFIG_USING_OTA_MODEL is not set
# CONFIG_USING_IMAGE_PROCESSING is not set
# CONFIG_USING_CMSIS_5 is not set
CONFIG_USING_KPU_PROCESSING=y
# CONFIG_USING_YOLOV2 is not set
# CONFIG_USING_YOLOV2_JSONPARSER is not set
# CONFIG_USING_K210_YOLOV2_DETECT is not set
# CONFIG_SUPPORT_CONTROL_FRAMEWORK is not set
#

View File

@@ -24,6 +24,6 @@ config APP_DIR
source "$RTT_DIR/Kconfig"
source "$RTT_DIR/bsp/stm32/libraries/Kconfig"
source "board/Kconfig"
source "$RT_Thread_DIR/drivers/Kconfig"
source "$RT_Thread_DIR/app_match_rt-thread/Kconfig"
source "$ROOT_DIR/APP_Framework/Kconfig"

View File

@@ -74,7 +74,7 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SCons
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript')))
# include more drivers
objs.extend(SConscript(os.getcwd() + '/../../drivers/SConscript'))
objs.extend(SConscript(os.getcwd() + '/../../app_match_rt-thread/SConscript'))
# include APP_Framework/Framework
objs.extend(SConscript(os.getcwd() + '/../../../../APP_Framework/Framework/SConscript'))

View File

@@ -34,7 +34,7 @@ menu "Onboard Peripheral Drivers"
default n
config BSP_USING_SPI_FLASH
bool "Enable SPI FLASH (W25Q128 spi1)"
bool "Enable SPI FLASH (W25Q128 spi2)"
select BSP_USING_SPI
select BSP_USING_SPI1
select RT_USING_SFUD

View File

@@ -16,7 +16,7 @@ if GetDepend(['BSP_USING_ETH']):
src += Glob('ports/phy_reset.c')
if GetDepend(['BSP_USING_SPI_FLASH']):
src += Glob('ports/spi_flash_init.c')
src += Glob('ports/flash_port.c')
if GetDepend(['BSP_USING_SDCARD']):
src += Glob('ports/sdcard_port.c')
@@ -28,6 +28,9 @@ if GetDepend(['BSP_USING_DCMI']):
src += ['drv_dcmi.c']
src += ['../../../../rt-thread/bsp/stm32/libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c']
if GetDepend(['RT_USING_DFS_ROMFS']):
src += ['ports/romfs.c']
src += ['ports/mnt_romfs.c']
path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
path += [cwd + '/ports']

View File

@@ -0,0 +1,42 @@
#include <rtthread.h>
#if defined(BSP_USING_SPI_FLASH)
#include "spi_flash_sfud.h"
#include "spi_flash.h"
#include "drv_spi.h"
#include <board.h>
#include <spi_msd.h>
#include <dfs_elm.h>
#include <dfs_fs.h>
#include <drv_spi.h>
#include <dfs_posix.h>
#include <rtdbg.h>
static int rt_hw_spi_flash_init(void)
{
__HAL_RCC_GPIOB_CLK_ENABLE();
rt_hw_spi_device_attach("spi2", "spi30", GPIOB, GPIO_PIN_14);
if (RT_NULL == rt_sfud_flash_probe("W25Q128", "spi30"))
{
LOG_E("W25Q128 flash spi30 fail !!!");
return -RT_ERROR;
};
#ifdef RT_USING_DFS_ROMFS
if (dfs_mount("W25Q128", "/FLASH", "elm", 0, 0) == RT_EOK)
#else
if (dfs_mount("W25Q128", "/", "elm", 0, 0) == RT_EOK)
#endif
{
LOG_I("Mount flash successfully");
return RT_EOK;
}
else
{
LOG_E("Mount fail !!!");
return -RT_ERROR;
}
}
INIT_APP_EXPORT(rt_hw_spi_flash_init);
#endif

View File

@@ -0,0 +1,20 @@
#include <rtthread.h>
#if defined RT_USING_DFS && defined RT_USING_DFS_ROMFS
#include <dfs_fs.h>
#include "dfs_romfs.h"
int mnt_init(void)
{
if (dfs_mount(RT_NULL, "/", "rom", 0, &(romfs_root)) == 0)
{
rt_kprintf("ROM file system initializated!\n");
}
else
{
rt_kprintf("ROM file system initializate failed!\n");
}
return 0;
}
INIT_ENV_EXPORT(mnt_init);
#endif

View File

@@ -0,0 +1,13 @@
/* Generated by mkromfs. Edit with caution. */
#include <rtthread.h>
#include <dfs_romfs.h>
#ifdef RT_USING_DFS_ROMFS
static const struct romfs_dirent _romfs_root[] = {
{ROMFS_DIRENT_DIR, "FLASH", RT_NULL, 0},
{ROMFS_DIRENT_DIR, "SD", RT_NULL, 0}
};
const struct romfs_dirent romfs_root = {
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root)/sizeof(_romfs_root[0])
};
#endif

View File

@@ -30,23 +30,27 @@ int sd_mount()
cs_gpiox = (GPIO_TypeDef *)((rt_base_t)GPIOA + (rt_base_t)(SDCARD_SPI2_CS_PIN / 16) * 0x0400UL);
cs_pin = (uint16_t)(1 << SDCARD_SPI2_CS_PIN % 16);
rt_hw_spi_device_attach(SDCARD_SPI_BUS_NAME, "spi20", cs_gpiox, cs_pin);
ret = msd_init("sd0", "spi20");
ret = msd_init("sd", "spi20");
if(RT_EOK == ret)
{
if(dfs_mount("sd0", "/", "elm", 0, 0) == 0)
#ifdef RT_USING_DFS_ROMFS
if(dfs_mount("sd", "/SD", "elm", 0, 0) == 0)
#else
if(dfs_mount("sd", "/", "elm", 0, 0) == 0)
#endif
{
LOG_I("Mount /sd0 successfully");
LOG_I("Mount sd card successfully");
return RT_EOK;
}
else
{
LOG_E("Mount fail !!1");
return -1;
LOG_E("Mount fail !!!");
return -RT_ERROR;
}
}
LOG_E("msd_init fail !!!");
return -2;
return -RT_ERROR;
}
INIT_ENV_EXPORT(sd_mount);
INIT_APP_EXPORT(sd_mount);
#endif /* BSP_USING_SDCARD */

View File

@@ -15,7 +15,7 @@
#define RT_ALIGN_SIZE 4
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 100
#define RT_TICK_PER_SECOND 1000
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_HOOK
#define RT_USING_IDLE_HOOK
@@ -103,10 +103,11 @@
#define RT_DFS_ELM_LFN_UNICODE 0
#define RT_DFS_ELM_MAX_LFN 255
#define RT_DFS_ELM_DRIVES 2
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
#define RT_DFS_ELM_REENTRANT
#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
#define RT_USING_DFS_DEVFS
#define RT_USING_DFS_ROMFS
/* Device Drivers */
@@ -124,6 +125,10 @@
#define RT_USING_PIN
#define RT_USING_SPI
#define RT_USING_SPI_MSD
#define RT_USING_SFUD
#define RT_SFUD_USING_SFDP
#define RT_SFUD_USING_FLASH_INFO_TABLE
#define RT_SFUD_SPI_MAX_HZ 50000000
#define RT_USING_WIFI
#define RT_WLAN_DEVICE_STA_NAME "wlan0"
#define RT_WLAN_DEVICE_AP_NAME "wlan1"
@@ -250,6 +255,7 @@
#define BSP_USING_USB_TO_USART
#define BSP_USING_SRAM
#define BSP_USING_SPI_FLASH
#define BSP_USING_OV2640
#define BSP_USING_SDCARD
#define SDCARD_SPI2_CS_PIN 28
@@ -294,6 +300,9 @@
#define MAIN_KTASK_STACK_SIZE 1024
/* ota app */
/* test app */
@@ -322,7 +331,7 @@
#define SENSOR_QUANTITY_D124_VOICE "voice_1"
#define SENSOR_DEVICE_D124_DEV "/dev/uart2"
#define SUPPORT_KNOWING_FRAMEWORK
#define USING_KPU_POSTPROCESSING
#define USING_KPU_PROCESSING
/* Security */

View File

@@ -0,0 +1,5 @@
menu "More Drivers"
source "$RT_Thread_DIR/app_match_rt-thread/rw007/Kconfig"
source "$RT_Thread_DIR/app_match_rt-thread/ov2640/Kconfig"
endmenu

Some files were not shown because too many files have changed in this diff Show More