Skip to content

spseol/STM8S-toolchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

124 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STM8 (SPŠE) Toolchain

🇨🇿 Česká verze | 🇬🇧 English

Three Makefiles

There are three Makefile variants available in the .make directory. This is because the SDCC compiler cannot remove dead code. There are three solutions. The first one is the most optimal, the other two solutions are kept just in case. When you run make for the first time, the toolchain will switch to the most optimal solution called sdcc.

To select a Makefile, run:

make
# or
make sdcc
# or
make sdcc-gas
# or
make sdccrm

You can switch between Makefile variants later:

make switch-sdcc
make switch-sdcc-gas
make switch-sdccrm

Switching only means creating a symlink to the root directory of the project. On systems that don't support symlinks (like Windows), the file is copied instead, so this operation may be lossy. On normal systems (pretty much all except Windows), this operation is lossless.

For more details, see https://chytrosti.marrek.cz/stm8oss.html

Usage

First, you need to select a Makefile. If you haven't done so yet, run:

make

Then you need to configure the microprocessor and its frequency in the Makefile; optionally the path to SDCC installation, or STVP.

#DEVICE_FLASH=stm8s103f3
DEVICE_FLASH=stm8s208rb

### STlink version for flash2 target (stm8flash program)
#STLINK=stlinkv2
#STLINK=stlink
STLINK=stlinkv21

F_CPU=16000000

ifeq ($(OS),Windows_NT)
	CC_ROOT = "/c/Program Files/SDCC"
	STVP_ROOT = "/c/Program Files (x86)/STMicroelectronics/st_toolset/stvp"
else
	CC_ROOT = /usr
endif

... and then just tinker, program and run make.

Command                      
make spl downloads and prepares libraries
make compiles the project (alias for make ihx)
make ihx compiles to Intel HEX format
make elf compiles to ELF format (with debug info)
make all compiles both (ihx and elf)
make flash uploads the program to the chip. On Linux it uses OpenOCD. On Windows it uses STVP command line version.
make flash2 alternative method (uses stm8flash).
make reflash cleans everything and uploads again
make clean deletes everything that was compiled
make cleanall deletes everything including SPL libraries
make rebuild cleans everything and recompiles
make openocd runs openocd for debugging
make gdb runs STM8-gdb
make gdbgui runs gdbgui (if installed)
make tree displays the project tree
make spl-renew re-downloads SPL libraries
make switch-sdcc switches to pure SDCC Makefile
make switch-sdcc-gas switches to SDCC-gas Makefile
make switch-sdccrm switches to SDCCRM Makefile

Dependencies

On Windows

choco install git make vscode mingw

Releases

No releases published

Packages

 
 
 

Contributors