Zero-overhead Destructors in C

CNXSoft: This is another guest by Blu, this time about C programming, and specifically destructors in C programming language If you asked seasoned C++ developers what their favorite features in the C++ language might be, chances are that destructors would be on everybody’s shortlist. As many other C++ developers, I too tend to do my occasional share of C, and if there’s one feature I dearly miss in C that is destructors ‒ precisely in their capacity of automating the release of resources at the right moment. But first a disclaimer is in order: many people call simple application of destructors ‘RAII’ ‒ ‘Resource Acquisition Is Initialization’; I find this acronym unnecessarily awkward and obfuscating an otherwise straightforward concept, so you won’t see this acronym through the end of this text. Instead, I’ll be using ‘end-of-scope’ action. Traditionally, in the language of C end-of-scope (more often end-of-function) actions are achieved via deliberate arrangement of the control flow, often via goto’s …

Support CNX Software – Donate via PayPal or become a Patron on Patreon

Self-hosted GLES on ChromeOS, part two

This is a follow-up post from an earlier guest post by Blu about OpenGL ES development on Chrome OS. One can’t practice real-time rendering to disk files for long ‒ it’s just unnatural. So after checking that my habitual GLES tests work as intended on ChromeOS when rendering to an off-screen-buffer-subsequently-saved-to-a-PNG, the next step was to figure out a way how to show frames on screen at a palpable framerate, if possible. Being as new to Chrome OS as the next guy, I had to start from scratch with ‘How to show EGL surfaces on screen fast’. In the comments section to the first article William Barath kindly mentioned that there was a wayland client library on Chromebrew, so I decided to pursue that as I had had (positive) prior experience with wayland. Long story short, the established way on most platforms for connecting wayland to EGL (or vice versa) is to ask wayland/weston for an EGL-compatible window surface, and …

Support CNX Software – Donate via PayPal or become a Patron on Patreon

MicroWebSrv Lightweight HTTP Web Server Supports HTML/Python Language Templating

There are many languages that can be used to create a web page: HTML,  HTML5, JavaScript, PHP, etc… But Python? Apparently yes, as MicroWebSrv  lightweight web server – mostly designed for ESP32 platforms running MicroPython such as Pycom boards – supports inserting Python code inside “HTML” files with the extension .pyhtml. The code can be found in Github, and is only comprised of three files. microWebSrv.py – The Web server microWebSocket.py – The optional support of WebSockets microWebTemplate.py – The optional templating language for .pyhtml rendered pages Beside HTML/Python files, the web server can handle GET, POST, … requests, an embedded full REST API, routing handlers, WebSockets, etc… That’s what a mixed HTML + Python .pyhtml file may look like: You can use double curly braces {{ and }} to insert MicroPython code, if statements, for loops, or includes. I’m not sure if this makes really sense for all platforms, but if your board is resource limited, and already runs …

Support CNX Software – Donate via PayPal or become a Patron on Patreon

Self-hosted OpenGL ES Development on ChromeOS?

opengles chromeos

This is a guest post by blu about developing OpenGL ES applications on Chrome OS. Ever since I’ve been using a chromebook in developer mode as my daily notebook (can’t beat 10h-plus battery life on ~300EUR well-performing machines), I’ve been missing one thing ‒ OpenGL ES coding under ChromeOS. My chromebook is more than well-equipped for GLES3 hardware-wise (verified via dual-booting to ArchLinux), and I always have up-to-date toolchains self-hosted under ChromeOS, thanks to an excellent package manager aptly named Chromebrew. And yet my coding-on-the-go under ChromeOS has been limited to console apps ‒ ChromeOS has strict limitations which include no X11 display manager, or any other industry-standard display manager that I’m aware of, and I don’t feel like dual-booting into ArchLinux too often ‒ ChromeOS has spoiled me with its fine-tuned performance. The no-display-manager limitation of ChromeOS is usually worked-around via Crouton but in my case Crouton would not help ‒ no 3D-hardware-accelerated support on ARM chromebooks. So in …

Support CNX Software – Donate via PayPal or become a Patron on Patreon

WiFiBoy32 is an ESP32 Portable Game Console and IoT Devkit

WiFiBoy32

I’ve noticed that ever since Hardkernel launched their ODROID-GO “10th anniversary” portable game console based on ESP32 processor, most of the talk on IRC and social media is about this new toy, and people almost seem to have forgotten about the company’s Arm Linux boards 🙂 But recently, I’ve come across a somewhat similar ESP32 device called WiFiBoy32 that acts as both a portable game console and an IoT development kit. WiFIBoy32 specifications: Wireless module – ESP32-WROOM-32 wireless module with 802.11 b/g/n WiFi and Bluetooth 4.2 LE connectivity Display – 2.4″ 240×320 color SPI TFT LCD display Expansion – 2x 8-pin through holes with GPIOs, SPI, DAC, I2S,ADC, VP/VN, and power signals (3.3V, Vin, GND) Misc Top – 6x large gaming buttons, select and start push buttons, buzzer Bottom – PROG and RESET buttons, user LED USB – 1x micro USB port for power and programming (CP2102) Dimensions – 120 x 73 mm The board can be programmed with the …

Support CNX Software – Donate via PayPal or become a Patron on Patreon

Coocox CoIDE and GCC Arm Embedded Toolchain Download Links

I’ve been playing with RAK811 LoRa GPS tracker last week-end and earlier this week, and Rak Wireless provides open source firmware for the board that can be work on with Arm Keil or Coocox CoIDE tools. The former requires registration, and the latter is freeware and appears to be preferred by Rakwireless guys. The only problem is that CooCox website have been down for several days, so I could not download the IDE from the official website. So instead I downloaded it from Softpedia together with a GCC toolchain. Sadly the version in Softpedia and the toolchain are outdated, so the firmware won’t build. I had installed CooCox CoIDE v 1.7.8 with GNU Tools ARM Embedded 4.7 2013q. Rakwireless engineers informed me they used CoIDE v 2.0.6 with gcc-arm-none-eabi-5_4-2016q3-20160926-win32. I could not find it online, so they added both to their RAK811 documentation. You’ll find the two files under Tools: CoIDE-V2Beta-20170117.exe and gcc-arm-none-eabi-5_4-2016q3-20160926-win32.exe. But again, it took me a few …

Support CNX Software – Donate via PayPal or become a Patron on Patreon

KidBright32 Board is Thailand’s BBC Micro:Bit Equivalent

BBC Micro:Bit board was first announced in July 2015. Designed for STEM education, the board was then offered to UK schools in March 2016, and a few months later UK store would start selling it worldwide. It’s now available pretty much anywhere, and you can likely find it in a local store or online. The Thai government must have seen this, and thought to themselves “If the British can do it, we can do it too!”, as the National Electronics and Computer Technology Center (NECTEC) part of Thailand’s Ministry of Science and Technology designed KidBright32 board and courses to teach STEM to Thai students. The board is based on Espressif Systems ESP32-WROOM-32 WiFI and Bluetooth module, and comes with large holes for power (5V/GND) and 6 digital inputs/outputs,  smaller through holes for I2C and more I/Os, as well as an I2C header. We’ll also find some LEDs, two dot matrix LED displays, three buttons, a buzzer, an RTC, a light …

Support CNX Software – Donate via PayPal or become a Patron on Patreon

Visual Studio 2017 with an Embedded Linux Arm Device

This is a non-sponsored guest post written by Marc Goodner: Principal Program Manager, Microsoft, and Jeremias Cordoba: Innovation Engineer, Toradex. Today many embedded devices run some flavor of Linux as their primary operating system. This poses a challenge to developers who run Windows on their development machine. This article explains a new way to use the latest Visual Studio for C++ development on an embedded Arm Devices from a Windows Host PC using containers for the build environment. The device we are deploying to is from the Toradex Colibri Family of System on Modules using the NXP i.MX 6ULL SoC, which features an Arm Cortex A-7. As a demo project we will connect a Bluetooth Sensor with the Toradex Colibri Module. Please note that Visual Studio support for this case is in an early state, you will see improvements from Microsoft and Toradex in the coming months. Prerequisites Colibri i.MX 6ULL with Wi-Fi/BT and an Aster Carrier Board TI SensorTag (Bluetooth low energy) …

Support CNX Software – Donate via PayPal or become a Patron on Patreon