NuttX-7.27 ---------- The 127th release of NuttX, Version 7.27, was made on November 14, 2018, and is available for download from the Bitbucket.org website. Note that release consists of two tarballs: nuttx-7.27.tar.gz and apps-7.27.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: - Assertions: Add 'BOARD_ASSERT_RESET_VALUE' in config/Kconfig and replace reboot status '0' to 'CONFIG_BOARD_ASSERT_RESET_VALUE'. From Gregory Nutt. - Assertions: up_registerdump capture the general register if not yet saved and up_saveusercontext is implemented, the register dump is very useful to find the cause of failure. From Xiang Xiao. - Assertions: up_stackdump() dump the full stack if stack overflow the stack info is very useful to find the backtrace From Xiang Xiao. - binfmt/ and libs/libc: Make exepath_*() more common: Move exepath_*() related code to libc/misc, rename exepath_ to envpath_, and rename BINFMT_EXEPATH to LIBC_ENVPATH. From nchao. - CLOCK: Support CLOCK_MONOTONIC in clock_getres.c. From Xiang Xiao. - Clock Timekeeping: Use clock_basetime() to initialize g_clock_wall_time to get the best initial RTC value and initialize g_clock_last_counter too since the hardware may not start counting from zero. From Xiang Xiao. - exit(): Add SCHED_EXIT_KILL_CHILDREN option to kill all child threads when the main thread of a task exits. From nchao. - IOBs: Add an IOB notifier that will notify any registered threads that want to known when an IOB has been freed. This is basically just a wrapper around the generic notifier. Includes a divider that can be used to reduce the rate of IOB notifications. From Gregory Nutt. - Memory Manager: In mm_free(), add DEBUGASSERT()'s to catch memory corruption early. From Petteri Aimonen. - Memory Manager: Add debug option CONFG_MM_FILL_ALLOCATIONS to fill all mallocs() with recognizable value. From Petteri Aimonen. - sched/signal and syscall/: Add support for pselect() and ppoll() functions From dongjianli. - Task Groups: group_foreachchild() now iterates in reverse order since the callback (e.g. group_killchildren) may remove the tcb from list. From zhangyuan7. - WDOG Timer: Improve accuracy of wd_gettime() in tickless mode From ligd. - Work Queues: Add a generic notification facility that runs on a work queue. The notification facility can notify a group of subscribers to an event via callbacks. This API is for use within the OS only. From Gregory Nutt. * File Systems/Block and MTD Drivers - FAT: Add CONFIG_FAT_LFN_ALIAS_HASH to speed up creating long filenames. Long filenames on FAT file systems have associated 8.3 character alias short filenames. The traditional form of these is FILENA~1.EXT with a running count of the number of similar names. However creating this unique count can take several seconds if there are many similarly named files in the directory. Enabling FAT_LFN_ALIAS_HASH uses an alternative format of FI0123~1.TXT where the four digits are a hash of the original filename. This method is similar to what is used by Windows 2000 and later. From Petteri Aimonen. - FAT: Add CONFIG_FAT_LFN_ALIAS_TRAILCHARS alternative format for 8.3 filenames. Traditional format for long filename 8.3 aliases takes first 6 characters of long filename. If this option is set to N > 0, NuttX will instead take first 6-N and last N characters to form the short name. This is useful for filenames like "datafile12.txt" where the first characters would always remain the same. From Petteri Aimonen. - FAT: if block driver wait seems to be a long one, give time for other threads to run. From Petteri Aimonen. - file_open(): Add file_open() implementation with some fully-function, interim, placeholder logic. Change occurrences of open() followed by file_detach() in the OS to file_open(). From Gregory Nutt. - MX25LF25635F: Add support to Macronix MX25LF25635F serial NOR flash From David Sidrane. - nx_open(): Add nx_open() which is the same as open() except that it does not create a cancellation point nor does it modify the errno variable. Change most other, non-controversial calls to open() to nx_open(). From Gregory Nutt. - file_ioctl(): Replace calls to ioctl() in the OS to file_ioctl(). From Gregory Nutt. - mount: Add mount() support for file systems that require MTD drivers (vs. block drivers). From Gregory Nutt. - mount: Add support for mounting a file system with either a block or an MTD driver. From Xiang Xiao. - MTD FTL: Support BIOC_FLUSH ioctl From Xiang Xiao. - MTD FTL: Make READAHEAD and WRITEBUFFER work independently of each other. There have cases we use writebuffer but not readbuffer, so the write buffer must be flushed before read. Let rwb driver do it. From zhuyanlin. - MTD FTL: Allocate eblock only when it's really needed From Xiang Xiao. - MTD FTL: Add support support unlink operation to avoid the memory leak. From Xiang Xiao. - MTD Partition: Add register_mtdpartition() for MTD partition From Xiang Xiao. - MTD Partition: Remove the hard code partition name length From Xiang Xiao. - MTD Proxy: Make MTD device accessible via a character driver proxy like block devices From Xiang Xiao. - ProcFS: Change output of the ProcFS 'env' file so that it looks more like output from the 'env' command. From Gregory Nutt. - ProcFS: Add support to provide MLD statistics at /proc/net/mld. From Gregory Nutt. - ProcFS: Remove MTD ProcFS and mtd_procfsoperations() since we can now get the same information from inode From Xiang Xiao. - ProcFS: Add /proc/version support to get version info From iuhaitao. - ProcFS: Add support for named MTD drivers in the pseudo file system. This will, eventually, allow us to mount file systems that need MTD drivers without having to fake an intervening block driver. - R/W Buffer: Don't queue work to flush write buffer if CONFIG_DRVR_WRDELAY == 0 From Xiang Xiao. - R/W Buffer: Improve the rwb_read/write overlap performance From zhuyanlin. - SIM HOSTFS: Support S_IFSOCK, DT_LNK, O_DIRECT and O_SYNC From Xiang Xiao. - SPIFFS: Brings in a NuttX port of version 0.3.7 of Peter Anderson's SPIFFS flash file system into NuttX. From Gregory Nutt. * Networking/Network Drivers: - Network Configuration Add new configuration CONFIG_NET_MCASTGROUP. This option is selected automatically if either CONFIG_NET_IGMP or CONFIG_NET_MLD are selected. Most conditional logic based on CONFIG_NET_IGMP replaced with conditioning on CONFIG_NET_MCASTGROUP. From Gregory Nutt. - Network Device: Add notification logic for the case where the network goes down. From Gregory Nutt. - Network Device: Rename netdev_dev_lladdrsize() to netdev_lladdrsize() and move the prototype to include/nuttx/nex/netdev.h, giving is global scope within the OS. From Xiang Xiao. - ARP: Redesign ARP table aging to simplify the net initialization From Xiang Xiao. - ARP: Check ifname match before sending packet. From Xiang Xiao. - ARP and ICMPv6: Double the delay time on each iteration for ARP/ICMP to fight work jitter better. From Xiang Xiao. - ICMP/ICMPv6: Add NET_ICMP[v6]_NO_STACK for usrsock case From Xiang Xiao. - ICMPv6: Encapsulate the link scope address generation into icmpv6_linkipaddr() From Xiang Xiao. - ICMPv6: Remove the coupling between ICMPv6 and Ethernet by moving all Ethernet stuff to neighbor_ethernet_out.c and make the mac address as first field. From Xiang Xiao. - ICMPv6 MLD: Implement Multicast Listener Discovery (MLD) protocol based on RFC 2710 and RFC 3810. From Gregory Nutt. - ICMPv6 MLD: Implement MLDv1 compatibility mode. From Gregory Nutt. - ICMPv6 MLD: Implement 'Other Querier Present Timer'. This timer is used to revert to Querier mode if there is no other querier on the network. From Gregory Nutt. - IGMP: Backport some MLD design improvements/fixes. From Gregory Nutt. - IPv4 setsockopt(): Add implementation for all IPv4 socket options that have implemented IOCTL command counterparts. From Gregory Nutt. - IPv4/6 Socket Options: Add framework to support IPv4 and IPv6 protocol socket options (i.e., SOL_IP and SOL_IP6). Handling of these socket options was a necessary step on the way to ICMPv6 MLD support. From Gregory Nutt. - ICMPv6 Autoconfiguration: Don't take the network device down when reconfiguring only the IP address from within ICMPv6 logic. Recommended by Xiang Xiao in order to avoid the long delays of bringing some networks back up. Normally it is required that the network be in the "down" state when re-configuring the network interface. This is thought not to be a necessary here because: (1) The ICMPv6 logic here runs with the network locked so there can be no outgoing packets with bad source IP addresses from any asynchronous network activity using the device being reconfigured. And (2) incoming packets depend only upon the MAC filtering. Network drivers do not use the IP address; they filter incoming packets using only the MAC address which is not being changed here. From Gregory Nutt. - IPv6 Input: Add logic to skip over the variable number of IPv6 extension headers that may be present between the IPv6 header and the transport layer header. The extension headers are simply ignored. This is necessary because with MLD, certain incoming messages may have, at a minimum, a Router Alert Hop-by-hop extension header. Additional changes to ICMPv6, TCP, and UDP input to handle the offset protocol headers. From Gregory Nutt. - IPv6 Neighbor: Simplify the neighbor table aging process From Xiang Xiao. - IPv6 Neighbor: Simplify neighbor_dumpentry() implementation From Xiang Xiao. - IPv6 Neighbor: neighbor_lookup() checks if the target IP belongs to one of the local network devices. From Xiang Xiao. - IPv6 Neighbor: Support neighbor_out() for multiple link layer at the same time From Xiang Xiao. - IPv6 setsockopt(): Implement the IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP socket options. From Gregory Nutt. - TCP: Extend the TCP notification logic logic so that it will report loss of connection events. From Gregory Nutt. - SLIP: Add IPv6 support and fix minor issue From Xiang Xiao. - TCP: Add TCP poll() logic to receive notifications when IOBs are freed. From Gregory Nutt. - TCP: In TCP backlog, add SOMAXCONN definition and implementation per OpenGroup.org. From zhangyuan7. - TCP/UDP: Extend send()/sendto() logic it also requires that at least one IOB is also available to be able to send. From Gregory Nutt. - TCP/UDP: Add notification logic when TCP or UDP read-ahead data is buffered. From Gregory Nutt. - TUN: Call ipv[4|6]_input dynamically by checking packet header and remove the code duplication From Xiang Xiao. * Wireless/Wireless Drivers: - Broadcom IEEE 802.11: Add capability for Broadcom chips to get firmware and CLM data from a mounted file system vs. in-memory data structures. From Ramtin Amin. - XBee IEEE 802.15.4: Add support for setting/getting tx power. From Anthony Merlino. * Other Common Device Drivers: - GPIO: Support multiple registrations of GPIO signal events. From Xiang Xiao. - INA226: Add INA226 device driver. From Daniel P. Carvalho. - MAX7219: Support all digits presented in the MAX7219 datasheet. From Alan Carvalho de Assis. - MLX90614: Add support for the Infrared Thermometer MLX90614 From Alan Carvalho de Assis. - RTC Driver: up_rtc_set_lowerhalf call clock_synchronize() for external RTC. From Xiang Xiao. - SYSLOG: Uncomment the g_syslog_channel->sc_flush call in syslog_flush(). From Xiang Xiao. - SYSLOG: syslog_initialize initialize dev/syslog too and call syslog to add the prefix and timestamp. From Xiang Xiao. - USB Composite and DFU drivers: Add support for Microsoft OS descriptors. These Microsoft-only descriptors help in loading the correct driver on Windows. They are especially helpful to give libusb access to a custom device without having to manually configure/install WinUSB driver. With this change DFU interface works automatically on Windows 10 with dfu-util 0.9 and libusb 1.0.22. On Windows 7 it still appears to need driver installation. From Petteri Aimonen. - USB DFU Device: Add DFU Runtime driver for activating boot-loader through USB command. From Petteri Aimonen. - USB RNDIS Device: Account for CONFIG_NET_GUARDSIZE in allocation of packet buffer allocation: Make USB device parameters configurable. From Sakari Kapanen. - USB RNDIS Composite Device: Fix strid comparison. Add support for composite configuration. From Petteri Aimonen. * Microchip PIC32MX Boards; - PCBLOGIC-PIC32MX: Remove support for the PCB Logic PIC32MX board. I do not find any references to PCB Logic on the web and I do not believe that this breakout board is available any longer. From Gregory Nutt. * NXP Freescale i.MX RT: - i.MXRT: Added support for the i.MXRT 106x family. From David Sidrane. * NXP Freescale i.MX RT Drivers: - i.MXRT: Add LPI2C driver. From Ivan Ucherdzhiev. - i.MXRT LPSPI: Add full support for the LPSPI in poll mode; includes a minor fix for LPI2C. - i.MXRT USDHC: Initial commit of the i.MXRT SDHC driver working in PIO mode. From Dave Marples. - i.MXRT USDHC: Complete the interrupt driven USDHC1 functionality for the IMXRT EVKB. Improve SD card handling in the DMA case. From Dave Marples. * NXP Freescale i.MX RT Boards: - IMXRT1060-EVK: Add support for the IMXRT1060-EVK. From David Sidrane. * NXP LPC17xx Boards: - Olimex-LPC1766STK: Add support to initialize a USB HID keyboard. Add a configuration for testing the HID keyboard. From Gregory Nutt. * On Semi LPC23450 Drivers: - LC823450: MPU support for FLAT build From Masayuki Ishikawa. * STMicro STM32: - STM32: Add support for STM32F303xD/E. From Mateusz Szafoni. - STM32 L4: Add initial support for STM32L412 and STM32L422 chips From Juha Niskanen. * STMicro STM32 Drivers: - STM32 ADC: Major refactor: Use STM32 ADC IP core version and ADC available functions instead of chip family names in conditional compilation. Replace family specific ADC headers with STM32 ADC IP core version headers. Configurable sample time supported for all chips, not just L1. Enable/disable interrupts supported for all chips, not just L1. Add ADC resolution configuration. From Mateusz Szafoni. - STM32 PWM: Improvements in STM32 PWM low level driver: Support complementary outputs, dead-time configuration, output polarity and IDLE state configuration. From Mateusz Szafoni. - STM32 PWM: Break and lock configuration and some cosmetics From Mateusz Szafoni. - STM32 SPI. Enable separate DMA per SPI configuration From Daniel Agar. - STM32 F7 FLASH: Allow programming OTP blocks through progmem interface From Jussi Kivilinna. - STM32 H7 I2C: Add I2C support for STM32H7. From raiden00pl. - STM32 H7 RCC: Update RCC definitions, add SPI clock configuration and some fixes in RCC. From raiden00pl. - STM32 H7 SPI: Add basic SPI support for H7. Enable SYSCFG clock in RCC. From Mateusz Szafoni. * STMicro STM32 Boards: - Nucleo-F302R8: Add support for Nucleo-F302R8 board From raiden00pl. - Nucleo-F302R8: Add PWM support. From Mateusz Szafoni. - Nucleo-F303ZE: Add basic support for nucleo-f303ze. From Mateusz Szafoni. - Nucleo-F303ZE: Support for ADC and ADC example. From Mateusz Szafoni. - Nucleo-L432KC: Added support for AT45DB Serial Flash From Daniel P. Carvalho. - Nucleo-L432KC: Add support for the INA226. From Daniel P. Carvalho. - Nucleo-H743ZI: Add NRF24L01 support. From Mateusz Szafoni. - Olimex-STM32-P407: Add a HID keyboard configuration. From Gregory Nutt. - STM32F4-Discovery: Add MLX90614 support for the STM32F4-Discovery board From Alan Carvalho de Assis. - STM32F429I-DISCO: Add PWM support. From Mateusz Szafoni. - STM32F429I-DISCO: Support for ADC and ADC example. From Mateusz Szafoni. * MIPS32: - MIPS32 Toolchain.defs: Add toolchain flags for the pinguino toolchain under Linux. From Ouss4. * RISC-V: - RISC-V GAP: This commit brings in support for the GAP8 architecture. The GAP8 is a 1+8-core DSP-like RISC-V MCU. Also included is support for the Gapuino GAP8 evaluation board. From hhuysqt. * Other Tools: - tools/tesbuild.sh: No longer installs and builds the NxWidgets libraries. They are now a port of apps/. From Gregory Nutt. * Libraries/Header Files: - include/net and include/sys: Align the constant values with values in the Linux kernel which makes targeting the usrsock server to Linux kernel easier. From Xiang Xiao. - include/netdb.h Add NO_ADDRESS definition From zhangyuan7. - include/netinet/in.h: Adds definitions for IPPROTO_IPV6 socket options to netinet/in.h. Adds missing fields to sockaddr_in6. Adds struct ipv6-mreq. These changes all follow the opengroup standard for netinet/in.h From Anthony Merlino. - include/netinet/in.h: Add IPv4 SOL_IP socket options for symmetry with IPv6 definitions added in a previous commit. Remove some duplicate types from sys/sockio.h. From Gregory Nutt. - include/netinet/in.h: Add other definitions required by OpenGroup.org. From Gregory Nutt. - include/netinet/in.h: Add Linux IP_PKTINFO and IPV6_PKTINFO definitions. - include/nuttx/net/ipv6ext.h: Create header file with all of the definitions of IPv6 extension headers that I could find. From Gregory Nutt. - include/nuttx/net/mld.h: Add MLD header file based on RFC2710 and RFC3810. From Gregory Nutt. - include/sys/socket.h: With increased size of struct sockaddr_in6, the size of struct sockaddr_storage in include/sys/socket.h must also be increase so that it can contain the new, larger sockaddr_in6. From Gregory Nutt. - libs/libc/misc: Add implementation of CRC8-CCITT. From Alan Carvalho de Assis. - libs/libc/modlib: Add per-module library symbol table support. From nchao. - libs/libc/net: Add basic implementation for recvmsg() and sendmsg() per OpenGroup.org specification. From ligd. - libs/libc/netdb: A few improvements to getaddrinfo: (1) Use the protocol and socktype hints in returned address, (2) Ignore AI_PASSIVE argument if hostname is not NULL From Anthony Merlino. - libs/libc/netdb: Make DNS receive timeout configurable. From ligd. - libs/libc/stdio: Eliminate recursive in conversion functions of lib_vsprintf(). From Xiang Xiao. - libs/libc/string: Add some new functions defined in POSIX.1-2017: stpncpy(), strsignal(), psignal(), psiginfo(). From Gregory Nutt. - libs/libc/string: Add memrchr() function From Xiang Xiao. - libs/libc/string: Make strerror() return the string "Success" for error = 0. From Petteri Aimonen. * Build System: - Makefile.unix/win: Remove deletion of Eclipse project files from make distclean target. From Gregory Nutt. - apps/Application.mk: Fix some build issues. (1) Unable to found target 'context' when CONFIG_NSH_BUILTIN_APPS disabled. (2) Unable to generate multiple programs. From Chao An. - apps/Directory.mk: Fix distclean targets. Makefiles were not removing generated Kconfig files. There was then no way to remove this Kconfig files without manually deleting them one at a time. From Gregory Nutt. * NSH: apps/nshlib: - apps/nshlib/, apps/examples/: Update to show newer file system object types returned by stat(). From Gregory Nutt. - apps/nshlib: Add support for the 'env' command. From Gregory Nutt. - apps/nshlib: Add support for NSH local variables if CONFIG_NSH_VARS are set. These are like environment variables but are local to NSH. The importance of this is that these variables are *not* inherited when NSH creates a new task. The new command 'export' was added. In this case, the NSH variable will be promoted to an environment variable and will then be inherited by any tasks executed by NSH. From Gregory Nutt. - apps/nshlib: If CONFIG_NSH_VARS=y, the NSH 'set' command with no argument will list all of the local NSH variables. From Gregory Nutt. * Examples/Tests: apps/examples: - apps/examples/gpio: Align with GPIO driver update From wangyanjiong. - apps/examples/ina226: Added INA226 example From Daniel P. Carvalho. - apps/examples/mld: Add a test of MLD. Provides a mechanism for some low-level bring-up of MLD. From Gregory Nutt. - apps/examples/mlx90614: Add mlx90614 test example From Alan Carvalho de Assis. - apps/examples/mlx90614/: Include support to change device address on mlx90614 From Alan Carvalho de Assis. - apps/examples/fstest: Adapt the existing fstest example for SPIFFS: For SPIFFS, add garbage collection and file system integrity IOCTL calls. Call statfs() and show state of file system on each loop. Add logic to dump logic content of SPIFFS. Ignore EINTR errors while reading or writing. Add configuration option to customize stack size. Detect when the media is full and stop writing files. Report total file size. From Gregory Nutt. - apps/examples/tcpblaster: Add an option to use poll() to pace input or output. From Gregory Nutt. - apps/examples/tcpblaster: Select CONFIG_LIBC_FLOATINGPOINT automatically. Units in output are wrong: Not Kbps bus Kb/Sec. From Gregory Nutt. - apps/examples/udpblaster: Add option to use poll() on output (only). From Gregory Nutt. * System Utilities: apps/system - apps/system/ping and apps/system/ping6: Set optind to zero in the error case/. Move all ping preparation work into icmp_ping. Support -W and -s option. Decouple the output from ping logic. From Xiang Xiao. - apps/system/ping and pings and apps/netutils/ping: Extract icmp ping and icmpv6 ping6 logic from system/ to C-callable library in netutils/. From ligd. - apps/system/progmem: Remove this utility. It makes illegal direct calls into the OS. From Gregory Nutt. * Network Utilities: apps/netutils: - apps/netutils/netlib and apps/examples/igmp: Adapt to use the corrected, semi-standard version of struct ip_msfilter. From Gregory Nutt. - apps/netutils/chat and apps/examples/chat: 'constify' chat variables and parameters From Xiang Xiao. * Wireless Utilities: apps/wireless: - apps/wireless/ieee802154/i8sak: Properly shuts down event thread. From Anthony Merlino. - apps/wireless/ieee802154/i8sak: Fixes i8sak name. Accidentally renamed to i8ask in recent changes From Anthony Merlino. - apps/wireless/ieee802154/i8sak: Adds support for getting/setting transmit power. From Anthony Merlino. * Graphic Utilities: apps/graphics: - apps/graphics/NxWidgets: Move the NxWidgets repository into the apps/ repository. Remove old apps/NxWidgets directory. Move NxWidgets files into apps/graphics/NxWidgets. Integrate configuration/build system. Fix file paths in file headers. Remove some duplicate tools. Add new NxWidgets Unit Test configuration and build logic. From Gregory Nutt. - apps/graphics/NxWidgets: Add CNxString string + operator and ::format() function. Add CNumericEdit option to include unit name after the value. Make CNxWidget useWidgetStyle() public. From Petteri Aimonen. - apps/graphics/NxWidgets: Add CLabelGrid control for displaying text in grid format. From Petteri Aimonen. 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: - Clock: Remove g_monotonic_basetime and g_clock_monotonic_time since we don't need ensure monotonic time start from zero as state here: http://pubs.opengroup.org/onlinepubs/009696899/functions/clock_getres.html From Xiang Xiao. - Clock: Don't call up_timer_gettime in clock_gettime() and clock_systimer() to ensure the return value from them consistent with clock_systimespec From Xiang Xiao. - Clock Initialization: clock_inittime() needs to be done with CONFIG_SCHED_TICKLESS and clock_initialize should skip clock_inittime() for external RTC case since the RTC isn't ready yet. From Xiang Xiao. - IOBs: Work around some issues with the IOB throttle semaphore. It has some odd behaviors that can cause assertions in sem_post(). Also, it seems to get outside of its range occasionally. Need to REVISIT this. From Gregory Nutt. - IOBs: iob_navail() was returning the number of free IOB chain queue entries, not the number of free IOBs. Completely misnamed. From Gregory Nutt. - PM: Use the start time of state btime to calculate thrcnt; remove the loop whose count may be very big after the long idle From ligd. - PM Uninitialization: Fix pm_domain_s.stime un-initialize caused time error. From ligd. - sched_kfree() and sched_ufree(): This patch prevent heap corruption in a corner case where memory is freed while switching contexts. This change forces all de-allocations via sched_kfree() and sched_ufree() to be delayed. Eliminating the immediate de-allocation prevents the problem with the the re-entrant semaphore because the deallocation always occurs on the worker thread, never on the suspended task. From EunBong Song. - sigsuspend(): sigsuspend() shouldn't eat the pending signal but dispatch all instead From Xiang Xiao. - task_restart(): Was restarting tasks with all signals set in the sigprocmask set. Should have restarted with the sigprocmask cleared. Noted by Jeongchan Kim From Gregory Nutt. - unsetenv(): Fix and error in unsetenv() when un-setting the last of the environment variables. From Gregory Nutt. - waitpid(): Remove a bad error check. From Gregory Nutt. * File System/Block and MTD Drivers: - FAT: Fix file data corruption in fat_truncate(). From Petteri Aimonen. - Partitions: Try MTDIOC_GEOMETRY IOCTL before bops's geometry. From Xiang Xiao. - MTD Progmem: Change up_progmem_npages() to up_progmem_neraseblocks(). page is a unit for read/write operation. eraseblock is a unit for erase operation. up_progmem_npages() is a little bit confusing because it returns number of erase blocks in flash memory. This patch changes up_progmem_npages to up_progmem_neraseblocks. up_progmem_eraseblock erase a block. so it's better to return the erase block size than page size. From EunBong Song. - R/W Buffer: Fix a lock issue From Xiang Xiao. - SmartFS: Current sector should have a space for next entry size. If not, we should move to next sector. From EunBong Song. * Networking/Network Drivers: - 6LoWPAN: Fixes bug in uncompress_addr handling of odd postfix. This affected multicast compress/uncompress since it's the only logic that used an odd postfix. The odd byte needs to be handled first, not last. From Anthony Merlino. - ARP and ICMPv6: Don't call d_txavail directly since it may point to NULL From Xiang Xiao. - ICMPv6: icmpv6_neighbor() shouldn't use the out of scope variable(dripaddr) From Xiang Xiao. - IPv6 input: Fixes logic in ipv6_input to handle more than ff02::/16 multicast addresses. Don't forward mcast packets if scope is not appropriate From Anthony Merlino. - IPv6 Input: Fix a logic error when the received IPv6 srcaddr is a multicast address. Exiting logic only supported UDP multicast. But MLD and certain other ICMPv6 packets also require acceptance of multicast packets. From Gregory Nutt. - TCP: In TCP recv window calculations, in order to receive data we must not only have IOBs available, but we must also have at least one IOB chain qentry available. Otherwise, we will advertise that we an buffer a lot of data when, in fact, we cannot. This is an experimental fix to a performance problem noted by Masayuki Ishikawa. From Gregory Nutt. - TCP: Fix compiler error and warning when CONFIG_NET_SENDFILE=y From Xiang Xiao. - TCP Input: Fix recovery when ackseq > unackseq. The comment near this line says "reset the number of outstanding, unacknowledged bytes". However, the code actually resets the whole TCP connection. It was changed to the current form in commit f034d84ea1f with no explanation of the intent. Recover the line to what it was before that commit. From Sakari Kapanen. - TCP Write Buffering: Fix buffer release handling on failed buffer allocation. Attempt to release write buffer on failed TCP write I/O buffer alloc and tryalloc failed to wrb->wb_iob assertion. From Harri Luhtala - TCP/UDP: In the POLLOUT poll logic, request an immediate Tx poll from the network device bound to the socket. From Gregory Nutt. - UDP: On a failure to find the destination device, fallback to netdev_default device if the device is not found, rather than arbitrary using the device at the head of the list of devices. From Xiang Xiao. - USRSOCK: Revert previous commit to re-allow combination of usrsock and NuttX TCP/IP stack. For example, in case device has Ethernet and mobile connectivity and NuttX TCP/IP stack is used when configured to use Ethernet connection and usrsock when configured to use modem (modem TCP/IP stack through usrsock). From Jussi Kivilinna. - USRSOCK accept(): Mark newconn ready before issue accept request to avoid the case that the request is discarded due to the socket being in the invalid state From Xiang Xiao. * Wireless/Wireless Drivers: - Broadcom 802.11 Driver: There were two functions that have a address issue. In bcmf_read_sbreg() and bcmf_write_sbreg(): SBSDIO_SB_OFT_ADDR_MASK should be used before map address space. Noted by Shao Li in Bitbucket issue #126. From Gregory Nutt. - Broadcom 802.11 Driver: Remove incorrect OR condition. Always true. Noted by Shao Li in Issue 127. From Gregory Nutt. - NRF24L01: Fix compilation errors. From Mateusz Szafoni. * Other Common Drivers: - ALARM Upper Half: Fix alarm ISR error when no CONFIG_SCHED_TICKLESS drivers/timers/arch_alarm.c: Use uint64_t to avoid alarm 32-bit overflow. From ligd. - MAX11802: Fix compilation errors and allow setting PULL and SAMPLE registers. From Petteri Aimonen. - S25FL1: During a MTDIOC_GEOMETRY ioctl call, the driver was incorrectly reporting the blocksize to be the same as the erasesize. The blocksize should be 256 (the page size). This patch fixes that, and now the SmartFS configuration is working. From Ken Pettit. - SYSLOG: nx_syslog's return value should include the timestamp length From Xiang Xiao. - SYSLOG: syslog_putc() calls sc_force in idle task even if interrupt buffer enabled. The following cases may hang randomly in the bring up phase: (1) boot up process and (2) suspend/resume process. Either case runs in the idle task context, so it's difficult to debug the hang issue if these output go through the interrupt buffer. From Xiang Xiao. - SYSLOG: Ensure interrupt log doesn't interlace in normal log. Don't call syslog_putc in syslog_default_write because syslog_putc will try to empty the interrupt buffer every time. From Xiang Xiao. - UART 16550: Fix UART flow control issue. UART_MCR_RTS need be high even UART_MCR_AFCE is enabled From zhangyuan7. - USB RNDIS Device: Fix buffer overrun check in rndis.c. The rndis driver has been working since 13 Nov 2017. However, I finally found that it depends on network and buffer configurations. If a receiving TCP packet is divided into smaller ones based on USB max packet size, this condition check works correctly. From Masayuki Ishikawa. * ARMv7-A: - ARMv7-A: Replicate the same fix was previously committed for the ARMv7-R. From Gregory Nutt. * ARMv7-R: - ARMv7-R: Fix error in cp15_flash_dcache. Change mcrne to mcr for unconditional dcache. From EunBong Song. * ARMv7-M: - ARMv7-M Interrupts: Correct all ARMv7-M architectures. Interrupts were not be disabled correctly on power up. Writing zero to the NVIC SET-ENABLE registers has no effect. In order to disable interrupts, it is necessary to write all ones to the NVIC CLEAR-ENABLE register. Noted by David Sidrane. From Gregory Nutt. * Broadcom BCM2708 Drivers: - BCM2708 Serial: Juha Niskanen's fix related to STM32 CONFIG_SERIAL_OFLOWCONTROL also applies to cloned logic in BCM2708. From Gregory Nutt. * Intel x86: - Qemu i486: Correct .bss, IDLE stack, heap organization. From Gregory Nutt. * NXP/Freescale LPC43xx Drivers: - LPC43 Ethernet: Fix Ethernet TX_EN pin definitions. TX_EN on LPC43xx can be routed via P0.1 and PC.4 in both MII and RMII mode. Before, P0.1 was hard-coded for MII and PC.4 was hard-coded for RMII. Also, the definitions used inconsistent naming (TXEN vs. TX_EN). From Jakob Haufe. - LPC43 Serial: Fix copy-paste error: g_usart1port->g_uart1port. From Dave Marples. - LPC43 SDMMC: Fix the LPC43 family SDMMC card access: Clocks were wrongly configured, way too fast because there is no primary divider on LPC4330, the LPC43_SDMMC_DELAY register was not being set, the LPC43_SDMMC_BLKSIZ and LPC43_SDMMC_BYTECNT registers had the wrong values. From Dave Marples. - LPC43 SDMMC: Corrected a problem in lpc43_dmasendsetup(). There was no linked DMA descriptor code on the send side. The end result was stalls while sending multiple sectors. This commit adds that in and the send code is working much better. From Dave Marples. - LPC43 SDMMC: With these changes the SDMMC card for LPC43 is now working properly: Timing was dependent on CPU speed rather than absolute time, end of transfer handling was a bit mixed up. It is possible for data to still be in the FIFO (i.e. not have reached the card) when a next write is requested, so we need to wait for that to complete. Interrupt Status could be carried over from one transfer episode to the next, corrupting progress. Multi-descriptor DMA writing simply wasn't implemented. From Dave Marples. * NXP/Freescale LPC43xx Boards: - Bambino-200E: Correct calculation of SDMMC clock configuration. The LPC43 has no SDMMC source clock divider. Error noted by Dave Marples. From Gregory Nutt. * NXP/Freescale Kinetis: - Kinetis: Remove all attempts to reprioritize interrupts. From Gregory Nutt. * NXP/Freescale Kinetis Drivers: - Kinetis I2C: I2C On failed reset re-initialization I2C and clocking. If a reset fails, we still must reinitializes the I2C block so that subsequent transfers will not cause a hard-fault due to the clock being off. If that transfer fails it can try to reset again. From David Sidrane. - Kinetis Serial: Juha Niskanen's fix related to STM32 CONFIG_SERIAL_OFLOWCONTROL also applies to cloned logic in Kinetis. From Gregory Nutt. * NXP i.MXRT Drivers: - i.MXRT Ethernet: The board would not come up if I ran NuttX from cold. I dumped the PHY registers to see what the differences were and the PHY was coming up in NANDTree mode. This is a mode for testing connectivity between the PHY and the MAC. Switching this mode off in the PHY registers has fixed the problem. From Dave Marples. - i.MXRT Ethernet: Fix a race condition in setting up the Ethernet Tx transfer. From Dave Marples. - i.MXRT Ethernet: Corrections for the i.MXRT Ethernet: (1) Now the Ethernet is completely re-initialized when an error occurs by means of taking the interface down and back up but the PHY is _not_ renegotiated for that case because that is very time consuming and an error in the Ethernet is no reflection on the state of the PHY anyway. (2) Explicitly sets the expected PHY address to zero (this could be moved into the config rather than searching for it which takes ages, and it's zero anyway for this board (that's the broadcast address, and anything that cannot respond on that has multiple PHYs, so that would be a new board). (3) Allows for the renegotiation of the PHY to be optional when a reset is needed. If a non-renegotiated reset doesn't result in good comms to the PHY then it'll automatically be escalated to a renegotiated one. (4) Only performs a reset for errors that need it (the CRITICAL_ERROR define). The list of errors that need reset are somewhat arbitrarily chosen based on my prejudices and might need to be revisited, but certainly the jabber errors don't need reset, the partial packet is thrown away by the layer above anyway. (5) Re-loads the multicast table on reset. (6) Adds a bit more logging into the imxrt Ethernet module. From Dave Marples. - i.MXRT LPI2C: Fixes 2 bugs in the for IMXRT1050: (1) I2C time out and did not send STOP condition when sending single byte, (2) I2C could not receive bytes after repeated start. From Ivan Ucherdzhiev. - i.MXRT LPSRTC: SVNC LPCR register bits 0 & 1 are NOT reserved and are, in fact, needed to enabled the SRTC. Now the SRTC is working. From Ivan Ucherdzhiev. - LPC54 SDMMC: Add support for and SDMMC errata. It appears that now I can read the SD card successfully, but I get CRC errors when writing to the card. From Gregory Nutt. - LPC54 SDMMC: Ported Dave Marples fixes LPC43 SDMMC to the LPC54. From Gregory Nutt. - i.MXRT WDOG: Typos in bit definitions, wdog registers are 16 bits, wdog update has to be within 255 clocks of unlock, define board clocking based on divisor and muxes. From David Sidrane. * NXP i.MXRT: - i.MXRT: clockconfig bug fix: Fixed logic that was not clearing bits as ~ was missing in &= mask operations. Use values from the board.h file so set the Mux that selects the clock sources. Use board defined PODF values to select clock. Only configure USDHC2 clocks when board defines clocks. From David Sidrane. * NXP i.MXRT Boards: - IMXRT1050-EVK: Previous committed implemented SPI-based MMC/SD card support conditioned on CONFIG_MMCSD. This interferes with the implementation of MMC/SD card support using the SDIO-based peripheral. This commit renames that atypical support to *mmcsd_spi* and conditions using the SPI-based support on CONFIG_MMCSD_SPI which will then not interfere with the MMC/SD support that can be conditioned on CONFIG_MMCSD_SDIO. From Gregory Nutt. * On Semi LC823450 Boards: - LC823450: Fix up_allocate_heap() in lc823450_allocateheap2.c. For lc823450, heap area in flat build mode must start just after _eronly. Because bss/data area is allocated in lower address than text area in SRAM. See ld.scripts for details. Also, this change removes unused up_allocateheap.c From Masayuki Ishikawa. * Silicon Labs EFM32 Drivers: - EFM32 Serial: Juha Niskanen's fix related to STM32 CONFIG_SERIAL_OFLOWCONTROL also applies to cloned logic in EFM32. From Gregory Nutt. - EFM32 USB Device: The epin_configure() function used the same eptype as the TxFIFO number for all endpoints. This should probably be the physical EP number, not the EP type. Suggested by Key Two. From Gregory Nutt. * STMicro STM32 Drivers: - STM32* SPI: Don't rely on SPI_CR1_SPE to determine if peripheral has been initialized. This change is needed specifically for the case where a boot loader sets the SPE bit before starting NuttX. In that case, the test in the SPI driver is wrong. This change fixes that by assuring that NuttX has booted and initialized at least once (whether or not SPE is set) before the driver starts refusing to initialize. From Anthony Merlino. - STM32 F0, F7, H7, L4 Serial: Fix use of CONFIG_SERIAL_IFLOWCONTROL where CONFIG_SERIAL_OFLOWCONTROL was intended. From Juha Niskanen. - STM32 TIM: Don't use hard-coded UIF interrupt in some functions. From raiden00pl. - STM32 (FS/HS), STM32F7, and STM32L4 OTGFS/HS Device: The epin_configure() function used the same eptype as the TxFIFO number for all endpoints. This should probably be the physical EP number, not the EP type. Suggested by Key Two. From Gregory Nutt. - STM32 F2: Fixes Kconfig options to include all STM32F20XX processors, not just STM32F207. Also removes redundant STM32_STM32F429 depends from Kconfig. STM32F4XXX already does this. From Anthony Merlino. - STM32 F4 DAC: STM32F407VG has only one DAC. NDAC=2 causes compilation error when trying to use e.g. STM32_DAC1_CR macro. From Petteri Aimonen. - STM32 F7 Serial: Force invalidation of data cache after DMA re-enable when returning from low-power mode From Juha Niskanen. * STMicro STM32 Boards: - B-L475E-IOT01A: Correct timer source clock frequencies. From Freemans Goden. - Nucleo-L432KC: Fix SPI pin definitions in board.h. From Daniel P. Carvalho. * MIPS32: - CP0 Definitions: Fix some copy-paste errors that cause malformed comments and syntax errors when certain CP0 CONFIG1 bits are referenced. Note in Issue 123 by Anonymous. From Gregory Nutt. - microMIPS: Reported by Anonymous in Bitbucket Issue #129: When MIPS port is built for microMIPS and then loaded as an application, the __start entry point is entered in microMIPS mode, but the CPU core initialization code there misses to set the config3ISAOnExc bit to 1. Subsequently, exceptions are entered in MIPS32 mode, but the code base was built for microMIPS. * Microchip PIC32MZ: - PIC32MZ Startup: In pic32mz-head.S, initialize the global pointer in all shadow sets. From Ouss4. * Microchip PIC32MZ Drivers: - PIC32MZ Serial: Fix a typo in assignment of TTYS0 to UART6 From Ouss4. * Simulation: - SIM Network Driver: Fix error 'invalid operands to binary &' From Xiang Xiao. * C Library/Header Files: - Fix typographical error in endian.h and resource.h From anchao. - include/net/if.h: Adds extern "C" guard in include/net/if.h From Anthony Merlino. - include/netinet/in.h: Per OpenGroup.org, type of sin_port in struct sockaddr_in must be in_port_t vs uint16_t. NOTE: in_port_t is typdef'ed as uint16_t anyway. From Gregory Nutt. - include/nuttx: Fix definitions used to access OS functions within the libraries. In the FLAT build, we must always set the errno and/or create cancellation points because the same library functions are used within the OS as are used by applications. This could cause issues for the OS but corrects some problems at the user interface. Noted by Federico Braghiroli in Bitbucket issue 121. From Gregory Nutt. - include/nuttx/clock.h: Fix uptime wrong if DEBUG_FEATURES and SCHED_TICKLESS enabled. From Xiang Xiao. - include/nuttx/fs/fs.h: Fix some backward parameters in a new macro definition. From Gregory Nutt. - include/nuttx/fs/fs.h: Register_mtddriver should depend on CONFIG_MTD not CONFIG_MTD_PARTITION From Xiang Xiao. - include/sys/socket.h: Renumber the socket types. They must begin at 1, not zero. Socket type zero has a special meaning for some interfaces. For example, getaddrinfo() uses a socket type of zero to many any type of socket. The is no standard name for the any-type-socket, but macOS uses SOCK_UNSPEC. NuttX will do the same. Issue noted by Anthony Merlino. From Gregory Nutt. - libs/libc: Correct some errors in psignal() and stpncpy(). From Lokesh B V. - libs/libc/math: Add variable convergence in log() and logf() to avoid hangs caused by failure to converge for very specific input values. Also includes a small change to log() and logf() that improves accuracy and convergence time. From Rajan Gill. - libs/libc/stdio: Fix conversion for format specifiers in sscanf() that appear right after a floating point format specifier. When performing a floating point conversion the parsing code could consume more than required characters from the input buffer. This made impossible to convert input of form "1.1K" using format "%f%c". Fix the issue by advancing the input buffer with the actual characters converted as a float point number. From Mihai Serban. - libs/libc/stdio: Remove CONFIG_NOPRINTF_FIELDWIDTH. That option does, indeed, make the printf family of functions much smaller. But it also adds a lot of complexity and makes the functions non-standard. Removing this might break some of the tinier platforms but it is the best thing to do for long term maintenance for for OpenGroup.org compliance. - libs/libc/stdio: Update to vsprintf(). This resolves the integer field width problem if Issue 35 for the cases of integer, long and long long integer types. The output now matches the output form glibc. From Gregory Nutt. - libs/libc/string: Correct the return pointer value from stpncpy() for the case where the NUL terminator is transferred. From Gregory Nutt. - libs/libc/string: Fix strrchr() so that it considers null terminator as part of string. From Petteri Aimonen. - libs/libc/wqueue: Eliminate a race condition noted by Xiang Xiao. Use sigprocmask() so that we do not lose a signal. From Gregory Nutt. - libs/libnx/nxfonts: Fix kerning of 'I' in Sans17x22 font. From Petteri Aimonen. - libs/libnx/nxfonts: In nxfonts_getfont(), avoid unnecessary warnings for other whitespace chars also. From Petteri Aimonen. - libs/libnx/mxmu: NXMU now re-validates window pointer for mouse events. NXMU caches the previous window pointer so that further mouse events can be sent to the same window. However, if the window is destroyed while mouse button is held down, the pointer may become invalid and cause a crash. This patch revalidates the pointer before using it. From Petteri Aimonen. - libs/libnx/nxtk: nxtk_bitmapwindow: Fix warning message when bitmap is fully off-screen. From Petteri Aimonen. * Build System: - Fix issue with libcxx build. This was changed multiple times, but should be fixed now. From Anthony Merlino. - configs/Makefile and tools/Config.mk: Move single file copy to the new function COPYFILE. This fixes the Windows native build case when there is no cp or cp does not recognize Windows paths. From Anatol Ivanov. - tools/Config.mk and tools/Makefile.win: Force use 'cmd' for shell with windows native build From Anatol Ivanov. - tools/Directories.mk: Correct the path to the installed libcxx directory. From Gregory Nutt. - tools/Makefile.win/unix: Staging directory (and its libraries) should be removed on 'make clean' (issue noted by Dave Marples). From Gregory Nutt. - apps/Directory.mk: If the current directory contains a Kconfig file and MENUDESC is not defined, then Directory.mk must not trash the Kconfig in the current directory. From Gregory Nutt. - apps/Makefile: Fix Windows native build patch extension. From Anatol Ivanov. * Other Tools: - tools/Config.mk: Fix an error in RWILDCARD implementation From Anthony Merlino. - tools/configure.c: Add missing '\n' in printf statement - tools/configure.c: Add missed -g option to getopt() string. From Anatol Ivanov. - tools/configure.c and tools/configure.sh: Fix Windows native pre-build kconfig-conf incompatibility. From Anatol Ivanov. - tools/csvparser.h: Extend MAX_PARMSIZE to 256. Fixes this issue: 70: Parameter too long: ... From Xiang Xiao. - tools/link.bat: Fix .fakelink creation. From Anatol Ivanov. - tools/mkdeps.c: Fix '\0' missing with MinGW. From Anatol Ivanov. * NSH Library: apps/nshlib: - apps/nshlib: Correct maximum number of arguments that can be provided to the mksmartfs command. From Eunbong Song. - apps/nshlib: Add fflush to nsh_consolewrite(). This resolves this problem: 'cat /dev/ttyCP &' followed by 'echo ls >/dev/ttyCP'. In that case we can't get the 'ls' result immediately, because 'cat' cmd uses nsh_consolewrite() and that uses fwrite with no fflush. We can get the 'ls' result after type '\n', because nsh will fflush output when get '\n'. From ligd. - apps/nshlib: nsh_catfile() should not append '\n' if the last char in file is already '\n' From Xiang Xiao. - apps/nshlib: Fix warning g_oldpwd defined but not used [-Wunused-const-variable] in nsh_envcmds.c. From Xiang Xiao. * Examples/Tests: apps/examples: - apps/examples/adc/Kconfig: CONFIG_BOARDCTL_ADCTEST does not exist anymore and should removed as a dependency. From Eunbong Song. - apps/examples/webserver/Kconfig: The webserver "app" allows for DHCP client to be enabled. However, the Kconfig infrastructure does not contain EXAMPLES_WEBSERVER_DHCPC config. Based on patch from "Anonymous" attached to Bitbucket Issue #130. From Gregory Nutt. * System Utilities: apps/system: - apps/system/hexed: Fix memory leak From zhuyanlin. - apps/system/i2c: Fix i2c_msg freq initialization problem. Typo prevented I2C frequency initialization in a struct i2c_msg. From dongjiuzhu. - apps/system/system: Fix warning when passing argument 6 of 'task_spawn' from incompatible pointer type [-Wincompatible-pointer-types] From Xiang Xiao. * Network Utilities: apps/netutils: - Correct some network-related configuration variable names. All *_MTU defines were changes to *_PKTSIZE gut that was not reflected in apps/ From Gregory Nutt. - apps/netutils/netlib/netlib_parsehttpurl.c: Correct handling of long URLs as noted in Bitbucket issue #119 (in the nuttx/ repository, not the apps/ repository). From Gregory Nutt. - apps/netutils/codecs: "dst" overflow protection when base64 string ends with "=" From Aleksandr Vyhovanec. - apps/include/netutils/ipmsfilter.h: Eliminate error generated by bad pre-processor logic. From Gregory Nutt. * GPS Utilities: apps/graphics: - apps/graphics/NxWidgets: Fix garbage returned when CCycleButton::getValue() is called after removeAllOptions(). CScrollingPanel should not draw outside the widget area. From Petteri Aimonen.