24. July 2023

ESP32 How to merge firmware into signle binary

Application built on top of ESP-IDF can be merged into single binary using following commands:

cd build
esptool.py --chip ESP32 merge_bin -o merged-flash.bin @flash_args

The esptool will output following command and perform the conversion:

esptool.py --chip ESP32 merge_bin -o merged-flash.bin --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0 bootloader/bootloader.bin 0x10000 wasmachine.bin 0x8000 partition_table/partition-table.bin 0xd000 ota_data_initial.bin
esptool.py v3.3.2
Wrote 0x2ad4d0 bytes to file merged-flash.bin, ready to flash to offset 0x0

The output is stored in build/merged-flash.bin.

26. December 2019

Build Installer for your Python application – PyInstaller

Do you have your Python application ready? Now it’s time to distribute it. The question is how to bundle it?

One way of bundling Python application into exe/binary file is to use PyInstaller.

You can do it using following commands:

pip install pyinstaller
pyinstaller file_with_main.py

The result will be stored in directory dist. The directory contains one build for the operating system that you’re running.

22. December 2019

Jenkins Generic Webhook Plugin failed with: Did not find any jobs with GenericTrigger configured

Generic Webhook Plugins allows invoking build of Jenkins job.

First of all, you need to set the token in job configuration.

Go to Build Triggers, check Generic Webhook Triggers.

Jenkins Build Trigger

Set Token e.g. to WEBHOOK-TOKEN.

Invoke curl:

curl http://localhost:8080/generic-webhook-trigger/invoke?token=WEBHOOK-TOKEN

It might happen that job build fails with the message:

{"jobs":null,
"message":"Did not find any jobs with GenericTrigger configured! 
If you are using a token, you need to pass it like ...trigger/invoke?token=TOKENHERE. 
If you are not using a token, you need to authenticate like 
http://user:passsword@jenkins/generic-webhook... "}

To fix the problem make sure that Trigger builds remotely is not checked in job configuration. The token set in this field has priority.

Once the duplicate token is removed the build should be possible to start.

23. April 2019

Android Studio Unresolved reference: activity_main – R.layout and R.id

You can easily run into mysterious errors with Android Studio. Here is one.

Suddenly all references related to R.layout or R.id stopped to work and build failed with a message like this:

Compilation error. See log for more details
Unresolved reference: activity_main
Unresolved reference: url_edittext
Unresolved reference: update_button

The code looked like this:

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

I tried clean, builds, rebuilds. Nothing helped. The problem was caused by simple import which accidentally occurred in Activity file:

import android.R

After removing this line the whole project was working again and even code hinting was correct.

22. June 2018

How to display build log in Xcode

Xcode has a very minimalistic design when working with build errors. Sometimes it’s necessary to get more information about a failed build and it might not be obvious how to do it.

The answer is simple and it’s one click away.

Click on the last icon (text bubble) in the top left panel.

Now select the build and you’ll see all build information.