Forum: Compiler & IDEs toolchain für STM8 unter Windows


von hochsitzcola (Gast)


Lesenswert?

Hallo zusammen,

ich suche und probiere schon den ganzen Tag :-(
Wie lässt sich der STM8 unter Windows progammieren? Ich wollte SDCC mit 
Eclipse nutzen, das funktioniert nicht so, wie in den (meist recht 
alten) Tutorials beschrieben, die Dialoge in Eclipse sehen inzwischen 
ganz anders aus. Unter Linux geht es anscheinend.
Gibt es eine Alternative unter Windows, ohne Codegrößenbeschränkung und 
ohne sich mit Befehlszeilen rumzuschlagen?

Ich möchte dieses Projekt ausprobieren!
https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware


Gruß
hochsitzcola

: Verschoben durch User
von Pd G. (pdg)


Lesenswert?

Gibt den Cosmic-Compiler, der für STM8 kostenfrei genutzt werden kann.

von pegel (Gast)


Lesenswert?

Eigentlich steht doch auf der Seite was zu tun ist

https://opensourceebikefirmware.bitbucket.io/Development_tools.html

Mit eclipse Mars und cygwin sollte es auch genau so funktionieren, oder?

von hochsitzcola (Gast)


Lesenswert?

pegel schrieb:
> Mit eclipse Mars und cygwin sollte es auch genau so funktionieren, oder?

Hmm, diesen Umweg wollte ich eigentlich nicht machen, habe noch nie mit 
cygwin gearbeitet...

Pd G. schrieb:
> Gibt den Cosmic-Compiler

OK, ich dachte der wäre auch größenbeschränkt?!

Gruß
hochsitzcola

von DraconiX (Gast)


Lesenswert?

SW4STM ist nichts für dich? Ist ja ebenfalls Eclipse basierend?!

von hochsitzcola (Gast)


Lesenswert?

Auf den ersten Blick kann der SW4STM doch "nur" STM32, keine STM8....

Beitrag #5100107 wurde vom Autor gelöscht.
von Pd G. (pdg)


Lesenswert?

Cosmic hat das etwas verwirrend auf deren Website. Nimm nicht die 
32KB-Version, da die tatsächlich limitiert ist.
Man muss sich nur einmal registrieren, aber ich habe bislang keine 
unerwünschten Mails bekommen.

von Pd G. (pdg)


Lesenswert?


von hochsitzcola (Gast)


Lesenswert?

Ja, hab's auch grad gelesen, daß STM8 komplett frei ist und nur die 
STM32 Version auf 32k beschränkt. Das werde ich mal ausprobieren!

Danke und Gruß
hochsitzcola

von (º°)·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.· (Gast)


Lesenswert?

Um sich mit den kleinen Kerlchen anzufreunden, wuerde ich dir
die Kickstartversion von IAR waermstens empfehlen.

Zusaetzlich koennen die ST-Tools:
- ST Visual Develop und
- ST Visual Programmer
nichts schaden.

Erst dann wuerde ich den SDCC in Erwaegung ziehen.

Sehr lesenswert zum Thema STM8 ist:

http://blog.mark-stevens.co.uk/tag/the-way-of-the-register/
http://blog.mark-stevens.co.uk/tag/the-way-of-the-register/page/2/
http://blog.mark-stevens.co.uk/?cat=17
...

von Ralph S. (jjflash)


Lesenswert?

hochsitzcola schrieb:
> und
> ohne sich mit Befehlszeilen rumzuschlagen?

... das ist zwar ein "herumschlagen", dafür hast aber alles "unter 
Kontrolle".

Ich mag, weder für AVR, STM32 noch für STM8, die IDE's !

Compilertoolchain (und evtl. Lib) installiert, der Rest macht ein 
Texteditor nach Wahl und ein Makefile.

Dieses funktioniert nirgends besser , IMHO, als unter Linux !

Livesystem auf Stick installieren, Toolchains einrichten und darauf 
programmieren (wenn man sein Windows behalten mag).

Wenn aus dem Postleitzahlenbereich 76xxx bist, kann ich dir was fix und 
fertig eingerichtetes geben.

von hochsitzcola (Gast)


Lesenswert?

Hm jetzt habe ich Cosmic ausprobiert, aber der Code von Github bringt 
1000 Fehlermeldungen, das müsste ich wohl alles von Hand portieren :-(

Kann mir noch mal jemand für Doofe erklären, mit welchem Tool der Autor 
hier compiliert hat? Ich werde da nicht schlau draus?!

https://opensourceebikefirmware.bitbucket.io/Development_tools.html

Gruß
hochsitzcola

von pegel (Gast)


Lesenswert?


von Pd G. (pdg)


Lesenswert?

Ich kann dir zwar beim verwendeten Tool nicht helfen, weiß aber, dass 
beim Cosmic und Quellcode anderer Toolchains Unmassen von Fehlern 
auftreten können. In der Regel liegt es an fehlerhaft referenzierten bzw 
nicht eingebundenen Bibliotheken. Wenn du die Fehlerliste vorn anfängst 
abzuarbeiten, sollte eigentlich schnell offensichtlich sein, welche 
Bibos fehlen oder wo sie erwartet werden.

: Bearbeitet durch User
von hochsitzcola (Gast)


Lesenswert?

pegel schrieb:
> https://opensourceebikefirmware.bitbucket.io/Devel...

das hab ich mir natürlich schon drei mal durchgelesen... Ich bin wohl 
nicht tief genug im Thema um zu verstehen wofür jetzt welcher Teil 
zuständig ist.

gdb 7.12.1
binuils 2.27
openocd 0.10.0
sdcc 3.6.0

da werde ich mich wohl tiefer einlesen müssen :-(

Gruß
hochsitzcola

von hochsitzcola (Gast)


Lesenswert?

SDCC habe ich unter Linux auch nach drei Tagen rumprobieren nicht 
eingerichtet bekommen :-(

Ich möchte jetzt doch versuchen, den Code nach Cosmic zu portieren.

Pd G. schrieb:
> In der Regel liegt es an fehlerhaft referenzierten bzw
> nicht eingebundenen Bibliotheken.

offensichtlich ist die Syntax bei Interrupts bei sdcc als bei Cosmic. 
Ich finde zu Cosmic erschreckend wenig Beispielcode. Hat da jemand einen 
Tipp?

Gruß
hochsitzcola

von (º°)·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.· (Gast)


Lesenswert?

> Hat da jemand einen Tipp?

Wie waers mit den Examples/Appnotes von ST selber.
Da werden eigentlich alle Markt zu findenen Compiler beruecksichtigt.
Vom noch recht volatilen SDCC mal abgesehn.
1
CD00262888.pdf    Audio software codec for the STM8S
2
CD00281325.pdf    Building an RFID short-range reader using the STM8S-DISCOVERY
3
CD00282842.pdf    RS232 communications with a terminal using the STM8S-DISCOVERY
4
CD00282849.pdf    Building a thermometer using the STM8S-DISCOVERY
5
CD00285727.pdf    Displaying variable voltage on a bar of LEDs using STM8S-DISCOVERY
6
CD00296680.pdf    Generating PWM signals using STM8S-DISCOVERY
7
8
9
stsw-stm8005.zip  STM8S20xxx LCD software driver
10
stsw-stm8021.zip  Handling hardware and software failures with the STM8S-DISCOVERY (AN3265)
11
stsw-stm8024.zip  Building a thermometer using the STM8S-DISCOVERY (AN3260)
12
stsw-stm8026.zip  STM8S optimized examples package
13
stsw-stm8035.zip  Displaying variable voltage on a bar of LEDs using STM8S-DISCOVERY (AN3280)
14
stsw-stm8036.zip  Example: Generating PWM signals using STM8S-DISCOVERY (AN3332)
15
stsw-stm8037.zip  RS232 communications with a terminal using the STM8S-DISCOVERY (AN3259)
16
stsw-stm8045.zip  Audio software codec for the STM8S
17
stsw-stm8059.zip  Building an RFID short-range reader using the STM8S-DISCOVERY (AN3255)

Aber Cosmic ist halt ein echter Exot. Etwa so wie XC8 fuer die PICkels.

von hochsitzcola (Gast)


Lesenswert?

Danke für die Tipps. Welchen Compiler empfiehlst du denn? ST Visual 
Develop nutzt doch auch die Cosmic Toolchain?!

Gruß
hochsitzcola

von (º°)·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.· (Gast)


Angehängte Dateien:

Lesenswert?

> Welchen Compiler empfiehlst du denn?

Tja, lies mal oben...
Ich hab hier aber nicht nur die Kickstartversion.
Insoweit habe ich da keinen weiteren Bedarf.
Zum (problemlosen) Einarbeiten taugt die Kickstartversion
trotzdem.

> ST Visual Develop
Enthaelt zumindest schonmal Debugger und Assembler.
Wenn es nichts anderes (freies) ausser SDCC und Cosmic gibt,
wirst du dich wohl fuer einen von den beiden entscheiden
muessen.

Ansonsten hat Raisonance noch eine 16k-(Light)-Version ihrer
Umgebung. Empfehlenswert ist sie trotzdem nicht, weil sie
den RLink als Debugadapter voraussetzt und die UI schon
ziemlich schlimm ist. (Siehe den Screenshot...)
Mann kann deren Boards aber auch mit einen ST-Link benutzen.

von Philipp Klaus K. (pkk)


Lesenswert?

hochsitzcola schrieb:
> Ich möchte dieses Projekt ausprobieren!
> https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware

Ich habe nur einen kurzen Blick auf den Code geworfen, aber es sieht 
aus, als sei der Code weitgehend in ISO C99 und für SDCC 3.6.0 
geschrieben. Vermutlich lässt sich der Code mit geringen Aufwand für IAR 
abändern, auch Cosmic sollte mit wenig mehr Aufwand gehen (aber der 
C99-Modus ist oder war bei Cosmic etwas versteckt und im Vergleich zu 
SDCC und IAR unvollständiger); Raisonance dürfte etwas mehr Aufwand sein 
(da gibt es kein C99).

Ansonsten gilt der Compilervergleich auf 
http://www.colecovision.eu/stm8/compilers.shtml im Wesentlichen für die 
aktuellen Releases der Compiler noch. Bei SDCC gab es seither deutliche 
weitere Fortschritte (siehe "Feature List" auf 
http://sdcc.sourceforge.net/mediawiki/index.php/SDCC_3.7.0_Release), die 
allerdings zur Zeit nur in den Entwicklerversionen zu finden sind, da es 
noch keinen SDCC 3.7.0 gibt.

Philipp

von (º°)·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.· (Gast)


Angehängte Dateien:

Lesenswert?

SDCC 3.6.5 #9842 (schon etwas aelter und nicht aktuell) kompiliert
den ganzen Source. Mit einigen Warnungen.
Das binary hab ich mal angehaengt.
1
X:\work>make
2
Removing bin...
3
Done.
4
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 StdPeriphLib/src/stm8s_itc.c -obin/
5
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 StdPeriphLib/src/stm8s_clk.c -obin/
6
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 StdPeriphLib/src/stm8s_gpio.c -obin/
7
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 StdPeriphLib/src/stm8s_exti.c -obin/
8
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 StdPeriphLib/src/stm8s_uart2.c -obin/
9
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp4. Please contact sdcc authors with source code to reproduce.
10
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 StdPeriphLib/src/stm8s_tim1.c -obin/
11
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 StdPeriphLib/src/stm8s_adc1.c -obin/
12
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
13
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
14
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
15
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
16
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
17
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
18
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 gpio.c -obin/
19
sdcc.exe -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 motor. c -obin/
20
sdcc.exe -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 -L/usr/local/share/sdcc/lib/stm8/stm8.lib -I/usr/local/share/sdcc/include main.c bin/gpio.rel bin/motor.rel bin/stm8s_adc1.rel bin/stm8s_clk.rel bin/stm8s_exti.rel bin/stm8s_gpio.rel bin/stm8s_itc.rel bin/stm8s_tim1.rel bin/stm8s_uart2.rel -obin/
21
main.c:102: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
22
main.c:101: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
23
main.c:490: warning 59: function 'putchar' must return value
24
main.c:534: warning 85: in function main unreferenced local variable : 'i8_buffer'
25
main.c:534: warning 85: in function main unreferenced local variable : 'ui8_value'
26
main.c:534: warning 85: in function main unreferenced local variable : 'objects_readed'
27
hex2bin -p 00 bin/main.ihx
28
29
HEX TO BIN FILE CONVERTER V1.1
30
Copyright Raisonance S.A. 2004
31
ERROR: Cannot open the input file.make: *** [main] Error 1
32
33
X:\work>cd bin
34
35
X:\work\bin>hex2bin main.ihx
36
37
HEX TO BIN FILE CONVERTER V1.1
38
Copyright Raisonance S.A. 2004
39
Conversion successful.
40
X:\work\bin>cd ..
41
42
X:\work>sdcc -v
43
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.6.5 #9842 (MINGW32)
44
published under GNU General Public License (GPL)
45
46
X:\work>make -v
47
GNU Make 3.81
48
Copyright (C) 2006  Free Software Foundation, Inc.
49
This is free software; see the source for copying conditions.
50
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
51
PARTICULAR PURPOSE.
52
53
This program built for i586-pc-mingw32

von Jorge P. (Firma: Portugal) (casainho)


Lesenswert?

Hi everyone.

I am the author of that project and I am very happy to see others 
interested on this project!!

Sorry but I can't understand german so I will write in EN.

My current active and development branch is this: 
https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware/tree/SVM
Please use that branch as the Makefile is different (as also the code is 
much more recent).

I am writing the news and answering questions on this forum: 
https://endless-sphere.com/forums/viewtopic.php?f=30&t=87870&start=125

Right now, the motor works but needs phase angle correction (same 
objective of FOC) and I was able to test it manually and see that it is 
what is missing now!! I tried some approach but failed... but now I have 
another one (more simple) that I will try tomorrow and I hope it will 
work.

I am a Linux user and I am being developing firmware for 
microcontrollers, like ARMs, since about 10 years ago and I find Linux 
to have better development tools that Windows and so I keep using Linux. 
Sure, the OpenSource ideal is the one I prefer and were I learn much 
more. That's why I started this project as OpenSource and that is 
strategic.

von pegel (Gast)


Lesenswert?

Hi Jorge

the Ubuntu version of sdcc 3.6.0 #9615 (Linux) ends the build with an 
error:
1
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 motor.c -obin/
2
sdcc -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-ihx --debug -lstm8 -L/usr/local/share/sdcc/lib/stm8/stm8.lib -I/usr/local/share/sdcc/include main.c bin/stm8s_clk.rel bin/gpio.rel bin/stm8s_gpio.rel bin/stm8s_exti.rel bin/stm8s_tim1.rel bin/stm8s_uart2.rel bin/motor.rel bin/stm8s_adc1.rel bin/stm8s_itc.rel -obin/
3
main.c:99: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
4
main.c:98: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
5
main.c:492: error 65: function 'putchar' already has body
6
-:0: warning 85: in function main unreferenced local variable : 'i8_buffer'
7
-:0: warning 85: in function main unreferenced local variable : 'ui8_value'
8
-:0: warning 85: in function main unreferenced local variable : 'objects_readed'
9
Makefile:61: die Regel für Ziel main scheiterte
10
make: *** [main] Fehler 1

and a cosmetic problem is the absolute path of sdcc in Makefile

von Christopher J. (christopher_j23)


Lesenswert?

Someone has made the effort to provide a toolchain for the STM8, 
including patched versions of SDCC, OpenOCD and GDB.

https://stm8-binutils-gdb.sourceforge.io/

A description how to use Eclipse as GDB frontend is also provided, 
although you can use whatever frontend you like.
There are binaries available for Windows, compile it yourself on Linux.

Jorge is also refering to this toolchain on his website, so this is 
probably what he is using. With that toolchain the firmware compiled on 
my system although with some warnings:
1
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oStdPeriphLib/src/stm8s_itc.c StdPeriphLib/src/stm8s_itc.c
2
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oStdPeriphLib/src/stm8s_clk.c StdPeriphLib/src/stm8s_clk.c
3
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oStdPeriphLib/src/stm8s_gpio.c StdPeriphLib/src/stm8s_gpio.c
4
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oStdPeriphLib/src/stm8s_exti.c StdPeriphLib/src/stm8s_exti.c
5
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oStdPeriphLib/src/stm8s_uart2.c StdPeriphLib/src/stm8s_uart2.c
6
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp4. Please contact sdcc authors with source code to reproduce.
7
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oStdPeriphLib/src/stm8s_tim1.c StdPeriphLib/src/stm8s_tim1.c
8
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oStdPeriphLib/src/stm8s_tim2.c StdPeriphLib/src/stm8s_tim2.c
9
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oStdPeriphLib/src/stm8s_adc1.c StdPeriphLib/src/stm8s_adc1.c
10
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
11
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
12
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
13
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
14
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
15
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
16
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -ogpio.c gpio.c
17
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -outils.c utils.c
18
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -ocruise_control.c cruise_control.c
19
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -ouart.c uart.c
20
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -oadc.c adc.c
21
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -obrake.c brake.c
22
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -otimers.c timers.c
23
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -opwm.c pwm.c
24
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 -omotor.c motor.c
25
sdcc -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug -lstm8 main.c StdPeriphLib/src/stm8s_itc.rel StdPeriphLib/src/stm8s_clk.rel StdPeriphLib/src/stm8s_gpio.rel StdPeriphLib/src/stm8s_exti.rel StdPeriphLib/src/stm8s_uart2.rel StdPeriphLib/src/stm8s_tim1.rel StdPeriphLib/src/stm8s_tim2.rel StdPeriphLib/src/stm8s_adc1.rel gpio.rel utils.rel cruise_control.rel uart.rel adc.rel brake.rel timers.rel pwm.rel motor.rel
26
stm8-size main.elf
27
   text    data     bss     dec     hex filename
28
  18281       0       0   18281    4769 main.elf
29
stm8-objcopy -O binary -R DATA -R INITIALIZED -R SSEG -R .debug_line -R .debug_loc -R .debug_abbrev -R .debug_info -R .debug_pubnames -R .debug_frame main.elf main.bin

von Philipp Klaus K. (pkk)


Lesenswert?

pegel schrieb:
> Hi Jorge
>
> the Ubuntu version of sdcc 3.6.0 #9615 (Linux) ends the build with an
> error:

Sorry, that was my fault; somehow I lost an #else in a commit (but the 
fix is easy: 
https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware/pull/2)

Philipp

von hochsitzcola (Gast)


Lesenswert?

Danke für die ganzen Inputs, so langsam lichtet sich das Bild etwas. 
Leider habe ich das Ganze unter Linux nicht installiert bekommen.

Wie bekomme ich das makefile auf Windows übersetzt? Ich habe alle Pfade 
in die Schreibweise "C:\...." (mit den Anführungszeichen) gesetzt.
Make schimpft jetzt "mehrere Targetmuster"

Gruß
hochsitzcola

von Jorge P. (Firma: Portugal) (casainho)


Lesenswert?

hochsitzcola,

I don't know how to put the Makefile working for Windows. If you get it, 
I would love have it and put on the project so others can take advantage 
of it.

von pegel (Gast)


Lesenswert?

hochsitzcola schrieb:
> Leider habe ich das Ganze unter Linux nicht installiert bekommen.

Was war das Problem?
Ubuntu bietet in seiner Paketverwaltung den sdcc an.
Das hex2bin gibt es von sourceforge.

Damit klappt das jetzt zwar mit Warnungen und ohne Garantie:

hex2bin -p 00 bin/main.ihx
hex2bin v2.5, Copyright (C) 2017 Jacques Pelletier & contributors

Allocate_Memory_and_Rewind:
Lowest address:   00008000
Highest address:  0000A611
Starting address: 00008000
Max Length:       9746

Binary file start = 00008000
Records start     = 00008000
Highest address   = 0000A611
Pad Byte          = 0
sdcc -IStdPeriphLib/inc -I.  -mstm8 -I/usr/local/share/sdcc/include 
-I/usr/local/share/sdcc/lib/ --std-c99 --nolospre --out-fmt-elf --debug 
-lstm8 main.c bin/stm8s_clk.rel bin/gpio.rel bin/stm8s_gpio.rel 
bin/stm8s_exti.rel bin/stm8s_tim1.rel bin/stm8s_uart2.rel bin/motor.rel 
bin/stm8s_adc1.rel bin/stm8s_itc.rel -obin/
main.c:99: warning 110: conditional flow changed by optimizer: so said 
EVELYN the modified DOG
main.c:98: warning 110: conditional flow changed by optimizer: so said 
EVELYN the modified DOG
main.c:549: warning 85: in function main unreferenced local variable : 
'i8_buffer'
main.c:549: warning 85: in function main unreferenced local variable : 
'ui8_value'
main.c:549: warning 85: in function main unreferenced local variable : 
'objects_readed'
size bin/main.elf
   text     data      bss      dec      hex  filename
  10060        0        0    10060     274c  bin/main.elf

von (º°)·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.· (Gast)


Lesenswert?

> I don't know how to put the Makefile working for Windows.

When "sdcc.exe" is in your %PATH% simply change

#Compiler
CC = /home/cas/software/stm8-binutils/bin/sdcc

to

#Compiler
CC = sdcc.exe

This works for the MinGW-Version of sdcc and make.
I do not use Cygwin-Versions.

von hochsitzcola (Gast)


Lesenswert?

(º°)·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.· schrieb im Beitrag 
#5107280:
> When "sdcc.exe" is in your %PATH% simply change
>
> #Compiler
> CC = /home/cas/software/stm8-binutils/bin/sdcc
>
> to
>
> #Compiler
> CC = sdcc.exe

Das hat bei mir nicht funktioniert :-(.

Ich habe es jetzt unter Windows hinbekommen, allerdings mit einer von 
Hand erstellten Batchdatei, nicht mit dem makefile, da kam immer der 
oben schon genannte Fehler.
Beim Erzeugen der main.ihx kamen viele Meldungen der Form "Multiple 
definition of A$stm8s_tim1$..."

Gruß
hochsitzcola

von hochsitzcola (Gast)


Lesenswert?

Hmm, jetzt stehe ich vor dem Problem, das hex-file zu flashen. Wenn ich 
das ihx-File im ST Visual Programmer öffnen will, kommen jede Menge 
Fehler, daß der Adressbereich nicht passt. Das stm8flash.exe Tool von
https://github.com/tenbaht/sduino-windowstools
läuft nicht.

hat jemand einen Tipp?

Gruß
hochsitzcola

von pegel (Gast)


Angehängte Dateien:

Lesenswert?

Was steht denn in deiner ihx?
Zeig mal. Meine sieht so aus:

von hochsitzcola (Gast)


Angehängte Dateien:

Lesenswert?

Sieht so aus :-)

Gruß
hochsitzcola

von pegel (Gast)


Lesenswert?

Meine Adressen liegen alle zwischen 0x8000 und ca. 0xA500.
Deine sind da wesentlich dynamischer.
Wie ist der der Adressbereich des µC?

von hochsitzcola (Gast)


Lesenswert?

Siehe Seite 30 des Datenblattes:
http://www.st.com/content/ccc/resource/technical/document/datasheet/42/5a/27/87/ac/5a/44/88/DM00024550.pdf/files/DM00024550.pdf/jcr:content/translations/en.DM00024550.pdf

ab 0x008000 ist auf jeden Fall schon mal richtig. Der ST Visual 
Programmer will dein File aber auch nicht einlesen :-(

Gruß
hochsitzcola

von pegel (Gast)


Angehängte Dateien:

Lesenswert?

Das kann ich so nicht bestätigen. Meine Datei möchte er.
Hast du den richtigen Adapter und den richtigen µC eingestellt?
Mehr kann ich mangels STM8 nicht prüfen.

von hochsitzcola (Gast)


Lesenswert?

Du hast recht, mit der Einstellung für den STM8105 funktioniert es. Ich 
hatte ausversehen beim S06P (Blockkommutierer) geschaut, da steckt ein 
STM8S003 drin.
https://opensourceebikefirmware.bitbucket.io/Controllers--BMSBattery_S06x--S06P.html

Wo wird im Code denn der Prozessortyp definiert? Das habe ich bisher 
nicht gefunden.

Jetzt muß ich noch mal prüfen, warum unter Windows nicht richtig 
compiliert wird, unter Linux habe ich es inzwischen hinbekommen.

Gruß
hochsitzcola

von pegel (Gast)


Lesenswert?

hochsitzcola schrieb:
> Wo wird im Code denn der Prozessortyp definiert?

Gar nicht wie es aussieht. Erst beim flashen.
Genaueres weiss sicher Jorge.

von hochsitzcola (Gast)


Lesenswert?

Jetzt habe ich es auch unter Windows hingekriegt :-). Ich hatte die 
includes als -elf compiliert, mit -ihx hat es dann funktioniert.
Jetzt muss ich mir erst mal einen entsprechenden Controller bestellen 
:-)

Gruß
hochsitzcola

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.