Lazarus And The Free Pascal Compiler Gain Dynamic Package Support

"Built with Free Pascal Lazarus" bannerIf you have developed in Pascal or Delphi in the past decades, you’re probably familiar with the Lazarus IDE that provides an interface to the Free Pascal Compiler (FPC), much like Delphi’s IDE. For users of Lazarus IDE there’s now an exciting new development, with the announcement that FPC and Lazarus now support dynamic packages.

The upshot of this is that you no longer need to rebuild the IDE if you want to add components, controls and Lazarus extensions. In addition you can use this same dynamic package feature in your own Pascal applications this way.

Naturally this is a great improvement, and it’s good to see more improvements to such a venerable programming language. Not only is it still being used today for just about anything, including web development, but there is a good case to be made for using Pascal today as it’s no longer the language it was half a decade ago.

We’d also be remiss to not mention the legacy of [Niklaus Wirth], who not only created Pascal, but was also instrumental in the development of Object Pascal together with Apple. This effort ultimately led to everything from Turbo Pascal to Delphi, FPC and so much more, making it a heartening sight to see this legacy being kept alive today.

Visualize Regular Expressions With Marbles

If you are one of those people who visualize things physically better than in the abstract, then Regex Marble Run by [bottomless] might be for you. You enter a test expression and a string, and the site generates a virtual marble machine that lets you see the regular expression pick apart the string in a physical way.

Click this link, and you’ll see the regular expression “^[hH]ack.[dD][^0-9]*$” which, if you aren’t a regular expression user, might seem a bit cryptic. However, it is fairly simple if you take it bit-by-bit.

The caret character tells it to match the start of the string. So “^dog” will match “dog” and “dog food” but won’t match “food for a dog.” The following bit “[hH]” will match either “h” or “H”. Then there is “ack” which is just what you think it is. So a string starting with “hack” or “Hack” might match (depending on the rest of the expression.

The period means match any single character. Then there’s another “[]” but this time with “dD” to match any kind of D. The next “[]” character class is a range from 0-9, but since there is a caret, the match is negated. So “[^0-9]” means match anything except a digit from 0 to 9. The “*” means we can have zero or more of these. So “HackxD” matches, but so does “HackxDXYZabc” for now. Trick question: Does “HackxDXYZabc123” match? So far, yes, but it only matches to the lowercase “c” character.

The final character, “$” means end of string. So now “HackxDXYZabc123” does not match because we are still in the middle of the string. However, “HackxDXYZabc” will match since the previous “*” “ate” the rest of the string.

Head spinning? The site will let you see each letter of a test string as a marble that falls through the different parts of the regular expression. Balls that pass wind up in the left-hand box, while failures are in the right-hand box. Will it help you? We don’t know, but it is fun to watch.

Want a refresher on regular expressions? Or perhaps you want some practice?

Mars Pathfinder: What Really Happened?

You’ve probably heard of Mars Pathfinder, the NASA lander and its Sojourner rover that took up residence on Mars in 1997. At first, all was well, but after a few days, the lander suffered a series of total system resets. A watchdog timer detected a problem and forced reboots. [Vivek Bhageria’s] recent post looks into what happened and the eventual solution.

The root cause was priority inversion. This happens when a lower-priority task holds a resource needed by a higher-priority task and prevents the higher-priority task from executing. In this case, the operating system was VxWorks, but this can happen on any kind of priority scheduling system.

The simplified version is that there were two tasks that each used the same mutex to avoid stepping on each other. The highest priority was a data distribution task. The lowest priority task dealt with meteorology data processing. There was also a medium-priority task that handled bus maintenance.

The failure would occur when the low-priority task had the mutex and lost its time slot before releasing it. The high-priority task would then find it couldn’t take the mutex. However, the low-priority task didn’t get control again because of the medium-priority tasks waiting to run.

In effect, the high-priority task was now waiting on something that couldn’t become available until the lowest-priority task was able to run. That’s priority inversion.

Continue reading “Mars Pathfinder: What Really Happened?” →

The EDG C++ Compiler Frontend Has Been Open Sourced

Recently [John Spicer] of the EDG C++ compiler front-end project announced that the project will be made open source, from now on managed by the non-profit C++ Alliance. Related source code can be found on the GitHub account.

The Edison Design Group (EDG) is a US company which has made compiler front-ends since 1988, previously also for Java and Fortran. They are used in the Intel C++ compiler, Microsoft’s VC++, NVIDIA’s CUDA compiler, as well as many other commercial products. Last year the decision was made to shutdown the company in 2026 and transition to an open source model, with the details outlined on the EDGCPP site.

Although far from the only C++ front-end, EDGCPP will be very interesting still for supporting bleeding-edge features and having been used in such wide-ranging, demanding applications by a host of commercial customers. For most of us C++ developers our contact with it will have been via the MSVC and Intel Compiler Collection tooling, but of course it’s just one part of the entire toolset.

We’re looking forward to seeing what this means for the wider open source C++ ecosystem, especially as it pertains to GCC and LLVM’s Clang.

It’s GW-BASIC, Jim, But Not As We Know It

Back in the old days the IBM-PC, like most of its contemporary computers, shipped with BASIC in ROM. Even after it stopped living in ROM, IBM-Compatibles shipped with GW-BASIC, and now we have a project that asks: what if they still did? Thoreau BASIC is GW-BASIC, but updated for the 21st century.

It’s meant to be code-compatible with all old GW-BASIC code — which means, yes, line numbers and GOTOs abound — but it can boot from a modern x86 PC’s UEFI or run under Windows and take full advantage of modern hardware with 64-bit memory and multithreading support. Graphics are 24-bit at any resolution your monitor can handle, and there are a number of handy built-in commands to handle file management, graphics — including sprites — mouse and keyboard input, 32-channel sound, and more. It is also not strictly an interpreted language. Programs can be compiled to run under Windows or bare-metal on UEFI x86 machines.

It’s not open source, but the project is “pay what you want” over on Itch.io, where you can also see a number of examples.

We’ve seen other attempts to revive BASIC over the years, like MoonBASIC or BASIC-256, but we have to admit it’s never going to be the dominant force it once was, regardless of how nostalgic we might get. That’s probably for the best, but it’s still nice to know you can boot to BASIC if you really, really want to. Do you think it would work with our preprocessor?

When The Debugger Lies With Stale Cache Values

In a recent blog post by [Daniel Mangum] he goes over a scenario observed while debugging the Cortex-M33-based nRF54LM20, reading and writing values while running through a few scenarios. After initially it seemed to go seemingly without any issues, suddenly the GDB debugger would happily return values that suggested that a previous operation had not succeeded. Or, as the case turned out to be, stale cached values were being returned.

What follows is a very technical and low-level breakdown of how this MCU functions inside, especially its cryptographic features and Key Management Unit, which is used for storing sensitive information. The most amusing part is probably you can bypass the cached data by explicitly specifying the access port and memory address along with other parameters.

This ReadMemAP command supported by the JLinkGDBServer used here showed the right value, whereas the normal GDB read command using x kept returning the cached values. This raised the question of which cache was doing this. The direct read from the AHB-AP access port worked fine, so the suspicion is that the J-Link software’s own caching, with a run without the J-Link caching indeed working fine.

J-Link has had some hardware-related issues too, with this new issue pointing to an awkward software bug that could be table-flip-and-rage-quit worthy depending on how much time it wastes during a debug session. Fortunately [Daniel] seems to have caught this one quickly and had an easy way to bypass it, but we aren’t all that lucky.

 

A 3D Rasterizer For Embedded Devices

Once upon a time, doing graphics on a microcontroller was challenging, to say nothing of the concept of going into three dimensions. But modern microcontrollers are far more powerful, and you might find yourself wanting to do all sorts of graphical wizardry with one. To that end, you might find Jet useful.

Created by [CubeCoders], Jet is a compact 3D rasterizer built for modern chips like the ESP32 and STM32. It’s dependency free, relatively tiny, and is written in C++17 with an eye towards working well on memory-limited platforms. It runs entirely in software, uses only integer arithmetic, and is built around 16-bit RGB565 color — intended to make it easy to use with parts like the ST7796, ILI9488, and other similar displays interfaced via SPI.

As a point of reference, on a ESP32-S3 Jet can render around 650 on-screen triangles (post-culling) at 60 frames per second on a 480×320 display, or 1300 triangles at 30 FPS. The developers note that 3D performance lands somewhere between the Sega 32X and Sega Saturn — not bad for a microcontroller you can buy for under $20. The Wipeout-like demo shows off the capabilities of Jet rather fantastically, we think.

You’d be foolish to expect your next microcontroller project to render Crysis. However, if you want some retro 3D graphics for your next ESP32-based build, you might just consider exploring what Jet can do for you.

Continue reading “A 3D Rasterizer For Embedded Devices” →