TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

casainho said:
jur said:
Actually, while cycling to work this morning I realised something important: We don't have the I to plug into IwL! That is actually an unknown quantity. The only thing we have is filtered average battery current.

So back to analysis for me...
I is the motor phase current. Yes, we have only the battery current mesured on the shunt because the signal is low pass filteed on hardware.

But phase amplitude current should be I battery / duty-cycle, right??
Battery current is the average of the phase current yes; but the phase current is a vector whose components are the real current, transfering power, and the reactive current in the inductance. In the ideal motor, reactive current is zero.

We might be able to come up with an iterative procedure to converge to the optimum phase angle using battery current as a start. But I am staring at the pics again. Right now, I am thinking we will have to use the geometry approach like Colter did. Watch this space...
 
Got an experimental code working near what is expected - I will explain:

On purpose, I put an wrong angle value at startup and I see my motor asking to much current when I increase the speed. When I put a correct value of 0, it simple don't ask much current is about 0.6 amps on full speed and I think that is because it has low current/load.

So I put an angle of 10: #define MOTOR_ROTOR_OFFSET_ANGLE 10

Here the the experimental code, that calcs Iwl and V, than it does asinf and convert to angle values. Yes, I think some part of the code may not doing correct angle conversion.... can you please review?

The code prints the variables and also puts the negative value to ui8_angle_correction, that is used to correct the angle.

I did 2 tests, by keeping the ui8_angle_correction always at 0 (angle offset error of 10) or by apply the value calculated. I show t
he graphs and logged as also videos, where you can see the power supply current for each case and listen the motor noise.

Code:
  ui32_l_x1000000 = 135;

  ui32_temp = ui32_w_angular_velocity_x10 * ui32_l_x1000000;
  ui32_temp *= ui32_i_phase_current_x2;
  ui16_iwl = (ui32_temp / 2000000);
  
  f_temp = asinf((float) ui16_iwl / (float) ui16_e_phase_voltage) * 5732.0;
  ui16_temp = f_temp;

  printf ("%d,%d,%d,%d\n",
          ui16_e_phase_voltage,
          ui16_i_phase_current,
          ui16_motor_speed_erps,
          ui16_temp/100);

  ui8_angle_correction = - (ui16_temp/100);

FOC calculation disabled:
- speed ERPS = 450
- phase current = 3.5A

FOC calculation enabled:
- speed ERPS = 350
- phase current = 0.5A

FOC calculation disabled


FOC calculation enabled



FOC calculation disabled
[youtube]-cUIJlzcs2c[/youtube]

FOC calculation enabled
[youtube]8uOsVOv5oS4[/youtube]
 
I tested again just to make sure it is working. This time I setup the initial angle as zero and the adjust FOC algorithm will put a negative angle value. I also decided to low pass filter the FOC calculated angle.

Also I did another test, I increased the the lab power supply voltage from ~36V up to ~48V and the phase voltage increased from 22V up to 34V (duty_cycle was kept constant but lower than 100%).

Here the results:
- 22V, I phase 1A, 350ERPS, FOC angle 7.5 degrees --> 16ERPS / volts
- 34V, I phase 1A, 525ERPS (4200RPMs), FOC angle 10.5 degrees --> 16ERPS / volts

So, the speed scaled as expected and FOC had to adjust the angle by +3 degrees. Also the speed is near the motor rated 4000RPMs (motor has 8 pole pairs).

I tried to decrease the speed of control loop to something like 50ms and I saw motor kind in oscillations, as I expected. Lowered to the 5ms and works as seen on the previous videos. I am not sure it is at 5ms because control loop code may take more time than that...
Next time I would like to improve this code, starting by measuring the time it takes to process and maybe use a look up table for asin() instead of using that float version...

 
I put the TSDZ2 motor on an testing ebike and then on a training roller that makes a constant mechanical load on the wheel. I put the load to max possible value and went to measure the efficiency of our flexible OpenSource firmware VS the original firmware:

Code:
Our flexible OpenSource firmware || original firmware
wheel speed  | battery amps    || wheel speed   | battery amps
8 km/h       | 1 amp           || 8.4 km/h      | 1 amp
13.3 km/h    | 2 amp           || 13.3 km/h     | 2 amp
17.2 km/h    | 3 amp           || 16.9 km/h     | 3 amp
20.5 km/h    | 4 amp           || 20.2 km/h     | 4 amp

NOTE: my lab power supply current limit is near the 4 amps. Later I should get a battery and test to at least 15 amps.

As we can see, the efficiency is the same. Also the running noise is the same for both firmwares, almost none.

The firmware source files are on github.

Here the graph of real time data, showing a session similar to that tests I did. You can see phase voltage, phase current, motor speed in ERPs and FOC calculated angle:
Original size



Video:
[youtube]N0D_q2zbrh4[/youtube]
 
Casainho suggested I can ask about development on this forum.

Firstly I’m using windows and I can only flash hex files so would appreciate if someone can post the lcd3 firmware in hex plzzz... :)


Anyway I’m trying to setup the latest eclipse in windows. Have installed sscd and OpenOCD, not sure which toolchain to use.
Been at it for the past couple of days and it still won’t let me build.

I get errors when I run OpenOCD or when I double click the bat file.

Is anyone able to build in Windows with eclipse ??if not is there an easier way like using the st link visual ide ?
 
jbalat said:
Casainho suggested I can ask about development on this forum.

Firstly I’m using windows and I can only flash hex files so would appreciate if someone can post the lcd3 firmware in hex plzzz... :)


Anyway I’m trying to setup the latest eclipse in windows. Have installed sscd and OpenOCD, not sure which toolchain to use.
Been at it for the past couple of days and it still won’t let me build.

I get errors when I run OpenOCD or when I double click the bat file.

Is anyone able to build in Windows with eclipse ??if not is there an easier way like using the st link visual ide ?
Finally I uploaded the LCD3 and motor controller original improved firmware as hex files -- get them here, you want the v5:
https://github.com/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/tree/master/TSDZ2_original_improved_and_KT_LCD3_firmwares

The firmware for motor controller was a conversion from the bin file to hex file, I am not sure it works.

About development, this is not an ARM so the tools are different. Follow my notes for Linux and Stancecoke notes for Windows up to you understand. Would be great if you could write a wiki page.
 
jbalat said:
I get errors when I run OpenOCD or when I double click the bat file.

You have to edit the windows_makefile to make the Start_compiling.bat work.
Replace the existing section with this (copied from the linux makefile):

Code:
# These are the sources that must be compiled to .rel files:
EXTRASRCS = \
    $(SDIR)/stm8s_iwdg.c \
	$(SDIR)/stm8s_itc.c \
	$(SDIR)/stm8s_clk.c \
	$(SDIR)/stm8s_gpio.c \
	$(SDIR)/stm8s_uart2.c \
	$(SDIR)/stm8s_tim1.c \
    $(SDIR)/stm8s_tim2.c \
	$(SDIR)/stm8s_tim3.c \
	$(SDIR)/stm8s_exti.c \
	$(SDIR)/stm8s_adc1.c \
	watchdog.c \
	torque_sensor.c \
	uart.c \
	pwm.c \
	motor.c \
	wheel_speed_sensor.c \
	brake.c \
	pas.c \
	adc.c \
	timers.c \
	ebike_app.c \
	utils.c \

HEADERS = watchdog.h torque_sensor.h interrupts.h main.h uart.h pwm.h motor.h wheel_speed_sensor.h brake.h pas.h adc.h timers.h \
ebike_app.h utils.h pins.h config.h

If it still doesn't work, please post the output of the command window, than we can see what's going wrong...

regards
stancecoke
 
stancecoke said:
jbalat said:
I get errors when I run OpenOCD or when I double click the bat file.

You have to edit the windows_makefile to make the Start_compiling.bat work.
Replace the existing section with this (copied from the linux makefile):

Code:
# These are the sources that must be compiled to .rel files:
EXTRASRCS = \
    $(SDIR)/stm8s_iwdg.c \
	$(SDIR)/stm8s_itc.c \
	$(SDIR)/stm8s_clk.c \
	$(SDIR)/stm8s_gpio.c \
	$(SDIR)/stm8s_uart2.c \
	$(SDIR)/stm8s_tim1.c \
    $(SDIR)/stm8s_tim2.c \
	$(SDIR)/stm8s_tim3.c \
	$(SDIR)/stm8s_exti.c \
	$(SDIR)/stm8s_adc1.c \
	watchdog.c \
	torque_sensor.c \
	uart.c \
	pwm.c \
	motor.c \
	wheel_speed_sensor.c \
	brake.c \
	pas.c \
	adc.c \
	timers.c \
	ebike_app.c \
	utils.c \

HEADERS = watchdog.h torque_sensor.h interrupts.h main.h uart.h pwm.h motor.h wheel_speed_sensor.h brake.h pas.h adc.h timers.h \
ebike_app.h utils.h pins.h config.h

If it still doesn't work, please post the output of the command window, than we can see what's going wrong...

regards
stancecoke
Stancecoke, you are free to makes changes to that repo!!
 
casainho said:
Stancecoke, you are free to makes changes to that repo!!

I have no write access to that repo. I just tried to compile, the folder StdPeriphLib\src is still missing. You have to add it, perhaps you have to change your gitignore settings to upload.

with the changes in the windows makefile, the code compiles OK then. Is the processor exactly the same than in the kunteng?

regards
stancecoke
 
stancecoke said:
casainho said:
Stancecoke, you are free to makes changes to that repo!!

I have no write access to that repo. I just tried to compile, the folder StdPeriphLib\src is still missing. You have to add it, perhaps you have to change your gitignore settings to upload.

with the changes in the windows makefile, the code compiles OK then. Is the processor exactly the same than in the kunteng?
Ok now you have.

Yes, just the same.
 
Don't forget you need to flash the correct option bytes to remove read/write protection and get the correct signals! I only have the file in .bin, and I don't know enough coding to get it in hex. I think it might be in Stancoke's instructions somewhere.

jbalat said:
Casainho suggested I can ask about development on this forum.

Firstly I’m using windows and I can only flash hex files so would appreciate if someone can post the lcd3 firmware in hex plzzz... :)


Anyway I’m trying to setup the latest eclipse in windows. Have installed sscd and OpenOCD, not sure which toolchain to use.
Been at it for the past couple of days and it still won’t let me build.

I get errors when I run OpenOCD or when I double click the bat file.

Is anyone able to build in Windows with eclipse ??if not is there an easier way like using the st link visual ide ?
 
Hmmm, then I will upload that file in hex.

pawepie said:
Don't forget you need to flash the correct option bytes to remove read/write protection and get the correct signals! I only have the file in .bin, and I don't know enough coding to get it in hex. I think it might be in Stancoke's instructions somewhere.

jbalat said:
Casainho suggested I can ask about development on this forum.

Firstly I’m using windows and I can only flash hex files so would appreciate if someone can post the lcd3 firmware in hex plzzz... :)


Anyway I’m trying to setup the latest eclipse in windows. Have installed sscd and OpenOCD, not sure which toolchain to use.
Been at it for the past couple of days and it still won’t let me build.

I get errors when I run OpenOCD or when I double click the bat file.

Is anyone able to build in Windows with eclipse ??if not is there an easier way like using the st link visual ide ?
 
pawepie said:
Don't forget you need to flash the correct option bytes to remove read/write protection and get the correct signals!

Just doubleclick on "WriteOptionBytes.bat" :wink:

casainho said:
Ok now you have.

I've updated the repo with the missing files and the updated windows makefile.
It compiles OK. The Start_compiling.bat can be run directly from eclipse via the "run external tool" button.

regards
stancecoke
 

Attachments

  • log.txt
    4.1 KB · Views: 62
thanks for the hex files casainho it worked like a charm. i now have power back on the lcd3
the image is static and buttons are not working
 
stancecoke said:
pawepie said:
Don't forget you need to flash the correct option bytes to remove read/write protection and get the correct signals!

Just doubleclick on "WriteOptionBytes.bat" :wink:

casainho said:
Ok now you have.

I've updated the repo with the missing files and the updated windows makefile.
It compiles OK. The Start_compiling.bat can be run directly from eclipse via the "run external tool" button.

regards
stancecoke
Great!! So nice to see sharing/using from KT project as it is just the same STM8.

About option bytes, I will upload anyway because on this project, people are flashing the hex files and not even build.
 
jbalat said:
thanks for the hex files casainho it worked like a charm. i now have power back on the lcd3
the image is static and buttons are not working
IMG_20180726_15155.jpg
Great!! It works. Now the LCD will just work when receiving communication from TSDZ2.
 
this is what I get when i execute startcompiling.bat from within eclipse

Code:
C:\Users\tayla\Desktop>PATH = C:/Program Files/Java/jre1.8.0_181/bin/server;C:/Program Files/Java/jre1.8.0_181/bin;C:/Program Files/Java/jre1.8.0_181/lib/amd64;C:\Program Files (x86)\STMicroelectronics\st_toolset\asm;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Users\tayla\AppData\Local\Microsoft\WindowsApps;C:\adb;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility;C:\Users\tayla\AppData\Local\Microsoft\WindowsApps;;C:\Users\tayla\Desktop;;C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp;C:\sdcc_eclipse\sdcc\bin;C:\Kunteng_LCD3_firmware-master\tools\cygwin\bin;C:\Kunteng_LCD3_firmware-master

C:\Users\tayla\Desktop>cd\

C:\>cd C:\Kunteng_LCD3_firmware-master

C:\Kunteng_LCD3_firmware-master>del main.hex
Could Not Find C:\Kunteng_LCD3_firmware-master\main.hex

C:\Kunteng_LCD3_firmware-master>make -f Makefile_windows clean
Cleaning files...

C:\Kunteng_LCD3_firmware-master>del *.obj
Could Not Find C:\Kunteng_LCD3_firmware-master\*.obj

C:\Kunteng_LCD3_firmware-master>del *.lsr
Could Not Find C:\Kunteng_LCD3_firmware-master\*.lsr

C:\Kunteng_LCD3_firmware-master>del *.lst
Could Not Find C:\Kunteng_LCD3_firmware-master\*.lst

C:\Kunteng_LCD3_firmware-master>del *.cod
Could Not Find C:\Kunteng_LCD3_firmware-master\*.cod

C:\Kunteng_LCD3_firmware-master>del *.sym
Could Not Find C:\Kunteng_LCD3_firmware-master\*.sym

C:\Kunteng_LCD3_firmware-master>del *.s19
Could Not Find C:\Kunteng_LCD3_firmware-master\*.s19

C:\Kunteng_LCD3_firmware-master>del *.err
Could Not Find C:\Kunteng_LCD3_firmware-master\*.err

C:\Kunteng_LCD3_firmware-master>del *.grp
Could Not Find C:\Kunteng_LCD3_firmware-master\*.grp

C:\Kunteng_LCD3_firmware-master>del *.map
Could Not Find C:\Kunteng_LCD3_firmware-master\*.map
Could Not Find C:\Kunteng_LCD3_firmware-master\*.asm
Could Not Find C:\Kunteng_LCD3_firmware-master\*.rel
Could Not Find C:\Kunteng_LCD3_firmware-master\*.lk
Could Not Find C:\Kunteng_LCD3_firmware-master\*.lst
Could Not Find C:\Kunteng_LCD3_firmware-master\*.rst
Could Not Find C:\Kunteng_LCD3_firmware-master\*.sym
Could Not Find C:\Kunteng_LCD3_firmware-master\*.cdb
Could Not Find C:\Kunteng_LCD3_firmware-master\*.map
Could Not Find C:\Kunteng_LCD3_firmware-master\*.elf
Could Not Find C:\Kunteng_LCD3_firmware-master\*.adb
Done.

C:\Kunteng_LCD3_firmware-master>make -f Makefile_windows
make: *** No rule to make target 'StdPeriphLib/src/stm8s_itc.rel', needed by 'main'.  Stop.

C:\Kunteng_LCD3_firmware-master>STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -verbose -no_loop
STVP_CmdLine version 1.6

Verbose ON
Log activity ON
Display Progress OFF
Message box warning if protect option byte ON
Loop mode OFF
Erase device OFF
Blank check device OFF
Verify device ON

Configuration:
BoardName=ST-LINK ST-LINK_ID=0 Device=STM8S105x6 Port=USB ProgMode=SWIM

>>> Filling PROGRAM MEMORY image in computer with Blank Value
<<< Filling PROGRAM MEMORY image in computer succeeds

>>> Loading file main.ihx in PROGRAM MEMORY image in computer
(API) ERROR : No such file or directory

C:\Kunteng_LCD3_firmware-master>pause
Press any key to continue . . .

and when i call up openocd I get.
Code:
Open On-Chip Debugger 0.10.0 (2017-08-21) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
embedded:startup.tcl:21: Error: Unknown target type stm8, try one of arm7tdmi, arm9tdmi, arm920t, arm720t, arm966e, arm946e, arm926ejs, fa526, feroceon, dragonite, xscale, cortex_m, cortex_a, cortex_r4, arm11, ls1_sap, mips_m4k, avr, dsp563xx, dsp5680xx, testee, avr32_ap7k, hla_target, nds32_v2, nds32_v3, nds32_v3m, or1k, quark_x10xx,  or quark_d20xx
in procedure 'script' 
at file "embedded:startup.tcl", line 60
in procedure 'target' called at file "tools/openocd-v0.10.0-scripts/stm8s105.cfg", line 69
in procedure 'ocd_bouncer' 
at file "embedded:startup.tcl", line 21
 

Attachments

  • toolchaineditor.png
    toolchaineditor.png
    13.5 KB · Views: 2,600
jbalat said:
this is what I get when i execute startcompiling.bat from within eclipse

When did you download the repo? I've updated the LCD-repo just a few minutes ago.
The error
Code:
make: *** No rule to make target 'StdPeriphLib/src/stm8s_itc.rel', needed by 'main'.  Stop.

apperars, if the folder StdPeriphLib/src/ is missing.

Please download the repo again and have a new try!

regards
stancecoke
 
about the openOCD, did you build the openOCD with the stm8 patches? (because it looks like it does not know the stm8) (same for binutils for compiling)
 
nieles said:
about the openOCD, did you build the openOCD with the stm8 patches? (because it looks like it does not know the stm8) (same for binutils for compiling)
You mean on Linux? On Linux I just did follow the instructions. Also I think Ubuntu OpenOCD 0.10.0 already supports out of box the STM8.
 
Thanks for everyones help so far Re windows eclipse
Getting closer
I got this with the bat file.. below

but OpenOCD is the same. I guess I need to apply the patches ?? using this info...
https://stm8-binutils-gdb.sourceforge.io/
But I need some terminal window to simulate unix I'm guessing. Where do I get one from ?

Code:
C:\Users\tayla\Desktop>PATH = C:/Program Files/Java/jre1.8.0_181/bin/server;C:/Program Files/Java/jre1.8.0_181/bin;C:/Program Files/Java/jre1.8.0_181/lib/amd64;C:\Program Files (x86)\STMicroelectronics\st_toolset\asm;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Users\tayla\AppData\Local\Microsoft\WindowsApps;C:\adb;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility;C:\Users\tayla\AppData\Local\Microsoft\WindowsApps;;C:\Users\tayla\Desktop;;C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp;C:\sdcc_eclipse\sdcc\bin;C:\Kunteng_LCD3_firmware-master

C:\Users\tayla\Desktop>cd\

C:\>cd C:\Kunteng_LCD3_firmware-master

C:\Kunteng_LCD3_firmware-master>del main.hex
Could Not Find C:\Kunteng_LCD3_firmware-master\main.hex

C:\Kunteng_LCD3_firmware-master>make -f Makefile_windows clean
"Cleaning files..."

C:\Kunteng_LCD3_firmware-master>del *.obj
Could Not Find C:\Kunteng_LCD3_firmware-master\*.obj

C:\Kunteng_LCD3_firmware-master>del *.lsr
Could Not Find C:\Kunteng_LCD3_firmware-master\*.lsr

C:\Kunteng_LCD3_firmware-master>del *.lst
Could Not Find C:\Kunteng_LCD3_firmware-master\*.lst

C:\Kunteng_LCD3_firmware-master>del *.cod
Could Not Find C:\Kunteng_LCD3_firmware-master\*.cod

C:\Kunteng_LCD3_firmware-master>del *.sym
Could Not Find C:\Kunteng_LCD3_firmware-master\*.sym

C:\Kunteng_LCD3_firmware-master>del *.s19
Could Not Find C:\Kunteng_LCD3_firmware-master\*.s19

C:\Kunteng_LCD3_firmware-master>del *.err
Could Not Find C:\Kunteng_LCD3_firmware-master\*.err

C:\Kunteng_LCD3_firmware-master>del *.grp
Could Not Find C:\Kunteng_LCD3_firmware-master\*.grp

C:\Kunteng_LCD3_firmware-master>del *.map
Could Not Find C:\Kunteng_LCD3_firmware-master\*.map
Could Not Find C:\Kunteng_LCD3_firmware-master\*.asm
Could Not Find C:\Kunteng_LCD3_firmware-master\*.rel
Could Not Find C:\Kunteng_LCD3_firmware-master\*.lk
Could Not Find C:\Kunteng_LCD3_firmware-master\*.lst
Could Not Find C:\Kunteng_LCD3_firmware-master\*.rst
Could Not Find C:\Kunteng_LCD3_firmware-master\*.sym
Could Not Find C:\Kunteng_LCD3_firmware-master\*.cdb
Could Not Find C:\Kunteng_LCD3_firmware-master\*.map
Could Not Find C:\Kunteng_LCD3_firmware-master\*.elf
Could Not Find C:\Kunteng_LCD3_firmware-master\*.adb
"Done."

C:\Kunteng_LCD3_firmware-master>make -f Makefile_windows
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oStdPeriphLib/src/stm8s_iwdg.c StdPeriphLib/src/stm8s_iwdg.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oStdPeriphLib/src/stm8s_clk.c StdPeriphLib/src/stm8s_clk.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oStdPeriphLib/src/stm8s_gpio.c StdPeriphLib/src/stm8s_gpio.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oStdPeriphLib/src/stm8s_adc1.c StdPeriphLib/src/stm8s_adc1.c
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oStdPeriphLib/src/stm8s_tim1.c StdPeriphLib/src/stm8s_tim1.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oStdPeriphLib/src/stm8s_tim3.c StdPeriphLib/src/stm8s_tim3.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oStdPeriphLib/src/stm8s_uart2.c StdPeriphLib/src/stm8s_uart2.c
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp4. Please contact sdcc authors with source code to reproduce.
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oStdPeriphLib/src/stm8s_flash.c StdPeriphLib/src/stm8s_flash.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -ogpio.c gpio.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oht162.c ht162.c
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oadc.c adc.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -otimers.c timers.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -olcd.c lcd.c
lcd.c:244: warning 112: function 'lcd_execute_menu_config_submenu_2' implicit declaration
lcd.c:244: warning 84: 'auto' variable 'lcd_execute_menu_config_submenu_2' may be used before initialization
lcd.c:244: warning 84: 'auto' variable 'lcd_execute_menu_config_submenu_2' may be used before initialization
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp25. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp5. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp5. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp5. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp5. Please contact sdcc authors with source code to reproduce.
lcd.c:1255: warning 85: in function lcd_enable_battery_symbols unreferenced function argument : 'ui8_battery_state'
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp0. Please contact sdcc authors with source code to reproduce.
lcd.c:1382: warning 94: comparison is always true due to limited range of data type
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -ouart.c uart.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -oeeprom.c eeprom.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -obutton.c button.c
sdcc -c -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  -outils.c utils.c
sdcc -IStdPeriphLib/inc -I.  -mstm8 -Ddouble=float --std-c99 --nolospre --out-fmt-ihx --debug  main.c StdPeriphLib/src/stm8s_iwdg.rel StdPeriphLib/src/stm8s_clk.rel StdPeriphLib/src/stm8s_gpio.rel StdPeriphLib/src/stm8s_adc1.rel StdPeriphLib/src/stm8s_tim1.rel StdPeriphLib/src/stm8s_tim3.rel StdPeriphLib/src/stm8s_uart2.rel StdPeriphLib/src/stm8s_flash.rel gpio.rel ht162.rel adc.rel timers.rel lcd.rel uart.rel eeprom.rel button.rel utils.rel
main.c:101: warning 126: unreachable code
main.c:72: warning 84: 'auto' variable 'ui16_10ms_loop_counter' may be used before initialization

C:\Kunteng_LCD3_firmware-master>STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -verbose -no_loop
STVP_CmdLine version 1.6

Verbose ON
Log activity ON
Display Progress OFF
Message box warning if protect option byte ON
Loop mode OFF
Erase device OFF
Blank check device OFF
Verify device ON

Configuration:
BoardName=ST-LINK ST-LINK_ID=0 Device=STM8S105x6 Port=USB ProgMode=SWIM

>>> Filling PROGRAM MEMORY image in computer with Blank Value
<<< Filling PROGRAM MEMORY image in computer succeeds

>>> Loading file main.ihx in PROGRAM MEMORY image in computer
<<< Loading file succeeds

Hit 'Esc' key to abort during communication.

>>> Programming PROGRAM MEMORY
(API) ERROR : Cannot communicate with the tool.
Wrong tool selection or check tool power supply or check that a previous session is closed.
<<< Programming PROGRAM MEMORY fails

C:\Kunteng_LCD3_firmware-master>pause
Press any key to continue . . .

openocd
Code:
Open On-Chip Debugger 0.10.0 (2017-08-21) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
embedded:startup.tcl:21: Error: Unknown target type stm8, try one of arm7tdmi, arm9tdmi, arm920t, arm720t, arm966e, arm946e, arm926ejs, fa526, feroceon, dragonite, xscale, cortex_m, cortex_a, cortex_r4, arm11, ls1_sap, mips_m4k, avr, dsp563xx, dsp5680xx, testee, avr32_ap7k, hla_target, nds32_v2, nds32_v3, nds32_v3m, or1k, quark_x10xx,  or quark_d20xx
in procedure 'script' 
at file "embedded:startup.tcl", line 60
in procedure 'target' called at file "tools/openocd-v0.10.0-scripts/stm8s105.cfg", line 69
in procedure 'ocd_bouncer' 
at file "embedded:startup.tcl", line 21
 
jbalat said:
Thanks for everyones help so far Re windows eclipse
Getting closer
I got this with the bat file.. below

So everything went OK with compiling, just the ST-Link was not plugged in, or the LCD3 was not connected. 8)

I can't say anything to openocd, I never got it running... (and I don't miss it :wink: )

regards
stancecoke
 
stancecoke said:
So everything went OK with compiling, just the ST-Link was not plugged in, or the LCD3 was not connected. 8)
I can't say anything to openocd, I never got it running... (and I don't miss it :wink: )
regards
stancecoke

You are right I didnt have the lcd plugged and stlink plugged in.. Does that mean it created some bin and hex files for me somewhere ??
So the build button in eclipse needs to run this bat file ? Because at the moment it doesn't do anything...

So I don't really need openocd for making the firmwares ? From reading it says that its a debugging tool.

Someone mentioned that Windows10 has a unix interface you can install and that it may enable me to install the patches for SDCC
https://docs.microsoft.com/en-us/windows/wsl/install-win10

Getting there......... :)
 
jbalat said:
Does that mean it created some bin and hex files for me somewhere ??
So the build button in eclipse needs to run this bat file ? Because at the moment it doesn't do anything...

You have just to plug in the STLink and connect the LCD3, then start the Start_compiling.bat. Then compiling and flashing is done automatically. You don't have to care about any hex or bin file and you don't have to use the VisualProgrammer. You can start the batch from eclipse via the run-button with the small additional red symbol if you choose Start Compiling in the dropdown next to the button.

start_compiling.png


OpenOCD is a tool that makes debugging easier, you don't need it.

regards
stancecoke
 
Back
Top