board/stm32f401rc-rs485: Add support to Device Configuration over Telnet

Signed-off-by: Rodrigo Sim rcsim10@gmail.com
This commit is contained in:
Rodrigo Sim 2024-07-11 18:38:26 -03:00 committed by Xiang Xiao
parent a4fece3450
commit da8934180a
5 changed files with 195 additions and 0 deletions

View File

@ -501,6 +501,7 @@ rndis
Configures the NuttShell (nsh), enables a serial console on USART6 and enables RNDIS over USB.
NSH commands::
nsh> mount -t procfs /proc
nsh> ping -h
Usage: ping [-c <count>] [-i <interval>] [-W <timeout>] [-s <size>] <hostname>
@ -598,3 +599,36 @@ The board profile configures the NSH over USB and you can use the fb command to
5: ( 55, 25) ( 18, 14)
Test finished
nsh>
telnetd
-------
Configures the NuttShell (nsh), enables a serial console on USART6, enables RNDIS over USB and
enables Device Configuration over Telnet.
NSH commands::
nsh> mount -t procfs /proc
nsh> ifcong
Get the ip address assigned to eth0 and convert to hexadecimal, for example 192.168.1.2
becomes 0xC0A80102, than configure CONFIG_NETINIT_IPADDR and CONFIG_EXAMPLES_TELNETD_IPADDR,
also configure the router address, in this example it woukd be 0xC0A80101. After theses changes
rebuild and load the new firmware on your board::
nsh> mount -t procfs /proc
nsh> telnetd
At your host PC, telnet to IP address for the board::
$ telnet 192.168.01.02
Now you will be able to access the Device Configuration over Telnet::
Device Configuration over Telnet
You can add functions to setup your device
Type '?' and press <enter> for help
cfg> ?
Available commands:
help, ? - show help
reset - reset the board
exit - exit shell

View File

@ -0,0 +1,93 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_FPU is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_SYSTEM_TELNETD is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f401rc-rs485"
CONFIG_ARCH_BOARD_STM32F401RC_RS485=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F401RC=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=8499
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_EXAMPLES_BUTTONS=y
CONFIG_EXAMPLES_BUTTONS_NAME0="SW3"
CONFIG_EXAMPLES_BUTTONS_NAME1="SW4"
CONFIG_EXAMPLES_BUTTONS_NAME2="SW5"
CONFIG_EXAMPLES_BUTTONS_NAMES=y
CONFIG_EXAMPLES_BUTTONS_QTD=3
CONFIG_EXAMPLES_TELNETD=y
CONFIG_EXAMPLES_TELNETD_DRIPADDR=0xC0A80101
CONFIG_EXAMPLES_TELNETD_IPADDR=0xC0A80102
CONFIG_FS_PROCFS=y
CONFIG_FS_TMPFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INPUT=y
CONFIG_INPUT_BUTTONS=y
CONFIG_INPUT_BUTTONS_LOWER=y
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_MEMFD_ERROR=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDB_DNSSERVER_IPv4ADDR=0x0
CONFIG_NETDEV_LATEINIT=y
CONFIG_NETINIT_DRIPADDR=0xC0A80101
CONFIG_NETINIT_IPADDR=0xC0A80102
CONFIG_NETINIT_NETMASK=0xFFFFFF00
CONFIG_NETINIT_NOMAC=y
CONFIG_NETINIT_THREAD=y
CONFIG_NETUTILS_DHCPC=y
CONFIG_NETUTILS_TELNETD=y
CONFIG_NETUTILS_WEBCLIENT=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=98304
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RNDIS=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SPI=y
CONFIG_START_DAY=5
CONFIG_START_MONTH=5
CONFIG_START_YEAR=2014
CONFIG_STM32_JTAG_SW_ENABLE=y
CONFIG_STM32_OTGFS=y
CONFIG_STM32_PWR=y
CONFIG_STM32_USART6=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART6_SERIAL_CONSOLE=y
CONFIG_USBDEV=y

View File

@ -30,6 +30,9 @@ endif()
if(CONFIG_BOARDCTL)
list(APPEND SRCS stm32_appinit.c)
if(CONFIG_BOARDCTL_RESET)
list(APPEND SRCS stm32_reset.c)
endif()
endif()
if(CONFIG_ARCH_BUTTONS)

View File

@ -38,6 +38,9 @@ endif
ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += stm32_appinit.c
ifeq ($(CONFIG_BOARDCTL_RESET),y)
CSRCS += stm32_reset.c
endif
endif
ifeq ($(CONFIG_ARCH_BUTTONS),y)

View File

@ -0,0 +1,62 @@
/****************************************************************************
* boards/arm/stm32/stm32f401rc-rs485/src/stm32_reset.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 <nuttx/arch.h>
#include <nuttx/board.h>
#ifdef CONFIG_BOARDCTL_RESET
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_reset
*
* Description:
* Reset board. Support for this function is required by board-level
* logic if CONFIG_BOARDCTL_RESET is selected.
*
* Input Parameters:
* status - Status information provided with the reset event. This
* meaning of this status information is board-specific. If not
* used by a board, the value zero may be provided in calls to
* board_reset().
*
* Returned Value:
* If this function returns, then it was not possible to power-off the
* board due to some constraints. The return value int this case is a
* board-specific reason for the failure to shutdown.
*
****************************************************************************/
int board_reset(int status)
{
up_systemreset();
return 0;
}
#endif /* CONFIG_BOARDCTL_RESET */