OpenSourceEBike / TSDZ2-Smart-EBike

Flexible OpenSource firmware for TongSheng TSDZ2 mid drive ebike motor
GNU General Public License v3.0
255 stars 131 forks source link

clear_eeprom fails with invalid address #163

Closed chgpalmer closed 1 year ago

chgpalmer commented 1 year ago

Running compile_and_flash_20.sh fails at the eeprom clearing stage. The command that is run:

$ stm8flash -c stlinkv2 -p stm8s105?6 -w src/controller/data_empty.ihx
Determine FLASH area
Due to its file extension (or lack thereof), "src/controller/data_empty.ihx" is considered as INTEL HEX format!
Address 4000 is out of range at line 1

The problem is that EEPROM starts at address 0x4000, but stm8flash assumes that flash is being addressed because that is the default.

The solution seems simple, explicitly specify eeprom:

$ stm8flash -c stlinkv2 -p stm8s105?6 -w src/controller/data_empty.ihx -s eeprom

I have tested this and it works as expected.