Skip to content

A build configuration tool for SDCC based STM8 projects

Notifications You must be signed in to change notification settings

TheGrandmother/stm8forge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stm8forge

So this is a pretty cringe project with a cringe name by someone who does not know anything about embedded development and is pretty shit at software development. But it may against all odds help someone get started with the STM8 development on a gnu/POSIX system for people who don't want to write everything by hand or entertain the notion of using an eclipse based IDE.

I have no understanding of any of this and it is all just things that I managed to get working somehow.

Pull requests are not expected but would be very welcome.

Acknowledgement

Major thanks goes out to the dude who wrote this blog post. The bulk of all the installation steps in the requirements sections are pretty much copied verbatim and a lotr of what was written here was used as the base for this.

Usage

Just run forge.py --cube-file my-poject.txt And you can then flash your device by running ninja flash

Forge will hopefully complain if it can't find the stuff it needs.

Features

  • Generate a ninja build file to build a project using SDCC
  • Automatically resolves the used peripherals from the STM8CubeMx report file (the .txt ones) and include the appropriate files from the STM8S_StdPeriphlibrary (not included)
  • Setup a build target for flashing a device using stm8flash matching the MCU used
  • Support building for debugging
  • Will create a file (serve_openocd) to start an openocd instance matching the MCU used
  • Has cringy colors in the output like some fancy kind of thing
  • Pretends to be robust and do some error checking
  • Has lofty plans to add code generation

To do

  • Lose interest, move on to something else and never touch this again
  • Add a way to manually specify things besides CubeMx
  • Add code generation for peripherals
  • Better cli interface
  • Dockerfile for dependencies
  • Generalize and add support for completely different MCUs

Requirements

These are the things that you pretty much have to have.

python

Version 3.something, probably at least 10. Can be found wherever you get your python installations from

Used for the actuall building

3.5 or higher i guess. This is how i got mine, your mileage may vary:

# download the latest version
$ wget https://sourceforge.net/projects/sdcc/files/sdcc-linux-amd64/4.3.0/sdcc-4.3.0-amd64-unknown-linux2.5.tar.bz2
$ tar -xjf ./sdcc-4.3.0-amd64-unknown-linux2.5.tar.bz2
$ cd sdcc
$ sudo cp -r * /usr/local

Whatever version is avaliable, have fun.

Download the STM8S standard peripheral library which is hidden away behind some moronic license.

You will need to patch the libs to make it compatible with SDCC.

Your mileage may vary here as well. I had some issues getting rid of a bunch of warnings so i needed to add void _assert_failed(void); to my main file to get SDCC to shut up.

stm8flash

What forge will use to flash your thing

$ git clone https://github.com/vdudouyt/stm8flash.git
$ cd stm8flash
$ make
$ sudo make install

Optional debug stuff

stm8-gdb

This is kinda fun if you are into debugging. But also a bit of a hassle and takes a while.

$ wget https://sourceforge.net/projects/stm8-binutils-gdb/files/stm8-binutils-gdb-sources-2018-03-04.tar.gz/download -O stm8-binutils-gdb-sources-2018-03-04.tar.gz

$ tar -xf stm8-binutils-gdb-sources-2018-03-04.tar.gz
$ cd stm8-binutils-gdb-sources
$ ./patch_binutils.sh
$ ./configure_binutils.sh
$ cd binutils-2.30
$ make
$ sudo make install

Note: To get the TUI working, which is fun, you will have to install the development files for ncursesw. If you don*t do this you will get no indication that TUI is disabled.

This is neat and sets creates a connection between the MCU and your computer that gdb (or other debuggers i guess) can use.

About

A build configuration tool for SDCC based STM8 projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages