C Compiler For STM8S Series MCUs - ST8CC by Mengjin Su (mengjins@hotmail.com)
|
||||||
This web page introduces you a C compiler that supports STM8S series MCUs from STMicroelectronics. It's full functional and free. ST8CC supports those basic data types: char(8-bit integer, signed and unsigned), int(16-bit integer, signed and unsigned) and long(32-bit integer, signed and unsigned). Plus, it supports 'struct' and 'union' to define customized data. Following preprocessors are supported in ST8CC: #if expression #else #endif #ifdef symbol #ifndef symbol #pragma symbol expression #define symbol expression #define symbol(par1,par2,...) expression #include "filename" #include <filename>
How to use ST8CC [1] Install the compiler Unzip and extract all file, and then put them into a folder (e.g. STM8CC). And then put the path into the environment, like
[NOTE, you can make batch file (filename with extension '.bat') to set the path]. In this folder, you should see following files: st8cc.exe - STM8S compiler st8as.exe - STM8S assembler st8lk.exe - STM8S linker \include - the folder that contains stm8s devices header files \lib - the folder that contains standard lib code (for devices that have <= 32KB ROM) \libx - the folder that contains standard lib code (for devices that have > 32KB ROM) examples(folder) - a folder that contains some example codes
[2] Compiling command:
After compiling, if no error detected, assembly code(with extention '.asm') will be generated for each source file. The assembly code is very readable, and you can check what result exactly is. where the option is: -L compile the source code for devices that have more than 32KB ROM -Dsymbol<=xxxx> define symbol (with or without value)
[3] Assembling command
It will generate xxxx.obj and xxxx.lst for each input.
[4] Linking command
where the option is: -L link the object codes for devices that have more than 32KB ROM
Resources used by Compiler ST8CC will use RAM location 0x0000 ~ 0x0003 (first four locations in bank0) as software accumulator for compilation, holding function return value and temporary values. User should never use these location for any purpose.
Notes for ST8CC The total local data size for any function, including entry parameters, should be no more than 255 bytes, because ST8CC uses stack pointer register(SP) as the frame pointer.
Check examples for details The ST8CC package comes with some examples of how to use ST8CC. It shows some details of coding (e.g how to declare interrupt service routine). It will greatly save you a lot of time and efforts to pick it up for you testing.
Download free version of ST8CC The free version of ST8CC is full functional, no limitation or restriction at all! Click here to get free version of STM8CC. You can download and distribute it freely. Suggestions and comments are very welcome by sending emails to 'mengjins@hotmail.com'! Your donation will be highly appreciated, which will help me
keep improving the compiler tools.
|
||||||