the free toolchain for the stm8 - fosdemthe free toolchain for the stm8 getting into first place...
TRANSCRIPT
![Page 1: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/1.jpg)
The free toolchain for the STM8Getting into first place when non-free tools had years of head
start
Philipp Klaus Krause
February 3, 2018
![Page 2: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/2.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal
SDCC
LLVMEclipse
Code::Blocks
OpenOCDGDB
![Page 3: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/3.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal
SDCC
LLVMEclipse
Code::Blocks
OpenOCDGDB
![Page 4: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/4.jpg)
STM8 microcontrollers
High-performance 8-bit coreRich set of peripherals similar to STM32C-friendly architectureUp to 6 KB of RAM, 128 KB of flashCheapBillions made
![Page 5: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/5.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal
SDCC
LLVMEclipse
Code::Blocks
OpenOCDGDB
![Page 6: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/6.jpg)
What is SDCC?
Standard C compiler (ANSI C89, ISO C90, ISO C99, ISO C11)Freestanding implementation or part of a hostedimplementationSupporting tools (assembler, linker, simulator, ...)Works on many host systems (GNU/Linux, Windows, MacOS, NetBSD, FreeBSD, OpenBSD, Hurd, ...)Targets various 8-bit architectures (MCS-51, DS80C390, Z80,Z180, Rabbit 2000, Rabbit 3000A, GBZ80, TLCS-90, HC08,S08, STM8, PIC)Has some unusual optimizations that make sense for thesetargets (in particular in register allocation)
![Page 7: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/7.jpg)
Optimal Register Allocation in Polynomial Time
Register allocator based on graph-structure theoryOptimal register allocation in polynomial timeFlexible through use of cost functionProvides substantial improvements in code qualityBut slow for architectures with many registersCompilation speed / code quality trade-off:–max-allocs-per-node
![Page 8: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/8.jpg)
Bytewise Register Allocation and Spilling
Decide on the storage of variables bytewiseDecide for each individual byte in a variable whether to storeit in memory or a registerConsider any byte of any register as a possible storage location
![Page 9: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/9.jpg)
Regression testing
Regression testing of nightly snapshots≈ 10000 tests compiled and executed on simulatorTests mostly from fixed bugs and from GCCTargets architectures: MCS-51, DS390, Z80, Z180, GBZ80,Rabbit 2000, Rabbit 3000A, TLCS-90, HC08, S08, STM8Host OS: GNU/Linux, Windows, MacOSHost architectures: i386, x86_64, ppc, arm
![Page 10: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/10.jpg)
SDCC vs. non-free compilers: Benchmark scores
![Page 11: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/11.jpg)
SDCC vs. non-free compilers: Code size
![Page 12: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/12.jpg)
SDCC vs. non-free compilers: Summary
Standard compl. Code speed Code size OS support LicenseSDCC 3.5.0 + - - + +Cosmic ◦ ◦ ◦ ◦ -Raisonance - - + - -IAR + ◦ - - -SDCC 3.7.0 + + ◦ + +
![Page 13: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/13.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal
SDCC
LLVMEclipse
Code::Blocks
OpenOCDGDB
![Page 14: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/14.jpg)
LLVM+SDCC
Uses LLVM C front- and backend to produce C code to becompiled with SDCCCode compiled with LLVM+SDCC can be mixed with C codecompiled with SDCCAllows languages other than CEnables high-level optimizationsExperimental, many issues remaining
![Page 15: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/15.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal
SDCC
LLVMEclipse
Code::Blocks
OpenOCDGDB
![Page 16: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/16.jpg)
stm8flash
Allows reading and writing of flash, eeprom, option bytesSupports all known STM8 variantsUses ST-Link and ESP-STLINK
![Page 17: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/17.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal
SDCC
LLVMEclipse
Code::Blocks
OpenOCDGDB
![Page 18: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/18.jpg)
stm8gal
Allows reading and writing of flashDoes not need ST-Link, directly uses STM8 on-chip UARTUses bootloader (not available on all STM8)Needs non-free blob for some STM8
![Page 19: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/19.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal
SDCC
LLVMEclipse
Code::Blocks
OpenOCDGDB
![Page 20: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/20.jpg)
OpenOCD and GDB
Patches to OpenOCD and GDB for STM8 and ST-LinksupportAllows on-target debugging
![Page 21: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/21.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal
SDCC
LLVMEclipse
Code::Blocks
OpenOCDGDB
![Page 22: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/22.jpg)
Eclipse
eclipseSDCC plugin from 2006Plugin needs updating for current SDCC and EclipseNeeds work from someone familiar with Java and EclipseDebugging support works with Eclipse without plugin
![Page 23: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/23.jpg)
Code::Blocks
Has support for current SDCCNeeds testing and improvementNeeds debugging support
![Page 24: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/24.jpg)
Table of Contents
STM8
ST-Link
stm8flashstm8gal OpenOCDGDB
SDCC
EclipseCode::Blocks
LLVM
![Page 25: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/25.jpg)
ST-Link
Originals by ST, many cheap clones availableAll variants use non-free firmwareFree alternatives: ESP-STLINK, UPROG2 support memoryread / write, but not debugging
![Page 26: The free toolchain for the STM8 - FOSDEMThe free toolchain for the STM8 Getting into first place when non-free tools had years of head start Philipp Klaus Krause February 3, 2018](https://reader033.vdocument.in/reader033/viewer/2022042202/5ea3446bd7166f3a390b7ced/html5/thumbnails/26.jpg)
TODO
SDCC needs developersFix SDCC bugsImprove SDCC further in standard compliance, optimizations,debug info, etcMake LLVM+SDCC useableGet GDB changes integrated upstreamImprove IDE integrationPort RTOSesReplace non-free ST-Link firmware and bootloader, supportfree replacements in tools