NuttX-7.20 Release Notes

The 120th release of NuttX, Version 7.20, was made on March 8, 2017, and is available for download from the Bitbucket.org website. Note that release consists of two tarballs: nuttx-7.20.tar.gz and apps-7.20.tar.gz. These are available from:

https://bitbucket.org/nuttx/nuttx/downloads
https://bitbucket.org/nuttx/apps/downloads

Both may be needed (see the top-level nuttx/README.txt file for build information).

Additional new features and extended functionality:

* Core OS:

  - Kernel Modules:  Module initializer may now return a symbol table.
  - Modules:  Extend the module interface so that we can access symbols
    exported by the module.
  - Shared Libraries:  In the FLAT build mode, kernel modules may be
    used to provide minimal shared library functionality.
  - Modules/Shared Libraries:  Add support for dependencies between
    modules.
  - Module Library:  Add build a configuration logic for a shared module
    library.
  - Shared Libraries: Implement module based shared libraries for the
    PROTECTED mode build.
  - Interrupt handling:  irq_attach() now includes an argument of type
    xcpt_t that retained with the handler address.  That argument is
    then provided to the interrupt handler when the interrupt occurs. 
    The common parameter passing replaces the ad hoc parmater passing
    implemented in current drivers.  From Mark Schulte.
  - Adapt many drivers to utilize the IRQ argument feature.
  - All functions that used to return an xcpt_t old handler value, now
    return an int error code.  The oldhandler value is no longer useful
    with the recent changes to the interrupt argument passing.  Some of
    the functions effected include board_button_irq(), arch_phy_irq(),
    STM32 EXTI functions (Alarm, COMP, PVD), GPIO interrupt logic like
    kinetis_pinirq(), stm32_gpiosetevent(), and others.
  - IRQ subsystem:  Add support for smaller interrupt tables as
    described at
    http://www.nuttx.org/doku.php?id=wiki:howtos:smallvectors .  This
    is partially the work of Mark Schulte.

* File Systems/Block and MTD Drivers

  - Pseudo File System:  Add support for soft links in the top-level
    psuedo file system.
  - Soft links:  Add an implementation of readlink().
  - Add fstat() support.  Implement fstat() method in binfs, romfs,
    unionfs, tmpfs, nxffs, nfx, hostfs, procfs, and smartfs.
  - fstat:  Add fstat() support to FAT.  From Alan Carvalho de Assis.

* Graphics/Display Drivers:

  - Fonts: Add support for Tom Thumb small mono-space font. From Alan
    Carvalho de Assis.
  - Graphics:  Separated of font cache from graphics/nxterm.  Now in
    libnx/nxfronts where it can be shared with other grapics
    applications.

* Networking/Network Drivers:

  - Ethernet drivers:  Add framework for serialization in the case where
    multiple low-priority work queues are used.

* Other Common Device Drivers:

  - Add capabilities() method to SDIO interface.  Remove
    CONFIG_SDIO_WIDTH_D1_ONLY.  That should not be a global propertie,
    but rather a capability/limitation of single slot when there may be
    multiple slots.
  - Removed dmasupported() method from the SDIO interface.  That is now
    a bit in the capability set.
  - drivers/sensors: Add driver for the ST L3GD20 3 axis gyro.  From
    raiden00.

* Atmel SAM3/4:

  - SAM3/4: Add support for ATSAM4S4C.  From Wolfgang Reißnegger.

* NXP Freescale i.MX6 Boards:

  - Sabre 6quad:  Enable examples/smp test in i.MX6 SMP/NSH
    configurations.

* NXP Freescale Kinetis:

  - Kinetis:  Added support for CHIP_MK60FN1M0VLQ12 chip.  From Maciej
    Skrzypek.
  - Kinetis:  Add support for K64/K66 RTC lower half driver. From Neil
    Hancock.
  - Kinetis:  Extensive modification of MCG support based feature
    configuration.  From David Sidrane.
  - Kinetis:  Add support for K66 family.  From David Sidrane.
  - Kinetis:  Created a kinetis SIM versioning scheme pulled in by
    Kinetis chip.h.  From David Sidrane.
  - Created a kinetis PMC versioning scheme pulled in by Kinetis
    chip.h.  From David Sidrane.
  - Kinetis:  Extend clock configuration logic.  Refactor
    implementation.  From David Sidrane.

* NXP Freescale Kinetis Drivers:

  - Kinetis Ethernet:  Kinetis Support RMII clock source select.  This
    defined the RMII clock source select bits and allows the selection
    to be made via Kconfig. From David Sidrane.  Freedom-K66F uses
    ENET_1588_CLKIN as RMII clock
  - Kinetis Serial:  Added configurable 1|2 stop bits.
    HAVE_SERIAL_CONSOLE -> HAVE_UART_CONSOLE to be consistent with
    HAVE_LPUART_CONSOLE naming. From David Sidrane.
  - Kinetis LPserial:  Add LPUART serial driver and Clock
    configuartaion to freedom-k66f board.  From David Sidrane.
  - Kinetis USB device:  Refactor clocking in kinetis_usbdev.  From
    David Sidrane.

* NXP Freescale Kinetis Boards:

  - Add support for NXP Freedom-k66f development board.  From David
    Sidrane.
  - Kinetis Freedom K66F:  Add Ethernet support.  From David Sidrane.
  - Add twr-k64f120m config.  From Marc Rechté.

* NXP Freescale LPC43xx Boards:

  - Bamboo-200E: Add netnsh configuration.  From Alan Carvalho de Assis.
  - Add usbnsh config to Bambino 200E board.  From Alan Carvalho de
    Assis.

* STMicro STM32:

  - STM32 F7: Allow board to configure HSE clock in bypass-mode. This
    is needed to enable HSE with Nucleo-F746ZG board.  From Jussi
    Kivilinna.
  - STM32 F7: stm32_allocateheap: allow use DTCM memory for heap. 
    STM32F7 has up to 128KiB of DTCM memory that is currently left
    unused.  This change adds DTCM to main heap if
    CONFIG_STM32F7_DTCMEXCLUDE is not enabled.  From Jussi Kivilinna.
  - Add basic support for the STM32F334.  From Mateusz Szafoni.
  - STM32F33XX DAC, OPAMP, COMP, ADC, HRTIM headers.   From Mateusz
    Szafoni.

* STMicro STM32 Drivers:

  - STM32 F7 SDMMC:  Add support for single bit operation on SDMMC2.
  - STM32 L4:  Port STM32L4 SAI driver from MDK.
  - STM32 L4:  Bring power management logic from Motrola MDK into NuttX.
  - STM32 L4:  Bring LPTIM driver in from the Motorola MDK.
  - STM32 L4 COMP: Port from Motorola MDK.

* STMicro STM32 Boards:

  - STM32F429i Discovery: Add support for NxWM on STM32F429i-Disco
    board. From Alan Carvalho de Assis.
  - STM32F103 Minimum: Add support for nRF24 on STM32F103-Minimum
    board. From Alan Carvalho de Assis.
  - Olimex STM32 P407: Add a NSH protected build configuration; Enable
    procfs/ in all configurations.
  - Olimex STM32 P407: Add support for on-board microSD slot.
  - STM32F429i Discovery: add support for the L3GD20 driver.  From
    raiden00.
  - STM32F103 Minimum: Add support to QEncoder on STM32F103 Minimum
    board.   From Alan Carvalho de Assis.
  - Olimex STM32 P407:  Add external SRAM support.
  - Add basic support for the Nucleo F334R8 board.  From Mateusz
    Szafoni.
  - STM32F103 Minimum: Add SDCard support over SPI on STM32F103-Minimum
    board.  From Alan Carvalho de Assis.
  - STM32F103 Minimum: Add support to USB Device on STM32F103-Minimum
    board.  From Alan Carvalho de Assis.

* C Library/Header Files:

  - compiler.h: packed_struct replaced by begin_packed_struct and
    end_packed_struct. Now support IAR style packed structures.  From
    Aleksandr Vyhovanec.
  - Math library: Leverage optimized ARMv8-M functions from BSD license
    ARM file.
  - Shared libraries:  Add a non-standard dllfnc.h function to set the
    symbol table.
  - C Library: Add a support for setvbuf(). This is a collaborative
    effort.  Alan Carvalho de Assis did the initial prototype.
  - C Library: Add setbuf() which is a trivial wrapper around setvbuf().
  - C library:  Add swab().
  - C library: Add strtoimax and strtoumax.
  - C library:  Add ffs(), rindex(), an index().  Add strings.h.  Move
    strcasecmp, strncasecmp, bzero, bcmp, and bcopy to where they
    belong in strings.h.h, not string.h.  bzero, bcmp, and bcopy are
    legacy functions; the contemporary counterparts should be used
    instead.
  - C library: Add fstatfs().
  - Update cwchar.  Add cwctype.

* Build/Configuration System:

  - Add configuration support for builds with Ubuntu under Windows 10.

* Tools:

  - tools/noteinfo.c: A hack tool that I use to analyze some sched_note
    output.  Needs a home and may be useful to others.
  - tools/mkconfig.c: Add logic to keep all of the buffering options in
    sync.

* NSH: apps/nshlib:

  - NSH: Add support for the 'ln' command.
  - NSH ls command: if node is a symobolic link, use readlink() to get
    and the display the target of the symblic link.
  - NSH: Add readlink command.

* Applications: apps/examples:

  - apps/examples/nxtext: Make line spacing configurable.
  - apps/system/zmodem/host/nuttx/compiler.h synchronized with
    nuttx/nuttx/include/nuttx/compiler.h.  From Aleksandr Vyhovanec.
  - apps/examples/sotest:  Add a test for shared libraries.
  - apps/examples/ostest:  Add a test of setvbuf().
  - apps/examples/stat:  Add a simple test for stat(), fstat(),
    statfs(), and fstatfs().

Works-In-Progress:

* IEEE802.14.5/6LowPAN.  Hooks and framework for this effort were
  introduced in NuttX-7.15.  Work has continued on this effort on
  forks from the main repositories, albeit with many interruptions.
  The completion of this wireless feature will postponed until at
  least NuttX-7.21.

Bugfixes. Only the most critical bugfixes are listed here (see the ChangeLog for the complete list of bugfixes and for additional, more detailed bugfix information):

* Core OS:

  - SMP: There were certain conditions that we must avoid by preventing
    the release of the pending tasks while withn a critical section. 
    But this logic was incomplete; there was no logic to prevent other
    CPUs from adding new, running tasks while on CPU is in a critical
    section.  This commit corrects this.  This is matching logic in
    sched_addreadytorun to avoid starting new tasks within the critical
    section (unless the CPU is the holder of the lock).  The holder of
    the IRQ lock must be permitted to do whatever it needs to do.
  - SMP: Make checks for CPU lock set more robust.  There are certain
    conditions early in initialization on during interrupt handling
    where things need to be done a little differently.
  - sched_cpulocked:  Avoid use of spinlock.  That has been reported to
    cause a deadlock (2016-12-28).
  - SMP: Fix a gap where we may try to make modifications to the task
    lists without being in a critical sections.  That permits
    concurrent access to the tasks lists and many subtle problems. 
    This fix just remains in the critical section throughout the
    operation (and possible until the task is restore in the event of a
    context switch).  Makes a big difference in stability.
  - SMP: Fix an error in critical section logic when performing a
    context switch from an interrupt handler.  The g_cpu_irqset bit was
    not being set for the CPU so other CPUs did not know about the
    critical section.
  - SMP Signals: Fix some SMP signal delivery logic. Was not handling
    some critical sections correctly and was missing logic to signal
    tasks running on other CPUs.
  - SMP:  Fix timer related issues:  Round robin and sporadic
    scheduling were only being performed for tasks running on the CPU
    that processes the system timer interrupt.  Similary, CPU load
    measurements were only be processed for running on the CPU that
    receives the sampling interrupt.
  - sched_note: Fix spinlock instrumentation.  From Masayuki Ishikawa.
  - In all implementations of _exit(), use enter_critical_section() vs.
    disabling local interrupts.
  - sigtimedwait:  When timer expires, up_unblock_task() is called. 
    This is okay in the single CPU case because interrupts are disable
    in the timer interrupt handler.  But it is insufficient in the SMP
    case.  enter_ and leave_critical_section() must be called in order
    to manage spinlocks correctly.
  - Fix a compile error: in sched_cpuload.c:Line136, the variables ts
    and secs are not defined if CONFIG_CPULOAD_ONESHOT_ENTROPY = 0.
    However, these variables are used regardless of
    CONFIG_CPULOAD_ONESHOT_ENTROPY at lines~180:onwards.  From rg.
  - CPU load: Correct computation of the nominal period to use when the
    source is a oneshot timer.
  - Cancellation points:  Fix some backward logic in conditional
    compilation.
  - Remove an unused variable when calling sigwaitinfo() and
    sigtimedwait().  From Masayuki Ishikawa.

* File System/Block and MTD Drivers:

  - procfs:  Correct to snprintf-related errors in fs_procfsproc.c.
    Resolves issue #24.
  - Add logic to VFS rename:  If target of rename exists and is a
    directory, then the source file should be moved 'under' the target
    directory. POSIX also requires that if the target is a file, then
    that old file must be deleted.
  - Fix open() a block device with
    CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y. From Masayuki Ishikawa.
  - File System: Don't build block driver proxy if PSEUDOFS_OPERATIONS
    are disabled.
  - sendfile():  Fix error introduced with commit
    ff73be870e38959b0aaee5961dc47b4b58dc2d86.  Noted by Maciej Wójcik.

* Graphics/Graphic Drivers:

  - NxWM configurations.  If using a 7-bit character set, then the
    cursor character cannot be 137 (graphic block).  Use 95
    (underscore) instead.
  - NX server: Correct message queue names.  Should not be at /dev,
    but rather relative to /var/mqueue.

* Common Drivers:

  - MMCSD_SDIO: Only wait for card ejected if card detection is
    supported. From Alan Carvalho de Assis.
  - Typos withim mtd/ with Macronix MX25L.  In
    NuttX/drivers/mtd/Make.defs letters X between M and 25 are
    missing.  Noted by Oleg Evseev.
  - USBMSC: Always set LUN readonly flag.  From Wolfgang Reißnegger.
  - drivers/lcd:  ssd1306_configspi() must have global scope.
  - MMC/SD SDIO:  Some drivers need to start DMA before sending CMD24
    and some AFTER.  From Alan Carvalho de Assis.
  - drivers/tone.c:  Handle configuration with multiple PWM channels.
    This resolves issue #30: Audio Tone Generator and PWM Multiple
    Output Channel options.
  - drivers/tone.c:  50% duty needs to be expressed a a fixed precision
    number.
  - drivers/spi/Kconfig:  There is too much SPI in the configuration
    menu; SPI Driver Support menu is empty.  From Maciej Wójcik.
  - option to enable Memory Card debug output was hidden with SD cards
    connected through SPI.   From Maciej Wójcik.
  - usbhost_cdcacm: fix tx outbuffer overflow and remove now invalid
    assert.  From Janne Rosberg.

* Networking/Network Drivers:

  - Networking: Fixed some issues that prevented IPv6 from working with
    IPv4 enabled.  From Pascal Speck.
  - Networking: fixed a nullptr-dereference on iob_clone.  From Pascal
    Speck.
  - Ethernet: Need two work structures (minimum) in all Ethernet
    drivers so that pending poll work is not lost when an interrupt
    occurs.

* ARMv7-R:

  - I found an issue inside the cp15_coherent_dcache function:  The
    "mcr CP15_BPIALLIS(r0)" should only be used with SMP
    configurationa. In non-SMP configuration this instruction could
    become undefined.  From Manohara HK.

* Atmel SAM3/4 Drivers:

  - SAM3/4: GPIO bit numbering typo fixes.  From Wolfgang Reißnegger.

* Atmel SAM3/4 Boards:

  - Add missing sched_note_*() calls in sam4cm SMP functions.

* NXP/Freescale Kinetis:

  - Kinetis: Fixed wrong MCG VDIV calculation on new NXP K60.  From
    Maciej Skrzypek.
  - Kinetis: Need to set HAVE_UART_DEVICE when UART4 is selected.  From 
    Maciej Skrzypek.
  - Kinetis MCG: Wrong FRDIV set in MCG_C1.  From Maciej Skrzypek.

* NXP/Freescale Kinetis Drivers:

  - Kinetis Serial: Fixed compile error when UART5 is selected.  From
    Maciej Skrzypek.
  - Kinetis SDHC - Enable clock after selected.  From David Sidrane.
  - Kinetis:  Correct some SPI and I2C configuration issues.  From
    David Sidrane.
  - Kinetis Ethernet:  Add #define for number of loops for auto
    negotiation to complete.  From Marc Rechté.
  - Kinetis Werial:  Fixed up_rxint - did not disable the RX
    interuppts. There was an OR where and AND NOT was needed.  From
    David Sidrane.

* NXP/Freescale LPC43xx:

  - LPC43 pinset definitions:  Add more 1 bit to pinset to reach
    SFSCLK0-SFSCLK3. Remove PINCONFIG_DIGITAL.  From Alan Carvalho de
    Assis.

* NXP/Freescale LPC43xx Drivers:

  - LPC43 serial:  Correct conditional logic that selects /dev/ttySN.
    Problem noted by Alan Carvalho de Assis.

* NXP/Freescale i.MX6:

  - i.MX6: Fix clearing GPT status register.  From Masayuki Ishikawa.

* STMicro STM32:

  - STM32, STM32L4 Oneshot: Fix logic so that it can support multiple
    oneshot timers.
  - STM32 F7: Added missing ARCH_HAVE_RESET for F7.  From David Sidrane.
  - STM32:  Add missing STM32_BKP_BASE.  From David Sidrane.
  - STM32 and STM32F7: Fixes the BKP reference counter issue.  From
    David Sidrane.

* STMicro STM32 Drivers:

  - Fix for SAMv7 SPI: DLYBS value was calculated, but never written to
    any registers. This led to incorrect timings on the bus.  From
    Michael Spahlinger.
  - STM32 QEncoder: Fix QEncoder driver, based on STM32L4 driver.  From
    Alan Carvalho de Assis.
  - STM32 QEncoder:  Enable clocking to the timer on QE setup; disable
    clock on QE teardown.
  - STM32 Ethernet: Need two work structures so that pending poll work
    is not lost when an interrupt occurs.  This change has also been
    ported to all all other effected Ethernet drivers.
  - STM32 OTGHS host:  stm32_in_transfer() fails and returns NAK if a
    short transfer is received.  This causes problems from class
    drivers like CDC/ACM where short packets are expected.  In those
    protocols, any transfer may be terminated by sending short or NUL
    packet.  From Janne Rosberg.  Adapted Janne Rosberg's patch to
    STM32 OTGHS host to OTGFS host, and to similar USB host
    implementations for STM32 L4 and F7.

* STMicro STM32 Boards:

  - STM32F4 Discovery: Fix issues with QEncoder support.  From Alan
    Carvalho de Assis.

* C Library/Header Files:

  - Add debug assertion in libdtoa to catch attempts to use floating
    point output formats from within an interrupt handler.  That will
    cause assertions or crashes downstream because __dtoa will attempt
    to allocate memory.  From Pierre-noel Bouteville.
  - libc: Fix ARMv7-A/R memcpy assembly.
  - Fix return value if x is NaN.  From Aleksandr Vyhovanec.

* apps/nshlib:

  - NSH: Eliminate a warning when all memory inspection commands are disabled.

* apps/graphics:

  - apps/graphics/traveler/tools: Fix linkage issue. The -lm should
    come after -o binname.  From Alan Carvalho de Assis.

* apps/netutils:

  - The CONFIG_NETUTILS_HTTPD_PATH constant is used by httpd_mmap.c and
    httpd_sendfile.c but It was not present in Kconfig menu.  From
    Maciej Wójcik.

* apps/examples:

  - Configurations that enable OSTEST must not disable signals.
  - apps/examples/ostest:  Was ignoring
    CONFIG_EXAMPLES_OSTEST_FPUTESTDISABLE.
  - In apps/examples/mtdpart/mtdpart_main.c where
    CONFIG_EXAMPLES_MTDPART_NPARTITIONS defining is checked should be
    #ifndef instead of #ifdef.  Noted by Oleg Evseev.