Our Batteries
Industrial LiFePO4 Power Systems
  • Forklift Batteries
  • Golf Cart Batteries
  • AGV & AMR Batteries
  • Pallet Jack Batteries
  • LFP Cells
  • 12V Batteries
  • 12V Deep Cycle
  • Custom & Charging
48hr US Shipping
2-Year Warranty
US Technical Support
Request a Quote
About
Solutions Contact Request a Quote

Migration paths beyond the STM8

The STM8 is STMicroelectronics’ family of 8-bit microcontroller, an ST-designed core that has run cheap control jobs for years. A design on an STM8 reaches a day it moves off the part, the program outgrowing the core, ST steering its new work toward the 32-bit lines, a supply running thin on an older part. The path off the STM8 leads in a few clear directions. The right one turns on how far the design has to go.

Where the STM8 stands

An STM8S003 8-bit microcontroller on a product board
An STM8S003 8-bit microcontroller soldered on a product board, its part number readable on the package. The STM8S003 sits at the low-cost end of the family, a part that has sold for around a dime. The pale residue on the package is flux left from soldering. Image: Raimond Spekking, CC BY-SA 4.0.

The STM8 runs an eight-bit core of ST’s own design, a CISC architecture with a three-stage pipeline that clocks to twenty-four megahertz. The line splits into three branches. The STM8S is the mainstream part for industrial and consumer work, the one in high-volume designs. The STM8L is the low-power branch, its sleep current down in the microamps. The STM8A and STM8AF serve automotive designs. A part such as the STM8S003 has sold for around a dime, the floor that put the STM8 into so many cost-driven products. On-chip flash, RAM, and a small block of EEPROM sit in the part, the EEPROM a draw for a design that stores settings between power cycles. The EEPROM holds thousands of write cycles, a place for a calibration value or a counter a product keeps through a power loss. A bootloader in the part’s ROM lets a design load its own firmware over a serial line, an update sent to a product in the field with no programmer at hand. The family runs from the eight-kilobyte STM8S003 at the low end up to the hundred-and-twenty-eight-kilobyte STM8S207, with low-power STM8L parts beside them for battery work. The part runs across a wide supply range, from three volts up to five, an ease in a design sharing a five-volt rail.

The STM8 carries its own toolchain. ST Visual Develop, the STVD environment, builds for the part with the Cosmic or Raisonance C compiler, the tools free to use. Programming and debug run over the single-wire SWIM interface through an ST-Link probe. A generation of firmware sits in STM8 C, written against the standard peripheral library ST ships for the family. That library wraps the registers in C functions a developer calls by name, a timer or a serial port set up through it, the registers handled under the call. A team on the STM8 has the part, the tools, and the code in hand, all of it built on the low cost of the silicon. The years of work invested in that firmware are the weight a migration has to move.

A design that leaves the STM8 rarely does so over the part itself. ST has put its new development into the STM32. The 8-bit line stays in production, its newest peripherals and cores arriving on the 32-bit side now. A program that has grown past what an 8-bit core carries reaches for more. A supply that ran thin on an older part through a shortage sends a buyer toward a part with a broader, newer base. The STM8 still does its job. The move turns on where the design is headed, the part underfoot doing nothing wrong. A design that wants a peripheral the STM8 line never grew, a CAN FD port, a USB device, a richer analog front end, looks to the 32-bit side where those blocks live. The pull is toward what the newer line offers, the STM8 at the edge of its range.

The step up to STM32

The first path ST lays out leads to the STM32. The STM32C0 is the part ST aimed at this exact move, an Arm Cortex-M0+ at the price of an 8-bit MCU. ST sells it under a plain line: your next 8-bit MCU is a 32-bit. The C0 runs to forty-eight megahertz, holds sixteen to two hundred fifty-six kilobytes of flash, and sits in packages from eight pins to sixty-four, the range an STM8 design moves into with little jump in cost. Up to thirty-six kilobytes of RAM sit on the larger C0 parts, room a buffer-heavy program works in. The core brings the Arm instruction set, a flat memory map, and the wide ecosystem of tools and code that grew up around Cortex-M. The C0 carries the peripherals an 8-bit design already knows, the timers, the UART, the SPI and the I2C, the ADC, each in its STM32 form. The CubeMX configurator sets them up from a graphical view and writes the init code, the register-level setup done by the tool. The wider Cortex-M world brings a depth of examples, drivers, and middleware an STM8 design never had at hand, a real-time kernel or a USB stack ready to drop in.

ST documents the move from the STM8 to the STM32C0 in an application note, a sign of how common the path has become. The note walks the peripherals across, the timers, the serial ports, the ADC of the STM8 mapped to their STM32 equivalents. A team following it moves a known design onto the newer core with a map in hand. The debug probe carries over as well, the same ST-Link that flashed the STM8 over SWIM driving the STM32 over its SWD interface. The work the note saves is the mapping, a developer reading which STM32 timer or serial block stands in for the STM8 one, the names and the registers laid side by side. A team still writes the new peripheral code, the note pointing it at the right part of the HAL.

The move is a real port. The part does not drop into the old socket. The Cortex-M0+ is a different core from the STM8, its instruction set and its registers new to the firmware. The toolchain changes with it, STVD and Cosmic giving way to STM32CubeIDE and its GCC compiler, or to Keil or IAR. The peripheral library changes too, the STM8 standard library traded for the STM32 HAL and its low-layer drivers. A team budgets the time to learn the new tools and rework the peripheral code, the logic of the application carried across on top of it.

The table below sets the STM8S beside the two parts a design steps up to. The STM32C0 holds the line on cost, the closest thing to an 8-bit price on a 32-bit core. A design that wants more clock, more memory, or more analog than the entry part holds steps up again to the STM32G0. The two STM32 lines share a core, a peripheral set, and a pinout, a design able to start on the C0 and move to the G0 on the same board. The G0 carries more on the die, an op-amp and comparators for an analog front end, more timers and serial channels, a USB engine on some parts. A design that needs that analog, or that connectivity, steps to the G0 and keeps the same tools and the same board family. The two lines reading as one platform is the point, a migration that lands on the C0 free to grow into the G0 later.

STM8S and the two STM32 lines an 8-bit design steps up to. Flash and pin figures span each family. Single-unit prices are indicative and run lower in volume. Sources: ST product pages and migration note AN5775.
Attribute STM8S (part in hand) STM32C0 STM32G0
Core STM8, 8-bit CISC Arm Cortex-M0+, 32-bit Arm Cortex-M0+, 32-bit
Max clock 24 MHz 48 MHz 64 MHz
Flash 8-128 KB 16-256 KB up to 512 KB
Pin count 20-80 8-64 8-100
Toolchain STVD, Cosmic compiler STM32CubeIDE, GCC STM32CubeIDE, GCC
Debug SWIM SWD SWD
Single-unit price (approx.) ~$0.15 ~$0.40 ~$0.60
Where it fits Legacy 8-bit, lowest cost 8-bit price, 32-bit core Mainstream 32-bit, more analog and memory

This path fits the design that has outgrown 8 bits, or the one that wants the longer life and the deeper tools of the 32-bit line. A program low on flash, a control loop wanting real speed, a design reaching for a peripheral the STM8 never carried, each points up to the STM32. The cost of the port is paid once, the design landing on a core ST will carry and grow for years. A team that moves a first product across builds the skill its next products reuse, the second migration far lighter than the first. A team that holds several products on the STM8 plans the moves in order, the part nearest a shortage first, the skill built on it carried to the rest. The drivers and the board blocks from the first move serve the ones after, the cost of the program lower for each part carried across.

Staying on 8 bits

A design can leave the STM8 and stay on 8 bits. The other 8-bit families, Microchip’s PIC and AVR, Renesas’ RL78, each offer a low-cost core in the same class. A move to any of them is a full port all the same, a new core, a new toolchain, a new peripheral library, the same work a move to the STM32 asks. The same effort that lands another 8-bit part lands a 32-bit one. Many STM8 migrations go up for that reason, a sideways move buying little the design could not get from the STM32. The case for a sideways move holds where a part is already proven elsewhere in a product line, a second 8-bit family a company builds on and stocks already. A move onto a part a team knows saves the learning a fresh family would cost. The port stays real all the same, the tools and the habits in hand.

Staying on 8 bits pays off where the job is small and the cost is everything. A product made in the millions, counting every fraction of a cent, may find another low-cost 8-bit part the cheaper home. A design that never needed more than the STM8 gave can move to a near-equal 8-bit part and hold its cost. The move there answers a supply problem, the power of the part left where it was. A buyer making that move still pays the full porting cost, a reason the choice leans on cost alone. A second 8-bit family a company already runs in another product turns the sideways move into a smaller one, the part and the tools already on the bench. The choice still trades the STM8’s price for a near-equal, the gain measured in supply, the speed left where it was.

What the move costs

An STM32F103 on a Blue Pill development board, the STM32 migration target
An STM32 on a low-cost development board, the STM32F103 ‘Blue Pill’. The Arm Cortex-M family is where an STM8 design steps up, the STM32C0 and STM32G0 in the table sharing this 32-bit architecture. Image: Avandalen, CC BY-SA 4.0.

The largest cost of the move is the firmware. C code ports across cores at the language level, the logic of the program surviving the change. The peripheral code is the part that gets rewritten. Every timer setup, every serial routine, every ADC read written against the STM8 library is built again against the STM32 HAL, the registers and the calls all new. A large body of STM8 firmware carries weeks of this rework into the move, the size of the code base the best measure of the work ahead. The interrupt model changes with the core, the STM8 vector scheme giving way to the Cortex-M nested vectored controller and its priorities. The startup code, the clock tree setup, and the low-level init all come from the STM32 side, the tools generating them fresh for the new part. The application logic on top, the math and the state machines a product is built from, carries across as C with little change. The cleaner the original code kept the hardware apart, the lighter that rework lands.

The toolchain is the second cost. A team trades STVD and the Cosmic compiler for STM32CubeIDE and GCC, or for Keil or IAR. The new environment brings its own project setup, a different debugger flow, and a graphical configurator in CubeMX that writes the peripheral setup code. The learning is paid once, the same tools then serving every STM32 the team touches after, the cost spread across all the work that follows the first move. The free GCC compiler in STM32CubeIDE takes the place of the Cosmic licence, a paid tool whose cost leaves the build. CubeMX generates the peripheral init and the startup files, the hand-written register setup of the STM8 days replaced by generated code a developer then fills in.

The board is the third cost. The STM32 part does not share the STM8’s pinout, the footprint and the pin assignment new on the board. A migration redraws the schematic around the new part and lays out a new board, the passives and the supply revisited for the 32-bit part. A design pinned to its old board carries that redesign as part of the move, the work smaller where the board was already due for a revision. The supply voltage often shifts in the move. An STM8 design running at five volts meets an STM32 that runs to three-point-six volts, the IO lines and any five-volt parts on the board needing a fresh look. A level shifter on a stubborn signal, or a move of the whole board to three-point-three volts, rides along with the redesign. The package changes as well, the STM32 offered in the small QFN and BGA sizes a dense board reaches for.

The last cost is proving the new design. Firmware that changed core and library is tested again from the ground up. A product under a safety or an EMC mark carries the cost of re-certifying the board around the new part. A team weighs all of this against the years of life the move buys, the one-time work set beside a core ST will carry forward. A migration made early, ahead of the shortage that would force it, costs less than one an end-of-life notice or an empty shelf forces later, the early work done on a schedule the team sets, the late work crammed into the window a shortage leaves. Reading the lifecycle of the STM8 parts in a design, and the road of the STM32 line, lets a team set the move on its own terms.

Sourcing the transition

The STM8 stays in production, the parts on distributors’ shelves for the designs that keep using them. A buyer holding an STM8 design has time to plan the move, the part available while the migration runs. The STM32 sits on a far broader, newer base, the C0 and the G0 stocked deep and made in volume across many packages. A design that lands on the STM32 side joins ST’s main line, a base with years of road ahead of it. The STM8 saw its own tight supply through the recent shortage, a memory that pushes some buyers to plan the move while the parts are in hand. The STM32 base runs broad across the C0, the G0, and the lines above them, the spread softening the blow a single part’s shortage lands.

A transition runs both parts for a while. A design ships on the STM8 while the STM32 version is built and proven, the two stocked side by side through the change. A distributor carries the STM8 for the running product and the STM32 for the next one, the sourcing plan holding both until the move is done. A buyer who reads the lifecycle early orders the STM8 it still needs and designs in the STM32 it will need, the two timed so neither line runs dry mid-change. A distributor reads both sides of the plan, the STM8 held for the tail of the old product and the STM32 ramped for the new, the order book carrying the design through the overlap. A part chosen on the STM32 side lands on a line a distributor will stock for years, the supply question answered for the life of the next product.

Common questions about migrating off the STM8

Why migrate off the STM8 at all?

ST has moved its new development to the STM32, so the newest peripherals and cores arrive on the 32-bit side. A program can also outgrow what an 8-bit core holds, or a shortage can thin the supply of an older part. The STM8 still works, so the move follows where the design is headed, the part itself doing nothing wrong.

What is the main migration path from the STM8?

To the STM32C0, ST’s entry Arm Cortex-M0+ priced near an 8-bit part. ST documents the move in its application note AN5775, which maps the STM8 peripherals to their STM32 equivalents. A design that wants more clock, memory, or analog steps up to the STM32G0, which shares the C0’s core and pinout.

Is moving from STM8 to STM32 a drop-in?

No. The Cortex-M0+ is a different core, so the firmware meets a new instruction set and new registers. The toolchain changes from STVD and Cosmic to STM32CubeIDE and GCC, the peripheral library from the STM8 standard library to the STM32 HAL, and the pinout to a new footprint. The move is a real port with a board redesign.

Can I stay on 8 bits?

Yes. A design can move to another low-cost 8-bit family such as PIC, AVR, or RL78. Each move is a full port in itself, with a new core, toolchain, and peripheral library, the same effort a step up to the STM32 asks. That effort buys a 32-bit part for the same outlay, which sends many STM8 migrations upward, a sideways move buying little.

What does the STM32C0 bring?

A 32-bit Arm Cortex-M0+ at close to 8-bit price, running to 48 MHz with up to 256 KB of flash. It brings the flat memory map, the wide Cortex-M ecosystem, the STM32 toolchain, and a pin and platform path up to the STM32G0. The C0 is ST’s answer for an 8-bit design that wants a 32-bit core without a jump in cost.

Does the ST-Link work for both the STM8 and the STM32?

Yes. The ST-Link probe flashes and debugs the STM8 over its SWIM interface and the STM32 over SWD. A bench set up for the STM8 keeps its programmer through the move, one tool the migration does not have to change. The cost there is the firmware, the board, and the new toolchain, the debug hardware carried straight across.

Scroll to Top