“There is no ‘S’ for Security in IoT” has indeed some truth. With all the connected devices around us, security of code should be a concern for every developer. “Preventing Reverse Engineering: Enabling Flash Security” shows how to prevent external read-out of critical code from device. What some microcontroller have built in is yet another feature: ‘Execute-Only-Sections‘ or ‘Execute-Only-Memory‘. What it means is that only instruction fetches are allowed in this area. No read access at all. Similar like ‘read-only’ ‘execute-only’ it means that code can be executed there, but no other access from that memory is allowed.
In this article I describe the challenges for a toolchain like the GNU gcc, and how to compile and link code for such an execute-only memory.
In the C programming language it is good practice to pass values by reference (using a pointer), especially for large set of data. For example the following function takes a message string and pointer to integer data which then is printed to the console:
By default, the FreeRTOS threads do not show up with the SEGGER J-Link debug connection in the Eclipse based NXP S32 Design Studio IDE. But don’t worry: Here is how to get it working with SEGGER J-Link debug connection:
The ARM DWT (Data Watchpoint and Trace) is an optional feature of the ARM-Cortex-M, and many Cortex-M3, M4 and M7 devices have it implemented. With it comes a cycle counter which counts the cycles spent. In Cycle Counting on ARM Cortex-M with DWT I described an approach how the application on the target can access the cycle counter.
The MCUXpresso IDE shows that cycle counter in the Eclipse Registers view:
Is BLACK the color of the season? My students really seem to love these ‘dark’ Eclipse themes. Well, I tried ‘dark’ themes in the past, but I have not been vey excited about it. Somehow I preferred more the ‘black on white background’ thing. But: I have now managed to install the ‘Darkest Dark’ Eclipse theme into the NXP MCUXpresso 10.2 IDE for my daily work, and I feel it hurts my eyes less? Maybe I’m getting older? Or could it really be that ‘dark’ look and feel?
By default, the GNU compiler (gcc) optimizes each compilation unit (source file) separately. This is effective, but misses the opportunity to optimize across compilation units. Here is where the Link Time Optimization (LTO, option -flto) can help out: with a global view it can optimize one step further.
The other positive side effect is that the linker can flag possible issues like the one below which are not visible to the compiler alone:
type of '__SP_INIT' does not match original declaration [enabled by default]
Hardware Timers are essential to most embedded applications: I use them mostly for triggering actions at a given frequency, such as acquiring data from a sensor. With using an RTOS I can do a similar thing using a task: the task will run with a given frequency and I can periodic work in it. However, using a task might be too much overhead doing this. The good news is that there is a much more efficient way to do this in FreeRTOS with Software Timers. And this is what this tutorial is about: how to use Software Timers with FreeRTOS.
We in Switzerland are proud about the fact that our country has four official languages: Italian, French, German and Romansh. Most of Swiss people speak at least two of them, plus the inofficial fifth language (English).
Eclipse is even better than that and speaks 46 different languages. If you are not happy with the default language, try out Babel! And yes, Eclipse has a language pack for Klingon too:
When using the FreeRTOS Task List in the Eclipse based MCUXpresso IDE, it shows the list of tasks with their stack size used. But with the default FreeRTOS settings it is not able to determine the correct stack size and shows a warning icon:
I’m very happy with my 50W Laser Cutter (see “Getting Control over a 50 Watt CO2 Laser Cutter from China“). My main decision factors were (and still are): Software, software, tools and again software, and down in the list finally the hardware. Same thing for that laser cutter. After several upgrades (see “50W Laser Cutter Upgrades“), it was time replace the stock controller hardware with a new one including LCD display:
Using IP (Ethernet) based debug probes is a very handy thing: I don’t have to be directly connected to the debug probe (e.g. with the USB cable). This article explains how to use an IP-based Segger or P&E probe with the Eclipse based MCUXpresso IDE.
Windows 8 and 10 have added a ‘feature’ to scan and index devices attached to the host machine. This means that bootloaders or MSD (Mass Storage Device) programming implementations on evaluation boards developed in the Windows 7 age might not be prepared for that. Up to the point that it can impact the bootloader as outlined in “Bricking and Recovering OpenSDA Boards in Windows 8 and 10“. So far one of the easiest way to get out that situation was to use a Windows 7 machine. But if you only have a Windows 10 machine available, this article describes the needed steps to update the bootloader with Windows 10 host machines.
The map file produced by the GNU linker includes lots of information, however it is very cryptic to read. In “Listing Code and Data Size for each Source File with GNU and Eclipse” I showed how the GNU size utility can be used to report the code and data size for each object file. The Eclipse based MCUXpresso IDE comes with another nice view which shows detailed information about code and data allocation:
In “Flash-Resident USB-HID Bootloader with the NXP Kinetis K22 Microcontroller” I presented how I’m using the tinyK22 (or FRDM-K22F) with a flash resident USB HID bootloader. To make sure that the loaded application is not corrupted somehow, it is important to verify it with a Cyclic redundancy Checksum (CRC). The NXP KBOOT Bootloader can verify such a CRC, but how to generate one and how to use it is not really obvious (at least to me), so this article explains how to generate that CRC.
I’m mostly using my 50W laser cutter machine with plywood, simply because that material is available and very inexpensive. I have used it cutting or engraving PMMA (Polymethyl methacrylate or ‘Plexiglas’), simply because that material is more expensive.
From a reader of this blog I received something to experiment with: Cellulose Acetate sheets. Time to experiment with something new 🙂