Apache NuttX RTOS PMC

It is my great honor to become a PMC (Project Management Committee) member in the Open-Source Apache NuttX RTOS [1]. Thank you for inviting me into this great community and totally amazing project! :-)

NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are Posix and ANSI standards. Additional standard APIs from Unix and other common RTOS’s (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).

[1] https://nuttx.apache.org/

NuttX RTOS is now Apache TLP

My favorite NuttX RTOS [1] that is “Tiny Unix on MCU” has graduated to Apache Top-Level-Project [2], congratulations! :-)

Apache NuttX [1] is a real-time operating system (RTOS) that emphasizes standards compliance and small footprint, usable in all but the tightest micro-controller environments. It runs on 8-bit, 16-bit, 32-bit, and 64-bit microcontrollers across RISC-V, ARM, MIPS, ESP32, AVR, x86, and other architectures with a high degree of standards compliance. NuttX is used to power the Fitbit fitness tracker, as well as satellites, IoT devices, bluetooth headphones, drones, and more.

What I like most in NuttX is the development team / community.. and scalability starting upwards from 8-bit CPU’s. One day I wish porting NuttX to my 8-bit Atari and 16-bit Amiga and Atari ST and push new life to these amazing machines :-)

[1] https://nuttx.apache.org
[2] https://news.apache.org/foundation/entry/the-apache-software-foundation-announces-apache-nuttx-as-a-top-level-project

M2.NVM disk + PCI-E controller on FreeBSD

Modern laptops are quite expensive and hard to upgrade. While they are really handy to work in multiple places, they are not that efficient for advanced R&D activities like virtualization and massive software development combined (I/O speeds highly affects overall performance and compilation times). I was wondering if M2.NVM disk over PCI-E controller could work with my old desktop workstation giving additional performance benefit over standard onboard SATA attached SSD drive.

Old desktop PC only supports SATA drives. Switching to SATA SSD (electronics NAND Flash based Solid State Drive) in place of conventional HDD (mechanical drive) can boost I/O performance noticeably. We had 3.5″ (desktop) and 2.5″ (laptop) physical disk dimensions available so far. But new M2 SSD drives showed up, founding a new standard, with smaller form factor to be installed in embedded systems and lightweight laptops. M2 defines only a physical dimensions requirements, while disk itself can implement SATA (with average 500MB/s read/write speed) or NVM (with average 3000MB/s read/write speeds or better) interface.

So I have decided to try M2.NVM Samsung SSD 980 1TB drive over ICYBOX IB-PCI224M2-ARGB PCI-E 4.0 controller on my ASUS M5A97 R2.0 (last available BIOS 2603) that only supports PCI-E 2.0. I have several internal and external SSD SATA drives both in 2.5″ and M2 form factor. Having even basic M2.NVM drive over PCI-E controller seems to be more future proof purchase, for the same amount of money, it will be ready for possible motherboard replacement, and in bay benefit in additional performance gain over onboard SATA attached SSD drive. Operating system is Open-Source FreeBSD Unix version 13-STABLE, filesystem is ZFS (testing done with no compression and no encryption).

It turns out that PCI-E 4.0 card can work on older PCI-E 2.0 bus (for sure speed will be degraded in that case). Mainboard BIOS does not see the NVM controlleri in UEFI mode (TODO) so it is not possible to boot out of it without additional SATA drive with the FreeBSD bootloader / kernel first (TODO). FreeBSD can see and utilize both PCI-E Controller and the M2.NVM drive with no problem. Let’s see the data transfer speed results in numbers.

Average in-filesystem StressDisk large file write speed results:

  • Onboard SATA 2x WDEARS RED 2TB ZFS RAID0 STRIPE: 188MB/s.
  • PCI-E ICYBOX M2.NVM Samsung SSD 980 1TB ZFS: 410MB/s.

DiskInfo single drive summary results:

  • PCI-E ICYBOX M2.NVM Samsung SSD 980 1TB ZFS: O:1087557, M:1099090, I:1160432 kbytes/sec
  • Onboard SATA 3.5″ 2TB 5400RPM HDD WD20EFRX (RED):O:146521, M:116847, I:70159 kbytes/sec
  • Onboard SATA 3.5″ 2TB 5400RPM HDD WDEARS (GREEN): O:113811, M:87543, I:49209 kbytes/sec
  • External USB3.1 M2.SATA SSD disk enclosure: O:31503, M:31850, I:31900 kbytes/sec.

As we can see above, from user perspective in out-of-the-box configuration write speeds are 218% faster on NVM SDD over HDD RAID for large files (this may need some filesystem tuning). Weighted average disk access for NVM SSD is 1 115 693 KB/s, WD20EFRX is 111 176 KB/s, WDEARS is 83 521 KB/s. It turns out that WD RED HDD disks are 133% faster than WD GREEN HDD disks, while NVM SSD disks are over 1000% faster than WD HDD RED disks. On the other hand external USB 3.1 M2.SATA SSD disk has average 47 626 KB/s results. One last but crucial test will be added here containing the onboard SATA SSD drive, just to make sure and prove NVM dominance over SATA.

DiskInfo result for single 3.5″ 2TB 5400RPM HDD WDEARS (GREEN Series) drive attached to onboard SATA controller:

# diskinfo -tv /dev/ada2
/dev/ada2
        512             # sectorsize
        2000398934016   # mediasize in bytes (1.8T)
        3907029168      # mediasize in sectors
        4096            # stripesize
        0               # stripeoffset
        3876021         # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        WDC WD20EARS-00MVWB0    # Disk descr.
        XXX             # Disk ident.
        ahcich4         # Attachment
        No              # TRIM/UNMAP support
        Unknown         # Rotation rate in RPM
        Not_Zoned       # Zone Mode

Seek times:
        Full stroke:      250 iter in   7.135585 sec =   28.542 msec
        Half stroke:      250 iter in   5.288793 sec =   21.155 msec
        Quarter stroke:   500 iter in   7.540787 sec =   15.082 msec
        Short forward:    400 iter in   3.036829 sec =    7.592 msec
        Short backward:   400 iter in   2.956946 sec =    7.392 msec
        Seq outer:       2048 iter in   0.254515 sec =    0.124 msec
        Seq inner:       2048 iter in   0.199511 sec =    0.097 msec

Transfer rates:
        outside:       102400 kbytes in   0.899735 sec =   113811 kbytes/sec
        middle:        102400 kbytes in   1.169709 sec =    87543 kbytes/sec
        inside:        102400 kbytes in   2.080911 sec =    49209 kbytes/sec

DiskInfo result for single 3.5″ 2TB 5400RPM HDD WD20EFRX (RED Series) drive attached to onboard SATA controller:

# diskinfo -tv /dev/ada0
/dev/ada0
        512             # sectorsize
        2000398934016   # mediasize in bytes (1.8T)
        3907029168      # mediasize in sectors
        4096            # stripesize
        0               # stripeoffset
        3876021         # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        WDC WD20EFRX-68EUZN0    # Disk descr.
        XXX             # Disk ident.
        ahcich0         # Attachment
        No              # TRIM/UNMAP support
        5400            # Rotation rate in RPM
        Not_Zoned       # Zone Mode

Seek times:
        Full stroke:      250 iter in   6.653120 sec =   26.612 msec
        Half stroke:      250 iter in   5.172312 sec =   20.689 msec
        Quarter stroke:   500 iter in   7.808667 sec =   15.617 msec
        Short forward:    400 iter in   2.082164 sec =    5.205 msec
        Short backward:   400 iter in   3.350534 sec =    8.376 msec
        Seq outer:       2048 iter in   0.141464 sec =    0.069 msec
        Seq inner:       2048 iter in   0.139262 sec =    0.068 msec

Transfer rates:
        outside:       102400 kbytes in   0.698874 sec =   146521 kbytes/sec
        middle:        102400 kbytes in   0.876360 sec =   116847 kbytes/sec
        inside:        102400 kbytes in   1.459537 sec =    70159 kbytes/sec

DiskInfo result for single M2.NVM Samsung SSD 980 1TB drive attached to ICYBOX IB-PCI224M2-ARGB PCI-E 4.0 controller working on PCI-E 2.0 capable motherboard:

# diskinfo -tv /dev/nvd0
/dev/nvd0
        512             # sectorsize
        1000204886016   # mediasize in bytes (932G)
        1953525168      # mediasize in sectors
        4096            # stripesize
        0               # stripeoffset
        Samsung SSD 980 1TB     # Disk descr.
        XXX             # Disk ident.
        nvme0           # Attachment
        Yes             # TRIM/UNMAP support
        0               # Rotation rate in RPM

Seek times:
        Full stroke:      250 iter in   0.008369 sec =    0.033 msec
        Half stroke:      250 iter in   0.005510 sec =    0.022 msec
        Quarter stroke:   500 iter in   0.014519 sec =    0.029 msec
        Short forward:    400 iter in   0.010368 sec =    0.026 msec
        Short backward:   400 iter in   0.020456 sec =    0.051 msec
        Seq outer:       2048 iter in   0.032788 sec =    0.016 msec
        Seq inner:       2048 iter in   0.032863 sec =    0.016 msec

Transfer rates:
        outside:       102400 kbytes in   0.094156 sec =  1087557 kbytes/sec
        middle:        102400 kbytes in   0.093168 sec =  1099090 kbytes/sec
        inside:        102400 kbytes in   0.088243 sec =  1160432 kbytes/sec

DiskInfo resuls for USB 3.1 M2.SATA SSD disk enclosure:

 # diskinfo -tv /dev/da0
/dev/da0
        512             # sectorsize
        256060514304    # mediasize in bytes (238G)
        500118192       # mediasize in sectors
        4096            # stripesize
        0               # stripeoffset
        31130           # Cylinders according to firmware.
        255             # Heads according to firmware.
        63              # Sectors according to firmware.
        USB3.1          # Disk descr.
        XXX             # Disk ident.
        umass-sim0      # Attachment
        No              # TRIM/UNMAP support
        Unknown         # Rotation rate in RPM
        Not_Zoned       # Zone Mode

Seek times:
        Full stroke:      250 iter in   0.096377 sec =    0.386 msec
        Half stroke:      250 iter in   0.099408 sec =    0.398 msec
        Quarter stroke:   500 iter in   0.216023 sec =    0.432 msec
        Short forward:    400 iter in   0.190744 sec =    0.477 msec
        Short backward:   400 iter in   0.203053 sec =    0.508 msec
        Seq outer:       2048 iter in   0.769551 sec =    0.376 msec
        Seq inner:       2048 iter in   0.769675 sec =    0.376 msec

Transfer rates:
        outside:       102400 kbytes in   3.250481 sec =    31503 kbytes/sec
        middle:        102400 kbytes in   3.215029 sec =    31850 kbytes/sec
        inside:        102400 kbytes in   3.210055 sec =    31900 kbytes/sec

FreeBSD + Zephyr RTOS + ESP32

FreeBSD can natively emulate Linux ELF binaries. You can now bootstrap Linux espressif xtensa toolchain for ESP32 on FreeBSD under The Zephyr Project with west espressif install :-)
https://github.com/espressif/esp-idf/pull/7226#event-5064755416

CED 7000 battery replacement

If you need to replace battery for CED 7000 timer [1] you can either buy a HLP 443450 3.7V 800mAh 2.96Wh accumulator [2] or dedicated inexpensive Power Bank [3] that contains two accumulators inside – one for quick replacement of the timer battery and the other to charge timer over the USB cable – this way you can also safely carry a backup and replacement power source at hand :-) One thing that could be improved here is using both accumulators in the Power Bank so capacity is doubled and both are always charged – that should also prevent self-discharge below safe point of the unused unit.





[1] https://www.cedhk.com/ced7000-shot-timer
[2] https://www.cedhk.com/ced7000-replacement-battery
[3] https://www.halinka-arms.pl/timery-i-akcesoria/1096-power-bank-do-timera-ced-7000.html

ZEPHYR RTOS ROX!

If you never heard about Free-and-Open-Source ZEPHYR RTOS [1] (Apache 2.0 licensed) then it will make your day as the best platform out there for your new embedded electronics design :-) It works on anything.. even on Open-Source-Hardware RISC-V CPU [2] :-)

[1] https://zephyrproject.org/
[2] https://riscv.org/

DSO QUAD MINI SCOPE ACCU REPLACEMENT

If you are happy user of DSO QUAD pocket oscilloscope from Seeed Studio [1] then probably after all those years you need to replace the accumulator. Because stock model PL384070 3.7V 1000mAh is not available anymore you can safely use CL404070 3.7V 1300mAh that is only 0.2mm thicker but it also fits the scope very well and you gain 30% capacity. You only have to solder the plug from the old accumulator. Enjoy :-)







[1] https://www.seeedstudio.com/DSO-Quad-Aluminium-Alloy-Black-p-1034.html

LimeSuite on FreeBSD

I have ported LimeSuite [1] to FreeBSD [2]. You can now work with LimeSDR [3] / LimeSDR-Mini [4] and others on my favourite OS. Please visit MyriadRF [5] for various radio inspirations. Have fun! :-)

[1] https://github.com/myriadrf/LimeSuite
[2] https://www.freebsd.org/
[3] https://limemicro.com/products/boards/limesdr/
[4] https://limemicro.com/products/boards/limesdr-mini/
[5] https://myriadrf.org/

macOS Virtual Audio SoundFlower Loopback

SoundFlower [1] is amazing Free and Open-Source extension to macOS BSD that allows you to create Virtual Audio Device in order to Route and Record Applications Audio. This is especially important for activities like Online Streaming and Presentation/Lectures Recording.

If you need more advanced Audio Routing with a nice GUI and lots of options try Loopback [2] from RogueAmoeba [3].

Thank you for this amazing fork and keeping it Open-Source! :-)

[1] https://github.com/mattingalls/Soundflower
[2] https://rogueamoeba.com
[3] https://rogueamoeba.com/loopback

Blender Player Python

If you encounter a problem with running Python [python] scripts on a “bare” Blender Player [blender], make sure that both PYTHONHOME and PYTHONPATH are set correctly to match your needs. You can also use native Blender python with a simple shell script:

#!/bin/sh
export PYTHONHOME="/path/to/blender/python/"
export PYTHONPATH=$PYTHONHOME"/bin"
/path/to/your/blenderplayer $@

[python] https://www.python.org/
[blender] https://www.blender.org/

binary file hexdump

Sometimes you need to quickly create a hexeditor like dump of a binary file. HEXDUMP is your friend. It may be a standard Unix application or Python module.

Unix hexdump use example:

hexdump -Cv file.bin
00000000  12 01 00 02 ef 02 01 40  28 0d 04 02 00 10 01 02  |.......@(.......|
00000010  03 01 12 01 00 02 ef 02  01 40 28 0d 04 02 00 10  |.........@(.....|
00000020  01 02 03 01 09 02 82 00  04 01 00 80 fa 09 02 82  |................|
00000030  00 04 01 00 80 fa 09 04  00 00 02 08 06 50 07 07  |.............P..|
00000040  05 82 02 40 00 00 07 05  02 02 40 00 00 09 04 03  |...@......@.....|
00000050  00 02 03 00 00 06 09 21  00 01 00 01 22 21 00 07  |.......!...."!..|
00000060  05 81 03 40 00 01 07 05  01 03 40 00 01 08 0b 01  |...@......@.....|
00000070  02 02 02 01 04 09 04 01  00 01 02 02 01 04 05 24  |...............$|
00000080  00 10 01 05 24 01 03 02  04 24 02 06 05 24 06 01  |....$....$...$..|
00000090  02 07 05 83 03 10 00 20  09 04 02 00 02 0a 00 00  |....... ........|
(...)

Python hexdump use example:

python -m pip install hexdump
python -m hexdump file.bin
00000000: 12 01 00 02 EF 02 01 40  28 0D 04 02 00 10 01 02  .......@(.......
00000010: 03 01 12 01 00 02 EF 02  01 40 28 0D 04 02 00 10  .........@(.....
00000020: 01 02 03 01 09 02 82 00  04 01 00 80 FA 09 02 82  ................
00000030: 00 04 01 00 80 FA 09 04  00 00 02 08 06 50 07 07  .............P..
00000040: 05 82 02 40 00 00 07 05  02 02 40 00 00 09 04 03  ...@......@.....
00000050: 00 02 03 00 00 06 09 21  00 01 00 01 22 21 00 07  .......!...."!..
00000060: 05 81 03 40 00 01 07 05  01 03 40 00 01 08 0B 01  ...@......@.....
00000070: 02 02 02 01 04 09 04 01  00 01 02 02 01 04 05 24  ...............$
00000080: 00 10 01 05 24 01 03 02  04 24 02 06 05 24 06 01  ....$....$...$..
00000090: 02 07 05 83 03 10 00 20  09 04 02 00 02 0A 00 00  ....... ........
(...)

fastboot too old problem

If you want to perform stock factory flashing of a Nexus device and you encounter “fastboot too old” error message, that means you need to update your local fastboot application to a newer version. One additional word would make this interesting error message self-explanatory..

ARM mbed OS DAPLink pyOCD

It is my great honor to join Free-and-Open-Source ARM mbed [1] development team! :-)

[1] https://www.mbed.com

JTAGulator

I just did a self-assembly of JTAGulator. This simple and amazing device indeed works and shortens JTAG pinout search from days to seconds. AMAZING! I have some spare devices to sale cheap in EU, if you want one let me know! :-)

JTAGulator is an open source hardware tool, created by Joe Grand / Grand Idea Studio, that assists in identifying OCD connections from test points, vias, or component pads on a target device. All you need is a target device, bunch of tap wires / cables, USB-Mini cable, and serial terminal to operate JTAGulator.



On-chip debug (OCD) interfaces can provide chip-level control of a target device and are a primary vector used by engineers, researchers, and hackers to extract program code or data, modify memory contents, or affect device operation on-the-fly. Depending on the complexity of the target device, manually locating available OCD connections can be a difficult and time consuming task, sometimes requiring physical destruction or modification of the device.

FreeBSD PXE Network Install

Sometimes you need to perform a network installation (i.e. when no USB or DVD drive is allowed to boot, but you can boot PXE). In case of FreeBSD you can use DNSMASQ to serve the DHCP that will assign the initial client address and configuration along with PXE boot image served over tFTP. At this point you will have bootloader running, so you can serve filesystem over NFS to obtain working environment and/or the installer..

  • Create a directory that will hold the target filesystem over network. In my case that was
    /usr/local/tftp/FreeBSD
  • Put OS/Installer files inside above directory
    cd /usr/local/tftp/FreeBSD
    wget http://(..)/file.iso
    7z x file.iso
  • Edit /etc/exports to export the filesystem over NFS
    /usr/local/tftp/FreeBSD -ro -alldirs -network 192.168.0.0
  • Install the dnsmasq
    pkg install dnsmasq
  • Setup the /usr/local/etc/dnsmasq.conf
    enable-tftp
    tftp-root=/usr/local/tftp/FreeBSD
    
    dhcp-range=192.168.0.50,192.168.0.60,255.255.255.0,1h
    dhcp-boot=boot/pxeboot
    dhcp-option=option:router,
    dhcp-option=option:root-path,/usr/local/tftp/FreeBSD
    
  • Restart services
    service nfsd onerestart
    service dnsmasq onerestart
  • In case you get bootloader running but troubles with NFS make sure that mountd is running. Also you can see who is using the NFS shares with
    showmount -a

PXE Boot always use initial DHCP/tFTP to fetch configuration and bootloader, so the first stage is similar and should work with other Operating Systems and Bootloaders as well, the rest is up to bootloader itself..

LibSWD-0.7 RELEASE

It is my great pleasure to inform you folks that, almost after four years, I did a new release of LibSWD-0.7 [1], a low-level embedded systems access open framework. Special thanks goes to Andrew Parlane of Carallon Ltd [2] for his much appreciated contributions! Well now I feel like I need to invent some nice small device based on ARM Cortex-M0 CPU :-)

[1] https://github.com/cederom/LibSWD
[2] http://www.carallon.com/

PIP and Python Modules inside Blender

If you want to install additional Python [1] modules inside your Blender [2] environment, you can install PIP using this recommended script [3], then use PIP to install all modules that you want. Note Blender’s Python Virtualenv location is /path_to_blender/blender_version/python/bin/python and you need to use this particular interpreter to launch the script.

[1] https://www.python.org/
[2] https://www.blender.org/
[3] https://pip.pypa.io/en/stable/installing/

OrangeADE: Orange Autonomous Device Evaluation

I have recently started the OrangeADE project [1], that is Orange Autonomous Device Evaluation, an online platform to evaluate security level of network equipment and verify against known vulnerabilities. OrangeADE is released as Open-Source under the “new” 3-Clause BSD license. Enjoy the work in progress! :-)

[1] https://github.com/CeDeROM/OrangeADE

Blender 3D and DS4 PS4 Bluetooth controller

Blender 3D can work with DualShock4 Playstation4 wireless controller over Bluetooth [1].

[1] http://www.blendswap.com/blends/view/78315

FreeBSD Port devel/protobuf3

Created a FreeBSD Port for Google Protobuf version 3.1.0 :-)

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214957

Cura Configuration Reference Manual

Starting up the Configuration Reference Manual for Ultimaker CURA 3D printing Open-Source software :-)

https://github.com/Ultimaker/Cura/wiki/Cura-Configuration-Reference-Manual

Android Open Source and Hardware Obsolescence

Why only NEXUS devices are sensible choice for Advanced Android Users and Developers? Because NEXUS device vendors provide source code and device drivers.

This makes is possible to re-compile and re-create any customization of the Android by advanced users and developers. The most popular among them is CyanogenMod based on AOSP (Android Open Source Project).

Why is such customization really necessary? Because Vendors does not keep up with the Android development, their releases are flawed, contains unwanted modifications, quite often development is abandoned just after product release.

I know that Drivers Development is time and money consuming task for Vendors. Still, providing source code for device drivers would make it possible to run alternative and/or customized OS, also prolong device life for second-hand users in poor countries. Vendor sells the device anyway and Users can make fixes and customization. Why this Win-Win scheme is so hard to achieve in reality? Is really enforcing sales with mass garbage so important?

Sony Xperia Unlocked Mobile Firmware Restore

Sony Xperia phones are my favorite. Very good and durable electronics, amazing photo camera, nice utilities on top of standard Google Android OS. I have also always respected Xperia for allowing users to unlock their phones for Open-Source Firmware Customization on this amazing hardware..

xperiacompanionfail

Unfortunately, Sony seems to have this habit to make a bad decisions, so amazing hardware is not always followed with a good software. This is why Open-Source Customization is so important. I have already found several nice devices with a really bad firmware. What is more, this corruption seems to spread, and Sony blocks factory firmware restore for an unlocked devices with their official Xperia Companion utility. This means unlocking a device does not only Voids a Warranty, but also silently makes it Impossible to Go Back to a Stock Firmware! This is really bad idea.

emma

Luckily smart people tends to predict and help each other out. Developer team of Sony Mobile released EMMA utility (nice name by the way) that allows you to re-flash mobile that is unlocked in case something goes wrong or you simply want to get back to a stock firmware.

Open-Source Firmware Customization will become a standard, even for large enterprises, with mutual benefit to their customers, because looking at the big picture we are part of the same eco(no)system..

CeDeROM CASING for M24LR-DISCOVERY

As an exercise, I have just designed (using FreeCAD) and 3D-Printed (using semi-translucent PLA material) a casing for M24LR-DISCOVERY (CR95HF NFC Reader). Let me know if you need one :-)

Read More

OpenOCD on FreeBSD

My port of OpenOCD has just been committed. Enjoy Open On-Chip-Debugger on FreeBSD! =)