Archive

Posts Tagged ‘debugger’

How to Program STMicro STM8S $1 Board in Linux

April 13th, 2015 30 comments

In January, I discovered there was such thing as a one dollar development board based on STMicro STM8S103F3P6 8-bit MCU with 1KB SRAM, 8KB flash, and 640 bytes EEPROM, some GPIOs as well as I2C, UART, SPI, ADC, and PWM signals. Links to documentation and source code were provided, but development tools were only Windows based. However, one of my reader informed me SDCC (Small Devices C Compiler) supported STM8, and development in Linux should be feasible. So I decided to buy the board on eBay for $1.62, as well as an ST_link V2 programmer for STM8 / STM32 for $4.52 in order to flash the firmware.

The board came pretty quickly, i.e. within 2 to 3 weeks.

STM8S103F3_BoardBut due to a lost package, the programmer took nearly 3 months to reach me, as the seller had to re-send after I failed to receive it within 2 months.

ST-Link_V2_ProgrammerIt comes with 4 wires that need to be connected to RST/NRST, 3.3V, SWIM, and GND. To do so, I had to solder a 4-pin header on the side of the board.

To get started with STM8 on Linux, I found some information on ColeVision website where they explained how to run Drystone on STM8/128-EVAL board using SDCC as the compiler, and stm8flash to program the board.

So I’ve given it a try on Ubuntu 14.04 with the simple goal of blinking the TEST LED on the board. sdcc is an Ubuntu package, so it’s pretty easy to install:

Let’s check the version and some more information:

sdcc --version
SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.3.0 #8604 (Dec 30 2013) (Linux)

That’s version 3.3.0 released in December 2013 and it lacks STM8 supports, but the latest version (sdcc v3.4.0) has been released in April 2014, and we can get it with a PPA, so let’s use that one instead:

If you are using Ubuntu 14.10 or greater, you’ll already get the latest version.

Let’s double check stm8 is indeed supported:

sdcc --version
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.4.0 #8981 (Jan 10 2015) (Linux)
published under GNU General Public License (GPL)

Great! stm8 is now present in the list of supported MCUs.

For the next step was to install stm8flash tool to program the device:

Now I had to find some code samples to blink the LED. I started but checking the samples for ST Visual Programmer and IAR tools, combine with a modified version of Drystone source code, but I always had some issues with the header files, and it seems a bit more work than expected. But then I discovered that Valentin Dudouyt, stm8flash developer, also provided code samples in his github account, including a blinky sample:

First, I tried to compile the samples, and they failed because sp_test.c was missing, so I edited the Makefile to remove sp_test.ihx, and build was successful. The LED on the board is connected to B5 GPIO, so at that point I had to check out STM8S103F3 datasheet to find out more about the registers used in the sample. The register map is in section 6.2 of the document, and I need to use three registers:

  • PB_ODR – Port B data output latch register (Sets pin HIGH or LOW)
  • PB_DDR – Port B data direction register (Sets direction to INPUT or OUTPUT)
  • PB_CR1 – Port B control register 1

Since pin 5 correspond to 00100000 (0x20) I updated blinky.c sample as follows:

I typed make again to generate an updated firmware (blinky.ihx), and flash it as follows:

All good and the LED started blinking…
STM8S_Blink_LED

So now you should be able to write simple program to control other GPIOs, I2C, SPI, UART with the board. But if your program is a little more complex a debugger could be useful, and there’s Texane STLink working on Windows, Mac, and Linux, that can run gdbserver for STM32… But I tried it for STM8.

Then I ran st-link:

Hmmm, it does not look good, and sadly there’s no support for STM8 yet, as STM32 and STM8 use different interfaces (SWD vs SWIM).

So if you have troubles debugging your program, you may have to revert to Windows based tools, at least for now, unless you’re up for the task and want to add STM8 support to Texane.

Android 4.0 Hardware Graphics Acceleration Coming to More Platforms

December 15th, 2011 No comments

The Linaro Android Platform Team has just posted a weekly update to their progress.

They are going to release 11.12 very soon with hardware graphics acceleration to 2 of their members development boards: ST Ericsson Nova A9500 Snowball and Samsung Exynos 4212 Origen boards. So if you have any boards or products based on those processors you should be able to get an hardware optimized version very soon. Hardware acceleration is already available on all OMAP4 platform such as Pandaboard, since this was the default Android ICS target.

They also introduced support for the ARM DS-5 debugger, an Eclipse plug-in to help developer create high performance performance  and low power native software by integrating a graphical debugger for code generated for the Android Native Development Kit (NDK) and a basic version of the ARM Streamline performance analysis tool.

Here’s a list of this week achievements:

Key Points for wider discussion

  • Hardware accelerated graphics for Linaro Android Snowball ICS is running.
  • Gator (for DS-5) is running on Snowball, Pandaboard and Virtual Express.

Team Highlights

  • Good progress on Hardware accelerated graphics for Linaro Android Origen ICS.
  • ICS can be built with a gcc 4.6 based toolchain.
  • Good progress on strict-aliasing support for gcc 4.6 toolchain.
  • Progress in updating ffmpeg in ICS to version 0.9.
  • A kernel rebuild script is finished and ready for deployment.
  • A wiki page on how to install DS-5 on 64-bit Ubuntu Oneiric workstations is available.

The team is also preparing for several events that will take place in February 2012 in San Francisco: Linaro Connect, Android Builders Summit and the Embedded Linux Conference.

LinuxCon 2011 Presentation: Embedded Systems

August 25th, 2011 No comments

The fourth presentation entitled  “Embedded Systems” was presented by Tim Harder, developer at OSUOSL (Oregon State University Open Source Lab) on the 16th of August 2011 at LinuxCon 2011.

Abstract: This presentation deals with software development for Embedded Systems especially focusing on Linux and open source.  It describes current software development challenges such as fast software life cycle and memory footprint issues, lists several open hardware projects (Beagleboard, Pandaboard, Bug Labs, Gumstix),  microcontrollers (Arduino and TI MSP430), different operating systems (Android, Meego) and toolchain build tools (Buildroot, Yocto) for embedded systems. It also explains specific challenges to embedded software development such a the numerous number of hardware platforms and software & hardware  tools. Finally, it deals with the cross-compilers, emulators (e.g. qemu) and debugging tools (gdb, jtag, serial console, etc…).

If you want to download the presentation slides, please go to Embedded Systems and use the download button on top of the Slideshare presentation. If it does not work, you may also download a copy here.