A working SDCC STM8 CMake configuration

If you have been looking desperately for a working CMake example for the SDCC compiler for STM8 microcontrollers here’s my take on it:

cmake_minimum_required(VERSION 3.2)

set(CMAKE_SYSTEM_NAME Generic) # No linux target etc

# Prevent default configuration

project(STM8Blink C)
SET(CMAKE_C_FLAGS "-mstm8 --std-c99")
add_executable(main.ihx main.c)

# Flash targets
add_custom_target(flash ALL COMMAND stm8flash -c stlink -p stm8s105c6 -w main.ihx)

This will build main.ihx from main.c. main.ihx is a Intel Hex file which can be directly flashed using stm8flash.

The last lines setup make flash ; you might need to use the correct microcontroller (stm8s105c6 in this example, run stm8flash -l to show supported devices) and the correct flash adapter (stlink, stlinkv2, stlinkv21, stlinkv3 or espstlink).

The setup example shown here is for the STM8S eval board.

I suppose it can be easily modified for other microcontrollers, but I haven’t tried that so far.

Posted by Uli Köhler in Build systems, Embedded, Hardware

How to disable Secure Boot on InsydeH20 UEFI BIOS / Acer Aspire A515-52-51EL

On my Acer Aspire A515-52-51EL Secure Boot is enabled by default.

When accessing the BIOS/UEFI by pressing the F2 key during boot, the Secure Boot option is [Enabled] and greyed out so I couldn’t change it.

In order to change it you need to temporarily set a supervisor password in the BIOS.

Go to the Security page and navigate to Set Supervisor Password.

Press enter. This will show a prompt to set a supervisor password.

Important: DO NOT use a hard-to-remember password here! I recommend using abc123 as a password and writing it down just in case. If you forget your supervisor password you WILL BRICK YOUR MACHINE! This password will only be used temporarily so you DO NOT want to use a secure password!

Enter the password, press return, enter the password again and press return again. On the top of the page, Supervisor password is should now read Set.

Now go to the Boot tab where you can now disable Secure Boot.


Now we will unset the supervisor password. Go to the Security tab again, go to Set Supervisor Password and press return.

Enter the password you used before (e.g. abc123), then press enter. In the Enter new password and Confirm New Password fields, DO NOT ENTER ANY PASSWORD! Just press return two times.

Double-check that Supervisor password is now read Clear. This means that we un-set our supervisor password.

Important: If Supervisor password is does not read Clear, repeat the last step to ensure there is no supervisor password set.

Now go to Exit, select Exit Saving Changes and press return. Select Yes and press Enter.

Even though we have unset the supervisor password, secure boot will stay disabled.

Posted by Uli Köhler in Hardware