Skip to content

Commit

Permalink
WIP: update NuttX to 7.30
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Jun 27, 2019
1 parent 49966f4 commit edffa52
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
[submodule "platforms/nuttx/NuttX/nuttx"]
path = platforms/nuttx/NuttX/nuttx
url = https://github.com/PX4/NuttX.git
branch = px4_firmware_nuttx-7.28+
branch = px4_firmware_nuttx-7.30+
[submodule "platforms/nuttx/NuttX/apps"]
path = platforms/nuttx/NuttX/apps
url = https://github.com/PX4/NuttX-apps.git
branch = px4_firmware_nuttx-7.28+
branch = px4_firmware_nuttx-7.30+
[submodule "cmake/configs/uavcan_board_ident"]
path = cmake/configs/uavcan_board_ident
url = https://github.com/PX4/uavcan_board_ident.git
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ set(package-contact "[email protected]")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
2 changes: 1 addition & 1 deletion boards/av/x-v1/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ px4_add_board(
wind_estimator

SYSTEMCMDS
bl_update
#bl_update
config
dmesg
dumpfile
Expand Down
20 changes: 13 additions & 7 deletions boards/av/x-v1/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#
# 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_DISABLE_OS_API is not set
# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set
# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
Expand Down Expand Up @@ -50,7 +57,7 @@ CONFIG_ARMV7M_USEBASEPRI=y
CONFIG_BOARDCTL_FINALINIT=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_CRASHDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=43103
CONFIG_BOARD_LOOPSPERMSEC=22114
CONFIG_BOARD_RESET_ON_ASSERT=2
CONFIG_BUILTIN=y
CONFIG_C99_BOOL8=y
Expand All @@ -73,7 +80,10 @@ CONFIG_FS_CROMFS=y
CONFIG_FS_FAT=y
CONFIG_FS_FATTIME=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_INCLUDE_PROGMEM=y
CONFIG_FS_PROCFS_EXCLUDE_BLOCKS=y
CONFIG_FS_PROCFS_EXCLUDE_MOUNT=y
CONFIG_FS_PROCFS_EXCLUDE_MOUNTS=y
CONFIG_FS_PROCFS_EXCLUDE_USAGE=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_FS_ROMFS=y
CONFIG_GRAN=y
Expand Down Expand Up @@ -105,7 +115,6 @@ CONFIG_NETUTILS_TELNETD=y
CONFIG_NET_ARP_IPIN=y
CONFIG_NET_ARP_SEND=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_HOSTNAME="px4"
CONFIG_NET_ICMP=y
CONFIG_NET_ROUTE=y
CONFIG_NET_SOCKOPTS=y
Expand All @@ -124,14 +133,11 @@ CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_CMDPARMS=y
CONFIG_NSH_CROMFSETC=y
CONFIG_NSH_DISABLE_PSSTACKUSAGE=y
CONFIG_NSH_DRIPADDR=0xc0a85601
CONFIG_NSH_IPADDR=0xc0a8560c
CONFIG_NSH_LINELEN=128
CONFIG_NSH_LOGIN_PASSWORD="px4"
CONFIG_NSH_LOGIN_USERNAME="px4"
CONFIG_NSH_MAXARGUMENTS=12
CONFIG_NSH_NESTDEPTH=8
CONFIG_NSH_NETINIT_THREAD=y
CONFIG_NSH_QUOTE=y
CONFIG_NSH_ROMFSETC=y
CONFIG_NSH_ROMFSSECTSIZE=128
Expand All @@ -146,7 +152,7 @@ CONFIG_PREALLOC_WDOGS=50
CONFIG_PRIORITY_INHERITANCE=y
CONFIG_PTHREAD_MUTEX_ROBUST=y
CONFIG_PTHREAD_STACK_MIN=512
CONFIG_RAM_SIZE=376832
CONFIG_RAM_SIZE=245760
CONFIG_RAM_START=0x20010000
CONFIG_RAW_BINARY=y
CONFIG_RTC_DATETIME=y
Expand Down
7 changes: 7 additions & 0 deletions boards/omnibus/f4sd/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#
# 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_DEV_CONSOLE is not set
# CONFIG_DISABLE_OS_API is not set
# CONFIG_MMCSD_HAVE_CARDDETECT is not set
Expand Down
7 changes: 7 additions & 0 deletions boards/px4/fmu-v4/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#
# 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_DISABLE_OS_API is not set
# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set
# CONFIG_MMCSD_HAVE_CARDDETECT is not set
Expand Down
7 changes: 7 additions & 0 deletions boards/px4/fmu-v5/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#
# 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_DISABLE_OS_API is not set
# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set
# CONFIG_MMCSD_HAVE_CARDDETECT is not set
Expand Down
9 changes: 8 additions & 1 deletion boards/px4/io-v2/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#
# 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_DEV_CONSOLE is not set
# CONFIG_DEV_NULL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD_CUSTOM_DIR="../nuttx-config"
Expand All @@ -17,7 +25,6 @@ CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_POLL=y
CONFIG_DISABLE_PTHREAD=y
CONFIG_DISABLE_SIGNALS=y
CONFIG_FDCLONE_DISABLE=y
CONFIG_FDCLONE_STDIO=y
CONFIG_HAVE_CXX=y
Expand Down
2 changes: 1 addition & 1 deletion platforms/nuttx/NuttX/Make.defs.in
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
endif

CFLAGS = $(ARCHINCLUDES) \
-std=gnu99 \
-std=gnu11 \
${CMAKE_C_FLAGS} \
$(FLAGS) \
-Wno-bad-function-cast \
Expand Down
2 changes: 1 addition & 1 deletion platforms/nuttx/NuttX/apps
Submodule apps updated 721 files
2 changes: 1 addition & 1 deletion platforms/nuttx/NuttX/nuttx
Submodule nuttx updated 2796 files
3 changes: 0 additions & 3 deletions platforms/nuttx/cmake/px4_impl_os.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ function(px4_os_add_flags)
${PX4_BINARY_DIR}/NuttX/apps/include
)

# NuttX's disables inline below C99 (comiler.h), but __STDC_VERSION__ isn't set for C++
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-D__STDC_VERSION__=199901L>)

# prevent using the toolchain's std c++ library
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-nostdinc++>)

Expand Down
1 change: 1 addition & 0 deletions src/drivers/boards/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ if ((${PX4_PLATFORM} MATCHES "nuttx") AND NOT ${PX4_BOARD} MATCHES "io")
board_fat_dma_alloc.c
board_gpio_init.c
board_dcache_control.c
board_reset.c
)

if (${CONFIG_ARCH_CHIP} MATCHES "kinetis")
Expand Down
14 changes: 7 additions & 7 deletions src/drivers/boards/common/board_dcache_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <stdbool.h>

#include "nvic.h"
#include "cache.h"
#include <nuttx/cache.h>
#include "up_arch.h"

#include <parameters/param.h>
Expand Down Expand Up @@ -93,7 +93,7 @@ void board_configure_dcache(int stage)
/* On boot we should default to disabled on effected HW */

if (erratta && stage == 0) {
arch_disable_dcache();
up_disable_dcache();
return;
}

Expand All @@ -106,15 +106,15 @@ void board_configure_dcache(int stage)
switch (dcache) {
default:
case 0:
erratta ? arch_disable_dcache() : arch_enable_dcache();
erratta ? up_disable_dcache() : up_enable_dcache();
break;

case 1:
arch_disable_dcache();
up_disable_dcache();
break;

case 2:
arch_enable_dcache();
up_enable_dcache();
break;
return;
}
Expand Down Expand Up @@ -157,11 +157,11 @@ int board_dcache_info(int action, char **pmesg, bool *pstate)
}

if (action == 0) {
arch_disable_dcache();
up_disable_dcache();
}

if (action == 1) {
arch_enable_dcache();
up_enable_dcache();
}

if (pmesg) {
Expand Down
77 changes: 77 additions & 0 deletions src/drivers/boards/common/board_reset.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/****************************************************************************
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
*
* 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 <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 */
10 changes: 5 additions & 5 deletions src/drivers/px4io/px4io_serial_f7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#ifdef PX4IO_INTERFACE_F7

#include "stm32_uart.h"
#include "cache.h"
#include <nuttx/cache.h>

/* serial register accessors */
#define REG(_x) (*(volatile uint32_t *)(PX4IO_SERIAL_BASE + (_x)))
Expand Down Expand Up @@ -288,8 +288,8 @@ PX4IO_serial_f7::_bus_exchange(IOPacket *_packet)
stm32_dmastart(_rx_dma, _dma_callback, this, false);

/* Clean _current_packet, so DMA can see the data */
arch_clean_dcache((uintptr_t)_current_packet,
(uintptr_t)_current_packet + ALIGNED_IO_BUFFER_SIZE);
up_clean_dcache((uintptr_t)_current_packet,
(uintptr_t)_current_packet + ALIGNED_IO_BUFFER_SIZE);

/* start TX DMA - no callback if we also expect a reply */
/* DMA setup time ~3µs */
Expand Down Expand Up @@ -458,8 +458,8 @@ PX4IO_serial_f7::_do_interrupt()
/* if there is DMA reception going on, this is a short packet */
if (_rx_dma_status == _dma_status_waiting) {
/* Invalidate _current_packet, so we get fresh data from RAM */
arch_invalidate_dcache((uintptr_t)_current_packet,
(uintptr_t)_current_packet + ALIGNED_IO_BUFFER_SIZE);
up_invalidate_dcache((uintptr_t)_current_packet,
(uintptr_t)_current_packet + ALIGNED_IO_BUFFER_SIZE);

/* verify that the received packet is complete */
size_t length = sizeof(*_current_packet) - stm32_dmaresidual(_rx_dma);
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/stm32/armv7-m_dcache/armv7-m_dcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

#include <parameters/param.h>

#include "cache.h"
#include <nuttx/cache.h>

#if defined(CONFIG_ARMV7M_DCACHE) && defined(CONFIG_ARMV7M_DCACHE_WRITETHROUGH)

Expand Down
4 changes: 2 additions & 2 deletions src/lib/systemlib/print_load_nuttx.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void print_load_buffer(uint64_t t, char *buffer, int buffer_length, print_load_c
print_state->interval_time_ms_inv = 1.f / ((float)((print_state->new_time - print_state->interval_start_time) / 1000));

/* header for task list */
snprintf(buffer, buffer_length, "%4s %*-s %8s %6s %11s %10s %-5s %2s",
snprintf(buffer, buffer_length, "%4s %-*s %8s %6s %11s %10s %-5s %2s",
"PID",
CONFIG_TASK_NAME_SIZE, "COMMAND",
"CPU(ms)",
Expand Down Expand Up @@ -282,7 +282,7 @@ void print_load_buffer(uint64_t t, char *buffer, int buffer_length, print_load_c
}

// print output
int print_len = snprintf(buffer, buffer_length, "%4d %*-s %8d %2d.%03d %5u/%5u %3u (%3u) ",
int print_len = snprintf(buffer, buffer_length, "%4d %-*s %8d %2d.%03d %5u/%5u %3u (%3u) ",
tcb_pid,
CONFIG_TASK_NAME_SIZE, tcb_name,
total_runtime[i],
Expand Down

0 comments on commit edffa52

Please sign in to comment.