diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/Kconfig b/boards/arm/stm32f7/stm32f777zit6-meadow/Kconfig index 2e0325b97ed..00b86f9ae55 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/Kconfig +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/Kconfig @@ -5,4 +5,63 @@ if ARCH_BOARD_MEADOW_F7MICRO +config HCOM_FILESYSTEM_INIT + bool "Enables HCOM FS initialization support" + default y + +config HCOM_MTD_STRESS_TEST + bool "Enables HCOM MTD stress testing support" + default n + +config HCOM_MONO_STDERR_STDOUT + bool "Enables HCOM routing of Mono stdout and stderr to PC/Mac" + default y + +config HCOM_MONO_REMOTE_DEBUGGING + bool "Enables HCOM Mono remote debugging support" + default y + +config HCOM_COMMS_DEVICE_NAME + string "Specifies the device name for HCOM communications" + default "/dev/ttyACM0" + +config MEADOW_CLOUD + string "Enables Meadow Cloud support" + default y + +config MEADOW_ETHNET_INCLUDE_IN_BUILD + bool "Build Meadow and include Ethernet for compute module" + default n + ---help--- + This must be used with a 'defconfig' file that includes the correct Ethernet configuration. + +config HCOM_ESP32_COMMS + bool "Enables HCOM file download to the ESP32" + default y + +menu "ESP32 Coprocessor Configuration" +source "boards/arm/stm32f7/stm32f777zit6-meadow/Kconfig-ESP32" +endmenu + +config ARCH_BOARD_MEADOW + bool "Enables Meadow board features" + default y + +# See meadow-adc.c file, currently unused. +config MEADOW_ADC + bool "Enables Meadow ADC support" + +config MEADOW_HCOM + bool "Enables Meadow HCOM support" + default n + +config MEADOW_TIMER_SUPPORT + bool "Enables Meadow timer support" + default n + +config MEADOW_PWR_MGMT_SUPPORT + bool "Enables Meadow power management support" + default n + + endif # ARCH_BOARD_MEADOW_F7MICRO diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/Kconfig-ESP32 b/boards/arm/stm32f7/stm32f777zit6-meadow/Kconfig-ESP32 new file mode 100644 index 00000000000..2451240fce4 --- /dev/null +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/Kconfig-ESP32 @@ -0,0 +1,31 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config MEADOW_ESPCP_MANAGER + bool "Enable ESP32 Coprocessor" + default y + ---help--- + Enable or disable ESP32 coprocessor support. + +if MEADOW_ESPCP_MANAGER + +config MEADOW_ESPCP_USE_EXTERNAL_ESP32_BOARD + bool "Use external ESP32 chip" + default n + ---help--- + Use an external ESP32 for debugging purposes. + +config MEADOW_ESPCP_RESET_ESP32_AT_STARTUP + bool "Reset the ESP32 at startup?" + default y + ---help--- + Should the ESP32 be reset as part of the startup process. The default for production + is "Y". For development it is sometimes necessary to attach a debugger to the ESP32 + and in this case resetting the chip interferes with debugging. + + For debugging set this to Y + For production set this to N (default). + +endif diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/configs/meadow_os/defconfig b/boards/arm/stm32f7/stm32f777zit6-meadow/configs/meadow_os/defconfig new file mode 100644 index 00000000000..6963db3ac4d --- /dev/null +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/configs/meadow_os/defconfig @@ -0,0 +1,57 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_STM32F7_USE_LEGACY_PINMAP is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="stm32f777zit6-meadow" +CONFIG_ARCH_BOARD_MEADOW_F7MICRO=y +CONFIG_ARCH_CHIP="stm32f7" +CONFIG_ARCH_CHIP_STM32F777ZI=y +CONFIG_ARCH_CHIP_STM32F7=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_DTCM=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_BCH=y +CONFIG_BOARDCTL_USBDEVCTRL=y +CONFIG_BOARD_LATE_INITIALIZE=y +CONFIG_BOARD_LOOPSPERMSEC=43103 +CONFIG_BUILTIN=y +CONFIG_CDCACM=y +CONFIG_CDCACM_CONSOLE=y +CONFIG_CDCACM_PRODUCTID=0x0001 +CONFIG_CDCACM_PRODUCTSTR="Wilderness Labs" +CONFIG_CDCACM_VENDORID=0x2E6A +CONFIG_CDCACM_VENDORSTR="Meadow F7 Micro" +CONFIG_CRYPTO=y +CONFIG_CRYPTO_RANDOM_POOL=y +CONFIG_DEV_URANDOM=y +CONFIG_DEV_URANDOM_RANDOM_POOL=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_MEADOW_HCOM=y +CONFIG_MM_REGIONS=3 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=245760 +CONFIG_RAM_START=0x20010000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=14 +CONFIG_STM32F7_OTGFS=y +CONFIG_STM32F7_USART1=y +CONFIG_SYSTEM_NSH=y +CONFIG_TASK_NAME_SIZE=64 +CONFIG_USBDEV=y diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/scripts/Make.defs b/boards/arm/stm32f7/stm32f777zit6-meadow/scripts/Make.defs index 4d611ac2cbd..898b4bcc8dc 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/scripts/Make.defs +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/scripts/Make.defs @@ -27,7 +27,7 @@ ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 -CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -I $(BOARD_DIR)$(DELIM)src -I $(BOARD_DIR)$(DELIM)src/Meadow.OS/include CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/src/Makefile b/boards/arm/stm32f7/stm32f777zit6-meadow/src/Makefile index b34c3bb61be..b1667cfe6ed 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/src/Makefile +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/src/Makefile @@ -20,6 +20,7 @@ include $(TOPDIR)/Make.defs + CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c ifeq ($(CONFIG_ARCH_LEDS),y) @@ -57,4 +58,127 @@ else ifeq ($(CONFIG_STM32F7_OTGFSHS),y) CSRCS += stm32_usb.c endif +ifeq ($(CONFIG_USBMSC),y) +CSRCS += stm32_usbmsc.c +endif + +ifeq ($(CONFIG_ARCH_IDLE_CUSTOM),y) +CSRCS += stm32_idle.c +endif + +ifeq ($(CONFIG_STM32F7_SDMMC2),y) +CSRCS += meadow_sdmmc.c +endif + +ifdef MEADOW_OS + +# Enable Meadow.OS build (WORK IN PROGRESS) + +MEADOW_OS_DIR=Meadow.OS +CFLAGS += -DMEADOW_OS + +ifeq ($(CONFIG_MEADOW_HCOM),y) +CSRCS += $(MEADOW_OS_DIR)/hcom_nx/hcom_nx_upd.c \ +$(MEADOW_OS_DIR)/hcom_nx/hcom_nx_startup_mgr.c \ +$(MEADOW_OS_DIR)/hcom_nx/hcom_nx_common_utils.c \ +$(MEADOW_OS_DIR)/hcom_nx/hcom_nx_bbreg_access.c \ +$(MEADOW_OS_DIR)/hcom_nx/hcom_nx_upd_route_cmd.c \ +$(MEADOW_OS_DIR)/hcom_nx/hcom_nx_config_manager.c \ +$(MEADOW_OS_DIR)/hcom_nx/commands/hcom_nx_ex_flash.c \ +$(MEADOW_OS_DIR)/hcom_nx/comms/hcom_nx_host_send.c \ +$(MEADOW_OS_DIR)/hcom_nx/create_fs/hcom_nx_fs.c \ +$(MEADOW_OS_DIR)/hcom_nx/create_fs/hcom_nx_fs_littlefs.c \ +$(MEADOW_OS_DIR)/hcom_nx/diag/hcom_nx_route_text_to_host.c \ +$(MEADOW_OS_DIR)/hcom_nx/diag/hcom_nx_trace_msg_proc.c \ +$(MEADOW_OS_DIR)/hcom_nx/tests/hcom_nx_qspi_flash_tests.c + +ifeq ($(CONFIG_ARCH_IDLE_CUSTOM),y) +CSRCS += $(MEADOW_OS_DIR)/misc/meadow_idle_monitor.c +endif + +ifeq ($(CONFIG_MEADOW_PWR_MGMT_SUPPORT),y) +CSRCS += $(MEADOW_OS_DIR)/pwrmgmt_calib_lsi_clock.c \ +$(MEADOW_OS_DIR)/pwrmgmt_config_wakeup_timer.c \ +$(MEADOW_OS_DIR)/pwrmgmt_config_wakeup_alarm.c \ +$(MEADOW_OS_DIR)/pwrmgmt_control.c \ +$(MEADOW_OS_DIR)/pwrmgmt_enter_stop_mode.c \ +$(MEADOW_OS_DIR)/pwrmgmt_misc.c \ +$(MEADOW_OS_DIR)/pwrmgmt_switch_rtc_clock.c \ +$(MEADOW_OS_DIR)/pwrmgmt_time_support.c +endif + +ifeq ($(CONFIG_MEADOW_TIMER_SUPPORT),y) +CSRCS += $(MEADOW_OS_DIR)/timers/timer_manager.c \ +$(MEADOW_OS_DIR)/timers/cpu_measure.c \ +$(MEADOW_OS_DIR)/timers/pulse_width.c \ +$(MEADOW_OS_DIR)/timers/freq_duty.c \ +$(MEADOW_OS_DIR)/timers/rc_servo_decode.c \ +$(MEADOW_OS_DIR)/timers/lsi_clk_freq_measure.c +endif + +CSRCS += $(MEADOW_OS_DIR)/ethernet/meadow_ethnet_start.c \ +$(MEADOW_OS_DIR)/ethernet/meadow_ethnet_utils.c \ +$(MEADOW_OS_DIR)/ethernet/meadow_ethnet_connect.c \ +$(MEADOW_OS_DIR)/ethernet/meadow_ethnet_monitor.c \ +$(MEADOW_OS_DIR)/ethernet/meadow_ethnet_dhcp.c \ +$(MEADOW_OS_DIR)/ethernet/meadow_ethnet_ping.c + +ifeq ($(CONFIG_MEADOW_ESPCP_MANAGER),y) +CSRCS += $(MEADOW_OS_DIR)/espcp/espcp_thread.c \ +$(MEADOW_OS_DIR)/espcp/espcp_queue.c \ +$(MEADOW_OS_DIR)/espcp/espcp_encoders.c \ +$(MEADOW_OS_DIR)/espcp/espcp_message.c \ +$(MEADOW_OS_DIR)/espcp/espcp_message_dispatcher.c \ +$(MEADOW_OS_DIR)/espcp/generic_list.c \ +$(MEADOW_OS_DIR)/espcp/espcp_coprocessor.c \ +$(MEADOW_OS_DIR)/espcp/espcp_wifi.c \ +$(MEADOW_OS_DIR)/espcp/espcp_system.c \ +$(MEADOW_OS_DIR)/espcp/espcp_common.c \ +$(MEADOW_OS_DIR)/espcp/espcp_usrsock_sockif.c \ +$(MEADOW_OS_DIR)/espcp/espcp_event_handlers.c \ +$(MEADOW_OS_DIR)/espcp/espcp_file_system.c +endif + +CSRCS += $(MEADOW_OS_DIR)/kerneltests/espcp_tests.c \ +$(MEADOW_OS_DIR)/kerneltests/ethernet_tests.c \ +$(MEADOW_OS_DIR)/kerneltests/bg77_tests.c \ +$(MEADOW_OS_DIR)/kerneltests/network_tests.c \ +$(MEADOW_OS_DIR)/kerneltests/sdcard_tests.c \ +$(MEADOW_OS_DIR)/kerneltests/power_management_tests.c \ +$(MEADOW_OS_DIR)/kerneltests/iso8601_time_tests.c \ +$(MEADOW_OS_DIR)/kerneltests/quick_misc_tests.c +# +# Add the NTP client. +# +CSRCS += $(MEADOW_OS_DIR)/ntpclient/ntpclient.c $(MEADOW_OS_DIR)/misc/long_period_scheduler.c + +# +# Add the Meadow logging system. +# +CSRCS += $(MEADOW_OS_DIR)/misc/meadow_logging.c + + +# +# The libyaml library is required by cyaml. +# +CSRCS += $(MEADOW_OS_DIR)/libyaml/api.c $(MEADOW_OS_DIR)/libyaml/dumper.c $(MEADOW_OS_DIR)/libyaml/emitter.c $(MEADOW_OS_DIR)/libyaml/loader.c \ + $(MEADOW_OS_DIR)/libyaml/parser.c $(MEADOW_OS_DIR)/libyaml/reader.c $(MEADOW_OS_DIR)/libyaml/scanner.c $(MEADOW_OS_DIR)/libyaml//writer.c +# +# The cyaml library maps the items from the libyaml output to the structures used by the application. +# +CSRCS += $(MEADOW_OS_DIR)/libcyaml/mem.c $(MEADOW_OS_DIR)/libcyaml/free.c $(MEADOW_OS_DIR)/libcyaml/load.c $(MEADOW_OS_DIR)/libcyaml/save.c $(MEADOW_OS_DIR)/libcyaml/util.c $(MEADOW_OS_DIR)/libcyaml/utf8.c + +# +# Add Meadow Cloud support +# +CSRCS += $(MEADOW_OS_DIR)/meadow_cloud/meadow_cloud.c + +# +# Add Meadow OS syscall implementations. +# +CSRCS += $(MEADOW_OS_DIR)/meadow_os/meadow_os_config.c + +endif +endif # MEADOW_OS + include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_boot.c b/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_boot.c index 8aaa0554c41..ad55745f70d 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_boot.c +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_boot.c @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -163,8 +164,20 @@ void board_late_initialize(void) * * stm32_mpu_uheap((uintptr_t)0x90000000, 0x4000000); */ -#endif +#endif +#if defined(MEADOW_OS) + /* Initialize Meadow HCOM nuttx */ + + int ret; + ret = hcom_nx_setup_mgr(mtd); + if (ret < 0) + { + syslog(LOG_EMERG, "ERROR: HCOM proxy initialization failed!\n"); + PANIC(); + } + +#endif #if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) /* Perform NSH initialization here instead of from the NSH. This * alternative NSH initialization is necessary when NSH is ran in