As a (very) easy starting point, I have uploaded another STM8 template project to http://www.cream-tea.de/public/STM8_SimpleTemplate.zip  It is compatible with both SDCC and Cosmic compiler, and shows how to migrate between them.

The shell script makes the project and then uploads the hex file via STM8 bootloader, using a simple flash tool I wrote for Linux, MacOSX and Win. This tool is available at http://www.cream-tea.de/public/STM_BSL_flasher.zip. Note that this upload channel requires PC-COM to STM8-UART communication, which unfortunately is not available on the STM8 discovery board :-(  However, if you have a suitable board (like me) or an USB-UART bridge (available from Ä15=$20), it should work nicely. 

Alternatively you can use a flash tool via debug interface (SWIM), e.g. Valentinís stm8flash tool available at https://github.com/vdudouyt/stm8flash, which should work nicely with the ST-link on the STM8 discovery board.

Regards, Georg

PS: if you have comments, complaints, or need support, just let me know

Message: 4
Date: Sat, 29 Mar 2014 23:56:15 +0100
From: Master Postfach <1860-218@onlinehome.de>
Subject: [Sdcc-user] STM8 template project and header file
To: sdcc-user@lists.sourceforge.net
Message-ID: <2F93944A-A648-4EDB-B782-C03380F158C0@onlinehome.de>
Content-Type: text/plain; charset="windows-1252"

hello all,

I was very thrilled when I found that SDCC is finally being ported to the STM8. That?s great news for me, because in the past I used the 4k version of Cosmic. The good news is that it?s free, but the size restriction often is a big hazzle? So, thanks again team! :-)

As a contribution I have attached a simple C project compatible with both SDCC and STVP/Cosmic. I will phase out the latter, but currently I have to stay compatible with my legacy projects.

The project contains simple examples for using GPIOs, ADC, I2C etc, but most importantly it contains a file "stm8s207.h? with all peripherals from the STM8 reference manual. I don?t know if it?s of use for anybody, but I haven?t found anything similar on the net, so maybe it is? Please feel free to use! I took special care when generating this file, but of course I cannot guarantee its bug-freeness or take responsibility for its correct function. 

Don?t be mislead by the name of the headerfile. Apparently ST has kept the registers fixed over a wide range of devices, because it seems to work flawlessly from the discovery board (32kB consumer) to a STM8AF62AA (128kB/CAN automotive).

To compile the code use SDCC with options "-mstm8 --std-sdcc99? (see _compile_run* and Makefile). To upload the code to the STM8
via COM-port under Windows, I used the "Flash Loader Demonstrator" from STM?s homepage. But as of today I got my own portable tool, which I will provide in a separate mail
via SWIM (STM8 Discovery has no UART/USB bridge), I use ST Visual Programmer. Unfortunately it?s also Win only :-(

Thanks again and have a nice day,

PS: if you have problems with the project, just let me know

-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: STM8_Template.zip
Type: application/zip
Size: 40822 bytes
Desc: not available
-------------- next part --------------
An HTML attachment was scrubbed...




Sdcc-user mailing list

End of Sdcc-user Digest, Vol 93, Issue 4