Skip to content

Commit

Permalink
nuttx: Add Minimal support for stm32f7nucleo
Browse files Browse the repository at this point in the history
So far, Only console, http module has been tested.

Config file is generated using defconfig,
and contains those mandatory options:
```
CONFIG_NET_LOCAL=y
CONFIG_NET_TCPBACKLOG=y
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RR_INTERVAL=100
CONFIG_SCHED_LPWORKPRIORITY=176
```

Build flags are relying on mcpu flags.

More IO modules to be supported next.

Relate-to: rzr/webthing-iotjs#3
Change-Id: Ib44227e33c6b7d07f11687385d788017350e3827
IoT.js-DCO-1.0-Signed-off-by: Philippe Coval p.coval@samsung.com
  • Loading branch information
rzr committed Apr 29, 2019
1 parent b31e0ac commit edb432c
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ elseif("${TARGET_BOARD}" STREQUAL "rpi3")
elseif("${TARGET_BOARD}" STREQUAL "stm32f4dis")
iotjs_add_compile_flags(-mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16)
iotjs_add_compile_flags(-mfloat-abi=hard)
elseif("${TARGET_BOARD}" STREQUAL "stm32f7nucleo")
iotjs_add_compile_flags(-mcpu=cortex-m7)
iotjs_add_compile_flags(-mfloat-abi=hard)
endif()

# Add os-dependant flags
Expand Down
93 changes: 93 additions & 0 deletions config/nuttx/stm32f7nucleo/config.default
Original file line number Diff line number Diff line change
@@ -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="arm"
CONFIG_ARCH_BOARD="nucleo-144"
CONFIG_ARCH_BOARD_NUCLEO_144=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP_STM32F767ZI=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_BOARD_LOOPSPERMSEC=43103
CONFIG_BUILTIN=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ETH0_PHY_LAN8742A=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_FS_TMPFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IOTJS=y
CONFIG_LIB_HOSTNAME="stntest"
CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2
CONFIG_MM_REGIONS=3
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETUTILS_DISCOVER=y
CONFIG_NETUTILS_WEBCLIENT=y
CONFIG_NET_ARP_IPIN=y
CONFIG_NET_ARP_SEND=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ETH_PKTSIZE=1500
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_IGMP=y
CONFIG_NET_LOCAL=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_ROUTE=y
CONFIG_NET_SOLINGER=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCPBACKLOG=y
CONFIG_NET_UDP=y
CONFIG_NET_UDP_CHECKSUMS=y
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_NUCLEO_CONSOLE_VIRTUAL=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=4
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RAM_SIZE=245760
CONFIG_RAM_START=0x20010000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=100
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_LPWORKPRIORITY=176
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SPI=y
CONFIG_STACK_COLORATION=y
CONFIG_START_DAY=30
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2015
CONFIG_STM32F7_ETHMAC=y
CONFIG_STM32F7_PHYADDR=0
CONFIG_STM32F7_PHYSR=31
CONFIG_STM32F7_PHYSR_100FD=0x0018
CONFIG_STM32F7_PHYSR_100HD=0x0008
CONFIG_STM32F7_PHYSR_10FD=0x0014
CONFIG_STM32F7_PHYSR_10HD=0x0004
CONFIG_STM32F7_PHYSR_ALTCONFIG=y
CONFIG_STM32F7_PHYSR_ALTMODE=0x001c
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART3_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_WDOG_INTRESERVE=0
9 changes: 9 additions & 0 deletions src/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@
"native_files": ["modules/iotjs_module_stm32f4dis.c"],
"init": "InitStm32f4dis"
},
"stm32f7nucleo": {
"platforms": {
"nuttx": {
"native_files": ["modules/nuttx/iotjs_module_stm32f7nucleo-nuttx.c"]
}
},
"native_files": ["modules/iotjs_module_stm32f7nucleo.c"],
"init": "InitStm32f7nucleo"
},
"stream": {
"js_file": "js/stream.js",
"require": ["stream_duplex", "stream_internal", "stream_readable",
Expand Down
24 changes: 24 additions & 0 deletions src/modules/iotjs_module_stm32f7nucleo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright 2019-present Samsung Electronics Co., Ltd. and other contributors
*
* Licensed 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 "iotjs_def.h"
#include "iotjs_module_stm32f7nucleo.h"


jerry_value_t InitStm32f7nucleo() {
jerry_value_t stm32f7nucleo = jerry_create_object();

return stm32f7nucleo;
}
20 changes: 20 additions & 0 deletions src/modules/iotjs_module_stm32f7nucleo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Copyright 2019-present Samsung Electronics Co., Ltd. and other contributors
*
* Licensed 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 IOTJS_MODULE_STM32F4DIS_H
#define IOTJS_MODULE_STM32F4DIS_H


#endif /* IOTJS_MODULE_STM32F4DIS_H */
22 changes: 22 additions & 0 deletions src/modules/nuttx/iotjs_module_stm32f7nucleo-nuttx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Copyright 2019-present Samsung Electronics Co., Ltd. and other contributors
*
* Licensed 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.
*/

#if defined(__NUTTX__) && (TARGET_BOARD == stm32f7nucleo)


#include "iotjs_def.h"
#include "modules/iotjs_module_stm32f7nucleo.h"

#endif // __NUTTX__
5 changes: 4 additions & 1 deletion tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def init_options():
default=platform.arch(),
help='Specify the target architecture (default: %(default)s).')
iotjs_group.add_argument('--target-board',
choices=[None, 'artik10', 'stm32f4dis', 'rpi2', 'rpi3', 'artik05x'],
choices=[None, 'artik10', 'stm32f4dis', 'stm32f7nucleo',
'rpi2', 'rpi3', 'artik05x'],
default=None, help='Specify the target board (default: %(default)s).')
iotjs_group.add_argument('--target-os',
choices=['linux', 'darwin', 'osx', 'mock', 'nuttx', 'tizen', 'tizenrt',
Expand Down Expand Up @@ -282,6 +283,8 @@ def build_cmake_args(options):
include_dirs.append('%s/include' % options.sysroot)
if options.target_board == 'stm32f4dis':
include_dirs.append('%s/arch/arm/src/stm32' % options.sysroot)
elif options.target_board == 'stm32f7nucleo':
include_dirs.append('%s/arch/arm/src/stm32f7' % options.sysroot)

if options.target_os == 'tizenrt':
include_dirs.append('%s/../framework/include/iotbus' % options.sysroot)
Expand Down

0 comments on commit edb432c

Please sign in to comment.