GithubHelp home page GithubHelp logo

px4 / nuttx Goto Github PK

View Code? Open in Web Editor NEW
146.0 50.0 205.0 325.96 MB

Standard NuttX with current PX4 patches

Home Page: https://github.com/apache/incubator-nuttx

License: Apache License 2.0

Makefile 0.46% C 98.20% Assembly 1.05% C++ 0.03% Shell 0.14% Batchfile 0.01% Python 0.09% Perl 0.01% Dockerfile 0.01%
nuttx rtos px4 stm32 stm32f4 stm32f7 stm32h7 pixhawk nxphlite dronecode

nuttx's People

Contributors

acassis avatar anchao avatar antmerlino avatar btashton avatar davids5 avatar donny9 avatar gregory-nutt avatar guidingli avatar gustavonihei avatar hartmannathan avatar jerpelea avatar jlaitine avatar juniskane avatar liuguo09 avatar masayuki2009 avatar no1wudi avatar ouss4 avatar papatience avatar pkarashchenko avatar protobits avatar pussuw avatar raiden00pl avatar saramonteiro avatar slorquet avatar spiriou avatar spresense avatar xiaoxiang781216 avatar yamt avatar zhuyanlinzyl avatar ziggurat29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nuttx's Issues

NuttX build fail with CLICOLOR_FORCE=1 on Mac

On MacOS, with environment variable CLICOLOR_FORCE=1 set in .bashrc, the NuttX compilation fails at several places where it parses ls to find lists of kconfig files. Terminal color codes get spliced into the master kconfig list, which then fails to parse correctly.

For my color configuration, it failed only for files that were incorrectly marked executable. Although these permissions appear to have been fixed in the upstream NuttX, other users might run into this issue on all files, depending on their color configuration.

My immediate solution was to move CLICOLOR_FORCE to .bash_profile where it belongs (or disable it altogether). However, it may take users a very long time to discover this problem.

Another solution:
At the top of platforms/nuttx/NuttX/apps/tools/mkkconfig.sh, add unset CLICOLOR_FORCE.

I expect this change may be too specific to be accepted, but at least this will document the issue for future users.

Here's the error message:

.../Firmware/build/px4_fmu-v5_<model>/NuttX/apps/examples/Kconfig:57: '.../Firmware/build/px4_fmu-v5_<model>/NuttX/apps/examples/lis3dsh_reader/Kconfig' not found (in 'source ".../Firmware/build/px4_fmu-v5_<model>/NuttX/apps/examples/lis3dsh_reader/Kconfig"'). 

Check that environment variables are set correctly (e.g. $srctree, which is unset or blank). Also note that unset environment variables expand to the empty string.

statfs() might lead to halt

I added mavlink message, that checks the SD card status periodically (in contrast to current implementation STORAGE_INFORMATION, that need to be asked by the ground).
during checking my message, I tested what will happen if I remove the SD card during operation. doing that caused the mavlink thread to stop.

first, do you consider that as a problem? how the system behave if SD is removed, or get malfunction during flight.
I only checked that above scenario, (added periodic check mavlink message). but i guess that other methods that required the SD are much more critical, for example reading mission on commander....

I think that it related to the fact that reading the status of fat32 is done by fat_statfs(), that waits for semaphore fat_semtake(fs);

Testing code can be found at:
https://github.com/BazookaJoe1900/Firmware/tree/testing-sd_removal

(is that the right place to point to that issue?)

Buggy handling of unsigned long in vsprintf_internal

When compiling the code on a machine which has unsigned long defined as 8 bytes, the buggy code here will mark the second branch as duplicate branch since on x86-64 bit machines, unsigned long and unsigned long long have the same size, ie, 8 bytes.

                  case sizeof(unsigned long):
                    c = 'l';
                    break;

#if defined(CONFIG_HAVE_LONG_LONG) && ULLONG_MAX != ULONG_MAX
                  case sizeof(unsigned long long):
                    c = 'l';
                    flags |= FL_LONG;
                    flags &= ~FL_SHORT;
                    break;
#endif

A relatively simple fix would be to have the case for unsigned long in the #else branch of the #if.

#if defined(CONFIG_HAVE_LONG_LONG) && ULLONG_MAX != ULONG_MAX
                  case sizeof(unsigned long long):
                    c = 'l';
                    flags |= FL_LONG;
                    flags &= ~FL_SHORT;
                    break;
#else
  case sizeof(unsigned long):
                    c = 'l';
                    break;
#endif

This should fix the issue of duplicate branch.

fs_fat32.c fat_seek jump wrong

at fs_fat32.c fat_seek 1239 line:

 /* Then get the current sector from the cluster and the offset
  * into the cluster from the position
  */

  (void)fat_currentsector(fs, ff, filep->f_pos);

in fact fat_currentsector will change the currentsector to the sector we seek

int fat_currentsector(struct fat_mountpt_s *fs, struct fat_file_s *ff,
                      off_t position)
{
  int sectoroffset;

  if (position <= ff->ff_size)
    {
      /* sectoroffset is the sector number offset into the current cluster */

      sectoroffset = SEC_NSECTORS(fs, position) & CLUS_NDXMASK(fs);

      /* The current cluster is the first sector of the cluster plus
       * the sector offset
       */

      ff->ff_currentsector = fat_cluster2sector(fs, ff->ff_currentcluster)
                           + sectoroffset;

      /* The remainder is the number of sectors left in the cluster to be
       * read/written
       */

      ff->ff_sectorsincluster = fs->fs_fatsecperclus - sectoroffset;

      finfo("position=%d currentsector=%d sectorsincluster=%d\n",
            position, ff->ff_currentsector, ff->ff_sectorsincluster);

      return OK;
    }

  /* The position does not lie within the file */

  return -ENOSPC;
}

you could see the code, only when position <= ff->ff_size ,the sector will be changed right.
if position > filesize,it will return err,but dont deal with it.

if i want to write a file(size 1000) at 1500, first you seek to 1500,the seek func won change the current_sector,the current_sector will restain the last time.Then you use write,just write to the last sector not the sector 1500 bytes should be.This make the random seek and write not work and make a mess.

The solve :

      int sectoroffset;

	  /* sectoroffset is the sector number offset into the current cluster */

	  sectoroffset = SEC_NSECTORS(fs, filep->f_pos) & CLUS_NDXMASK(fs);

	  /* The current cluster is the first sector of the cluster plus
	   * the sector offset
	   */

	  ff->ff_currentsector = fat_cluster2sector(fs, ff->ff_currentcluster)
						   + sectoroffset;

	  /* The remainder is the number of sectors left in the cluster to be
	   * read/written
	   */

	  ff->ff_sectorsincluster = fs->fs_fatsecperclus - sectoroffset;

use the code replace the func fat_currentsector in seek func.

in other situation the fat_currentsector maybe work right

When disabling OTGFS, linker errors

Hi all! So, I was trying to use as GPIO the pins that are right now for OTGFS (PA11 and PA12, namely), in a fmu-v5 target. For that, I first wanted to disable OTGFS, since that interface is taking those pins and configuring them. However, when I disable OTGFS, I get this linking problem:
image

Is it a bug or I am missing something in the configuration?

Nuttx configuration for px4

Hi,
I am following tutorial https://www.youtube.com/watch?v=2Bvku3dnrr8 .
On the 13:22 minute, It can be seen the commands needed for installation and configuration of Nuttx for a board - which are " ./tools/configure.sh -c nucleo-l476rg/nsh"

I would like to use the board for px4 CUAV V5+ that has processor: STM32F765 -------------/https://docs.px4.io/main/en/flight_controller/cuav_v5_plus.html --------------

I have changed the board location to: stm32f769i-disco/nsh ,but this gives out the errors below:

tools/configure.bat -c stm32f769i-disco/nsh
mingw32-gcc.exe -Wall -Wstrict-prototypes -Wshadow -g -pipe -I. -DCONFIG_WINDOWS_NATIVE=y -o configure.exe configure.c cfgparser.c
ERROR: stat of (null) failed: Invalid argument
configure.exe failed

I also tried with:
tools/configure.sh -c stm32f769i-disco/nsh

and get the following error:

tools/configure.sh: line 142: [: /home/User: binary operator expected
tools/configure.sh: line 161: [: /home/User: binary operator expected
tools/configure.sh: line 181: [: /home/User: binary operator expected
tools/configure.sh: line 186: [: /home/User: binary operator expected
grep: /home/User: No such file or directory
grep: UserSurname/nuttx/tools/../boards///stm32f769i-disco/configs/nsh/defconfig: No such file or directory
grep: /home/User: No such file or directory
grep: UserSurname/nuttx/tools/../boards///stm32f769i-disco/configs/nsh/defconfig: No such file or directory
Copy files
ln: target UserSirname/nuttx/tools/../Make.defs': No such file or directory
Failed to symlink /home/UserSurname/nuttx/tools/../boards///stm32f769i-disco/configs/nsh/Make.defs

I can`t figure out what I'm doing wrong.
Any advice is appreciated.

Thanks

branch naming scheme

Thinking about this again we probably need the branch naming to be consistent such that the nuttx (and apps) branch stays in tact once PX4 master merges to beta, then stable.

Compilation error when CONFIG_NSOCKET_DESCRIPTORS >0

Two compilation error:

  1. Line 960 fs/procfs/fs_procfsproc.c
    linesize = snprintf(procfile->line, STATUS_LINELEN, "\n%3-s %-2s %-3s %s\n", "SD", "RF", "TYP", "FLAGS");
    unknown conversion type character
    probably need to be changed to
    linesize = snprintf(procfile->line, STATUS_LINELEN, "\n%-3s %-2s %-3s %s\n", "SD", "RF", "TYP", "FLAGS");

  2. Line 983 fs/procfs/fs_procfsproc.c
    linesize = snprintf(procfile->line, STATUS_LINELEN, "%3d %2d %3d %02x",
    i + CONFIG_NFILE_DESCRIPTORS,
    (long)socket->s_crefs, socket->s_type, socket->s_flags)
    probably need to be changed to
    linesize = snprintf(procfile->line, STATUS_LINELEN, "%3d %2d %3d %02x",
    i + CONFIG_NFILE_DESCRIPTORS,
    socket->s_crefs, socket->s_type, socket->s_flags)

Return before close ELF fd!

elf_init open a elf file , if both enabled CONFIG_NSH_BUIlTAPPS and CONFIG_NSH_FILE_APPS , elf_init will read elf file in /bin directory, but that length is zero , elf_read failed return and NOT close elf fd, so this line MUST be return to errout_with_init

goto errout;

Linking problems using uClibc++

I'm trying to compile the px4 firmware for the px4_fmu-v5_default target with uClibc++ as C++ library. However, I get several undefined references in the linking phase (ld command):

  • undefined reference to `operator delete(void*)'
  • undefined reference to `__cxa_pure_virtual'
  • undefined reference to `operator new[](unsigned int)'
  • ...

Am I missing something in the configuration?

problems in NuttX/arch/arm/src/stm32f7/Make.defs

Line 141
ifeq ($(filter y,$(CONFIG_STM32F7_IWDG) $(CONFIG_STM32F7_RTC_LSICLOCK)),y)
CHIP_CSRCS += stm32_lsi.c
endif

stm32_lsi.c will NOT be compiled if both CONFIG_STM32F7_IWDG and CONFIG_STM32F7_RTC_LSICLOCK equals to y
Could you please check it?
Thanks

STM32F4's GPIO_OTGFS_ID conflict with GPIO_USART1_RX_1

GPIO_OTGFS_ID pin was configured without any predefinition in OTG driver, but GPIO_USART1_RX_1 use the same pin was configured in low level startup before OTG driver initialization, so usart rx not work after OTG driver initialization

CANHUBK3 eth0 down, not able to ping

The default state of eth0 is down, When issuing the command ifup eth0 the interface reports 'okay' but does not init. I am unable to ping out from the device.

ping_canhubk3

Hardfault: Bus fault on vector table read (stm32f103ret6) on a dronecan node

This is a dronecan application firmware that is hard faulting after the bootloader updates firmware (there is nothing occupying flash space after the bootloader). The near exact board config worked with an stm32f103zet6 prototype (only differences is that there is no fsmc, and only 1 memory region on the ret6) and I was able to get the dronecan node operational and a nuttx console going.

The board config can be found here: PX4/PX4-Autopilot@main...dirksavage88:Firmware:aa_cannode_v1

Dronecan bootloader works as intended and I see it come up in init mode, it allows me to update the firmware via the dronecan gui tool. I also verify node status and node info when I plug in the node flashed with the bootloader. With the hardfault, it doesn't recover and the bootloader doesn't jump into firmware enough for me to get a system console (it just restarts and the node comes back up in init).

See screen snips. I am reading the hardfault in the bus monitor ascii section.

@ryanjAA

@davids5 I believe this is similar to oliminexino stm32 you brought into Nuttx, it's just a higher density version (512kb flash, 64kb sram).

Other known issues: the nuttx hardware pinmap for the stm32f103r is missing uart4 & uart5. I've made these changes in my local nuttx submodule but it is not fixed upstream. The node has a sensor on uart4.

hardfault1
hardfault2
hardfault3

fs_fat32.c fat_seek maybe return a error that shoud ok

Use case:
open a file with readonly,then lseek to the end with offset 0
there will return a error( ENOSPC 28 "No space left on device")
so i can't get the file size with this.

TestFile:13,107,200 Byte

Code:

static off_t fat_seek(FAR struct file filep, off_t offset, int whence)
---------1164
if ((ff->ff_oflags & O_WROK) != 0)
{
/ Extend the cluster chain (fat_extendchain
* will follow the existing chain or add new
* clusters as needed.
*/

cluster = fat_extendchain(fs, cluster);
}
else
{
/* Otherwise we can only follow the existing chain */

cluster = fat_getcluster(fs, cluster);
}

---------1178

when i debug i found that fat_getcluster(fs, cluster) will retrun the "0x0fffffff" that means FAT cluster end.
but in fat_seek ,there is no end deal,so there will be a error.

The break way is less than clustersize,in the loop, position Just coincidentally equal to clustersize,so it continue find next cluster chan.

---------1142

if (position < clustersize)
{
break;
}

---------1145

Solution:

add FAT end deal or make break condition wiht "position <= clustersize"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.