2020-02-23 12:23 PM
i am currently working on a temperature project which many may well have heard of. the W1209 temperature controller. and i have found everything i need to implement this circuit into my existing project with other features. the code is open for anyone to have and so is the circuit. only from the files i downloaded i need to compile them so i get a hex file that i can the program the chip with. i have some knowledge with arduino and pic from a long time ago, but am struggling to understand how to do this.
i have bought the ST Link v2 dongle for programming and not sure which software to best use. if there is anyone who can help and compile the program so i can have the file i need to just send to the chip i would be so grateful.
2020-02-24 07:00 AM
Find out which compiler your code was written for (IAR and SDCC are quite standard-complinat making it easy to compile code written for one with the other, slightly harder for code originally written for Cosmic or Raisonance).
Once compiled, you write the program onto the device (e.g. you use SDCC to compile C code into an Intel hex .ihx file, then use stm8flash to program the device via the ST-Link/v2).
You mentioned the code is "open". You could post a link to make it easier for us to help you.
2020-02-24 07:46 AM
No problem.
https://github.com/mister-grumbler/w1209-firmware
from here i got the full circuit diagram and program. but i just need the means to have the .hex file that i can load to the chip as the circuit will be done on a different board with other components and buttons in a better place for my project.
Thanks
2020-02-24 07:52 AM
Looking at the Makefile on Github, the code was written for SDCC.
Which OS do you use? For Debian or Ubuntu, the build procedure from the FAQ (https://github.com/mister-grumbler/w1209-firmware/wiki/FAQ) is probably the easiest. For other Unices, and macOS it will be similar (i.e. install SDCC, then use "make" to build the .ihx file (For Intel hex, both .ihx and .hex are used, this Makefile uses .ihx).
2020-02-24 08:26 AM
you are loosing me there. i use windows?? if thats what your asking?
i have found sdcc small device c compiler. so i am assuming if i install that then the files from github can be used and compiled so i can get a hex file to then program?
am i right in saying that?
2020-02-25 02:18 AM
Yes, I was asking about the OS.
A little background:
Source code, written in C (usually .c files, which in turn include some .h files) is usually compiled into object files first (.rel files here). Then the object files are linked together to form a binary (.ihx file here).
So programmers don't have to invoke the compiler for each .c file and then the linker, there are tools to automate this. The most common is a Makefile, executed by the program make. The Makefile contains rules on how to invoke compiler and linker with which options. The GitHub repo contains such as Makefile: https://github.com/mister-grumbler/w1209-firmware/blob/master/Makefile
make is available on most OSes,such as various GNU/Linux distributions. While make is also available for Windows, it is probably a little bit more tricky to use there.
No matter if you decide to use make, or some alternative, or to just compile each source file manually, you'll need the Small Device C Compiler (SDCC, which contains the compiler and linker).
2020-02-25 02:48 AM
sort of thanks... lol.
i have never used linux. is there some videos i can watch to understand the process better. i have used adruino ide and can sort of follow that, but this may be way past what i can do. would there be anyone who would beable to put the file together so i have the hex file that i can just use the STLink and program?
or is there anything to help me start from scratch and learn the process?
2020-02-25 06:19 AM
I just did it on my Debin GNU/Linux system using these three lines:
git clone https://github.com/mister-grumbler/w1209-firmware.git
cd w1209-firmware
make
Result is at http://colecovision.eu/stuff/thermostat.ihx (I haven't tested that file in any way).
For getting started, I wrote some simple tutorials for various STM8 boards a while ago (written for GNU/Linux, but shouldn't be much different on Windows):
Many developers, especially on Windows prefer to use an IDE instead of manually editing Makefiles. One IDE that supports SDCC (and an installed SDCC is detected when installing the IDE) is Code::Blocks.
2020-02-25 06:33 AM
> git clone https://github.com/mister-grumbler/w1209-firmware.git
> cd w1209-firmware
> make
I suppose under Windows that would work with Cygwin and the proper packages as well.
Never tried, since I prefer/have native Linux.
2020-02-25 09:41 AM
i am guessing that the file .ihx is the hex file that i can use with the stlink v2 dongle? if so you are a star. Thanks.
if i wanted to learn linux and all that? do i need a seperate computer setup with that os on? or is it something that would run inside windows?
or would a raspberry pi work? i have heard they work using linux?